generated from Template/H563ZI-HAL-CMake-Template
	fix: Set LF line endings for assembly files
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | *.S text eol=lf | ||||||
							
								
								
									
										42
									
								
								.mxproject
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								.mxproject
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										142
									
								
								AZURE_RTOS/App/app_azure_rtos.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										142
									
								
								AZURE_RTOS/App/app_azure_rtos.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,142 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    app_azure_rtos.c | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   app_azure_rtos application implementation file | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2024 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "app_azure_rtos.h" | ||||||
|  | /* Private includes ----------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN Includes */ | ||||||
|  |  | ||||||
|  | /* 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 */ | ||||||
|  |  | ||||||
|  | #if (USE_STATIC_ALLOCATION == 1) | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN TX_Pool_Buffer */ | ||||||
|  | /* USER CODE END TX_Pool_Buffer */ | ||||||
|  | #if defined ( __ICCARM__ ) | ||||||
|  | #pragma data_alignment=4 | ||||||
|  | #endif | ||||||
|  | __ALIGN_BEGIN static UCHAR tx_byte_pool_buffer[TX_APP_MEM_POOL_SIZE] __ALIGN_END; | ||||||
|  | static TX_BYTE_POOL tx_app_byte_pool; | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Private function prototypes -----------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN PFP */ | ||||||
|  |  | ||||||
|  | /* USER CODE END PFP */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Define the initial system. | ||||||
|  |   * @param  first_unused_memory : Pointer to the first unused memory | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | VOID tx_application_define(VOID *first_unused_memory) | ||||||
|  | { | ||||||
|  |   /* USER CODE BEGIN  tx_application_define_1*/ | ||||||
|  |  | ||||||
|  |   /* USER CODE END  tx_application_define_1 */ | ||||||
|  | #if (USE_STATIC_ALLOCATION == 1) | ||||||
|  |   UINT status = TX_SUCCESS; | ||||||
|  |   VOID *memory_ptr; | ||||||
|  |  | ||||||
|  |   if (tx_byte_pool_create(&tx_app_byte_pool, "Tx App memory pool", tx_byte_pool_buffer, TX_APP_MEM_POOL_SIZE) != TX_SUCCESS) | ||||||
|  |   { | ||||||
|  |     /* USER CODE BEGIN TX_Byte_Pool_Error */ | ||||||
|  |  | ||||||
|  |     /* USER CODE END TX_Byte_Pool_Error */ | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* USER CODE BEGIN TX_Byte_Pool_Success */ | ||||||
|  |  | ||||||
|  |     /* USER CODE END TX_Byte_Pool_Success */ | ||||||
|  |  | ||||||
|  |     memory_ptr = (VOID *)&tx_app_byte_pool; | ||||||
|  |     status = App_ThreadX_Init(memory_ptr); | ||||||
|  |     if (status != TX_SUCCESS) | ||||||
|  |     { | ||||||
|  |       /* USER CODE BEGIN  App_ThreadX_Init_Error */ | ||||||
|  |       while(1) | ||||||
|  |       { | ||||||
|  |       } | ||||||
|  |       /* USER CODE END  App_ThreadX_Init_Error */ | ||||||
|  |     } | ||||||
|  |     /* USER CODE BEGIN  App_ThreadX_Init_Success */ | ||||||
|  |  | ||||||
|  |     /* USER CODE END  App_ThreadX_Init_Success */ | ||||||
|  |  | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | #else | ||||||
|  | /* | ||||||
|  |  * Using dynamic memory allocation requires to apply some changes to the linker file. | ||||||
|  |  * ThreadX needs to pass a pointer to the first free memory location in RAM to the tx_application_define() function, | ||||||
|  |  * using the "first_unused_memory" argument. | ||||||
|  |  * This require changes in the linker files to expose this memory location. | ||||||
|  |  * For EWARM add the following section into the .icf file: | ||||||
|  |      place in RAM_region    { last section FREE_MEM }; | ||||||
|  |  * For MDK-ARM | ||||||
|  |      - either define the RW_IRAM1 region in the ".sct" file | ||||||
|  |      - or modify the line below in "tx_initialize_low_level.S to match the memory region being used | ||||||
|  |         LDR r1, =|Image$$RW_IRAM1$$ZI$$Limit| | ||||||
|  |  | ||||||
|  |  * For STM32CubeIDE add the following section into the .ld file: | ||||||
|  |      ._threadx_heap : | ||||||
|  |        { | ||||||
|  |           . = ALIGN(8); | ||||||
|  |           __RAM_segment_used_end__ = .; | ||||||
|  |           . = . + 64K; | ||||||
|  |           . = ALIGN(8); | ||||||
|  |         } >RAM_D1 AT> RAM_D1 | ||||||
|  |     * The simplest way to provide memory for ThreadX is to define a new section, see ._threadx_heap above. | ||||||
|  |     * In the example above the ThreadX heap size is set to 64KBytes. | ||||||
|  |     * The ._threadx_heap must be located between the .bss and the ._user_heap_stack sections in the linker script. | ||||||
|  |     * Caution: Make sure that ThreadX does not need more than the provided heap memory (64KBytes in this example). | ||||||
|  |     * Read more in STM32CubeIDE User Guide, chapter: "Linker script". | ||||||
|  |  | ||||||
|  |  * The "tx_initialize_low_level.S" should be also modified to enable the "USE_DYNAMIC_MEMORY_ALLOCATION" flag. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |   /* USER CODE BEGIN DYNAMIC_MEM_ALLOC */ | ||||||
|  |   (void)first_unused_memory; | ||||||
|  |   /* USER CODE END DYNAMIC_MEM_ALLOC */ | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | } | ||||||
							
								
								
									
										68
									
								
								AZURE_RTOS/App/app_azure_rtos.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								AZURE_RTOS/App/app_azure_rtos.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,68 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    app_azure_rtos.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   app_azure_rtos application header file | ||||||
|  |   ****************************************************************************** | ||||||
|  |    * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef APP_AZURE_RTOS_H | ||||||
|  | #define APP_AZURE_RTOS_H | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | #include "app_threadx.h" | ||||||
|  | #include "stm32h5xx_hal.h" | ||||||
|  | #include "app_azure_rtos_config.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 ---------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN EFP */ | ||||||
|  |  | ||||||
|  | /* USER CODE END EFP */ | ||||||
|  |  | ||||||
|  | /* Private defines -----------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN PD */ | ||||||
|  |  | ||||||
|  | /* USER CODE END PD */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #endif /* APP_AZURE_RTOS_H */ | ||||||
							
								
								
									
										70
									
								
								AZURE_RTOS/App/app_azure_rtos_config.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								AZURE_RTOS/App/app_azure_rtos_config.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | |||||||
|  |  | ||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    app_azure_rtos_config.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   app_azure_rtos config header file | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef APP_AZURE_RTOS_CONFIG_H | ||||||
|  | #define APP_AZURE_RTOS_CONFIG_H | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /* Private includes ----------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN Includes */ | ||||||
|  |  | ||||||
|  | /* USER CODE END Includes */ | ||||||
|  |  | ||||||
|  | /* Exported types ------------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN ET */ | ||||||
|  |  | ||||||
|  | /* USER CODE END ET */ | ||||||
|  |  | ||||||
|  | /* Exported constants --------------------------------------------------------*/ | ||||||
|  | /* Using static memory allocation via threadX Byte memory pools */ | ||||||
|  |  | ||||||
|  | #define USE_STATIC_ALLOCATION                    1 | ||||||
|  |  | ||||||
|  | #define TX_APP_MEM_POOL_SIZE                     1024 | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN EC */ | ||||||
|  |  | ||||||
|  | /* USER CODE END EC */ | ||||||
|  |  | ||||||
|  | /* Exported macro ------------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN EM */ | ||||||
|  |  | ||||||
|  | /* USER CODE END EM */ | ||||||
|  |  | ||||||
|  | /* Exported functions prototypes ---------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN EFP */ | ||||||
|  |  | ||||||
|  | /* USER CODE END EFP */ | ||||||
|  |  | ||||||
|  | /* Private defines -----------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN PD */ | ||||||
|  |  | ||||||
|  | /* USER CODE END PD */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #endif /* APP_AZURE_RTOS_CONFIG_H */ | ||||||
							
								
								
									
										204
									
								
								AutoGuideStick.ioc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										204
									
								
								AutoGuideStick.ioc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,204 @@ | |||||||
|  | #MicroXplorer Configuration settings - do not modify | ||||||
|  | CAD.formats= | ||||||
|  | CAD.pinconfig= | ||||||
|  | CAD.provider= | ||||||
|  | CORTEX_M33_NS.userName=CORTEX_M33 | ||||||
|  | File.Version=6 | ||||||
|  | GPIO.groupedBy= | ||||||
|  | KeepUserPlacement=false | ||||||
|  | MMTAppRegionsCount=0 | ||||||
|  | MMTConfigApplied=false | ||||||
|  | Mcu.CPN=STM32H563ZIT6 | ||||||
|  | Mcu.ContextProject=TrustZoneDisabled | ||||||
|  | Mcu.Family=STM32H5 | ||||||
|  | Mcu.IP0=BOOTPATH | ||||||
|  | Mcu.IP1=CORTEX_M33_NS | ||||||
|  | Mcu.IP2=DEBUG | ||||||
|  | Mcu.IP3=ICACHE | ||||||
|  | Mcu.IP4=MEMORYMAP | ||||||
|  | Mcu.IP5=NVIC | ||||||
|  | Mcu.IP6=PWR | ||||||
|  | Mcu.IP7=RCC | ||||||
|  | Mcu.IP8=SYS | ||||||
|  | Mcu.IP9=THREADX | ||||||
|  | Mcu.IPNb=10 | ||||||
|  | Mcu.Name=STM32H563ZITx | ||||||
|  | Mcu.Package=LQFP144 | ||||||
|  | Mcu.Pin0=PH0-OSC_IN(PH0) | ||||||
|  | Mcu.Pin1=PH1-OSC_OUT(PH1) | ||||||
|  | Mcu.Pin10=VP_BOOTPATH_VS_BOOTPATH | ||||||
|  | Mcu.Pin11=VP_MEMORYMAP_VS_MEMORYMAP | ||||||
|  | Mcu.Pin2=PA13(JTMS/SWDIO) | ||||||
|  | Mcu.Pin3=PA14(JTCK/SWCLK) | ||||||
|  | Mcu.Pin4=VP_CORTEX_M33_NS_VS_Hclk | ||||||
|  | Mcu.Pin5=VP_ICACHE_VS_ICACHE | ||||||
|  | Mcu.Pin6=VP_PWR_VS_SECSignals | ||||||
|  | Mcu.Pin7=VP_PWR_VS_LPOM | ||||||
|  | Mcu.Pin8=VP_SYS_VS_tim1 | ||||||
|  | Mcu.Pin9=VP_THREADX_VS_RTOSJjThreadXJjCoreJjDefault | ||||||
|  | Mcu.PinsNb=12 | ||||||
|  | Mcu.ThirdPartyNb=0 | ||||||
|  | Mcu.UserConstants= | ||||||
|  | Mcu.UserName=STM32H563ZITx | ||||||
|  | MxCube.Version=6.14.0 | ||||||
|  | MxDb.Version=DB.6.0.140 | ||||||
|  | NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||||||
|  | NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||||||
|  | NVIC.ForceEnableDMAVector=true | ||||||
|  | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||||||
|  | NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||||||
|  | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||||||
|  | NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false\:false | ||||||
|  | NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 | ||||||
|  | NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false\:false | ||||||
|  | NVIC.SavedPendsvIrqHandlerGenerated=true | ||||||
|  | NVIC.SavedSvcallIrqHandlerGenerated=true | ||||||
|  | NVIC.SavedSystickIrqHandlerGenerated=true | ||||||
|  | NVIC.SysTick_IRQn=true\:14\:0\:false\:false\:false\:false\:false\:true\:false | ||||||
|  | NVIC.TIM1_UP_IRQn=true\:15\:0\:false\:false\:true\:false\:false\:true\:true | ||||||
|  | NVIC.TimeBase=TIM1_UP_IRQn | ||||||
|  | NVIC.TimeBaseIP=TIM1 | ||||||
|  | NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||||||
|  | PA13(JTMS/SWDIO).Mode=Serial_Wire | ||||||
|  | PA13(JTMS/SWDIO).Signal=DEBUG_JTMS-SWDIO | ||||||
|  | PA14(JTCK/SWCLK).Mode=Serial_Wire | ||||||
|  | PA14(JTCK/SWCLK).Signal=DEBUG_JTCK-SWCLK | ||||||
|  | PH0-OSC_IN(PH0).Mode=HSE-External-Oscillator | ||||||
|  | PH0-OSC_IN(PH0).Signal=RCC_OSC_IN | ||||||
|  | PH1-OSC_OUT(PH1).Mode=HSE-External-Oscillator | ||||||
|  | PH1-OSC_OUT(PH1).Signal=RCC_OSC_OUT | ||||||
|  | PinOutPanel.RotationAngle=0 | ||||||
|  | ProjectManager.AskForMigrate=true | ||||||
|  | ProjectManager.BackupPrevious=false | ||||||
|  | ProjectManager.CompilerLinker=GCC | ||||||
|  | ProjectManager.CompilerOptimize=6 | ||||||
|  | ProjectManager.ComputerToolchain=false | ||||||
|  | ProjectManager.CoupleFile=true | ||||||
|  | ProjectManager.CustomerFirmwarePackage= | ||||||
|  | ProjectManager.DefaultFWLocation=true | ||||||
|  | ProjectManager.DeletePrevious=true | ||||||
|  | ProjectManager.DeviceId=STM32H563ZITx | ||||||
|  | ProjectManager.FirmwarePackage=STM32Cube FW_H5 V1.5.0 | ||||||
|  | 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=AutoGuideStick.ioc | ||||||
|  | ProjectManager.ProjectName=AutoGuideStick | ||||||
|  | ProjectManager.ProjectStructure= | ||||||
|  | ProjectManager.RegisterCallBack= | ||||||
|  | ProjectManager.StackSize=0x400 | ||||||
|  | ProjectManager.TargetToolchain=MDK-ARM V5.37 | ||||||
|  | ProjectManager.ToolChainLocation= | ||||||
|  | ProjectManager.UAScriptAfterPath= | ||||||
|  | ProjectManager.UAScriptBeforePath= | ||||||
|  | ProjectManager.UnderRoot=false | ||||||
|  | ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ICACHE_Init-ICACHE-false-HAL-true,0-MX_CORTEX_M33_NS_Init-CORTEX_M33_NS-false-HAL-true,0-MX_PWR_Init-PWR-false-HAL-true | ||||||
|  | RCC.ADCFreq_Value=250000000 | ||||||
|  | RCC.AHBFreq_Value=250000000 | ||||||
|  | RCC.APB1Freq_Value=250000000 | ||||||
|  | RCC.APB1TimFreq_Value=250000000 | ||||||
|  | RCC.APB2Freq_Value=250000000 | ||||||
|  | RCC.APB2TimFreq_Value=250000000 | ||||||
|  | RCC.APB3Freq_Value=250000000 | ||||||
|  | RCC.CECFreq_Value=32000 | ||||||
|  | RCC.CKPERFreq_Value=32000000 | ||||||
|  | RCC.CRSFreq_Value=48000000 | ||||||
|  | RCC.CSI_VALUE=4000000 | ||||||
|  | RCC.CortexFreq_Value=250000000 | ||||||
|  | RCC.DACFreq_Value=32768 | ||||||
|  | RCC.EPOD_VALUE=4000000 | ||||||
|  | RCC.ETHFreq_Value=250000000 | ||||||
|  | RCC.FCLKCortexFreq_Value=250000000 | ||||||
|  | RCC.FDCANFreq_Value=25000000 | ||||||
|  | RCC.FamilyName=M | ||||||
|  | RCC.HCLKFreq_Value=250000000 | ||||||
|  | RCC.HSE_VALUE=25000000 | ||||||
|  | RCC.HSI48_VALUE=48000000 | ||||||
|  | RCC.HSI_VALUE=64000000 | ||||||
|  | RCC.I2C1Freq_Value=250000000 | ||||||
|  | RCC.I2C2Freq_Value=250000000 | ||||||
|  | RCC.I2C3Freq_Value=250000000 | ||||||
|  | RCC.I2C4Freq_Value=250000000 | ||||||
|  | RCC.I3C1Freq_Value=250000000 | ||||||
|  | RCC.IPParameters=ADCFreq_Value,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,APB3Freq_Value,CECFreq_Value,CKPERFreq_Value,CRSFreq_Value,CSI_VALUE,CortexFreq_Value,DACFreq_Value,EPOD_VALUE,ETHFreq_Value,FCLKCortexFreq_Value,FDCANFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI48_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,I2C4Freq_Value,I3C1Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM3Freq_Value,LPTIM4Freq_Value,LPTIM5Freq_Value,LPTIM6Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSE_VALUE,LSIRC_VALUE,MCO1PinFreq_Value,MCO2PinFreq_Value,OCTOSPIMFreq_Value,PLL2PoutputFreq_Value,PLL2QoutputFreq_Value,PLL2RoutputFreq_Value,PLL3PoutputFreq_Value,PLL3QoutputFreq_Value,PLL3RoutputFreq_Value,PLLFRACN,PLLN,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PWRFreq_Value,RNGFreq_Value,SAI1Freq_Value,SAI2Freq_Value,SDMMC1Freq_Value,SDMMC2Freq_Value,SPI1Freq_Value,SPI2Freq_Value,SPI3Freq_Value,SPI4Freq_Value,SPI5Freq_Value,SPI6Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,UART12Freq_Value,UART4Freq_Value,UART5Freq_Value,UART7Freq_Value,UART8Freq_Value,UART9Freq_Value,UCPD1outputFreq_Value,USART10Freq_Value,USART11Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USART6Freq_Value,USBFreq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOPLL2OutputFreq_Value,VCOPLL3OutputFreq_Value | ||||||
|  | RCC.LPTIM1Freq_Value=250000000 | ||||||
|  | RCC.LPTIM2Freq_Value=250000000 | ||||||
|  | RCC.LPTIM3Freq_Value=250000000 | ||||||
|  | RCC.LPTIM4Freq_Value=250000000 | ||||||
|  | RCC.LPTIM5Freq_Value=250000000 | ||||||
|  | RCC.LPTIM6Freq_Value=250000000 | ||||||
|  | RCC.LPUART1Freq_Value=250000000 | ||||||
|  | RCC.LSCOPinFreq_Value=32000 | ||||||
|  | RCC.LSE_VALUE=32768 | ||||||
|  | RCC.LSIRC_VALUE=32000 | ||||||
|  | RCC.MCO1PinFreq_Value=32000000 | ||||||
|  | RCC.MCO2PinFreq_Value=250000000 | ||||||
|  | RCC.OCTOSPIMFreq_Value=250000000 | ||||||
|  | RCC.PLL2PoutputFreq_Value=258000000 | ||||||
|  | RCC.PLL2QoutputFreq_Value=258000000 | ||||||
|  | RCC.PLL2RoutputFreq_Value=258000000 | ||||||
|  | RCC.PLL3PoutputFreq_Value=258000000 | ||||||
|  | RCC.PLL3QoutputFreq_Value=258000000 | ||||||
|  | RCC.PLL3RoutputFreq_Value=258000000 | ||||||
|  | RCC.PLLFRACN=0 | ||||||
|  | RCC.PLLN=125 | ||||||
|  | RCC.PLLPoutputFreq_Value=250000000 | ||||||
|  | RCC.PLLQoutputFreq_Value=250000000 | ||||||
|  | RCC.PWRFreq_Value=250000000 | ||||||
|  | RCC.RNGFreq_Value=48000000 | ||||||
|  | RCC.SAI1Freq_Value=258000000 | ||||||
|  | RCC.SAI2Freq_Value=258000000 | ||||||
|  | RCC.SDMMC1Freq_Value=250000000 | ||||||
|  | RCC.SDMMC2Freq_Value=250000000 | ||||||
|  | RCC.SPI1Freq_Value=250000000 | ||||||
|  | RCC.SPI2Freq_Value=250000000 | ||||||
|  | RCC.SPI3Freq_Value=250000000 | ||||||
|  | RCC.SPI4Freq_Value=250000000 | ||||||
|  | RCC.SPI5Freq_Value=250000000 | ||||||
|  | RCC.SPI6Freq_Value=250000000 | ||||||
|  | RCC.SYSCLKFreq_VALUE=250000000 | ||||||
|  | RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK | ||||||
|  | RCC.UART12Freq_Value=250000000 | ||||||
|  | RCC.UART4Freq_Value=250000000 | ||||||
|  | RCC.UART5Freq_Value=250000000 | ||||||
|  | RCC.UART7Freq_Value=250000000 | ||||||
|  | RCC.UART8Freq_Value=250000000 | ||||||
|  | RCC.UART9Freq_Value=250000000 | ||||||
|  | RCC.UCPD1outputFreq_Value=8000000 | ||||||
|  | RCC.USART10Freq_Value=250000000 | ||||||
|  | RCC.USART11Freq_Value=250000000 | ||||||
|  | RCC.USART1Freq_Value=250000000 | ||||||
|  | RCC.USART2Freq_Value=250000000 | ||||||
|  | RCC.USART3Freq_Value=250000000 | ||||||
|  | RCC.USART6Freq_Value=250000000 | ||||||
|  | RCC.USBFreq_Value=48000000 | ||||||
|  | RCC.VCOInput2Freq_Value=4000000 | ||||||
|  | RCC.VCOInput3Freq_Value=4000000 | ||||||
|  | RCC.VCOInputFreq_Value=4000000 | ||||||
|  | RCC.VCOOutputFreq_Value=500000000 | ||||||
|  | RCC.VCOPLL2OutputFreq_Value=516000000 | ||||||
|  | RCC.VCOPLL3OutputFreq_Value=516000000 | ||||||
|  | VP_BOOTPATH_VS_BOOTPATH.Mode=BP_Activate | ||||||
|  | VP_BOOTPATH_VS_BOOTPATH.Signal=BOOTPATH_VS_BOOTPATH | ||||||
|  | VP_CORTEX_M33_NS_VS_Hclk.Mode=Hclk_Mode | ||||||
|  | VP_CORTEX_M33_NS_VS_Hclk.Signal=CORTEX_M33_NS_VS_Hclk | ||||||
|  | VP_ICACHE_VS_ICACHE.Mode=DirectMappedCache | ||||||
|  | VP_ICACHE_VS_ICACHE.Signal=ICACHE_VS_ICACHE | ||||||
|  | VP_MEMORYMAP_VS_MEMORYMAP.Mode=CurAppReg | ||||||
|  | VP_MEMORYMAP_VS_MEMORYMAP.Signal=MEMORYMAP_VS_MEMORYMAP | ||||||
|  | VP_PWR_VS_LPOM.Mode=PowerOptimisation | ||||||
|  | VP_PWR_VS_LPOM.Signal=PWR_VS_LPOM | ||||||
|  | VP_PWR_VS_SECSignals.Mode=Security/Privilege | ||||||
|  | VP_PWR_VS_SECSignals.Signal=PWR_VS_SECSignals | ||||||
|  | VP_SYS_VS_tim1.Mode=TIM1 | ||||||
|  | VP_SYS_VS_tim1.Signal=SYS_VS_tim1 | ||||||
|  | VP_THREADX_VS_RTOSJjThreadXJjCoreJjDefault.Mode=Core_Default | ||||||
|  | VP_THREADX_VS_RTOSJjThreadXJjCoreJjDefault.Signal=THREADX_VS_RTOSJjThreadXJjCoreJjDefault | ||||||
|  | board=custom | ||||||
							
								
								
									
										77
									
								
								Core/Inc/app_threadx.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								Core/Inc/app_threadx.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,77 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    app_threadx.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   ThreadX applicative header file | ||||||
|  |   ****************************************************************************** | ||||||
|  |     * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef __APP_THREADX_H | ||||||
|  | #define __APP_THREADX_H | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "tx_api.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 */ | ||||||
|  |  | ||||||
|  | /* Private defines -----------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN PD */ | ||||||
|  |  | ||||||
|  | /* USER CODE END PD */ | ||||||
|  |  | ||||||
|  | /* Main thread defines -------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN MTD */ | ||||||
|  |  | ||||||
|  | /* USER CODE END MTD */ | ||||||
|  |  | ||||||
|  | /* Exported macro ------------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN EM */ | ||||||
|  |  | ||||||
|  | /* USER CODE END EM */ | ||||||
|  |  | ||||||
|  | /* Exported functions prototypes ---------------------------------------------*/ | ||||||
|  | UINT App_ThreadX_Init(VOID *memory_ptr); | ||||||
|  | void MX_ThreadX_Init(void); | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN EFP */ | ||||||
|  |  | ||||||
|  | /* USER CODE END EFP */ | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 1 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 1 */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #endif /* __APP_THREADX_H */ | ||||||
							
								
								
									
										49
									
								
								Core/Inc/gpio.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								Core/Inc/gpio.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    gpio.h | ||||||
|  |   * @brief   This file contains all the function prototypes for | ||||||
|  |   *          the gpio.c file | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  | /* 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__ */ | ||||||
|  |  | ||||||
							
								
								
									
										50
									
								
								Core/Inc/icache.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Core/Inc/icache.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    icache.h | ||||||
|  |   * @brief   This file contains all the function prototypes for | ||||||
|  |   *          the icache.c file | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef __ICACHE_H__ | ||||||
|  | #define __ICACHE_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_ICACHE_Init(void); | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN Prototypes */ | ||||||
|  |  | ||||||
|  | /* USER CODE END Prototypes */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* __ICACHE_H__ */ | ||||||
|  |  | ||||||
							
								
								
									
										69
									
								
								Core/Inc/main.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								Core/Inc/main.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | |||||||
|  | /* 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) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef __MAIN_H | ||||||
|  | #define __MAIN_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal.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 -----------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN Private defines */ | ||||||
|  |  | ||||||
|  | /* USER CODE END Private defines */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* __MAIN_H */ | ||||||
							
								
								
									
										48
									
								
								Core/Inc/memorymap.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								Core/Inc/memorymap.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    memorymap.h | ||||||
|  |   * @brief   This file contains all the function prototypes for | ||||||
|  |   *          the memorymap.c file | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef __MEMORYMAP_H__ | ||||||
|  | #define __MEMORYMAP_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 */ | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN Prototypes */ | ||||||
|  |  | ||||||
|  | /* USER CODE END Prototypes */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* __MEMORYMAP_H__ */ | ||||||
|  |  | ||||||
							
								
								
									
										501
									
								
								Core/Inc/stm32h5xx_hal_conf.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										501
									
								
								Core/Inc/stm32h5xx_hal_conf.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,501 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ********************************************************************************************************************** | ||||||
|  |  | ||||||
|  |   * @file    stm32h5xx_hal_conf.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   HAL configuration file. | ||||||
|  |   ********************************************************************************************************************** | ||||||
|  |  | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ********************************************************************************************************************** | ||||||
|  |  | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | #ifndef STM32H5xx_HAL_CONF_H | ||||||
|  | #define STM32H5xx_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_CEC_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_COMP_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_CORDIC_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_CRC_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_CRYP_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_DAC_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_DCACHE_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_DCMI_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_DTS_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_ETH_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_FDCAN_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_FMAC_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_GTZC_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_HASH_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_HCD_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_IRDA_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_IWDG_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_I2C_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_I3C_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_I2S_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_LPTIM_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_NAND_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_NOR_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_OPAMP_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_XSPI_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_OTFDEC_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_PKA_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_RNG_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_RTC_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_SAI_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_SD_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_SDRAM_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_MMC_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_SMARTCARD_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_SMBUS_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_SPI_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_SRAM_MODULE_ENABLED */ | ||||||
|  | #define HAL_TIM_MODULE_ENABLED | ||||||
|  | /*#define HAL_RAMCFG_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_UART_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_USART_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_WWDG_MODULE_ENABLED */ | ||||||
|  | /*#define HAL_PSSI_MODULE_ENABLED */ | ||||||
|  | #define HAL_ICACHE_MODULE_ENABLED | ||||||
|  | /*#define HAL_PCD_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 | ||||||
|  |  | ||||||
|  | /* ####################################### 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    25000000U /*!< 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 Core Speed oscillator (CSI) default value. | ||||||
|  |   *        This value is the default CSI range value after Reset. | ||||||
|  |   */ | ||||||
|  | #if !defined  (CSI_VALUE) | ||||||
|  |   #define CSI_VALUE              4000000UL /*!< Value of the Internal oscillator in Hz*/ | ||||||
|  | #endif /* CSI_VALUE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @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              64000000UL /*!< Value of the Internal oscillator in Hz*/ | ||||||
|  | #endif /* HSI_VALUE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Internal High Speed oscillator (HSI48) value for USB FS, SDMMC and RNG. | ||||||
|  |   *        This internal oscillator is mainly dedicated to provide a high precision clock to | ||||||
|  |   *        the USB peripheral by means of a special Clock Recovery System (CRS) circuitry. | ||||||
|  |   *        When the CRS is not used, the HSI48 RC oscillator runs on it default frequency | ||||||
|  |   *        which is subject to manufacturing process variations. | ||||||
|  |   */ | ||||||
|  | #if !defined  (HSI48_VALUE) | ||||||
|  |   #define HSI48_VALUE             48000000UL /*!< Value of the Internal High Speed oscillator for USB FS/SDMMC/RNG in Hz. | ||||||
|  |                                                   The real value my vary depending on manufacturing process variations.*/ | ||||||
|  | #endif /* HSI48_VALUE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Internal Low Speed oscillator (LSI) value. | ||||||
|  |   */ | ||||||
|  | #if !defined  (LSI_VALUE) | ||||||
|  |   #define LSI_VALUE  32000UL    /*!< 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.*/ | ||||||
|  |  | ||||||
|  | #if !defined  (LSI_STARTUP_TIME) | ||||||
|  |   #define LSI_STARTUP_TIME          130UL      /*!< Time out for LSI start up, in us */ | ||||||
|  | #endif /* LSI_STARTUP_TIME */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @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  32768UL    /*!< Value of the External oscillator in Hz*/ | ||||||
|  | #endif /* LSE_VALUE */ | ||||||
|  |  | ||||||
|  | #if !defined  (LSE_STARTUP_TIMEOUT) | ||||||
|  |   #define LSE_STARTUP_TIMEOUT    5000UL     /*!< Time out for LSE start up, in ms */ | ||||||
|  | #endif /* LSE_STARTUP_TIMEOUT */ | ||||||
|  | /** | ||||||
|  |   * @brief External clock source for SPI/SAI peripheral | ||||||
|  |   *        This value is used by the SPI/SAI HAL module to compute the SPI/SAI clock source | ||||||
|  |   *        frequency, this source is inserted directly through I2S_CKIN pad. | ||||||
|  |  | ||||||
|  |   */ | ||||||
|  | #if !defined  (EXTERNAL_CLOCK_VALUE) | ||||||
|  |   #define EXTERNAL_CLOCK_VALUE    12288000UL /*!< Value of the External clock 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                  3300UL /*!< Value of VDD in mv */ | ||||||
|  | #define  TICK_INT_PRIORITY          (15UL)  /*!< tick interrupt priority (lowest by default) */ | ||||||
|  | #define  USE_RTOS                   0U | ||||||
|  | #define  PREFETCH_ENABLE            0U               /*!< Enable prefetch */ | ||||||
|  |  | ||||||
|  | /* ############################################ Assert Selection #################################################### */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Uncomment the line below to expanse the "assert_param" macro in the | ||||||
|  |   *        HAL drivers code | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* #define USE_FULL_ASSERT    1U */ | ||||||
|  |  | ||||||
|  | /* ############################################ Register callback feature configuration ############################# */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Set below the peripheral configuration  to "1U" to add the support | ||||||
|  |   *        of HAL callback registration/unregistration feature for the HAL | ||||||
|  |   *        driver(s). This allows user application to provide specific callback | ||||||
|  |   *        functions thanks to HAL_PPP_RegisterCallback() rather than overwriting | ||||||
|  |   *        the default weak callback functions (see each stm32h5xx_hal_ppp.h file | ||||||
|  |   *        for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef | ||||||
|  |   *        for each PPP peripheral). | ||||||
|  |   */ | ||||||
|  | #define  USE_HAL_ADC_REGISTER_CALLBACKS       0U    /* ADC register callback disabled       */ | ||||||
|  | #define  USE_HAL_CEC_REGISTER_CALLBACKS       0U    /* CEC register callback disabled       */ | ||||||
|  | #define  USE_HAL_COMP_REGISTER_CALLBACKS      0U    /* COMP register callback disabled      */ | ||||||
|  | #define  USE_HAL_CORDIC_REGISTER_CALLBACKS    0U    /* CORDIC 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_DTS_REGISTER_CALLBACKS       0U    /* DTS register callback disabled       */ | ||||||
|  | #define  USE_HAL_ETH_REGISTER_CALLBACKS       0U    /* ETH register callback disabled       */ | ||||||
|  | #define  USE_HAL_FDCAN_REGISTER_CALLBACKS     0U    /* FDCAN register callback disabled     */ | ||||||
|  | #define  USE_HAL_FMAC_REGISTER_CALLBACKS      0U    /* FMAC register callback disabled      */ | ||||||
|  | #define  USE_HAL_NOR_REGISTER_CALLBACKS       0U    /* NOR 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_I2S_REGISTER_CALLBACKS       0U    /* I2S register callback disabled       */ | ||||||
|  | #define  USE_HAL_I3C_REGISTER_CALLBACKS       0U    /* I3C register callback disabled       */ | ||||||
|  | #define  USE_HAL_IRDA_REGISTER_CALLBACKS      0U    /* IRDA register callback disabled      */ | ||||||
|  | #define  USE_HAL_IWDG_REGISTER_CALLBACKS      0U    /* IWDG register callback disabled      */ | ||||||
|  | #define  USE_HAL_LPTIM_REGISTER_CALLBACKS     0U    /* LPTIM 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_OPAMP_REGISTER_CALLBACKS     0U    /* OPAMP register callback disabled     */ | ||||||
|  | #define  USE_HAL_OTFDEC_REGISTER_CALLBACKS    0U    /* OTFDEC register callback disabled    */ | ||||||
|  | #define  USE_HAL_PCD_REGISTER_CALLBACKS       0U    /* PCD register callback disabled       */ | ||||||
|  | #define  USE_HAL_PKA_REGISTER_CALLBACKS       0U    /* PKA register callback disabled       */ | ||||||
|  | #define  USE_HAL_RAMCFG_REGISTER_CALLBACKS    0U    /* RAMCFG 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_SDRAM_REGISTER_CALLBACKS     0U    /* SDRAM register callback disabled     */ | ||||||
|  | #define  USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U    /* SMARTCARD 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_SRAM_REGISTER_CALLBACKS      0U    /* SRAM 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      */ | ||||||
|  | #define  USE_HAL_XSPI_REGISTER_CALLBACKS      0U    /* XSPI register callback disabled      */ | ||||||
|  |  | ||||||
|  | /* ############################################ 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 "stm32h5xx_hal_rcc.h" | ||||||
|  | #endif /* HAL_RCC_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_GPIO_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_gpio.h" | ||||||
|  | #endif /* HAL_GPIO_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_ICACHE_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_icache.h" | ||||||
|  | #endif /* HAL_ICACHE_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_DCACHE_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_dcache.h" | ||||||
|  | #endif /* HAL_DCACHE_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_GTZC_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_gtzc.h" | ||||||
|  | #endif /* HAL_GTZC_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_DMA_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_dma.h" | ||||||
|  | #endif /* HAL_DMA_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_DTS_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_dts.h" | ||||||
|  | #endif /* HAL_DTS_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_CORTEX_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_cortex.h" | ||||||
|  | #endif /* HAL_CORTEX_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_PKA_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_pka.h" | ||||||
|  | #endif /* HAL_PKA_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_ADC_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_adc.h" | ||||||
|  | #endif /* HAL_ADC_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_CRC_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_crc.h" | ||||||
|  | #endif /* HAL_CRC_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_CRYP_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_cryp.h" | ||||||
|  | #endif /* HAL_CRYP_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_DAC_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_dac.h" | ||||||
|  | #endif /* HAL_DAC_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_FLASH_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_flash.h" | ||||||
|  | #endif /* HAL_FLASH_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_HASH_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_hash.h" | ||||||
|  | #endif /* HAL_HASH_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_SRAM_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_sram.h" | ||||||
|  | #endif /* HAL_SRAM_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_SDRAM_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_sdram.h" | ||||||
|  | #endif /* HAL_SDRAM_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_MMC_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_mmc.h" | ||||||
|  | #endif /* HAL_MMC_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_NOR_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_nor.h" | ||||||
|  | #endif /* HAL_NOR_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_NAND_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_nand.h" | ||||||
|  | #endif /* HAL_NAND_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_I2C_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_i2c.h" | ||||||
|  | #endif /* HAL_I2C_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_I2S_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_i2s.h" | ||||||
|  | #endif /* HAL_I2S_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_I3C_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_i3c.h" | ||||||
|  | #endif /* HAL_I3C_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_IWDG_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_iwdg.h" | ||||||
|  | #endif /* HAL_IWDG_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_LPTIM_MODULE_ENABLED | ||||||
|  | #include "stm32h5xx_hal_lptim.h" | ||||||
|  | #endif /* HAL_LPTIM_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_PWR_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_pwr.h" | ||||||
|  | #endif /* HAL_PWR_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_XSPI_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_xspi.h" | ||||||
|  | #endif /* HAL_XSPI_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_RNG_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_rng.h" | ||||||
|  | #endif /* HAL_RNG_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_RTC_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_rtc.h" | ||||||
|  | #endif /* HAL_RTC_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_SAI_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_sai.h" | ||||||
|  | #endif /* HAL_SAI_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_SD_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_sd.h" | ||||||
|  | #endif /* HAL_SD_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_SMBUS_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_smbus.h" | ||||||
|  | #endif /* HAL_SMBUS_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_SPI_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_spi.h" | ||||||
|  | #endif /* HAL_SPI_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_TIM_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_tim.h" | ||||||
|  | #endif /* HAL_TIM_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_UART_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_uart.h" | ||||||
|  | #endif /* HAL_UART_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_USART_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_usart.h" | ||||||
|  | #endif /* HAL_USART_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_IRDA_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_irda.h" | ||||||
|  | #endif /* HAL_IRDA_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_SMARTCARD_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_smartcard.h" | ||||||
|  | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_WWDG_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_wwdg.h" | ||||||
|  | #endif /* HAL_WWDG_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_PCD_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_pcd.h" | ||||||
|  | #endif /* HAL_PCD_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_HCD_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_hcd.h" | ||||||
|  | #endif /* HAL_HCD_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_COMP_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_comp.h" | ||||||
|  | #endif /* HAL_COMP_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_CORDIC_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_cordic.h" | ||||||
|  | #endif /* HAL_CORDIC_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_DCMI_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_dcmi.h" | ||||||
|  | #endif /* HAL_DCMI_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_EXTI_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_exti.h" | ||||||
|  | #endif /* HAL_EXTI_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_ETH_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_eth.h" | ||||||
|  | #endif /* HAL_ETH_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_FDCAN_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_fdcan.h" | ||||||
|  | #endif /* HAL_FDCAN_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_CEC_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_cec.h" | ||||||
|  | #endif /* HAL_CEC_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_FMAC_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_fmac.h" | ||||||
|  | #endif /* HAL_FMAC_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_OPAMP_MODULE_ENABLED | ||||||
|  |   #include "stm32h5xx_hal_opamp.h" | ||||||
|  | #endif /* HAL_OPAMP_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_OTFDEC_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_otfdec.h" | ||||||
|  | #endif /* HAL_OTFDEC_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_PSSI_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_pssi.h" | ||||||
|  | #endif /* HAL_PSSI_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_RAMCFG_MODULE_ENABLED | ||||||
|  |  #include "stm32h5xx_hal_ramcfg.h" | ||||||
|  | #endif /* HAL_RAMCFG_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 /* STM32H5xx_HAL_CONF_H */ | ||||||
|  |  | ||||||
							
								
								
									
										64
									
								
								Core/Inc/stm32h5xx_it.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								Core/Inc/stm32h5xx_it.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,64 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_it.h | ||||||
|  |   * @brief   This file contains the headers of the interrupt handlers. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef __STM32H5xx_IT_H | ||||||
|  | #define __STM32H5xx_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 DebugMon_Handler(void); | ||||||
|  | void TIM1_UP_IRQHandler(void); | ||||||
|  | /* USER CODE BEGIN EFP */ | ||||||
|  |  | ||||||
|  | /* USER CODE END EFP */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* __STM32H5xx_IT_H */ | ||||||
							
								
								
									
										272
									
								
								Core/Inc/tx_user.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										272
									
								
								Core/Inc/tx_user.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,272 @@ | |||||||
|  | /**************************************************************************/ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*       Copyright (c) Microsoft Corporation. All rights reserved.        */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*       This software is licensed under the Microsoft Software License   */ | ||||||
|  | /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */ | ||||||
|  | /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */ | ||||||
|  | /*       and in the root directory of this software.                      */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /**************************************************************************/ | ||||||
|  |  | ||||||
|  | /**************************************************************************/ | ||||||
|  | /**************************************************************************/ | ||||||
|  | /**                                                                       */ | ||||||
|  | /** ThreadX Component                                                     */ | ||||||
|  | /**                                                                       */ | ||||||
|  | /**   User Specific                                                       */ | ||||||
|  | /**                                                                       */ | ||||||
|  | /**************************************************************************/ | ||||||
|  | /**************************************************************************/ | ||||||
|  |  | ||||||
|  | /**************************************************************************/ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  PORT SPECIFIC C INFORMATION                            RELEASE        */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    tx_user.h                                           PORTABLE C      */ | ||||||
|  | /*                                                           6.3.0        */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  AUTHOR                                                                */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    William E. Lamie, Microsoft Corporation                             */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  DESCRIPTION                                                           */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    This file contains user defines for configuring ThreadX in specific */ | ||||||
|  | /*    ways. This file will have an effect only if the application and     */ | ||||||
|  | /*    ThreadX library are built with TX_INCLUDE_USER_DEFINE_FILE defined. */ | ||||||
|  | /*    Note that all the defines in this file may also be made on the      */ | ||||||
|  | /*    command line when building ThreadX library and application objects. */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  RELEASE HISTORY                                                       */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    DATE              NAME                      DESCRIPTION             */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  05-19-2020      William E. Lamie        Initial Version 6.0           */ | ||||||
|  | /*  09-30-2020      Yuxin Zhou              Modified comment(s),          */ | ||||||
|  | /*                                            resulting in version 6.1    */ | ||||||
|  | /*  03-02-2021      Scott Larson            Modified comment(s),          */ | ||||||
|  | /*                                            added option to remove      */ | ||||||
|  | /*                                            FileX pointer,              */ | ||||||
|  | /*                                            resulting in version 6.1.5  */ | ||||||
|  | /*  06-02-2021      Scott Larson            Added options for multiple    */ | ||||||
|  | /*                                            block pool search & delay,  */ | ||||||
|  | /*                                            resulting in version 6.1.7  */ | ||||||
|  | /*  10-15-2021      Yuxin Zhou              Modified comment(s), added    */ | ||||||
|  | /*                                            user-configurable symbol    */ | ||||||
|  | /*                                            TX_TIMER_TICKS_PER_SECOND   */ | ||||||
|  | /*                                            resulting in version 6.1.9  */ | ||||||
|  | /*  04-25-2022      Wenhui Xie              Modified comment(s),          */ | ||||||
|  | /*                                            optimized the definition of */ | ||||||
|  | /*                                            TX_TIMER_TICKS_PER_SECOND,  */ | ||||||
|  | /*                                            resulting in version 6.1.11 */ | ||||||
|  | /*  10-31-2023      Xiuwen Cai              Modified comment(s),          */ | ||||||
|  | /*                                            added option for random     */ | ||||||
|  | /*                                            number stack filling,       */ | ||||||
|  | /*                                            resulting in version 6.3.0  */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /**************************************************************************/ | ||||||
|  |  | ||||||
|  | #ifndef TX_USER_H | ||||||
|  | #define TX_USER_H | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 1 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 1 */ | ||||||
|  |  | ||||||
|  | /* Define various build options for the ThreadX port.  The application should either make changes | ||||||
|  |    here by commenting or un-commenting the conditional compilation defined OR supply the defines | ||||||
|  |    though the compiler's equivalent of the -D option. | ||||||
|  |  | ||||||
|  |    For maximum speed, the following should be defined: | ||||||
|  |  | ||||||
|  |         TX_MAX_PRIORITIES                       32 | ||||||
|  |         TX_DISABLE_PREEMPTION_THRESHOLD | ||||||
|  |         TX_DISABLE_REDUNDANT_CLEARING | ||||||
|  |         TX_DISABLE_NOTIFY_CALLBACKS | ||||||
|  |         TX_NOT_INTERRUPTABLE | ||||||
|  |         TX_TIMER_PROCESS_IN_ISR | ||||||
|  |         TX_REACTIVATE_INLINE | ||||||
|  |         TX_DISABLE_STACK_FILLING | ||||||
|  |         TX_INLINE_THREAD_RESUME_SUSPEND | ||||||
|  |         TX_DISABLE_ERROR_CHECKING | ||||||
|  |  | ||||||
|  |    For minimum size, the following should be defined: | ||||||
|  |  | ||||||
|  |         TX_MAX_PRIORITIES                       32 | ||||||
|  |         TX_DISABLE_PREEMPTION_THRESHOLD | ||||||
|  |         TX_DISABLE_REDUNDANT_CLEARING | ||||||
|  |         TX_DISABLE_NOTIFY_CALLBACKS | ||||||
|  |         TX_NO_FILEX_POINTER | ||||||
|  |         TX_NOT_INTERRUPTABLE | ||||||
|  |         TX_TIMER_PROCESS_IN_ISR | ||||||
|  |  | ||||||
|  |    Of course, many of these defines reduce functionality and/or change the behavior of the | ||||||
|  |    system in ways that may not be worth the trade-off. For example, the TX_TIMER_PROCESS_IN_ISR | ||||||
|  |    results in faster and smaller code, however, it increases the amount of processing in the ISR. | ||||||
|  |    In addition, some services that are available in timers are not available from ISRs and will | ||||||
|  |    therefore return an error if this option is used. This may or may not be desirable for a | ||||||
|  |    given application.  */ | ||||||
|  |  | ||||||
|  | /* Override various options with default values already assigned in tx_port.h. Please also refer | ||||||
|  |    to tx_port.h for descriptions on each of these options.  */ | ||||||
|  |  | ||||||
|  | /*#define TX_MAX_PRIORITIES                32*/ | ||||||
|  | /*#define TX_TIMER_THREAD_STACK_SIZE                1024*/ | ||||||
|  | /*#define TX_TIMER_THREAD_PRIORITY                0*/ | ||||||
|  |  | ||||||
|  | /*#define TX_MINIMUM_STACK                200*/ | ||||||
|  |  | ||||||
|  | /* Determine if timer expirations (application timers, timeouts, and tx_thread_sleep) calls | ||||||
|  |    should be processed within the a system timer thread or directly in the timer ISR. | ||||||
|  |    By default, the timer thread is used. When the following is defined, the timer expiration | ||||||
|  |    processing is done directly from the timer ISR, thereby eliminating the timer thread control | ||||||
|  |    block, stack, and context switching to activate it.  */ | ||||||
|  |  | ||||||
|  | /*#define TX_TIMER_PROCESS_IN_ISR*/ | ||||||
|  |  | ||||||
|  | /* Determine if in-line timer reactivation should be used within the timer expiration processing. | ||||||
|  |    By default, this is disabled and a function call is used. When the following is defined, | ||||||
|  |    reactivating is performed in-line resulting in faster timer processing but slightly larger | ||||||
|  |    code size.  */ | ||||||
|  |  | ||||||
|  | /*#define TX_REACTIVATE_INLINE*/ | ||||||
|  |  | ||||||
|  | /* Determine is stack filling is enabled. By default, ThreadX stack filling is enabled, | ||||||
|  |    which places an 0xEF pattern in each byte of each thread's stack.  This is used by | ||||||
|  |    debuggers with ThreadX-awareness and by the ThreadX run-time stack checking feature.  */ | ||||||
|  |  | ||||||
|  | /*#define TX_DISABLE_STACK_FILLING*/ | ||||||
|  |  | ||||||
|  | /* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is | ||||||
|  |    disabled. When the following is defined, ThreadX thread stack checking is enabled.  If stack | ||||||
|  |    checking is enabled (TX_ENABLE_STACK_CHECKING is defined), the TX_DISABLE_STACK_FILLING | ||||||
|  |    define is negated, thereby forcing the stack fill which is necessary for the stack checking | ||||||
|  |    logic.  */ | ||||||
|  |  | ||||||
|  | /*#define TX_ENABLE_STACK_CHECKING*/ | ||||||
|  |  | ||||||
|  | /* Determine if random number is used for stack filling. By default, ThreadX uses a fixed pattern | ||||||
|  |    for stack filling. When the following is defined, ThreadX uses a random number for stack filling. | ||||||
|  |    This is effective only when TX_ENABLE_STACK_CHECKING is defined.  */ | ||||||
|  |  | ||||||
|  | /*#define TX_ENABLE_RANDOM_NUMBER_STACK_FILLING*/ | ||||||
|  |  | ||||||
|  | /* Determine if preemption-threshold should be disabled. By default, preemption-threshold is | ||||||
|  |    enabled. If the application does not use preemption-threshold, it may be disabled to reduce | ||||||
|  |    code size and improve performance.  */ | ||||||
|  |  | ||||||
|  | #define TX_DISABLE_PREEMPTION_THRESHOLD | ||||||
|  |  | ||||||
|  | /* Determine if global ThreadX variables should be cleared. If the compiler startup code clears | ||||||
|  |    the .bss section prior to ThreadX running, the define can be used to eliminate unnecessary | ||||||
|  |    clearing of ThreadX global variables.  */ | ||||||
|  |  | ||||||
|  | /*#define TX_DISABLE_REDUNDANT_CLEARING*/ | ||||||
|  |  | ||||||
|  | /* Determine if no timer processing is required. This option will help eliminate the timer | ||||||
|  |    processing when not needed. The user will also have to comment out the call to | ||||||
|  |    tx_timer_interrupt, which is typically made from assembly language in | ||||||
|  |    tx_initialize_low_level. Note: if TX_NO_TIMER is used, the define TX_TIMER_PROCESS_IN_ISR | ||||||
|  |    must also be used.  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  | #define TX_NO_TIMER | ||||||
|  | #ifndef TX_TIMER_PROCESS_IN_ISR | ||||||
|  | #define TX_TIMER_PROCESS_IN_ISR | ||||||
|  | #endif | ||||||
|  | */ | ||||||
|  |  | ||||||
|  | /* Determine if the notify callback option should be disabled. By default, notify callbacks are | ||||||
|  |    enabled. If the application does not use notify callbacks, they may be disabled to reduce | ||||||
|  |    code size and improve performance.  */ | ||||||
|  |  | ||||||
|  | #define TX_DISABLE_NOTIFY_CALLBACKS | ||||||
|  |  | ||||||
|  | /* Defined, the basic parameter error checking is disabled. */ | ||||||
|  |  | ||||||
|  | /*#define TX_DISABLE_ERROR_CHECKING*/ | ||||||
|  |  | ||||||
|  | /* Determine if the tx_thread_resume and tx_thread_suspend services should have their internal | ||||||
|  |    code in-line. This results in a larger image, but improves the performance of the thread | ||||||
|  |    resume and suspend services.  */ | ||||||
|  |  | ||||||
|  | /*#define TX_INLINE_THREAD_RESUME_SUSPEND*/ | ||||||
|  |  | ||||||
|  | /* Determine if the internal ThreadX code is non-interruptable. This results in smaller code | ||||||
|  |    size and less processing overhead, but increases the interrupt lockout time.  */ | ||||||
|  |  | ||||||
|  | /*#define TX_NOT_INTERRUPTABLE*/ | ||||||
|  |  | ||||||
|  | /* Determine if the trace event logging code should be enabled. This causes slight increases in | ||||||
|  |    code size and overhead, but provides the ability to generate system trace information which | ||||||
|  |    is available for viewing in TraceX.  */ | ||||||
|  |  | ||||||
|  | /*#define TX_ENABLE_EVENT_TRACE*/ | ||||||
|  |  | ||||||
|  | /* Determine if block pool performance gathering is required by the application. When the following is | ||||||
|  |    defined, ThreadX gathers various block pool performance information. */ | ||||||
|  |  | ||||||
|  | /*#define TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO*/ | ||||||
|  |  | ||||||
|  | /* Determine if byte pool performance gathering is required by the application. When the following is | ||||||
|  |    defined, ThreadX gathers various byte pool performance information. */ | ||||||
|  |  | ||||||
|  | /*#define TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO*/ | ||||||
|  |  | ||||||
|  | /* Determine if event flags performance gathering is required by the application. When the following is | ||||||
|  |    defined, ThreadX gathers various event flags performance information. */ | ||||||
|  |  | ||||||
|  | /*#define TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO*/ | ||||||
|  |  | ||||||
|  | /* Determine if mutex performance gathering is required by the application. When the following is | ||||||
|  |    defined, ThreadX gathers various mutex performance information. */ | ||||||
|  |  | ||||||
|  | /*#define TX_MUTEX_ENABLE_PERFORMANCE_INFO*/ | ||||||
|  |  | ||||||
|  | /* Determine if queue performance gathering is required by the application. When the following is | ||||||
|  |    defined, ThreadX gathers various queue performance information. */ | ||||||
|  |  | ||||||
|  | /*#define TX_QUEUE_ENABLE_PERFORMANCE_INFO*/ | ||||||
|  |  | ||||||
|  | /* Determine if semaphore performance gathering is required by the application. When the following is | ||||||
|  |    defined, ThreadX gathers various semaphore performance information. */ | ||||||
|  |  | ||||||
|  | /*#define TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO*/ | ||||||
|  |  | ||||||
|  | /* Determine if thread performance gathering is required by the application. When the following is | ||||||
|  |    defined, ThreadX gathers various thread performance information. */ | ||||||
|  |  | ||||||
|  | /*#define TX_THREAD_ENABLE_PERFORMANCE_INFO*/ | ||||||
|  |  | ||||||
|  | /* Determine if timer performance gathering is required by the application. When the following is | ||||||
|  |    defined, ThreadX gathers various timer performance information. */ | ||||||
|  |  | ||||||
|  | /*#define TX_TIMER_ENABLE_PERFORMANCE_INFO*/ | ||||||
|  |  | ||||||
|  | /* Define the common timer tick reference for use by other middleware components. */ | ||||||
|  |  | ||||||
|  | /*#define TX_TIMER_TICKS_PER_SECOND                100*/ | ||||||
|  |  | ||||||
|  | /* Determine if there is a FileX pointer in the thread control block. | ||||||
|  |    By default, the pointer is there for legacy/backwards compatibility. | ||||||
|  |    The pointer must also be there for applications using FileX. | ||||||
|  |    Define this to save space in the thread control block. | ||||||
|  | */ | ||||||
|  |  | ||||||
|  | /*#define TX_NO_FILEX_POINTER*/ | ||||||
|  |  | ||||||
|  | #ifdef __ICCARM__ | ||||||
|  | /* Define if the IAR library is supported. */ | ||||||
|  | /*#define TX_ENABLE_IAR_LIBRARY_SUPPORT*/ | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Define if the safety critical configuration is enabled. */ | ||||||
|  |  | ||||||
|  | /*#define TX_SAFETY_CRITICAL*/ | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 2 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 2 */ | ||||||
|  |  | ||||||
|  | #endif | ||||||
							
								
								
									
										91
									
								
								Core/Src/app_threadx.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								Core/Src/app_threadx.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,91 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    app_threadx.c | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   ThreadX applicative file | ||||||
|  |   ****************************************************************************** | ||||||
|  |     * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "app_threadx.h" | ||||||
|  |  | ||||||
|  | /* Private includes ----------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN Includes */ | ||||||
|  |  | ||||||
|  | /* 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 -----------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN PFP */ | ||||||
|  |  | ||||||
|  | /* USER CODE END PFP */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Application ThreadX Initialization. | ||||||
|  |   * @param memory_ptr: memory pointer | ||||||
|  |   * @retval int | ||||||
|  |   */ | ||||||
|  | UINT App_ThreadX_Init(VOID *memory_ptr) | ||||||
|  | { | ||||||
|  |   UINT ret = TX_SUCCESS; | ||||||
|  |   /* USER CODE BEGIN App_ThreadX_MEM_POOL */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END App_ThreadX_MEM_POOL */ | ||||||
|  |   /* USER CODE BEGIN App_ThreadX_Init */ | ||||||
|  |   /* USER CODE END App_ThreadX_Init */ | ||||||
|  |  | ||||||
|  |   return ret; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |   * @brief  Function that implements the kernel's initialization. | ||||||
|  |   * @param  None | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void MX_ThreadX_Init(void) | ||||||
|  | { | ||||||
|  |   /* USER CODE BEGIN Before_Kernel_Start */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END Before_Kernel_Start */ | ||||||
|  |  | ||||||
|  |   tx_kernel_enter(); | ||||||
|  |  | ||||||
|  |   /* USER CODE BEGIN Kernel_Start_Error */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END Kernel_Start_Error */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 1 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 1 */ | ||||||
							
								
								
									
										52
									
								
								Core/Src/gpio.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								Core/Src/gpio.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    gpio.c | ||||||
|  |   * @brief   This file provides code for the configuration | ||||||
|  |   *          of all used GPIO pins. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "gpio.h" | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 0 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 0 */ | ||||||
|  |  | ||||||
|  | /*----------------------------------------------------------------------------*/ | ||||||
|  | /* Configure GPIO                                                             */ | ||||||
|  | /*----------------------------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN 1 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 1 */ | ||||||
|  |  | ||||||
|  | /** Configure pins | ||||||
|  |      PH0-OSC_IN(PH0)   ------> RCC_OSC_IN | ||||||
|  |      PH1-OSC_OUT(PH1)   ------> RCC_OSC_OUT | ||||||
|  |      PA13(JTMS/SWDIO)   ------> DEBUG_JTMS-SWDIO | ||||||
|  |      PA14(JTCK/SWCLK)   ------> DEBUG_JTCK-SWCLK | ||||||
|  | */ | ||||||
|  | void MX_GPIO_Init(void) | ||||||
|  | { | ||||||
|  |  | ||||||
|  |   /* GPIO Ports Clock Enable */ | ||||||
|  |   __HAL_RCC_GPIOH_CLK_ENABLE(); | ||||||
|  |   __HAL_RCC_GPIOA_CLK_ENABLE(); | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 2 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 2 */ | ||||||
							
								
								
									
										57
									
								
								Core/Src/icache.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								Core/Src/icache.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    icache.c | ||||||
|  |   * @brief   This file provides code for the configuration | ||||||
|  |   *          of the ICACHE instances. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "icache.h" | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 0 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 0 */ | ||||||
|  |  | ||||||
|  | /* ICACHE init function */ | ||||||
|  | void MX_ICACHE_Init(void) | ||||||
|  | { | ||||||
|  |  | ||||||
|  |   /* USER CODE BEGIN ICACHE_Init 0 */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END ICACHE_Init 0 */ | ||||||
|  |  | ||||||
|  |   /* USER CODE BEGIN ICACHE_Init 1 */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END ICACHE_Init 1 */ | ||||||
|  |  | ||||||
|  |   /** Enable instruction cache in 1-way (direct mapped cache) | ||||||
|  |   */ | ||||||
|  |   if (HAL_ICACHE_ConfigAssociativityMode(ICACHE_1WAY) != HAL_OK) | ||||||
|  |   { | ||||||
|  |     Error_Handler(); | ||||||
|  |   } | ||||||
|  |   if (HAL_ICACHE_Enable() != HAL_OK) | ||||||
|  |   { | ||||||
|  |     Error_Handler(); | ||||||
|  |   } | ||||||
|  |   /* USER CODE BEGIN ICACHE_Init 2 */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END ICACHE_Init 2 */ | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 1 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 1 */ | ||||||
							
								
								
									
										225
									
								
								Core/Src/main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										225
									
								
								Core/Src/main.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,225 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file           : main.c | ||||||
|  |   * @brief          : Main program body | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "app_threadx.h" | ||||||
|  | #include "main.h" | ||||||
|  | #include "icache.h" | ||||||
|  | #include "memorymap.h" | ||||||
|  | #include "gpio.h" | ||||||
|  |  | ||||||
|  | /* Private includes ----------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN Includes */ | ||||||
|  |  | ||||||
|  | /* 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_ICACHE_Init(); | ||||||
|  |   /* USER CODE BEGIN 2 */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END 2 */ | ||||||
|  |  | ||||||
|  |   MX_ThreadX_Init(); | ||||||
|  |  | ||||||
|  |   /* We should never get here as control is now taken by the scheduler */ | ||||||
|  |  | ||||||
|  |   /* 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) | ||||||
|  | { | ||||||
|  |   RCC_OscInitTypeDef RCC_OscInitStruct = {0}; | ||||||
|  |   RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; | ||||||
|  |  | ||||||
|  |   /** Configure the main internal regulator output voltage | ||||||
|  |   */ | ||||||
|  |   __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0); | ||||||
|  |  | ||||||
|  |   while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} | ||||||
|  |  | ||||||
|  |   /** Initializes the RCC Oscillators according to the specified parameters | ||||||
|  |   * in the RCC_OscInitTypeDef structure. | ||||||
|  |   */ | ||||||
|  |   RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_CSI; | ||||||
|  |   RCC_OscInitStruct.CSIState = RCC_CSI_ON; | ||||||
|  |   RCC_OscInitStruct.CSICalibrationValue = RCC_CSICALIBRATION_DEFAULT; | ||||||
|  |   RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; | ||||||
|  |   RCC_OscInitStruct.PLL.PLLSource = RCC_PLL1_SOURCE_CSI; | ||||||
|  |   RCC_OscInitStruct.PLL.PLLM = 1; | ||||||
|  |   RCC_OscInitStruct.PLL.PLLN = 125; | ||||||
|  |   RCC_OscInitStruct.PLL.PLLP = 2; | ||||||
|  |   RCC_OscInitStruct.PLL.PLLQ = 2; | ||||||
|  |   RCC_OscInitStruct.PLL.PLLR = 2; | ||||||
|  |   RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1_VCIRANGE_2; | ||||||
|  |   RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1_VCORANGE_WIDE; | ||||||
|  |   RCC_OscInitStruct.PLL.PLLFRACN = 0; | ||||||
|  |   if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) | ||||||
|  |   { | ||||||
|  |     Error_Handler(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /** Initializes the CPU, AHB and APB buses clocks | ||||||
|  |   */ | ||||||
|  |   RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK | ||||||
|  |                               |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 | ||||||
|  |                               |RCC_CLOCKTYPE_PCLK3; | ||||||
|  |   RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; | ||||||
|  |   RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; | ||||||
|  |   RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; | ||||||
|  |   RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; | ||||||
|  |   RCC_ClkInitStruct.APB3CLKDivider = RCC_HCLK_DIV1; | ||||||
|  |  | ||||||
|  |   if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) | ||||||
|  |   { | ||||||
|  |     Error_Handler(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /** Configure the programming delay | ||||||
|  |   */ | ||||||
|  |   __HAL_FLASH_SET_PROGRAM_DELAY(FLASH_PROGRAMMING_DELAY_2); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 4 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 4 */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Period elapsed callback in non blocking mode | ||||||
|  |   * @note   This function is called  when TIM1 interrupt took place, inside | ||||||
|  |   * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment | ||||||
|  |   * a global variable "uwTick" used as application time base. | ||||||
|  |   * @param  htim : TIM handle | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) | ||||||
|  | { | ||||||
|  |   /* USER CODE BEGIN Callback 0 */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END Callback 0 */ | ||||||
|  |   if (htim->Instance == TIM1) | ||||||
|  |   { | ||||||
|  |     HAL_IncTick(); | ||||||
|  |   } | ||||||
|  |   /* USER CODE BEGIN Callback 1 */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END Callback 1 */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @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 */ | ||||||
							
								
								
									
										29
									
								
								Core/Src/memorymap.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								Core/Src/memorymap.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    memorymap.c | ||||||
|  |   * @brief   This file provides code for the configuration | ||||||
|  |   *          of the MEMORYMAP instances. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "memorymap.h" | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 0 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 0 */ | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 1 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 1 */ | ||||||
							
								
								
									
										79
									
								
								Core/Src/stm32h5xx_hal_msp.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								Core/Src/stm32h5xx_hal_msp.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,79 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file         stm32h5xx_hal_msp.c | ||||||
|  |   * @brief        This file provides code for the MSP Initialization | ||||||
|  |   *               and de-Initialization codes. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* 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 */ | ||||||
|  |  | ||||||
|  |   /* System interrupt init*/ | ||||||
|  |  | ||||||
|  |   /* USER CODE BEGIN MspInit 1 */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END MspInit 1 */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 1 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 1 */ | ||||||
							
								
								
									
										126
									
								
								Core/Src/stm32h5xx_hal_timebase_tim.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								Core/Src/stm32h5xx_hal_timebase_tim.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,126 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_timebase_tim.c | ||||||
|  |   * @brief   HAL time base based on the hardware TIM. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal.h" | ||||||
|  | #include "stm32h5xx_hal_tim.h" | ||||||
|  |  | ||||||
|  | /* Private typedef -----------------------------------------------------------*/ | ||||||
|  | /* Private define ------------------------------------------------------------*/ | ||||||
|  | /* Private macro -------------------------------------------------------------*/ | ||||||
|  | /* Private variables ---------------------------------------------------------*/ | ||||||
|  | TIM_HandleTypeDef        htim1; | ||||||
|  | /* Private function prototypes -----------------------------------------------*/ | ||||||
|  | /* Private functions ---------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  This function configures the TIM1 as a time base source. | ||||||
|  |   *         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 configured, by HAL_RCC_ClockConfig(). | ||||||
|  |   * @param  TickPriority: Tick interrupt priority. | ||||||
|  |   * @retval HAL status | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) | ||||||
|  | { | ||||||
|  |   RCC_ClkInitTypeDef    clkconfig; | ||||||
|  |   uint32_t              uwTimclock; | ||||||
|  |   uint32_t              uwPrescalerValue; | ||||||
|  |   uint32_t              pFLatency; | ||||||
|  |  | ||||||
|  |   HAL_StatusTypeDef     status; | ||||||
|  |  | ||||||
|  |   /* Enable TIM1 clock */ | ||||||
|  |   __HAL_RCC_TIM1_CLK_ENABLE(); | ||||||
|  |  | ||||||
|  |   /* Get clock configuration */ | ||||||
|  |   HAL_RCC_GetClockConfig(&clkconfig, &pFLatency); | ||||||
|  |  | ||||||
|  |   /* Compute TIM1 clock */ | ||||||
|  |       uwTimclock = HAL_RCC_GetPCLK2Freq(); | ||||||
|  |  | ||||||
|  |   /* Compute the prescaler value to have TIM1 counter clock equal to 100KHz */ | ||||||
|  |   uwPrescalerValue = (uint32_t) ((uwTimclock / 100000U) - 1U); | ||||||
|  |  | ||||||
|  |   /* Initialize TIM1 */ | ||||||
|  |   htim1.Instance = TIM1; | ||||||
|  |  | ||||||
|  |   /* Initialize TIMx peripheral as follow: | ||||||
|  |    * Period = [(TIM1CLK/1000) - 1]. to have a (1/1000) s time base. | ||||||
|  |    * Prescaler = (uwTimclock/100000 - 1) to have a 100KHz counter clock. | ||||||
|  |    * ClockDivision = 0 | ||||||
|  |    * Counter direction = Up | ||||||
|  |    */ | ||||||
|  |   htim1.Init.Period = (100000U / 1000U) - 1U; | ||||||
|  |   htim1.Init.Prescaler = uwPrescalerValue; | ||||||
|  |   htim1.Init.ClockDivision = 0; | ||||||
|  |   htim1.Init.CounterMode = TIM_COUNTERMODE_UP; | ||||||
|  |  | ||||||
|  |   status = HAL_TIM_Base_Init(&htim1); | ||||||
|  |   if (status == HAL_OK) | ||||||
|  |   { | ||||||
|  |     /* Start the TIM time Base generation in interrupt mode */ | ||||||
|  |     status = HAL_TIM_Base_Start_IT(&htim1); | ||||||
|  |     if (status == HAL_OK) | ||||||
|  |     { | ||||||
|  |       if (TickPriority < (1UL << __NVIC_PRIO_BITS)) | ||||||
|  |       { | ||||||
|  |         /* Enable the TIM1 global Interrupt */ | ||||||
|  |         HAL_NVIC_SetPriority(TIM1_UP_IRQn, TickPriority, 0U); | ||||||
|  |         uwTickPrio = TickPriority; | ||||||
|  |       } | ||||||
|  |       else | ||||||
|  |       { | ||||||
|  |         status = HAL_ERROR; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |   /* Enable the TIM1 global Interrupt */ | ||||||
|  |   HAL_NVIC_EnableIRQ(TIM1_UP_IRQn); | ||||||
|  |  | ||||||
|  |   /* Return function status */ | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Suspend Tick increment. | ||||||
|  |   * @note   Disable the tick increment by disabling TIM1 update interrupt. | ||||||
|  |   * @param  None | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_SuspendTick(void) | ||||||
|  | { | ||||||
|  |   /* Disable TIM1 update Interrupt */ | ||||||
|  |   __HAL_TIM_DISABLE_IT(&htim1, TIM_IT_UPDATE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Resume Tick increment. | ||||||
|  |   * @note   Enable the tick increment by Enabling TIM1 update interrupt. | ||||||
|  |   * @param  None | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_ResumeTick(void) | ||||||
|  | { | ||||||
|  |   /* Enable TIM1 Update interrupt */ | ||||||
|  |   __HAL_TIM_ENABLE_IT(&htim1, TIM_IT_UPDATE); | ||||||
|  | } | ||||||
|  |  | ||||||
							
								
								
									
										178
									
								
								Core/Src/stm32h5xx_it.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										178
									
								
								Core/Src/stm32h5xx_it.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,178 @@ | |||||||
|  | /* USER CODE BEGIN Header */ | ||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_it.c | ||||||
|  |   * @brief   Interrupt Service Routines. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2025 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  | /* USER CODE END Header */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "main.h" | ||||||
|  | #include "stm32h5xx_it.h" | ||||||
|  | /* Private includes ----------------------------------------------------------*/ | ||||||
|  | /* USER CODE BEGIN Includes */ | ||||||
|  | /* 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 TIM_HandleTypeDef htim1; | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN EV */ | ||||||
|  |  | ||||||
|  | /* USER CODE END EV */ | ||||||
|  |  | ||||||
|  | /******************************************************************************/ | ||||||
|  | /*           Cortex 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 Pre-fetch 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 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 */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /******************************************************************************/ | ||||||
|  | /* STM32H5xx 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_stm32h5xx.s).                    */ | ||||||
|  | /******************************************************************************/ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief This function handles TIM1 Update interrupt. | ||||||
|  |   */ | ||||||
|  | void TIM1_UP_IRQHandler(void) | ||||||
|  | { | ||||||
|  |   /* USER CODE BEGIN TIM1_UP_IRQn 0 */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END TIM1_UP_IRQn 0 */ | ||||||
|  |   HAL_TIM_IRQHandler(&htim1); | ||||||
|  |   /* USER CODE BEGIN TIM1_UP_IRQn 1 */ | ||||||
|  |  | ||||||
|  |   /* USER CODE END TIM1_UP_IRQn 1 */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* USER CODE BEGIN 1 */ | ||||||
|  |  | ||||||
|  | /* USER CODE END 1 */ | ||||||
							
								
								
									
										401
									
								
								Core/Src/system_stm32h5xx.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										401
									
								
								Core/Src/system_stm32h5xx.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,401 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    system_stm32h5xx.c | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   CMSIS Cortex-M33 Device Peripheral Access Layer System Source File | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   *   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_stm32h5xx.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. | ||||||
|  |   * | ||||||
|  |   *   After each device reset the HSI (64 MHz) is used as system clock source. | ||||||
|  |   *   Then SystemInit() function is called, in "startup_stm32h5xx.s" file, to | ||||||
|  |   *   configure the system clock before to branch to main program. | ||||||
|  |   * | ||||||
|  |   *   This file configures the system clock as follows: | ||||||
|  |   *============================================================================= | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        System Clock source                     | HSI | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        SYSCLK(Hz)                              | 64000000 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        HCLK(Hz)                                | 64000000 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        AHB Prescaler                           | 1 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        APB1 Prescaler                          | 1 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        APB2 Prescaler                          | 1 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        APB3 Prescaler                          | 1 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        HSI Division factor                     | 1 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL1_SRC                                | No clock | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL1_M                                  | Prescaler disabled | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL1_N                                  | 129 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL1_P                                  | 2 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL1_Q                                  | 2 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL1_R                                  | 2 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL1_FRACN                              | 0 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL2_SRC                                | No clock | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL2_M                                  | Prescaler disabled | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL2_N                                  | 129 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL2_P                                  | 2 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL2_Q                                  | 2 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL2_R                                  | 2 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL2_FRACN                              | 0 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL3_SRC                                | No clock | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL3_M                                  | Prescaler disabled | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL3_N                                  | 129 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL3_P                                  | 2 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL3_Q                                  | 2 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL3_R                                  | 2 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *        PLL3_FRACN                              | 0 | ||||||
|  |   *----------------------------------------------------------------------------- | ||||||
|  |   *============================================================================= | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup CMSIS | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_system | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_System_Private_Includes | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #include "stm32h5xx.h" | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_System_Private_TypesDefinitions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_System_Private_Defines | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if !defined  (HSE_VALUE) | ||||||
|  |   #define HSE_VALUE    (25000000UL) /*!< Value of the External oscillator in Hz */ | ||||||
|  | #endif /* HSE_VALUE */ | ||||||
|  |  | ||||||
|  | #if !defined  (CSI_VALUE) | ||||||
|  |   #define CSI_VALUE    (4000000UL)  /*!< Value of the Internal oscillator in Hz*/ | ||||||
|  | #endif /* CSI_VALUE */ | ||||||
|  |  | ||||||
|  | #if !defined  (HSI_VALUE) | ||||||
|  |   #define HSI_VALUE    (64000000UL) /*!< Value of the Internal oscillator in Hz */ | ||||||
|  | #endif /* HSI_VALUE */ | ||||||
|  |  | ||||||
|  | /************************* Miscellaneous Configuration ************************/ | ||||||
|  | /*!< Uncomment the following line if you need to relocate your vector Table in | ||||||
|  |      Internal SRAM. */ | ||||||
|  | /* #define VECT_TAB_SRAM */ | ||||||
|  | #define VECT_TAB_OFFSET  0x00U /*!< Vector Table base offset field. | ||||||
|  |                                    This value must be a multiple of 0x200. */ | ||||||
|  | /******************************************************************************/ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_System_Private_Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_System_Private_Variables | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |   /* The SystemCoreClock 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 = 64000000U; | ||||||
|  |  | ||||||
|  |   const uint8_t  AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U}; | ||||||
|  |   const uint8_t  APBPrescTable[8] =  {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U}; | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_System_Private_FunctionPrototypes | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_System_Private_Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Setup the microcontroller system. | ||||||
|  |   * @param  None | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | void SystemInit(void) | ||||||
|  | { | ||||||
|  |   uint32_t reg_opsr; | ||||||
|  |  | ||||||
|  |   /* FPU settings ------------------------------------------------------------*/ | ||||||
|  |   #if (__FPU_PRESENT == 1) && (__FPU_USED == 1) | ||||||
|  |    SCB->CPACR |= ((3UL << 20U)|(3UL << 22U));  /* set CP10 and CP11 Full Access */ | ||||||
|  |   #endif | ||||||
|  |  | ||||||
|  |   /* Reset the RCC clock configuration to the default reset state ------------*/ | ||||||
|  |   /* Set HSION bit */ | ||||||
|  |   RCC->CR = RCC_CR_HSION; | ||||||
|  |  | ||||||
|  |   /* Reset CFGR register */ | ||||||
|  |   RCC->CFGR1 = 0U; | ||||||
|  |   RCC->CFGR2 = 0U; | ||||||
|  |  | ||||||
|  |   /* Reset HSEON, HSECSSON, HSEBYP, HSEEXT, HSIDIV, HSIKERON, CSION, CSIKERON, HSI48 and PLLxON bits */ | ||||||
|  | #if defined(RCC_CR_PLL3ON) | ||||||
|  |   RCC->CR &= ~(RCC_CR_HSEON | RCC_CR_HSECSSON | RCC_CR_HSEBYP | RCC_CR_HSEEXT | RCC_CR_HSIDIV | RCC_CR_HSIKERON | \ | ||||||
|  |                RCC_CR_CSION | RCC_CR_CSIKERON |RCC_CR_HSI48ON | RCC_CR_PLL1ON | RCC_CR_PLL2ON | RCC_CR_PLL3ON); | ||||||
|  | #else | ||||||
|  |   RCC->CR &= ~(RCC_CR_HSEON | RCC_CR_HSECSSON | RCC_CR_HSEBYP | RCC_CR_HSEEXT | RCC_CR_HSIDIV | RCC_CR_HSIKERON | \ | ||||||
|  |                RCC_CR_CSION | RCC_CR_CSIKERON |RCC_CR_HSI48ON | RCC_CR_PLL1ON | RCC_CR_PLL2ON); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |   /* Reset PLLxCFGR register */ | ||||||
|  |   RCC->PLL1CFGR = 0U; | ||||||
|  |   RCC->PLL2CFGR = 0U; | ||||||
|  | #if defined(RCC_CR_PLL3ON) | ||||||
|  |   RCC->PLL3CFGR = 0U; | ||||||
|  | #endif /* RCC_CR_PLL3ON */ | ||||||
|  |  | ||||||
|  |   /* Reset PLL1DIVR register */ | ||||||
|  |   RCC->PLL1DIVR = 0x01010280U; | ||||||
|  |   /* Reset PLL1FRACR register */ | ||||||
|  |   RCC->PLL1FRACR = 0x00000000U; | ||||||
|  |   /* Reset PLL2DIVR register */ | ||||||
|  |   RCC->PLL2DIVR = 0x01010280U; | ||||||
|  |   /* Reset PLL2FRACR register */ | ||||||
|  |   RCC->PLL2FRACR = 0x00000000U; | ||||||
|  | #if defined(RCC_CR_PLL3ON) | ||||||
|  |   /* Reset PLL3DIVR register */ | ||||||
|  |   RCC->PLL3DIVR = 0x01010280U; | ||||||
|  |   /* Reset PLL3FRACR register */ | ||||||
|  |   RCC->PLL3FRACR = 0x00000000U; | ||||||
|  | #endif /* RCC_CR_PLL3ON */ | ||||||
|  |  | ||||||
|  |   /* Reset HSEBYP bit */ | ||||||
|  |   RCC->CR &= ~(RCC_CR_HSEBYP); | ||||||
|  |  | ||||||
|  |   /* Disable all interrupts */ | ||||||
|  |   RCC->CIER = 0U; | ||||||
|  |  | ||||||
|  |   /* Configure the Vector Table location add offset address ------------------*/ | ||||||
|  |   #ifdef VECT_TAB_SRAM | ||||||
|  |     SCB->VTOR = SRAM1_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 /* VECT_TAB_SRAM */ | ||||||
|  |  | ||||||
|  |   /* Check OPSR register to verify if there is an ongoing swap or option bytes update interrupted by a reset */ | ||||||
|  |   reg_opsr = FLASH->OPSR & FLASH_OPSR_CODE_OP; | ||||||
|  |   if ((reg_opsr == FLASH_OPSR_CODE_OP) || (reg_opsr == (FLASH_OPSR_CODE_OP_2 | FLASH_OPSR_CODE_OP_1))) | ||||||
|  |   { | ||||||
|  |     /* Check FLASH Option Control Register access */ | ||||||
|  |     if ((FLASH->OPTCR & FLASH_OPTCR_OPTLOCK) != 0U) | ||||||
|  |     { | ||||||
|  |       /* Authorizes the Option Byte registers programming */ | ||||||
|  |       FLASH->OPTKEYR = 0x08192A3BU; | ||||||
|  |       FLASH->OPTKEYR = 0x4C5D6E7FU; | ||||||
|  |     } | ||||||
|  |     /* Launch the option bytes change operation */ | ||||||
|  |     FLASH->OPTCR |= FLASH_OPTCR_OPTSTART; | ||||||
|  |  | ||||||
|  |     /* Lock the FLASH Option Control Register access */ | ||||||
|  |     FLASH->OPTCR |= FLASH_OPTCR_OPTLOCK; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @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 CSI, SystemCoreClock will contain the CSI_VALUE(*) | ||||||
|  |   * | ||||||
|  |   *           - 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(**) or CSI_VALUE(*) multiplied/divided by the PLL factors. | ||||||
|  |   * | ||||||
|  |   *         (*) CSI_VALUE is a constant defined in stm32h5xx_hal.h file (default value | ||||||
|  |   *             4 MHz) but the real value may vary depending on the variations | ||||||
|  |   *             in voltage and temperature. | ||||||
|  |   * | ||||||
|  |   *         (**) HSI_VALUE is a constant defined in stm32h5xx_hal.h file (default value | ||||||
|  |   *              64 MHz) but the real value may vary depending on the variations | ||||||
|  |   *              in voltage and temperature. | ||||||
|  |   * | ||||||
|  |   *         (***) HSE_VALUE is a constant defined in stm32h5xx_hal.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. | ||||||
|  |   * | ||||||
|  |   *         - 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 pllp, pllsource, pllm, pllfracen, hsivalue, tmp; | ||||||
|  |   float_t fracn1, pllvco; | ||||||
|  |  | ||||||
|  |   /* Get SYSCLK source -------------------------------------------------------*/ | ||||||
|  |   switch (RCC->CFGR1 & RCC_CFGR1_SWS) | ||||||
|  |   { | ||||||
|  |   case 0x00UL:  /* HSI used as system clock source */ | ||||||
|  |     SystemCoreClock = (uint32_t) (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3)); | ||||||
|  |     break; | ||||||
|  |  | ||||||
|  |   case 0x08UL:  /* CSI used as system clock  source */ | ||||||
|  |     SystemCoreClock = CSI_VALUE; | ||||||
|  |     break; | ||||||
|  |  | ||||||
|  |   case 0x10UL:  /* HSE used as system clock  source */ | ||||||
|  |     SystemCoreClock = HSE_VALUE; | ||||||
|  |     break; | ||||||
|  |  | ||||||
|  |   case 0x18UL:  /* PLL1 used as system clock source */ | ||||||
|  |     /* PLL_VCO = (HSE_VALUE or HSI_VALUE or CSI_VALUE/ PLLM) * PLLN | ||||||
|  |     SYSCLK = PLL_VCO / PLLR | ||||||
|  |     */ | ||||||
|  |     pllsource = (RCC->PLL1CFGR & RCC_PLL1CFGR_PLL1SRC); | ||||||
|  |     pllm = ((RCC->PLL1CFGR & RCC_PLL1CFGR_PLL1M)>> RCC_PLL1CFGR_PLL1M_Pos); | ||||||
|  |     pllfracen = ((RCC->PLL1CFGR & RCC_PLL1CFGR_PLL1FRACEN)>>RCC_PLL1CFGR_PLL1FRACEN_Pos); | ||||||
|  |     fracn1 = (float_t)(uint32_t)(pllfracen* ((RCC->PLL1FRACR & RCC_PLL1FRACR_PLL1FRACN)>> RCC_PLL1FRACR_PLL1FRACN_Pos)); | ||||||
|  |  | ||||||
|  |     switch (pllsource) | ||||||
|  |     { | ||||||
|  |     case 0x01UL:  /* HSI used as PLL clock source */ | ||||||
|  |       hsivalue = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3)) ; | ||||||
|  |       pllvco = ((float_t)hsivalue / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_PLL1N) + \ | ||||||
|  |                 (fracn1/(float_t)0x2000) +(float_t)1 ); | ||||||
|  |       break; | ||||||
|  |  | ||||||
|  |     case 0x02UL:  /* CSI used as PLL clock source */ | ||||||
|  |       pllvco = ((float_t)CSI_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_PLL1N) + \ | ||||||
|  |                 (fracn1/(float_t)0x2000) +(float_t)1 ); | ||||||
|  |       break; | ||||||
|  |  | ||||||
|  |     case 0x03UL:  /* HSE used as PLL clock source */ | ||||||
|  |       pllvco = ((float_t)HSE_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_PLL1N) + \ | ||||||
|  |                 (fracn1/(float_t)0x2000) +(float_t)1 ); | ||||||
|  |       break; | ||||||
|  |  | ||||||
|  |     default:  /* No clock sent to PLL*/ | ||||||
|  |       pllvco = (float_t) 0U; | ||||||
|  |       break; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     pllp = (((RCC->PLL1DIVR & RCC_PLL1DIVR_PLL1P) >>RCC_PLL1DIVR_PLL1P_Pos) + 1U ) ; | ||||||
|  |     SystemCoreClock =  (uint32_t)(float_t)(pllvco/(float_t)pllp); | ||||||
|  |  | ||||||
|  |     break; | ||||||
|  |  | ||||||
|  |   default: | ||||||
|  |     SystemCoreClock = HSI_VALUE; | ||||||
|  |     break; | ||||||
|  |   } | ||||||
|  |   /* Compute HCLK clock frequency --------------------------------------------*/ | ||||||
|  |   /* Get HCLK prescaler */ | ||||||
|  |   tmp = AHBPrescTable[((RCC->CFGR2 & RCC_CFGR2_HPRE) >> RCC_CFGR2_HPRE_Pos)]; | ||||||
|  |   /* HCLK clock frequency */ | ||||||
|  |   SystemCoreClock >>= tmp; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
							
								
								
									
										643
									
								
								Core/Src/tx_initialize_low_level.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										643
									
								
								Core/Src/tx_initialize_low_level.S
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,643 @@ | |||||||
|  |  | ||||||
|  | // by default AzureRTOS is configured to use static byte pool for | ||||||
|  | // allocation, in case dynamic allocation is to be used, uncomment | ||||||
|  | // the define below and update the linker files to define the following symbols | ||||||
|  | // EWARM toolchain: | ||||||
|  | //       place in RAM_region    { last section FREE_MEM}; | ||||||
|  | // MDK-ARM toolchain; | ||||||
|  | //       either define the RW_IRAM1 region in the ".sct" file or modify this file by referring to the correct memory region. | ||||||
|  | //         LDR r1, =|Image$$RW_IRAM1$$ZI$$Limit| | ||||||
|  | // STM32CubeIDE toolchain: | ||||||
|  | //       ._threadx_heap : | ||||||
|  | //       { | ||||||
|  | //        . = ALIGN(8); | ||||||
|  | //        __RAM_segment_used_end__ = .; | ||||||
|  | //        . = . + 64K; | ||||||
|  | //        . = ALIGN(8); | ||||||
|  | //       } >RAM_D1 AT> RAM_D1 | ||||||
|  | //  The simplest way to provide memory for ThreadX is to define a new section, see ._threadx_heap above. | ||||||
|  | //  In the example above the ThreadX heap size is set to 64KBytes. | ||||||
|  | //  The ._threadx_heap must be located between the .bss and the ._user_heap_stack sections in the linker script. | ||||||
|  | //  Caution: Make sure that ThreadX does not need more than the provided heap memory (64KBytes in this example). | ||||||
|  | //  Read more in STM32CubeIDE User Guide, chapter: "Linker script". | ||||||
|  |  | ||||||
|  | //#define USE_DYNAMIC_MEMORY_ALLOCATION | ||||||
|  |  | ||||||
|  | #if defined (__clang__) | ||||||
|  | /**************************************************************************/ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*       Copyright (c) Microsoft Corporation. All rights reserved.        */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*       This software is licensed under the Microsoft Software License   */ | ||||||
|  | /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */ | ||||||
|  | /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */ | ||||||
|  | /*       and in the root directory of this software.                      */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /**************************************************************************/ | ||||||
|  |  | ||||||
|  | /**************************************************************************/ | ||||||
|  | /**************************************************************************/ | ||||||
|  | /**                                                                       */ | ||||||
|  | /** ThreadX Component                                                     */ | ||||||
|  | /**                                                                       */ | ||||||
|  | /**   Initialize                                                          */ | ||||||
|  | /**                                                                       */ | ||||||
|  | /**************************************************************************/ | ||||||
|  | /**************************************************************************/ | ||||||
|  |  | ||||||
|  | SYSTEM_CLOCK      =   250000000 | ||||||
|  | SYSTICK_CYCLES    =   ((SYSTEM_CLOCK / 100) -1) | ||||||
|  |  | ||||||
|  | /**************************************************************************/ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  FUNCTION                                               RELEASE        */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    _tx_initialize_low_level                          Cortex-M33/AC6    */ | ||||||
|  | /*                                                           6.1          */ | ||||||
|  | /*  AUTHOR                                                                */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    Scott Larson, Microsoft Corporation                                 */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  DESCRIPTION                                                           */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    This function is responsible for any low-level processor            */ | ||||||
|  | /*    initialization, including setting up interrupt vectors, setting     */ | ||||||
|  | /*    up a periodic timer interrupt source, saving the system stack       */ | ||||||
|  | /*    pointer for use in ISR processing later, and finding the first      */ | ||||||
|  | /*    available RAM memory address for tx_application_define.             */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  INPUT                                                                 */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    None                                                                */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  OUTPUT                                                                */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    None                                                                */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  CALLS                                                                 */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    None                                                                */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  CALLED BY                                                             */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    _tx_initialize_kernel_enter           ThreadX entry function        */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  RELEASE HISTORY                                                       */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    DATE              NAME                      DESCRIPTION             */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  09-30-2020      Scott Larson            Initial Version 6.1           */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /**************************************************************************/ | ||||||
|  | // VOID   _tx_initialize_low_level(VOID) | ||||||
|  | // { | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  _tx_initialize_low_level | ||||||
|  |     .thumb_func | ||||||
|  | .type _tx_initialize_low_level, function | ||||||
|  | _tx_initialize_low_level: | ||||||
|  |  | ||||||
|  |     /* Disable interrupts during ThreadX initialization.  */ | ||||||
|  |     CPSID   i | ||||||
|  |  | ||||||
|  |     /* Set base of available memory to end of non-initialised RAM area.  */ | ||||||
|  | #ifdef USE_DYNAMIC_MEMORY_ALLOCATION | ||||||
|  |     LDR     r0, =_tx_initialize_unused_memory       // Build address of unused memory pointer | ||||||
|  |     LDR     r1, =Image$$RW_IRAM1$$ZI$$Limit         // Build first free address | ||||||
|  |     ADD     r1, r1, #4                              // | ||||||
|  |     STR     r1, [r0]                                // Setup first unused memory pointer | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |     /* Setup Vector Table Offset Register.  */ | ||||||
|  |     MOV     r0, #0xE000E000                         // Build address of NVIC registers | ||||||
|  |     LDR     r1, =__Vectors                          // Pickup address of vector table | ||||||
|  |     STR     r1, [r0, #0xD08]                        // Set vector table address | ||||||
|  |  | ||||||
|  |     /* Enable the cycle count register.  */ | ||||||
|  |     LDR     r0, =0xE0001000                         // Build address of DWT register | ||||||
|  |     LDR     r1, [r0]                                // Pickup the current value | ||||||
|  |     ORR     r1, r1, #1                              // Set the CYCCNTENA bit | ||||||
|  |     STR     r1, [r0]                                // Enable the cycle count register | ||||||
|  |  | ||||||
|  |     /* Set system stack pointer from vector value.  */ | ||||||
|  |     LDR     r0, =_tx_thread_system_stack_ptr        // Build address of system stack pointer | ||||||
|  |     LDR     r1, =__Vectors                          // Pickup address of vector table | ||||||
|  |     LDR     r1, [r1]                                // Pickup reset stack pointer | ||||||
|  |     STR     r1, [r0]                                // Save system stack pointer | ||||||
|  |  | ||||||
|  |     /* Configure SysTick.  */ | ||||||
|  |     MOV     r0, #0xE000E000                         // Build address of NVIC registers | ||||||
|  |     LDR     r1, =SYSTICK_CYCLES | ||||||
|  |     STR     r1, [r0, #0x14]                         // Setup SysTick Reload Value | ||||||
|  |     MOV     r1, #0x7                                // Build SysTick Control Enable Value | ||||||
|  |     STR     r1, [r0, #0x10]                         // Setup SysTick Control | ||||||
|  |  | ||||||
|  |     /* Configure handler priorities.  */ | ||||||
|  |     LDR     r1, =0x00000000                         // Rsrv, UsgF, BusF, MemM | ||||||
|  |     STR     r1, [r0, #0xD18]                        // Setup System Handlers 4-7 Priority Registers | ||||||
|  |  | ||||||
|  |     LDR     r1, =0xFF000000                         // SVCl, Rsrv, Rsrv, Rsrv | ||||||
|  |     STR     r1, [r0, #0xD1C]                        // Setup System Handlers 8-11 Priority Registers | ||||||
|  |                                                     // Note: SVC must be lowest priority, which is 0xFF | ||||||
|  |  | ||||||
|  |     LDR     r1, =0x40FF0000                         // SysT, PnSV, Rsrv, DbgM | ||||||
|  |     STR     r1, [r0, #0xD20]                        // Setup System Handlers 12-15 Priority Registers | ||||||
|  |                                                     // Note: PnSV must be lowest priority, which is 0xFF | ||||||
|  |  | ||||||
|  |     /* Return to caller.  */ | ||||||
|  |     BX      lr | ||||||
|  | // } | ||||||
|  |  | ||||||
|  | /* Define shells for each of the unused vectors.  */ | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  __tx_BadHandler | ||||||
|  |     .thumb_func | ||||||
|  | .type __tx_BadHandler, function | ||||||
|  | __tx_BadHandler: | ||||||
|  |     B       __tx_BadHandler | ||||||
|  |  | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  __tx_IntHandler | ||||||
|  |     .thumb_func | ||||||
|  | .type __tx_IntHandler, function | ||||||
|  | __tx_IntHandler: | ||||||
|  | // VOID InterruptHandler (VOID) | ||||||
|  | // { | ||||||
|  |     PUSH    {r0,lr}     // Save LR (and dummy r0 to maintain stack alignment) | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_enter             // Call the ISR enter function | ||||||
|  | #endif | ||||||
|  |     /* Do interrupt handler work here */ | ||||||
|  |     /* .... */ | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_exit              // Call the ISR exit function | ||||||
|  | #endif | ||||||
|  |     POP     {r0,lr} | ||||||
|  |     BX      LR | ||||||
|  | // } | ||||||
|  |  | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  SysTick_Handler | ||||||
|  |     .thumb_func | ||||||
|  | .type SysTick_Handler, function | ||||||
|  | SysTick_Handler: | ||||||
|  | // VOID TimerInterruptHandler (VOID) | ||||||
|  | // { | ||||||
|  |     PUSH    {r0,lr}     // Save LR (and dummy r0 to maintain stack alignment) | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_enter             // Call the ISR enter function | ||||||
|  | #endif | ||||||
|  |     BL      _tx_timer_interrupt | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_exit              // Call the ISR exit function | ||||||
|  | #endif | ||||||
|  |     POP     {r0,lr} | ||||||
|  |     BX      LR | ||||||
|  | // } | ||||||
|  |  | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  __tx_NMIHandler | ||||||
|  |     .thumb_func | ||||||
|  | .type __tx_NMIHandler, function | ||||||
|  | __tx_NMIHandler: | ||||||
|  |     B       __tx_NMIHandler | ||||||
|  |  | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  __tx_DBGHandler | ||||||
|  |     .thumb_func | ||||||
|  | .type __tx_DBGHandler, function | ||||||
|  | __tx_DBGHandler: | ||||||
|  |     B       __tx_DBGHandler | ||||||
|  |  | ||||||
|  |     .end | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #if defined(__IAR_SYSTEMS_ASM__) | ||||||
|  | ;/**************************************************************************/ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*       Copyright (c) Microsoft Corporation. All rights reserved.        */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*       This software is licensed under the Microsoft Software License   */ | ||||||
|  | ;/*       Terms for Microsoft Azure RTOS. Full text of the license can be  */ | ||||||
|  | ;/*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */ | ||||||
|  | ;/*       and in the root directory of this software.                      */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/**************************************************************************/ | ||||||
|  | ; | ||||||
|  | ; | ||||||
|  | ;/**************************************************************************/ | ||||||
|  | ;/**************************************************************************/ | ||||||
|  | ;/**                                                                       */ | ||||||
|  | ;/** ThreadX Component                                                     */ | ||||||
|  | ;/**                                                                       */ | ||||||
|  | ;/**   Initialize                                                          */ | ||||||
|  | ;/**                                                                       */ | ||||||
|  | ;/**************************************************************************/ | ||||||
|  | ;/**************************************************************************/ | ||||||
|  | ; | ||||||
|  | ; | ||||||
|  |     EXTERN  _tx_thread_system_stack_ptr | ||||||
|  |     EXTERN  _tx_initialize_unused_memory | ||||||
|  |     EXTERN  _tx_timer_interrupt | ||||||
|  |     EXTERN  _tx_execution_isr_enter | ||||||
|  |     EXTERN  _tx_execution_isr_exit | ||||||
|  |     EXTERN  __vector_table | ||||||
|  | ; | ||||||
|  | ; | ||||||
|  | SYSTEM_CLOCK      EQU   250000000 | ||||||
|  | SYSTICK_CYCLES    EQU   ((SYSTEM_CLOCK / 100) -1) | ||||||
|  | ; | ||||||
|  | ; | ||||||
|  |  | ||||||
|  | #ifdef USE_DYNAMIC_MEMORY_ALLOCATION | ||||||
|  |     RSEG    FREE_MEM:DATA | ||||||
|  |     PUBLIC  __tx_free_memory_start | ||||||
|  | __tx_free_memory_start | ||||||
|  |     DS32    4 | ||||||
|  | #endif | ||||||
|  | ; | ||||||
|  | ; | ||||||
|  |     SECTION `.text`:CODE:NOROOT(2) | ||||||
|  |     THUMB | ||||||
|  |  | ||||||
|  | ;/**************************************************************************/ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*  FUNCTION                                               RELEASE        */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*    _tx_initialize_low_level                          Cortex-M33/IAR    */ | ||||||
|  | ;/*                                                           6.1          */ | ||||||
|  | ;/*  AUTHOR                                                                */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*    Scott Larson, Microsoft Corporation                                 */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*  DESCRIPTION                                                           */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*    This function is responsible for any low-level processor            */ | ||||||
|  | ;/*    initialization, including setting up interrupt vectors, setting     */ | ||||||
|  | ;/*    up a periodic timer interrupt source, saving the system stack       */ | ||||||
|  | ;/*    pointer for use in ISR processing later, and finding the first      */ | ||||||
|  | ;/*    available RAM memory address for tx_application_define.             */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*  INPUT                                                                 */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*    None                                                                */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*  OUTPUT                                                                */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*    None                                                                */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*  CALLS                                                                 */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*    None                                                                */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*  CALLED BY                                                             */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*    _tx_initialize_kernel_enter           ThreadX entry function        */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*  RELEASE HISTORY                                                       */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*    DATE              NAME                      DESCRIPTION             */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/*  09-30-2020      Scott Larson            Initial Version 6.1           */ | ||||||
|  | ;/*                                                                        */ | ||||||
|  | ;/**************************************************************************/ | ||||||
|  | ;VOID   _tx_initialize_low_level(VOID) | ||||||
|  | ;{ | ||||||
|  |     PUBLIC  _tx_initialize_low_level | ||||||
|  | _tx_initialize_low_level: | ||||||
|  | ; | ||||||
|  | ;    /* Disable interrupts during ThreadX initialization.  */ | ||||||
|  | ; | ||||||
|  |     CPSID   i | ||||||
|  | ; | ||||||
|  | ;    /* Set base of available memory to end of non-initialised RAM area.  */ | ||||||
|  | ; | ||||||
|  | #ifdef USE_DYNAMIC_MEMORY_ALLOCATION | ||||||
|  |     LDR     r0, =_tx_initialize_unused_memory       ; Build address of unused memory pointer | ||||||
|  |     LDR     r1, =__tx_free_memory_start             ; Build first free address | ||||||
|  |     STR     r1, [r0]                                ; Setup first unused memory pointer | ||||||
|  | #endif | ||||||
|  | ; | ||||||
|  | ;    /* Setup Vector Table Offset Register.  */ | ||||||
|  | ; | ||||||
|  |     MOV     r0, #0xE000E000                         ; Build address of NVIC registers | ||||||
|  |     LDR     r1, =__vector_table                     ; Pickup address of vector table | ||||||
|  |     STR     r1, [r0, #0xD08]                        ; Set vector table address | ||||||
|  | ; | ||||||
|  | ;    /* Enable the cycle count register.  */ | ||||||
|  | ; | ||||||
|  | ;    LDR     r0, =0xE0001000                         ; Build address of DWT register | ||||||
|  | ;    LDR     r1, [r0]                                ; Pickup the current value | ||||||
|  | ;    ORR     r1, r1, #1                              ; Set the CYCCNTENA bit | ||||||
|  | ;    STR     r1, [r0]                                ; Enable the cycle count register | ||||||
|  | ; | ||||||
|  | ;    /* Set system stack pointer from vector value.  */ | ||||||
|  | ; | ||||||
|  |     LDR     r0, =_tx_thread_system_stack_ptr        ; Build address of system stack pointer | ||||||
|  |     LDR     r1, =__vector_table                     ; Pickup address of vector table | ||||||
|  |     LDR     r1, [r1]                                ; Pickup reset stack pointer | ||||||
|  |     STR     r1, [r0]                                ; Save system stack pointer | ||||||
|  | ; | ||||||
|  | ;    /* Configure SysTick.  */ | ||||||
|  | ; | ||||||
|  |     MOV     r0, #0xE000E000                         ; Build address of NVIC registers | ||||||
|  |     LDR     r1, =SYSTICK_CYCLES | ||||||
|  |     STR     r1, [r0, #0x14]                         ; Setup SysTick Reload Value | ||||||
|  |     MOV     r1, #0x7                                ; Build SysTick Control Enable Value | ||||||
|  |     STR     r1, [r0, #0x10]                         ; Setup SysTick Control | ||||||
|  | ; | ||||||
|  | ;    /* Configure handler priorities.  */ | ||||||
|  | ; | ||||||
|  |     LDR     r1, =0x00000000                         ; Rsrv, UsgF, BusF, MemM | ||||||
|  |     STR     r1, [r0, #0xD18]                        ; Setup System Handlers 4-7 Priority Registers | ||||||
|  |  | ||||||
|  |     LDR     r1, =0xFF000000                         ; SVCl, Rsrv, Rsrv, Rsrv | ||||||
|  |     STR     r1, [r0, #0xD1C]                        ; Setup System Handlers 8-11 Priority Registers | ||||||
|  |                                                     ; Note: SVC must be lowest priority, which is 0xFF | ||||||
|  |  | ||||||
|  |     LDR     r1, =0x40FF0000                         ; SysT, PnSV, Rsrv, DbgM | ||||||
|  |     STR     r1, [r0, #0xD20]                        ; Setup System Handlers 12-15 Priority Registers | ||||||
|  |                                                     ; Note: PnSV must be lowest priority, which is 0xFF | ||||||
|  | ; | ||||||
|  | ;    /* Return to caller.  */ | ||||||
|  | ; | ||||||
|  |     BX      lr | ||||||
|  | ;} | ||||||
|  | ; | ||||||
|  | ; | ||||||
|  | ;/* Define shells for each of the unused vectors.  */ | ||||||
|  | ; | ||||||
|  |     PUBLIC  __tx_BadHandler | ||||||
|  | __tx_BadHandler: | ||||||
|  |     B       __tx_BadHandler | ||||||
|  |  | ||||||
|  |     PUBLIC  __tx_IntHandler | ||||||
|  | __tx_IntHandler: | ||||||
|  | // VOID InterruptHandler (VOID) | ||||||
|  | // { | ||||||
|  |     PUSH    {r0,lr}     // Save LR (and dummy r0 to maintain stack alignment) | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_enter             // Call the ISR enter function | ||||||
|  | #endif | ||||||
|  |     /* Do interrupt handler work here */ | ||||||
|  |     /* .... */ | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_exit              // Call the ISR exit function | ||||||
|  | #endif | ||||||
|  |     POP     {r0,lr} | ||||||
|  |     BX      lr | ||||||
|  | // } | ||||||
|  |  | ||||||
|  |     PUBLIC  __tx_SysTickHandler | ||||||
|  |     PUBLIC SysTick_Handler | ||||||
|  | SysTick_Handler: | ||||||
|  | __tx_SysTickHandler: | ||||||
|  | // VOID TimerInterruptHandler (VOID) | ||||||
|  | // { | ||||||
|  |     PUSH    {r0,lr}     // Save LR (and dummy r0 to maintain stack alignment) | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_enter             // Call the ISR enter function | ||||||
|  | #endif | ||||||
|  |     BL      _tx_timer_interrupt | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_exit              // Call the ISR exit function | ||||||
|  | #endif | ||||||
|  |     POP     {r0,lr} | ||||||
|  |     BX      lr | ||||||
|  | // } | ||||||
|  |  | ||||||
|  |     PUBLIC  __tx_NMIHandler | ||||||
|  | __tx_NMIHandler: | ||||||
|  |     B       __tx_NMIHandler | ||||||
|  |  | ||||||
|  |     PUBLIC  __tx_DBGHandler | ||||||
|  | __tx_DBGHandler: | ||||||
|  |     B       __tx_DBGHandler | ||||||
|  |  | ||||||
|  |     END | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #if (defined(__GNUC__) && !defined(__clang__)) | ||||||
|  | /**************************************************************************/ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*       Copyright (c) Microsoft Corporation. All rights reserved.        */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*       This software is licensed under the Microsoft Software License   */ | ||||||
|  | /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */ | ||||||
|  | /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */ | ||||||
|  | /*       and in the root directory of this software.                      */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /**************************************************************************/ | ||||||
|  |  | ||||||
|  | /**************************************************************************/ | ||||||
|  | /**************************************************************************/ | ||||||
|  | /**                                                                       */ | ||||||
|  | /** ThreadX Component                                                     */ | ||||||
|  | /**                                                                       */ | ||||||
|  | /**   Initialize                                                          */ | ||||||
|  | /**                                                                       */ | ||||||
|  | /**************************************************************************/ | ||||||
|  | /**************************************************************************/ | ||||||
|  |  | ||||||
|  | SYSTEM_CLOCK      =   250000000 | ||||||
|  | SYSTICK_CYCLES    =   ((SYSTEM_CLOCK / 100) -1) | ||||||
|  |  | ||||||
|  | /**************************************************************************/ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  FUNCTION                                               RELEASE        */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    _tx_initialize_low_level                          Cortex-M33/GNU    */ | ||||||
|  | /*                                                           6.1          */ | ||||||
|  | /*  AUTHOR                                                                */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    Scott Larson, Microsoft Corporation                                 */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  DESCRIPTION                                                           */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    This function is responsible for any low-level processor            */ | ||||||
|  | /*    initialization, including setting up interrupt vectors, setting     */ | ||||||
|  | /*    up a periodic timer interrupt source, saving the system stack       */ | ||||||
|  | /*    pointer for use in ISR processing later, and finding the first      */ | ||||||
|  | /*    available RAM memory address for tx_application_define.             */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  INPUT                                                                 */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    None                                                                */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  OUTPUT                                                                */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    None                                                                */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  CALLS                                                                 */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    None                                                                */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  CALLED BY                                                             */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    _tx_initialize_kernel_enter           ThreadX entry function        */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  RELEASE HISTORY                                                       */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*    DATE              NAME                      DESCRIPTION             */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /*  09-30-2020      Scott Larson            Initial Version 6.1           */ | ||||||
|  | /*                                                                        */ | ||||||
|  | /**************************************************************************/ | ||||||
|  | // VOID   _tx_initialize_low_level(VOID) | ||||||
|  | // { | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  _tx_initialize_low_level | ||||||
|  |     .thumb_func | ||||||
|  | .type _tx_initialize_low_level, function | ||||||
|  | _tx_initialize_low_level: | ||||||
|  |  | ||||||
|  |     /* Disable interrupts during ThreadX initialization.  */ | ||||||
|  |     CPSID   i | ||||||
|  |  | ||||||
|  |     /* Set base of available memory to end of non-initialised RAM area.  */ | ||||||
|  | #ifdef USE_DYNAMIC_MEMORY_ALLOCATION | ||||||
|  |     LDR     r0, =_tx_initialize_unused_memory       // Build address of unused memory pointer | ||||||
|  |     LDR     r1, =__RAM_segment_used_end__           // Build first free address | ||||||
|  |     ADD     r1, r1, #4                              // | ||||||
|  |     STR     r1, [r0]                                // Setup first unused memory pointer | ||||||
|  | #endif | ||||||
|  |     /* Setup Vector Table Offset Register.  */ | ||||||
|  |     MOV     r0, #0xE000E000                         // Build address of NVIC registers | ||||||
|  |     LDR     r1, =g_pfnVectors                       // Pickup address of vector table | ||||||
|  |     STR     r1, [r0, #0xD08]                        // Set vector table address | ||||||
|  |  | ||||||
|  |     /* Enable the cycle count register.  */ | ||||||
|  |     LDR     r0, =0xE0001000                         // Build address of DWT register | ||||||
|  |     LDR     r1, [r0]                                // Pickup the current value | ||||||
|  |     ORR     r1, r1, #1                              // Set the CYCCNTENA bit | ||||||
|  |     STR     r1, [r0]                                // Enable the cycle count register | ||||||
|  |  | ||||||
|  |     /* Set system stack pointer from vector value.  */ | ||||||
|  |     LDR     r0, =_tx_thread_system_stack_ptr        // Build address of system stack pointer | ||||||
|  |     LDR     r1, =g_pfnVectors                       // Pickup address of vector table | ||||||
|  |     LDR     r1, [r1]                                // Pickup reset stack pointer | ||||||
|  |     STR     r1, [r0]                                // Save system stack pointer | ||||||
|  |  | ||||||
|  |     /* Configure SysTick.  */ | ||||||
|  |     MOV     r0, #0xE000E000                         // Build address of NVIC registers | ||||||
|  |     LDR     r1, =SYSTICK_CYCLES | ||||||
|  |     STR     r1, [r0, #0x14]                         // Setup SysTick Reload Value | ||||||
|  |     MOV     r1, #0x7                                // Build SysTick Control Enable Value | ||||||
|  |     STR     r1, [r0, #0x10]                         // Setup SysTick Control | ||||||
|  |  | ||||||
|  |     /* Configure handler priorities.  */ | ||||||
|  |     LDR     r1, =0x00000000                         // Rsrv, UsgF, BusF, MemM | ||||||
|  |     STR     r1, [r0, #0xD18]                        // Setup System Handlers 4-7 Priority Registers | ||||||
|  |  | ||||||
|  |     LDR     r1, =0xFF000000                         // SVCl, Rsrv, Rsrv, Rsrv | ||||||
|  |     STR     r1, [r0, #0xD1C]                        // Setup System Handlers 8-11 Priority Registers | ||||||
|  |                                                     // Note: SVC must be lowest priority, which is 0xFF | ||||||
|  |  | ||||||
|  |     LDR     r1, =0x40FF0000                         // SysT, PnSV, Rsrv, DbgM | ||||||
|  |     STR     r1, [r0, #0xD20]                        // Setup System Handlers 12-15 Priority Registers | ||||||
|  |                                                     // Note: PnSV must be lowest priority, which is 0xFF | ||||||
|  |  | ||||||
|  |     /* Return to caller.  */ | ||||||
|  |     BX      lr | ||||||
|  | // } | ||||||
|  |  | ||||||
|  | /* Define shells for each of the unused vectors.  */ | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  __tx_BadHandler | ||||||
|  |     .thumb_func | ||||||
|  | .type __tx_BadHandler, function | ||||||
|  | __tx_BadHandler: | ||||||
|  |     B       __tx_BadHandler | ||||||
|  |  | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  __tx_IntHandler | ||||||
|  |     .thumb_func | ||||||
|  | .type __tx_IntHandler, function | ||||||
|  | __tx_IntHandler: | ||||||
|  | // VOID InterruptHandler (VOID) | ||||||
|  | // { | ||||||
|  |     PUSH    {r0,lr}     // Save LR (and dummy r0 to maintain stack alignment) | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_enter             // Call the ISR enter function | ||||||
|  | #endif | ||||||
|  |     /* Do interrupt handler work here */ | ||||||
|  |     /* .... */ | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_exit              // Call the ISR exit function | ||||||
|  | #endif | ||||||
|  |     POP     {r0,lr} | ||||||
|  |     BX      lr | ||||||
|  | // } | ||||||
|  |  | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  SysTick_Handler | ||||||
|  |     .thumb_func | ||||||
|  | .type SysTick_Handler, function | ||||||
|  | SysTick_Handler: | ||||||
|  | // VOID TimerInterruptHandler (VOID) | ||||||
|  | // { | ||||||
|  |     PUSH    {r0,lr}     // Save LR (and dummy r0 to maintain stack alignment) | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_enter             // Call the ISR enter function | ||||||
|  | #endif | ||||||
|  |     BL      _tx_timer_interrupt | ||||||
|  | #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)) | ||||||
|  |     BL      _tx_execution_isr_exit              // Call the ISR exit function | ||||||
|  | #endif | ||||||
|  |     POP     {r0,lr} | ||||||
|  |     BX      lr | ||||||
|  | // } | ||||||
|  |  | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  __tx_NMIHandler | ||||||
|  |     .thumb_func | ||||||
|  | .type __tx_NMIHandler, function | ||||||
|  | __tx_NMIHandler: | ||||||
|  |     B       __tx_NMIHandler | ||||||
|  |  | ||||||
|  |     .section .text | ||||||
|  |     .balign 4 | ||||||
|  |     .syntax unified | ||||||
|  |     .eabi_attribute Tag_ABI_align_preserved, 1 | ||||||
|  |     .global  __tx_DBGHandler | ||||||
|  |     .thumb_func | ||||||
|  | .type __tx_DBGHandler, function | ||||||
|  | __tx_DBGHandler: | ||||||
|  |     B       __tx_DBGHandler | ||||||
|  |  | ||||||
|  |     .end | ||||||
|  |  | ||||||
|  | #endif | ||||||
							
								
								
									
										24017
									
								
								Drivers/CMSIS/Device/ST/STM32H5xx/Include/stm32h563xx.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24017
									
								
								Drivers/CMSIS/Device/ST/STM32H5xx/Include/stm32h563xx.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										252
									
								
								Drivers/CMSIS/Device/ST/STM32H5xx/Include/stm32h5xx.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										252
									
								
								Drivers/CMSIS/Device/ST/STM32H5xx/Include/stm32h5xx.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,252 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   CMSIS STM32H5xx Device Peripheral Access Layer Header File. | ||||||
|  |   * | ||||||
|  |   *          The file is the unique include file that the application programmer | ||||||
|  |   *          is using in the C source code, usually in main.c. This file contains: | ||||||
|  |   *           - Configuration section that allows to select: | ||||||
|  |   *              - The STM32H5xx device used in the target application | ||||||
|  |   *              - To use or not the peripheral<61>s drivers in application code(i.e. | ||||||
|  |   *                code will be based on direct access to peripheral<61>s registers | ||||||
|  |   *                rather than drivers API), this option is controlled by | ||||||
|  |   *                "#define USE_HAL_DRIVER" | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup CMSIS | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup stm32h5xx | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifndef STM32H5xx_H | ||||||
|  | #define STM32H5xx_H | ||||||
|  | #include "math.h" | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  |  extern "C" { | ||||||
|  | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
|  | /** @addtogroup Library_configuration_section | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief STM32 Family | ||||||
|  |   */ | ||||||
|  | #if !defined (STM32H5) | ||||||
|  | #define STM32H5 | ||||||
|  | #endif /* STM32H5 */ | ||||||
|  |  | ||||||
|  | /* Uncomment the line below according to the target STM32H5 device used in your | ||||||
|  |    application | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if !defined (STM32H573xx) && !defined (STM32H563xx) \ | ||||||
|  |     && !defined (STM32H562xx) && !defined (STM32H503xx) \ | ||||||
|  |     && !defined (STM32H533xx) && !defined (STM32H523xx) | ||||||
|  |   /* #define STM32H573xx  */   /*!< STM32H573xx Devices   */ | ||||||
|  |   /* #define STM32H563xx  */   /*!< STM32H563xx Devices   */ | ||||||
|  |   /* #define STM32H562xx  */   /*!< STM32H562xx Devices   */ | ||||||
|  |   /* #define STM32H503xx  */   /*!< STM32H503xx Devices   */ | ||||||
|  |   /* #define STM32H533xx  */   /*!< STM32H533xx Devices   */ | ||||||
|  |   /* #define STM32H523xx  */   /*!< STM32H523xx 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 Device version number 1.4.0 | ||||||
|  |   */ | ||||||
|  | #define __STM32H5_CMSIS_VERSION_MAIN   (0x01) /*!< [31:24] main version */ | ||||||
|  | #define __STM32H5_CMSIS_VERSION_SUB1   (0x04) /*!< [23:16] sub1 version */ | ||||||
|  | #define __STM32H5_CMSIS_VERSION_SUB2   (0x00) /*!< [15:8]  sub2 version */ | ||||||
|  | #define __STM32H5_CMSIS_VERSION_RC     (0x00) /*!< [7:0]  release candidate */ | ||||||
|  | #define __STM32H5_CMSIS_VERSION        ((__STM32H5_CMSIS_VERSION_MAIN << 24U)\ | ||||||
|  |                                        |(__STM32H5_CMSIS_VERSION_SUB1 << 16U)\ | ||||||
|  |                                        |(__STM32H5_CMSIS_VERSION_SUB2 << 8U )\ | ||||||
|  |                                        |(__STM32H5_CMSIS_VERSION_RC)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup Device_Included | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #if defined(STM32H5F5xx) | ||||||
|  |   #include "stm32h5f5xx.h" | ||||||
|  | #elif defined(STM32H5F4xx) | ||||||
|  |   #include "stm32h5f4xx.h" | ||||||
|  | #elif defined(STM32H5E5xx) | ||||||
|  |   #include "stm32h5e5xx.h" | ||||||
|  | #elif defined(STM32H5E4xx) | ||||||
|  |   #include "stm32h5e4xx.h" | ||||||
|  | #elif defined(STM32H573xx) | ||||||
|  |   #include "stm32h573xx.h" | ||||||
|  | #elif defined(STM32H563xx) | ||||||
|  |   #include "stm32h563xx.h" | ||||||
|  | #elif defined(STM32H562xx) | ||||||
|  |   #include "stm32h562xx.h" | ||||||
|  | #elif defined(STM32H503xx) | ||||||
|  |   #include "stm32h503xx.h" | ||||||
|  | #elif defined(STM32H523xx) | ||||||
|  |   #include "stm32h523xx.h" | ||||||
|  | #elif defined(STM32H533xx) | ||||||
|  |   #include "stm32h533xx.h" | ||||||
|  | #else | ||||||
|  |   #error "Please select first the target STM32H5xx device used in your application (in stm32h5xx.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 = 0, | ||||||
|  |   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))) | ||||||
|  |  | ||||||
|  | /* 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) | ||||||
|  |  | ||||||
|  | #define POSITION_VAL(VAL)     (__CLZ(__RBIT(VAL))) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined (USE_HAL_DRIVER) | ||||||
|  |  #include "stm32h5xx_hal.h" | ||||||
|  | #endif /* USE_HAL_DRIVER */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
|  | #endif /* STM32H5xx_H */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
							
								
								
									
										107
									
								
								Drivers/CMSIS/Device/ST/STM32H5xx/Include/system_stm32h5xx.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								Drivers/CMSIS/Device/ST/STM32H5xx/Include/system_stm32h5xx.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,107 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    system_stm32h5xx.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   CMSIS Cortex-M33 Device System Source File for STM32H5xx devices. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup CMSIS | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup stm32h5xx_system | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifndef SYSTEM_STM32H5XX_H | ||||||
|  | #define SYSTEM_STM32H5XX_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_System_Includes | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_System_Exported_Variables | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |   /* The SystemCoreClock 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 STM32H5xx_System_Exported_Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Setup the microcontroller system. | ||||||
|  |   * | ||||||
|  |   * Initialize the System and update the SystemCoreClock variable. | ||||||
|  |   */ | ||||||
|  | extern void SystemInit (void); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Update SystemCoreClock variable. | ||||||
|  |   * | ||||||
|  |   * Updates the SystemCoreClock with current core Clock retrieved from cpu registers. | ||||||
|  |   */ | ||||||
|  | extern void SystemCoreClockUpdate (void); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Update SystemCoreClock variable from secure application and return its value | ||||||
|  |   *        when security is implemented in the system (Non-secure callable function). | ||||||
|  |   * | ||||||
|  |   * Returns the SystemCoreClock value with current core Clock retrieved from cpu registers. | ||||||
|  |   */ | ||||||
|  | extern uint32_t SECURE_SystemCoreClockUpdate(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* SYSTEM_STM32H5XX_H */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
							
								
								
									
										201
									
								
								Drivers/CMSIS/Device/ST/STM32H5xx/LICENSE.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										201
									
								
								Drivers/CMSIS/Device/ST/STM32H5xx/LICENSE.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,201 @@ | |||||||
|  |                                  Apache License | ||||||
|  |                            Version 2.0, January 2004 | ||||||
|  |                         http://www.apache.org/licenses/ | ||||||
|  |  | ||||||
|  |    TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||||||
|  |  | ||||||
|  |    1. Definitions. | ||||||
|  |  | ||||||
|  |       "License" shall mean the terms and conditions for use, reproduction, | ||||||
|  |       and distribution as defined by Sections 1 through 9 of this document. | ||||||
|  |  | ||||||
|  |       "Licensor" shall mean the copyright owner or entity authorized by | ||||||
|  |       the copyright owner that is granting the License. | ||||||
|  |  | ||||||
|  |       "Legal Entity" shall mean the union of the acting entity and all | ||||||
|  |       other entities that control, are controlled by, or are under common | ||||||
|  |       control with that entity. For the purposes of this definition, | ||||||
|  |       "control" means (i) the power, direct or indirect, to cause the | ||||||
|  |       direction or management of such entity, whether by contract or | ||||||
|  |       otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||||||
|  |       outstanding shares, or (iii) beneficial ownership of such entity. | ||||||
|  |  | ||||||
|  |       "You" (or "Your") shall mean an individual or Legal Entity | ||||||
|  |       exercising permissions granted by this License. | ||||||
|  |  | ||||||
|  |       "Source" form shall mean the preferred form for making modifications, | ||||||
|  |       including but not limited to software source code, documentation | ||||||
|  |       source, and configuration files. | ||||||
|  |  | ||||||
|  |       "Object" form shall mean any form resulting from mechanical | ||||||
|  |       transformation or translation of a Source form, including but | ||||||
|  |       not limited to compiled object code, generated documentation, | ||||||
|  |       and conversions to other media types. | ||||||
|  |  | ||||||
|  |       "Work" shall mean the work of authorship, whether in Source or | ||||||
|  |       Object form, made available under the License, as indicated by a | ||||||
|  |       copyright notice that is included in or attached to the work | ||||||
|  |       (an example is provided in the Appendix below). | ||||||
|  |  | ||||||
|  |       "Derivative Works" shall mean any work, whether in Source or Object | ||||||
|  |       form, that is based on (or derived from) the Work and for which the | ||||||
|  |       editorial revisions, annotations, elaborations, or other modifications | ||||||
|  |       represent, as a whole, an original work of authorship. For the purposes | ||||||
|  |       of this License, Derivative Works shall not include works that remain | ||||||
|  |       separable from, or merely link (or bind by name) to the interfaces of, | ||||||
|  |       the Work and Derivative Works thereof. | ||||||
|  |  | ||||||
|  |       "Contribution" shall mean any work of authorship, including | ||||||
|  |       the original version of the Work and any modifications or additions | ||||||
|  |       to that Work or Derivative Works thereof, that is intentionally | ||||||
|  |       submitted to Licensor for inclusion in the Work by the copyright owner | ||||||
|  |       or by an individual or Legal Entity authorized to submit on behalf of | ||||||
|  |       the copyright owner. For the purposes of this definition, "submitted" | ||||||
|  |       means any form of electronic, verbal, or written communication sent | ||||||
|  |       to the Licensor or its representatives, including but not limited to | ||||||
|  |       communication on electronic mailing lists, source code control systems, | ||||||
|  |       and issue tracking systems that are managed by, or on behalf of, the | ||||||
|  |       Licensor for the purpose of discussing and improving the Work, but | ||||||
|  |       excluding communication that is conspicuously marked or otherwise | ||||||
|  |       designated in writing by the copyright owner as "Not a Contribution." | ||||||
|  |  | ||||||
|  |       "Contributor" shall mean Licensor and any individual or Legal Entity | ||||||
|  |       on behalf of whom a Contribution has been received by Licensor and | ||||||
|  |       subsequently incorporated within the Work. | ||||||
|  |  | ||||||
|  |    2. Grant of Copyright License. Subject to the terms and conditions of | ||||||
|  |       this License, each Contributor hereby grants to You a perpetual, | ||||||
|  |       worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||||||
|  |       copyright license to reproduce, prepare Derivative Works of, | ||||||
|  |       publicly display, publicly perform, sublicense, and distribute the | ||||||
|  |       Work and such Derivative Works in Source or Object form. | ||||||
|  |  | ||||||
|  |    3. Grant of Patent License. Subject to the terms and conditions of | ||||||
|  |       this License, each Contributor hereby grants to You a perpetual, | ||||||
|  |       worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||||||
|  |       (except as stated in this section) patent license to make, have made, | ||||||
|  |       use, offer to sell, sell, import, and otherwise transfer the Work, | ||||||
|  |       where such license applies only to those patent claims licensable | ||||||
|  |       by such Contributor that are necessarily infringed by their | ||||||
|  |       Contribution(s) alone or by combination of their Contribution(s) | ||||||
|  |       with the Work to which such Contribution(s) was submitted. If You | ||||||
|  |       institute patent litigation against any entity (including a | ||||||
|  |       cross-claim or counterclaim in a lawsuit) alleging that the Work | ||||||
|  |       or a Contribution incorporated within the Work constitutes direct | ||||||
|  |       or contributory patent infringement, then any patent licenses | ||||||
|  |       granted to You under this License for that Work shall terminate | ||||||
|  |       as of the date such litigation is filed. | ||||||
|  |  | ||||||
|  |    4. Redistribution. You may reproduce and distribute copies of the | ||||||
|  |       Work or Derivative Works thereof in any medium, with or without | ||||||
|  |       modifications, and in Source or Object form, provided that You | ||||||
|  |       meet the following conditions: | ||||||
|  |  | ||||||
|  |       (a) You must give any other recipients of the Work or | ||||||
|  |           Derivative Works a copy of this License; and | ||||||
|  |  | ||||||
|  |       (b) You must cause any modified files to carry prominent notices | ||||||
|  |           stating that You changed the files; and | ||||||
|  |  | ||||||
|  |       (c) You must retain, in the Source form of any Derivative Works | ||||||
|  |           that You distribute, all copyright, patent, trademark, and | ||||||
|  |           attribution notices from the Source form of the Work, | ||||||
|  |           excluding those notices that do not pertain to any part of | ||||||
|  |           the Derivative Works; and | ||||||
|  |  | ||||||
|  |       (d) If the Work includes a "NOTICE" text file as part of its | ||||||
|  |           distribution, then any Derivative Works that You distribute must | ||||||
|  |           include a readable copy of the attribution notices contained | ||||||
|  |           within such NOTICE file, excluding those notices that do not | ||||||
|  |           pertain to any part of the Derivative Works, in at least one | ||||||
|  |           of the following places: within a NOTICE text file distributed | ||||||
|  |           as part of the Derivative Works; within the Source form or | ||||||
|  |           documentation, if provided along with the Derivative Works; or, | ||||||
|  |           within a display generated by the Derivative Works, if and | ||||||
|  |           wherever such third-party notices normally appear. The contents | ||||||
|  |           of the NOTICE file are for informational purposes only and | ||||||
|  |           do not modify the License. You may add Your own attribution | ||||||
|  |           notices within Derivative Works that You distribute, alongside | ||||||
|  |           or as an addendum to the NOTICE text from the Work, provided | ||||||
|  |           that such additional attribution notices cannot be construed | ||||||
|  |           as modifying the License. | ||||||
|  |  | ||||||
|  |       You may add Your own copyright statement to Your modifications and | ||||||
|  |       may provide additional or different license terms and conditions | ||||||
|  |       for use, reproduction, or distribution of Your modifications, or | ||||||
|  |       for any such Derivative Works as a whole, provided Your use, | ||||||
|  |       reproduction, and distribution of the Work otherwise complies with | ||||||
|  |       the conditions stated in this License. | ||||||
|  |  | ||||||
|  |    5. Submission of Contributions. Unless You explicitly state otherwise, | ||||||
|  |       any Contribution intentionally submitted for inclusion in the Work | ||||||
|  |       by You to the Licensor shall be under the terms and conditions of | ||||||
|  |       this License, without any additional terms or conditions. | ||||||
|  |       Notwithstanding the above, nothing herein shall supersede or modify | ||||||
|  |       the terms of any separate license agreement you may have executed | ||||||
|  |       with Licensor regarding such Contributions. | ||||||
|  |  | ||||||
|  |    6. Trademarks. This License does not grant permission to use the trade | ||||||
|  |       names, trademarks, service marks, or product names of the Licensor, | ||||||
|  |       except as required for reasonable and customary use in describing the | ||||||
|  |       origin of the Work and reproducing the content of the NOTICE file. | ||||||
|  |  | ||||||
|  |    7. Disclaimer of Warranty. Unless required by applicable law or | ||||||
|  |       agreed to in writing, Licensor provides the Work (and each | ||||||
|  |       Contributor provides its Contributions) on an "AS IS" BASIS, | ||||||
|  |       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||||||
|  |       implied, including, without limitation, any warranties or conditions | ||||||
|  |       of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||||||
|  |       PARTICULAR PURPOSE. You are solely responsible for determining the | ||||||
|  |       appropriateness of using or redistributing the Work and assume any | ||||||
|  |       risks associated with Your exercise of permissions under this License. | ||||||
|  |  | ||||||
|  |    8. Limitation of Liability. In no event and under no legal theory, | ||||||
|  |       whether in tort (including negligence), contract, or otherwise, | ||||||
|  |       unless required by applicable law (such as deliberate and grossly | ||||||
|  |       negligent acts) or agreed to in writing, shall any Contributor be | ||||||
|  |       liable to You for damages, including any direct, indirect, special, | ||||||
|  |       incidental, or consequential damages of any character arising as a | ||||||
|  |       result of this License or out of the use or inability to use the | ||||||
|  |       Work (including but not limited to damages for loss of goodwill, | ||||||
|  |       work stoppage, computer failure or malfunction, or any and all | ||||||
|  |       other commercial damages or losses), even if such Contributor | ||||||
|  |       has been advised of the possibility of such damages. | ||||||
|  |  | ||||||
|  |    9. Accepting Warranty or Additional Liability. While redistributing | ||||||
|  |       the Work or Derivative Works thereof, You may choose to offer, | ||||||
|  |       and charge a fee for, acceptance of support, warranty, indemnity, | ||||||
|  |       or other liability obligations and/or rights consistent with this | ||||||
|  |       License. However, in accepting such obligations, You may act only | ||||||
|  |       on Your own behalf and on Your sole responsibility, not on behalf | ||||||
|  |       of any other Contributor, and only if You agree to indemnify, | ||||||
|  |       defend, and hold each Contributor harmless for any liability | ||||||
|  |       incurred by, or claims asserted against, such Contributor by reason | ||||||
|  |       of your accepting any such warranty or additional liability. | ||||||
|  |  | ||||||
|  |    END OF TERMS AND CONDITIONS | ||||||
|  |  | ||||||
|  |    APPENDIX: How to apply the Apache License to your work. | ||||||
|  |  | ||||||
|  |       To apply the Apache License to your work, attach the following | ||||||
|  |       boilerplate notice, with the fields enclosed by brackets "[]" | ||||||
|  |       replaced with your own identifying information. (Don't include | ||||||
|  |       the brackets!)  The text should be enclosed in the appropriate | ||||||
|  |       comment syntax for the file format. We also recommend that a | ||||||
|  |       file or class name and description of purpose be included on the | ||||||
|  |       same "printed page" as the copyright notice for easier | ||||||
|  |       identification within third-party archives. | ||||||
|  |  | ||||||
|  |    Copyright 2021 STMicroelectronics | ||||||
|  |  | ||||||
|  |    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. | ||||||
							
								
								
									
										6
									
								
								Drivers/CMSIS/Device/ST/STM32H5xx/LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Drivers/CMSIS/Device/ST/STM32H5xx/LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | This software component is provided to you as part of a software package and | ||||||
|  | applicable license terms are in the  Package_license file. If you received this | ||||||
|  | software component outside of a package or without applicable license terms, | ||||||
|  | the terms of the Apache-2.0 license shall apply.  | ||||||
|  | You may obtain a copy of the Apache-2.0 at: | ||||||
|  | https://opensource.org/licenses/Apache-2.0 | ||||||
							
								
								
									
										411
									
								
								Drivers/CMSIS/Include/cachel1_armv7.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										411
									
								
								Drivers/CMSIS/Include/cachel1_armv7.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,411 @@ | |||||||
|  | /****************************************************************************** | ||||||
|  |  * @file     cachel1_armv7.h | ||||||
|  |  * @brief    CMSIS Level 1 Cache API for Armv7-M and later | ||||||
|  |  * @version  V1.0.1 | ||||||
|  |  * @date     19. April 2021 | ||||||
|  |  ******************************************************************************/ | ||||||
|  | /* | ||||||
|  |  * Copyright (c) 2020-2021 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_CACHEL1_ARMV7_H | ||||||
|  | #define ARM_CACHEL1_ARMV7_H | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \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      ) | ||||||
|  |  | ||||||
|  | #ifndef __SCB_DCACHE_LINE_SIZE | ||||||
|  | #define __SCB_DCACHE_LINE_SIZE  32U /*!< Cortex-M7 cache line size is fixed to 32 bytes (8 words). See also register SCB_CCSIDR */ | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifndef __SCB_ICACHE_LINE_SIZE | ||||||
|  | #define __SCB_ICACHE_LINE_SIZE  32U /*!< Cortex-M7 cache line size is fixed to 32 bytes (8 words). See also register SCB_CCSIDR */ | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   Enable I-Cache | ||||||
|  |   \details Turns on I-Cache | ||||||
|  |   */ | ||||||
|  | __STATIC_FORCEINLINE void SCB_EnableICache (void) | ||||||
|  | { | ||||||
|  |   #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U) | ||||||
|  |     if (SCB->CCR & SCB_CCR_IC_Msk) return;  /* return if ICache is already enabled */ | ||||||
|  |  | ||||||
|  |     __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_FORCEINLINE 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_FORCEINLINE void SCB_InvalidateICache (void) | ||||||
|  | { | ||||||
|  |   #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U) | ||||||
|  |     __DSB(); | ||||||
|  |     __ISB(); | ||||||
|  |     SCB->ICIALLU = 0UL; | ||||||
|  |     __DSB(); | ||||||
|  |     __ISB(); | ||||||
|  |   #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   I-Cache Invalidate by address | ||||||
|  |   \details Invalidates I-Cache for the given address. | ||||||
|  |            I-Cache is invalidated starting from a 32 byte aligned address in 32 byte granularity. | ||||||
|  |            I-Cache memory blocks which are part of given address + given size are invalidated. | ||||||
|  |   \param[in]   addr    address | ||||||
|  |   \param[in]   isize   size of memory block (in number of bytes) | ||||||
|  | */ | ||||||
|  | __STATIC_FORCEINLINE void SCB_InvalidateICache_by_Addr (volatile void *addr, int32_t isize) | ||||||
|  | { | ||||||
|  |   #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U) | ||||||
|  |     if ( isize > 0 ) { | ||||||
|  |        int32_t op_size = isize + (((uint32_t)addr) & (__SCB_ICACHE_LINE_SIZE - 1U)); | ||||||
|  |       uint32_t op_addr = (uint32_t)addr /* & ~(__SCB_ICACHE_LINE_SIZE - 1U) */; | ||||||
|  |  | ||||||
|  |       __DSB(); | ||||||
|  |  | ||||||
|  |       do { | ||||||
|  |         SCB->ICIMVAU = op_addr;             /* register accepts only 32byte aligned values, only bits 31..5 are valid */ | ||||||
|  |         op_addr += __SCB_ICACHE_LINE_SIZE; | ||||||
|  |         op_size -= __SCB_ICACHE_LINE_SIZE; | ||||||
|  |       } while ( op_size > 0 ); | ||||||
|  |  | ||||||
|  |       __DSB(); | ||||||
|  |       __ISB(); | ||||||
|  |     } | ||||||
|  |   #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   Enable D-Cache | ||||||
|  |   \details Turns on D-Cache | ||||||
|  |   */ | ||||||
|  | __STATIC_FORCEINLINE void SCB_EnableDCache (void) | ||||||
|  | { | ||||||
|  |   #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) | ||||||
|  |     uint32_t ccsidr; | ||||||
|  |     uint32_t sets; | ||||||
|  |     uint32_t ways; | ||||||
|  |  | ||||||
|  |     if (SCB->CCR & SCB_CCR_DC_Msk) return;  /* return if DCache is already enabled */ | ||||||
|  |  | ||||||
|  |     SCB->CSSELR = 0U;                       /* select 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_FORCEINLINE void SCB_DisableDCache (void) | ||||||
|  | { | ||||||
|  |   #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) | ||||||
|  |     uint32_t ccsidr; | ||||||
|  |     uint32_t sets; | ||||||
|  |     uint32_t ways; | ||||||
|  |  | ||||||
|  |     SCB->CSSELR = 0U;                       /* select 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_FORCEINLINE void SCB_InvalidateDCache (void) | ||||||
|  | { | ||||||
|  |   #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) | ||||||
|  |     uint32_t ccsidr; | ||||||
|  |     uint32_t sets; | ||||||
|  |     uint32_t ways; | ||||||
|  |  | ||||||
|  |     SCB->CSSELR = 0U;                       /* select 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_FORCEINLINE void SCB_CleanDCache (void) | ||||||
|  | { | ||||||
|  |   #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) | ||||||
|  |     uint32_t ccsidr; | ||||||
|  |     uint32_t sets; | ||||||
|  |     uint32_t ways; | ||||||
|  |  | ||||||
|  |     SCB->CSSELR = 0U;                       /* select 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_FORCEINLINE void SCB_CleanInvalidateDCache (void) | ||||||
|  | { | ||||||
|  |   #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) | ||||||
|  |     uint32_t ccsidr; | ||||||
|  |     uint32_t sets; | ||||||
|  |     uint32_t ways; | ||||||
|  |  | ||||||
|  |     SCB->CSSELR = 0U;                       /* select 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. | ||||||
|  |            D-Cache is invalidated starting from a 32 byte aligned address in 32 byte granularity. | ||||||
|  |            D-Cache memory blocks which are part of given address + given size are invalidated. | ||||||
|  |   \param[in]   addr    address | ||||||
|  |   \param[in]   dsize   size of memory block (in number of bytes) | ||||||
|  | */ | ||||||
|  | __STATIC_FORCEINLINE void SCB_InvalidateDCache_by_Addr (volatile void *addr, int32_t dsize) | ||||||
|  | { | ||||||
|  |   #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) | ||||||
|  |     if ( dsize > 0 ) { | ||||||
|  |        int32_t op_size = dsize + (((uint32_t)addr) & (__SCB_DCACHE_LINE_SIZE - 1U)); | ||||||
|  |       uint32_t op_addr = (uint32_t)addr /* & ~(__SCB_DCACHE_LINE_SIZE - 1U) */; | ||||||
|  |  | ||||||
|  |       __DSB(); | ||||||
|  |  | ||||||
|  |       do { | ||||||
|  |         SCB->DCIMVAC = op_addr;             /* register accepts only 32byte aligned values, only bits 31..5 are valid */ | ||||||
|  |         op_addr += __SCB_DCACHE_LINE_SIZE; | ||||||
|  |         op_size -= __SCB_DCACHE_LINE_SIZE; | ||||||
|  |       } while ( op_size > 0 ); | ||||||
|  |  | ||||||
|  |       __DSB(); | ||||||
|  |       __ISB(); | ||||||
|  |     } | ||||||
|  |   #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   D-Cache Clean by address | ||||||
|  |   \details Cleans D-Cache for the given address | ||||||
|  |            D-Cache is cleaned starting from a 32 byte aligned address in 32 byte granularity. | ||||||
|  |            D-Cache memory blocks which are part of given address + given size are cleaned. | ||||||
|  |   \param[in]   addr    address | ||||||
|  |   \param[in]   dsize   size of memory block (in number of bytes) | ||||||
|  | */ | ||||||
|  | __STATIC_FORCEINLINE void SCB_CleanDCache_by_Addr (volatile void *addr, int32_t dsize) | ||||||
|  | { | ||||||
|  |   #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) | ||||||
|  |     if ( dsize > 0 ) { | ||||||
|  |        int32_t op_size = dsize + (((uint32_t)addr) & (__SCB_DCACHE_LINE_SIZE - 1U)); | ||||||
|  |       uint32_t op_addr = (uint32_t)addr /* & ~(__SCB_DCACHE_LINE_SIZE - 1U) */; | ||||||
|  |  | ||||||
|  |       __DSB(); | ||||||
|  |  | ||||||
|  |       do { | ||||||
|  |         SCB->DCCMVAC = op_addr;             /* register accepts only 32byte aligned values, only bits 31..5 are valid */ | ||||||
|  |         op_addr += __SCB_DCACHE_LINE_SIZE; | ||||||
|  |         op_size -= __SCB_DCACHE_LINE_SIZE; | ||||||
|  |       } while ( op_size > 0 ); | ||||||
|  |  | ||||||
|  |       __DSB(); | ||||||
|  |       __ISB(); | ||||||
|  |     } | ||||||
|  |   #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   D-Cache Clean and Invalidate by address | ||||||
|  |   \details Cleans and invalidates D_Cache for the given address | ||||||
|  |            D-Cache is cleaned and invalidated starting from a 32 byte aligned address in 32 byte granularity. | ||||||
|  |            D-Cache memory blocks which are part of given address + given size are cleaned and invalidated. | ||||||
|  |   \param[in]   addr    address (aligned to 32-byte boundary) | ||||||
|  |   \param[in]   dsize   size of memory block (in number of bytes) | ||||||
|  | */ | ||||||
|  | __STATIC_FORCEINLINE void SCB_CleanInvalidateDCache_by_Addr (volatile void *addr, int32_t dsize) | ||||||
|  | { | ||||||
|  |   #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) | ||||||
|  |     if ( dsize > 0 ) { | ||||||
|  |        int32_t op_size = dsize + (((uint32_t)addr) & (__SCB_DCACHE_LINE_SIZE - 1U)); | ||||||
|  |       uint32_t op_addr = (uint32_t)addr /* & ~(__SCB_DCACHE_LINE_SIZE - 1U) */; | ||||||
|  |  | ||||||
|  |       __DSB(); | ||||||
|  |  | ||||||
|  |       do { | ||||||
|  |         SCB->DCCIMVAC = op_addr;            /* register accepts only 32byte aligned values, only bits 31..5 are valid */ | ||||||
|  |         op_addr +=          __SCB_DCACHE_LINE_SIZE; | ||||||
|  |         op_size -=          __SCB_DCACHE_LINE_SIZE; | ||||||
|  |       } while ( op_size > 0 ); | ||||||
|  |  | ||||||
|  |       __DSB(); | ||||||
|  |       __ISB(); | ||||||
|  |     } | ||||||
|  |   #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /*@} end of CMSIS_Core_CacheFunctions */ | ||||||
|  |  | ||||||
|  | #endif /* ARM_CACHEL1_ARMV7_H */ | ||||||
							
								
								
									
										888
									
								
								Drivers/CMSIS/Include/cmsis_armcc.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										888
									
								
								Drivers/CMSIS/Include/cmsis_armcc.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,888 @@ | |||||||
|  | /**************************************************************************//** | ||||||
|  |  * @file     cmsis_armcc.h | ||||||
|  |  * @brief    CMSIS compiler ARMCC (Arm Compiler 5) header file | ||||||
|  |  * @version  V5.3.2 | ||||||
|  |  * @date     27. May 2021 | ||||||
|  |  ******************************************************************************/ | ||||||
|  | /* | ||||||
|  |  * Copyright (c) 2009-2021 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 */ | ||||||
|  |   /* __ARM_ARCH_8_1M_MAIN__  not applicable */ | ||||||
|  |  | ||||||
|  | /* CMSIS compiler control DSP macros */ | ||||||
|  | #if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1))     ) | ||||||
|  |   #define __ARM_FEATURE_DSP         1 | ||||||
|  | #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                   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 | ||||||
|  | #ifndef   __COMPILER_BARRIER | ||||||
|  |   #define __COMPILER_BARRIER()                   __memory_changed() | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* #########################  Startup and Lowlevel Init  ######################## */ | ||||||
|  |  | ||||||
|  | #ifndef __PROGRAM_START | ||||||
|  | #define __PROGRAM_START           __main | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifndef __INITIAL_SP | ||||||
|  | #define __INITIAL_SP              Image$$ARM_LIB_STACK$$ZI$$Limit | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifndef __STACK_LIMIT | ||||||
|  | #define __STACK_LIMIT             Image$$ARM_LIB_STACK$$ZI$$Base | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifndef __VECTOR_TABLE | ||||||
|  | #define __VECTOR_TABLE            __Vectors | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifndef __VECTOR_TABLE_ATTRIBUTE | ||||||
|  | #define __VECTOR_TABLE_ATTRIBUTE  __attribute__((used, section("RESET"))) | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* ##########################  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()                           __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()                           __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()                           __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                             __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 */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* ###########################  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 special-purpose register PRIMASK. | ||||||
|  |            Can only be executed in Privileged modes. | ||||||
|  |  */ | ||||||
|  | /* intrinsic void __enable_irq();     */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   Disable IRQ Interrupts | ||||||
|  |   \details Disables IRQ interrupts by setting special-purpose register PRIMASK. | ||||||
|  |            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; | ||||||
|  |   __ISB(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \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 special-purpose register FAULTMASK. | ||||||
|  |            Can only be executed in Privileged modes. | ||||||
|  |  */ | ||||||
|  | #define __enable_fault_irq                __enable_fiq | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   Disable FIQ | ||||||
|  |   \details Disables FIQ interrupts by setting special-purpose register FAULTMASK. | ||||||
|  |            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 */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* ###################  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)) | ||||||
|  |  | ||||||
|  | #define __SXTB16_RORn(ARG1, ARG2)        __SXTB16(__ROR(ARG1, ARG2)) | ||||||
|  |  | ||||||
|  | #define __SXTAB16_RORn(ARG1, ARG2, ARG3) __SXTAB16(ARG1, __ROR(ARG2, ARG3)) | ||||||
|  |  | ||||||
|  | #endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1))     ) */ | ||||||
|  | /*@} end of group CMSIS_SIMD_intrinsics */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif /* __CMSIS_ARMCC_H */ | ||||||
							
								
								
									
										1503
									
								
								Drivers/CMSIS/Include/cmsis_armclang.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1503
									
								
								Drivers/CMSIS/Include/cmsis_armclang.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1928
									
								
								Drivers/CMSIS/Include/cmsis_armclang_ltm.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1928
									
								
								Drivers/CMSIS/Include/cmsis_armclang_ltm.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										283
									
								
								Drivers/CMSIS/Include/cmsis_compiler.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										283
									
								
								Drivers/CMSIS/Include/cmsis_compiler.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,283 @@ | |||||||
|  | /**************************************************************************//** | ||||||
|  |  * @file     cmsis_compiler.h | ||||||
|  |  * @brief    CMSIS compiler generic header file | ||||||
|  |  * @version  V5.1.0 | ||||||
|  |  * @date     09. October 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 <stdint.h> | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Arm Compiler 4/5 | ||||||
|  |  */ | ||||||
|  | #if   defined ( __CC_ARM ) | ||||||
|  |   #include "cmsis_armcc.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Arm Compiler 6.6 LTM (armclang) | ||||||
|  |  */ | ||||||
|  | #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) && (__ARMCC_VERSION < 6100100) | ||||||
|  |   #include "cmsis_armclang_ltm.h" | ||||||
|  |  | ||||||
|  |   /* | ||||||
|  |  * Arm Compiler above 6.10.1 (armclang) | ||||||
|  |  */ | ||||||
|  | #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6100100) | ||||||
|  |   #include "cmsis_armclang.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * GNU Compiler | ||||||
|  |  */ | ||||||
|  | #elif defined ( __GNUC__ ) | ||||||
|  |   #include "cmsis_gcc.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * IAR Compiler | ||||||
|  |  */ | ||||||
|  | #elif defined ( __ICCARM__ ) | ||||||
|  |   #include <cmsis_iccarm.h> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * TI Arm Compiler | ||||||
|  |  */ | ||||||
|  | #elif defined ( __TI_ARM__ ) | ||||||
|  |   #include <cmsis_ccs.h> | ||||||
|  |  | ||||||
|  |   #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 | ||||||
|  |     #define __RESTRICT                             __restrict | ||||||
|  |   #endif | ||||||
|  |   #ifndef   __COMPILER_BARRIER | ||||||
|  |     #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored. | ||||||
|  |     #define __COMPILER_BARRIER()                   (void)0 | ||||||
|  |   #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 | ||||||
|  |   #ifndef   __COMPILER_BARRIER | ||||||
|  |     #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored. | ||||||
|  |     #define __COMPILER_BARRIER()                   (void)0 | ||||||
|  |   #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * COSMIC Compiler | ||||||
|  |  */ | ||||||
|  | #elif defined ( __CSMC__ ) | ||||||
|  |    #include <cmsis_csm.h> | ||||||
|  |  | ||||||
|  |  #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 | ||||||
|  |   #ifndef   __COMPILER_BARRIER | ||||||
|  |     #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored. | ||||||
|  |     #define __COMPILER_BARRIER()                   (void)0 | ||||||
|  |   #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #else | ||||||
|  |   #error Unknown compiler. | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif /* __CMSIS_COMPILER_H */ | ||||||
|  |  | ||||||
							
								
								
									
										2211
									
								
								Drivers/CMSIS/Include/cmsis_gcc.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2211
									
								
								Drivers/CMSIS/Include/cmsis_gcc.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1002
									
								
								Drivers/CMSIS/Include/cmsis_iccarm.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1002
									
								
								Drivers/CMSIS/Include/cmsis_iccarm.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										39
									
								
								Drivers/CMSIS/Include/cmsis_version.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								Drivers/CMSIS/Include/cmsis_version.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | |||||||
|  | /**************************************************************************//** | ||||||
|  |  * @file     cmsis_version.h | ||||||
|  |  * @brief    CMSIS Core(M) Version definitions | ||||||
|  |  * @version  V5.0.5 | ||||||
|  |  * @date     02. February 2022 | ||||||
|  |  ******************************************************************************/ | ||||||
|  | /* | ||||||
|  |  * Copyright (c) 2009-2022 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   ( 6U)                                      /*!< [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 | ||||||
							
								
								
									
										4228
									
								
								Drivers/CMSIS/Include/core_armv81mml.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4228
									
								
								Drivers/CMSIS/Include/core_armv81mml.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2222
									
								
								Drivers/CMSIS/Include/core_armv8mbl.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2222
									
								
								Drivers/CMSIS/Include/core_armv8mbl.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										3209
									
								
								Drivers/CMSIS/Include/core_armv8mml.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3209
									
								
								Drivers/CMSIS/Include/core_armv8mml.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										952
									
								
								Drivers/CMSIS/Include/core_cm0.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										952
									
								
								Drivers/CMSIS/Include/core_cm0.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,952 @@ | |||||||
|  | /**************************************************************************//** | ||||||
|  |  * @file     core_cm0.h | ||||||
|  |  * @brief    CMSIS Cortex-M0 Core Peripheral Access Layer Header File | ||||||
|  |  * @version  V5.0.8 | ||||||
|  |  * @date     21. August 2019 | ||||||
|  |  ******************************************************************************/ | ||||||
|  | /* | ||||||
|  |  * Copyright (c) 2009-2019 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 <stdint.h> | ||||||
|  |  | ||||||
|  | #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.<br> | ||||||
|  |      Function definitions in header files are used to allow 'inlining'. | ||||||
|  |  | ||||||
|  |    \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br> | ||||||
|  |      Unions are used for effective representation of core registers. | ||||||
|  |  | ||||||
|  |    \li Advisory Rule 19.7, Function-like macro defined.<br> | ||||||
|  |      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_FP | ||||||
|  |     #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 | ||||||
|  |  | ||||||
|  |     <strong>IO Type Qualifiers</strong> 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 RESERVED1[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) | ||||||
|  |   { | ||||||
|  |     __COMPILER_BARRIER(); | ||||||
|  |     NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); | ||||||
|  |     __COMPILER_BARRIER(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \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 *)(NVIC_USER_IRQ_OFFSET << 2);      /* point to 1st user interrupt */ | ||||||
|  |   *(vectors + (int32_t)IRQn) = vector;                              /* use pointer arithmetic to access vector */ | ||||||
|  |   /* ARM Application Note 321 states that the M0 does not require the architectural barrier */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \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 *)(NVIC_USER_IRQ_OFFSET << 2);      /* point to 1st user interrupt */ | ||||||
|  |   return *(vectors + (int32_t)IRQn);                                /* use pointer arithmetic to access vector */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \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 <b>__Vendor_SysTickConfig</b> is set to 1, then the | ||||||
|  |            function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b> | ||||||
|  |            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 */ | ||||||
							
								
								
									
										1087
									
								
								Drivers/CMSIS/Include/core_cm0plus.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1087
									
								
								Drivers/CMSIS/Include/core_cm0plus.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										979
									
								
								Drivers/CMSIS/Include/core_cm1.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										979
									
								
								Drivers/CMSIS/Include/core_cm1.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,979 @@ | |||||||
|  | /**************************************************************************//** | ||||||
|  |  * @file     core_cm1.h | ||||||
|  |  * @brief    CMSIS Cortex-M1 Core Peripheral Access Layer Header File | ||||||
|  |  * @version  V1.0.1 | ||||||
|  |  * @date     12. November 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 <stdint.h> | ||||||
|  |  | ||||||
|  | #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.<br> | ||||||
|  |      Function definitions in header files are used to allow 'inlining'. | ||||||
|  |  | ||||||
|  |    \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br> | ||||||
|  |      Unions are used for effective representation of core registers. | ||||||
|  |  | ||||||
|  |    \li Advisory Rule 19.7, Function-like macro defined.<br> | ||||||
|  |      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_FP | ||||||
|  |     #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 | ||||||
|  |  | ||||||
|  |     <strong>IO Type Qualifiers</strong> 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) | ||||||
|  |   { | ||||||
|  |     __COMPILER_BARRIER(); | ||||||
|  |     NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); | ||||||
|  |     __COMPILER_BARRIER(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \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; | ||||||
|  |   /* ARM Application Note 321 states that the M1 does not require the architectural barrier */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \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 <b>__Vendor_SysTickConfig</b> is set to 1, then the | ||||||
|  |            function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b> | ||||||
|  |            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 */ | ||||||
							
								
								
									
										2297
									
								
								Drivers/CMSIS/Include/core_cm23.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2297
									
								
								Drivers/CMSIS/Include/core_cm23.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1943
									
								
								Drivers/CMSIS/Include/core_cm3.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1943
									
								
								Drivers/CMSIS/Include/core_cm3.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										3277
									
								
								Drivers/CMSIS/Include/core_cm33.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3277
									
								
								Drivers/CMSIS/Include/core_cm33.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										3277
									
								
								Drivers/CMSIS/Include/core_cm35p.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3277
									
								
								Drivers/CMSIS/Include/core_cm35p.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2129
									
								
								Drivers/CMSIS/Include/core_cm4.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2129
									
								
								Drivers/CMSIS/Include/core_cm4.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										4817
									
								
								Drivers/CMSIS/Include/core_cm55.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4817
									
								
								Drivers/CMSIS/Include/core_cm55.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2366
									
								
								Drivers/CMSIS/Include/core_cm7.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2366
									
								
								Drivers/CMSIS/Include/core_cm7.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										4672
									
								
								Drivers/CMSIS/Include/core_cm85.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4672
									
								
								Drivers/CMSIS/Include/core_cm85.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1030
									
								
								Drivers/CMSIS/Include/core_sc000.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1030
									
								
								Drivers/CMSIS/Include/core_sc000.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1917
									
								
								Drivers/CMSIS/Include/core_sc300.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1917
									
								
								Drivers/CMSIS/Include/core_sc300.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										3592
									
								
								Drivers/CMSIS/Include/core_starmc1.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3592
									
								
								Drivers/CMSIS/Include/core_starmc1.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										275
									
								
								Drivers/CMSIS/Include/mpu_armv7.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										275
									
								
								Drivers/CMSIS/Include/mpu_armv7.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,275 @@ | |||||||
|  | /****************************************************************************** | ||||||
|  |  * @file     mpu_armv7.h | ||||||
|  |  * @brief    CMSIS MPU API for Armv7-M MPU | ||||||
|  |  * @version  V5.1.2 | ||||||
|  |  * @date     25. May 2020 | ||||||
|  |  ******************************************************************************/ | ||||||
|  | /* | ||||||
|  |  * Copyright (c) 2017-2020 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))) | \ | ||||||
|  |    (((SubRegionDisable) << MPU_RASR_SRD_Pos)  & MPU_RASR_SRD_Msk)                                 | \ | ||||||
|  |    (((Size)             << MPU_RASR_SIZE_Pos) & MPU_RASR_SIZE_Msk)                                | \ | ||||||
|  |    (((MPU_RASR_ENABLE_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 shareable) or 010b (if non-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) >> 1U), ((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) | ||||||
|  | { | ||||||
|  |   __DMB(); | ||||||
|  |   MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; | ||||||
|  | #ifdef SCB_SHCSR_MEMFAULTENA_Msk | ||||||
|  |   SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; | ||||||
|  | #endif | ||||||
|  |   __DSB(); | ||||||
|  |   __ISB(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** Disable the MPU. | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_MPU_Disable(void) | ||||||
|  | { | ||||||
|  |   __DMB(); | ||||||
|  | #ifdef SCB_SHCSR_MEMFAULTENA_Msk | ||||||
|  |   SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; | ||||||
|  | #endif | ||||||
|  |   MPU->CTRL  &= ~MPU_CTRL_ENABLE_Msk; | ||||||
|  |   __DSB(); | ||||||
|  |   __ISB(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** 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 rasr Value for RASR 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 rasr Value for RASR 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; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** Memcpy with strictly ordered memory access, e.g. used by code in ARM_MPU_Load(). | ||||||
|  | * \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 ARM_MPU_OrderedMemcpy(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) { | ||||||
|  |     ARM_MPU_OrderedMemcpy(&(MPU->RBAR), &(table->RBAR), MPU_TYPE_RALIASES*rowWordSize); | ||||||
|  |     table += MPU_TYPE_RALIASES; | ||||||
|  |     cnt -= MPU_TYPE_RALIASES; | ||||||
|  |   } | ||||||
|  |   ARM_MPU_OrderedMemcpy(&(MPU->RBAR), &(table->RBAR), cnt*rowWordSize); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #endif | ||||||
							
								
								
									
										352
									
								
								Drivers/CMSIS/Include/mpu_armv8.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										352
									
								
								Drivers/CMSIS/Include/mpu_armv8.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,352 @@ | |||||||
|  | /****************************************************************************** | ||||||
|  |  * @file     mpu_armv8.h | ||||||
|  |  * @brief    CMSIS MPU API for Armv8-M and Armv8.1-M MPU | ||||||
|  |  * @version  V5.1.3 | ||||||
|  |  * @date     03. February 2021 | ||||||
|  |  ******************************************************************************/ | ||||||
|  | /* | ||||||
|  |  * Copyright (c) 2017-2021 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)) | ||||||
|  |  | ||||||
|  | #if defined(MPU_RLAR_PXN_Pos) | ||||||
|  |    | ||||||
|  | /** \brief Region Limit Address Register with PXN value | ||||||
|  | * \param LIMIT The limit address bits [31:5] for this memory region. The value is one extended. | ||||||
|  | * \param PXN Privileged execute never. Defines whether code can be executed from this privileged region. | ||||||
|  | * \param IDX The attribute index to be associated with this memory region. | ||||||
|  | */ | ||||||
|  | #define ARM_MPU_RLAR_PXN(LIMIT, PXN, IDX) \ | ||||||
|  |   (((LIMIT) & MPU_RLAR_LIMIT_Msk) | \ | ||||||
|  |   (((PXN) << MPU_RLAR_PXN_Pos) & MPU_RLAR_PXN_Msk) | \ | ||||||
|  |   (((IDX) << MPU_RLAR_AttrIndx_Pos) & MPU_RLAR_AttrIndx_Msk) | \ | ||||||
|  |   (MPU_RLAR_EN_Msk)) | ||||||
|  |    | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /** | ||||||
|  | * 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) | ||||||
|  | { | ||||||
|  |   __DMB(); | ||||||
|  |   MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; | ||||||
|  | #ifdef SCB_SHCSR_MEMFAULTENA_Msk | ||||||
|  |   SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; | ||||||
|  | #endif | ||||||
|  |   __DSB(); | ||||||
|  |   __ISB(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** Disable the MPU. | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_MPU_Disable(void) | ||||||
|  | { | ||||||
|  |   __DMB(); | ||||||
|  | #ifdef SCB_SHCSR_MEMFAULTENA_Msk | ||||||
|  |   SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; | ||||||
|  | #endif | ||||||
|  |   MPU->CTRL  &= ~MPU_CTRL_ENABLE_Msk; | ||||||
|  |   __DSB(); | ||||||
|  |   __ISB(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #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) | ||||||
|  | { | ||||||
|  |   __DMB(); | ||||||
|  |   MPU_NS->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; | ||||||
|  | #ifdef SCB_SHCSR_MEMFAULTENA_Msk | ||||||
|  |   SCB_NS->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; | ||||||
|  | #endif | ||||||
|  |   __DSB(); | ||||||
|  |   __ISB(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** Disable the Non-secure MPU. | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_MPU_Disable_NS(void) | ||||||
|  | { | ||||||
|  |   __DMB(); | ||||||
|  | #ifdef SCB_SHCSR_MEMFAULTENA_Msk | ||||||
|  |   SCB_NS->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; | ||||||
|  | #endif | ||||||
|  |   MPU_NS->CTRL  &= ~MPU_CTRL_ENABLE_Msk; | ||||||
|  |   __DSB(); | ||||||
|  |   __ISB(); | ||||||
|  | } | ||||||
|  | #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 | ||||||
|  |  | ||||||
|  | /** Memcpy with strictly ordered memory access, e.g. used by code in ARM_MPU_LoadEx() | ||||||
|  | * \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 ARM_MPU_OrderedMemcpy(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; | ||||||
|  |     ARM_MPU_OrderedMemcpy(&(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; | ||||||
|  |       ARM_MPU_OrderedMemcpy(&(mpu->RBAR)+(rnrOffset*2U), &(table->RBAR), c*rowWordSize); | ||||||
|  |       table += c; | ||||||
|  |       cnt -= c; | ||||||
|  |       rnrOffset = 0U; | ||||||
|  |       rnrBase += MPU_TYPE_RALIASES; | ||||||
|  |       mpu->RNR = rnrBase; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     ARM_MPU_OrderedMemcpy(&(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 | ||||||
|  |  | ||||||
							
								
								
									
										206
									
								
								Drivers/CMSIS/Include/pac_armv81.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										206
									
								
								Drivers/CMSIS/Include/pac_armv81.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,206 @@ | |||||||
|  | /****************************************************************************** | ||||||
|  |  * @file     pac_armv81.h | ||||||
|  |  * @brief    CMSIS PAC key functions for Armv8.1-M PAC extension | ||||||
|  |  * @version  V1.0.0 | ||||||
|  |  * @date     23. March 2022 | ||||||
|  |  ******************************************************************************/ | ||||||
|  | /* | ||||||
|  |  * Copyright (c) 2022 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 PAC_ARMV81_H | ||||||
|  | #define PAC_ARMV81_H | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* ###################  PAC Key functions  ########################### */ | ||||||
|  | /** | ||||||
|  |   \ingroup  CMSIS_Core_FunctionInterface | ||||||
|  |   \defgroup CMSIS_Core_PacKeyFunctions PAC Key functions | ||||||
|  |   \brief    Functions that access the PAC keys. | ||||||
|  |   @{ | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #if (defined (__ARM_FEATURE_PAUTH) && (__ARM_FEATURE_PAUTH == 1)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   read the PAC key used for privileged mode | ||||||
|  |   \details Reads the PAC key stored in the PAC_KEY_P registers. | ||||||
|  |   \param [out]    pPacKey  128bit PAC key | ||||||
|  |  */ | ||||||
|  | __STATIC_FORCEINLINE void __get_PAC_KEY_P (uint32_t* pPacKey) { | ||||||
|  |   __ASM volatile ( | ||||||
|  |   "mrs   r1, pac_key_p_0\n" | ||||||
|  |   "str   r1,[%0,#0]\n" | ||||||
|  |   "mrs   r1, pac_key_p_1\n" | ||||||
|  |   "str   r1,[%0,#4]\n" | ||||||
|  |   "mrs   r1, pac_key_p_2\n" | ||||||
|  |   "str   r1,[%0,#8]\n" | ||||||
|  |   "mrs   r1, pac_key_p_3\n" | ||||||
|  |   "str   r1,[%0,#12]\n" | ||||||
|  |   : : "r" (pPacKey) : "memory", "r1" | ||||||
|  |   ); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   write the PAC key used for privileged mode | ||||||
|  |   \details writes the given PAC key to the PAC_KEY_P registers. | ||||||
|  |   \param [in]    pPacKey  128bit PAC key | ||||||
|  |  */ | ||||||
|  | __STATIC_FORCEINLINE void __set_PAC_KEY_P (uint32_t* pPacKey) { | ||||||
|  |   __ASM volatile ( | ||||||
|  |   "ldr   r1,[%0,#0]\n" | ||||||
|  |   "msr   pac_key_p_0, r1\n" | ||||||
|  |   "ldr   r1,[%0,#4]\n" | ||||||
|  |   "msr   pac_key_p_1, r1\n" | ||||||
|  |   "ldr   r1,[%0,#8]\n" | ||||||
|  |   "msr   pac_key_p_2, r1\n" | ||||||
|  |   "ldr   r1,[%0,#12]\n" | ||||||
|  |   "msr   pac_key_p_3, r1\n" | ||||||
|  |   : : "r" (pPacKey) : "memory", "r1" | ||||||
|  |   ); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   read the PAC key used for unprivileged mode | ||||||
|  |   \details Reads the PAC key stored in the PAC_KEY_U registers. | ||||||
|  |   \param [out]    pPacKey  128bit PAC key | ||||||
|  |  */ | ||||||
|  | __STATIC_FORCEINLINE void __get_PAC_KEY_U (uint32_t* pPacKey) { | ||||||
|  |   __ASM volatile ( | ||||||
|  |   "mrs   r1, pac_key_u_0\n" | ||||||
|  |   "str   r1,[%0,#0]\n" | ||||||
|  |   "mrs   r1, pac_key_u_1\n" | ||||||
|  |   "str   r1,[%0,#4]\n" | ||||||
|  |   "mrs   r1, pac_key_u_2\n" | ||||||
|  |   "str   r1,[%0,#8]\n" | ||||||
|  |   "mrs   r1, pac_key_u_3\n" | ||||||
|  |   "str   r1,[%0,#12]\n" | ||||||
|  |   : : "r" (pPacKey) : "memory", "r1" | ||||||
|  |   ); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   write the PAC key used for unprivileged mode | ||||||
|  |   \details writes the given PAC key to the PAC_KEY_U registers. | ||||||
|  |   \param [in]    pPacKey  128bit PAC key | ||||||
|  |  */ | ||||||
|  | __STATIC_FORCEINLINE void __set_PAC_KEY_U (uint32_t* pPacKey) { | ||||||
|  |   __ASM volatile ( | ||||||
|  |   "ldr   r1,[%0,#0]\n" | ||||||
|  |   "msr   pac_key_u_0, r1\n" | ||||||
|  |   "ldr   r1,[%0,#4]\n" | ||||||
|  |   "msr   pac_key_u_1, r1\n" | ||||||
|  |   "ldr   r1,[%0,#8]\n" | ||||||
|  |   "msr   pac_key_u_2, r1\n" | ||||||
|  |   "ldr   r1,[%0,#12]\n" | ||||||
|  |   "msr   pac_key_u_3, r1\n" | ||||||
|  |   : : "r" (pPacKey) : "memory", "r1" | ||||||
|  |   ); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   read the PAC key used for privileged mode (non-secure) | ||||||
|  |   \details Reads the PAC key stored in the non-secure PAC_KEY_P registers when in secure mode. | ||||||
|  |   \param [out]    pPacKey  128bit PAC key | ||||||
|  |  */ | ||||||
|  | __STATIC_FORCEINLINE void __TZ_get_PAC_KEY_P_NS (uint32_t* pPacKey) { | ||||||
|  |   __ASM volatile ( | ||||||
|  |   "mrs   r1, pac_key_p_0_ns\n" | ||||||
|  |   "str   r1,[%0,#0]\n" | ||||||
|  |   "mrs   r1, pac_key_p_1_ns\n" | ||||||
|  |   "str   r1,[%0,#4]\n" | ||||||
|  |   "mrs   r1, pac_key_p_2_ns\n" | ||||||
|  |   "str   r1,[%0,#8]\n" | ||||||
|  |   "mrs   r1, pac_key_p_3_ns\n" | ||||||
|  |   "str   r1,[%0,#12]\n" | ||||||
|  |   : : "r" (pPacKey) : "memory", "r1" | ||||||
|  |   ); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   write the PAC key used for privileged mode (non-secure) | ||||||
|  |   \details writes the given PAC key to the non-secure PAC_KEY_P registers when in secure mode. | ||||||
|  |   \param [in]    pPacKey  128bit PAC key | ||||||
|  |  */ | ||||||
|  | __STATIC_FORCEINLINE void __TZ_set_PAC_KEY_P_NS (uint32_t* pPacKey) { | ||||||
|  |   __ASM volatile ( | ||||||
|  |   "ldr   r1,[%0,#0]\n" | ||||||
|  |   "msr   pac_key_p_0_ns, r1\n" | ||||||
|  |   "ldr   r1,[%0,#4]\n" | ||||||
|  |   "msr   pac_key_p_1_ns, r1\n" | ||||||
|  |   "ldr   r1,[%0,#8]\n" | ||||||
|  |   "msr   pac_key_p_2_ns, r1\n" | ||||||
|  |   "ldr   r1,[%0,#12]\n" | ||||||
|  |   "msr   pac_key_p_3_ns, r1\n" | ||||||
|  |   : : "r" (pPacKey) : "memory", "r1" | ||||||
|  |   ); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   read the PAC key used for unprivileged mode (non-secure) | ||||||
|  |   \details Reads the PAC key stored in the non-secure PAC_KEY_U registers when in secure mode. | ||||||
|  |   \param [out]    pPacKey  128bit PAC key | ||||||
|  |  */ | ||||||
|  | __STATIC_FORCEINLINE void __TZ_get_PAC_KEY_U_NS (uint32_t* pPacKey) { | ||||||
|  |   __ASM volatile ( | ||||||
|  |   "mrs   r1, pac_key_u_0_ns\n" | ||||||
|  |   "str   r1,[%0,#0]\n" | ||||||
|  |   "mrs   r1, pac_key_u_1_ns\n" | ||||||
|  |   "str   r1,[%0,#4]\n" | ||||||
|  |   "mrs   r1, pac_key_u_2_ns\n" | ||||||
|  |   "str   r1,[%0,#8]\n" | ||||||
|  |   "mrs   r1, pac_key_u_3_ns\n" | ||||||
|  |   "str   r1,[%0,#12]\n" | ||||||
|  |   : : "r" (pPacKey) : "memory", "r1" | ||||||
|  |   ); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   \brief   write the PAC key used for unprivileged mode (non-secure) | ||||||
|  |   \details writes the given PAC key to the non-secure PAC_KEY_U registers when in secure mode. | ||||||
|  |   \param [in]    pPacKey  128bit PAC key | ||||||
|  |  */ | ||||||
|  | __STATIC_FORCEINLINE void __TZ_set_PAC_KEY_U_NS (uint32_t* pPacKey) { | ||||||
|  |   __ASM volatile ( | ||||||
|  |   "ldr   r1,[%0,#0]\n" | ||||||
|  |   "msr   pac_key_u_0_ns, r1\n" | ||||||
|  |   "ldr   r1,[%0,#4]\n" | ||||||
|  |   "msr   pac_key_u_1_ns, r1\n" | ||||||
|  |   "ldr   r1,[%0,#8]\n" | ||||||
|  |   "msr   pac_key_u_2_ns, r1\n" | ||||||
|  |   "ldr   r1,[%0,#12]\n" | ||||||
|  |   "msr   pac_key_u_3_ns, r1\n" | ||||||
|  |   : : "r" (pPacKey) : "memory", "r1" | ||||||
|  |   ); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #endif /* (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) */ | ||||||
|  |  | ||||||
|  | #endif /* (defined (__ARM_FEATURE_PAUTH) && (__ARM_FEATURE_PAUTH == 1)) */ | ||||||
|  |  | ||||||
|  | /*@} end of CMSIS_Core_PacKeyFunctions */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif /* PAC_ARMV81_H */ | ||||||
							
								
								
									
										337
									
								
								Drivers/CMSIS/Include/pmu_armv8.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										337
									
								
								Drivers/CMSIS/Include/pmu_armv8.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,337 @@ | |||||||
|  | /****************************************************************************** | ||||||
|  |  * @file     pmu_armv8.h | ||||||
|  |  * @brief    CMSIS PMU API for Armv8.1-M PMU | ||||||
|  |  * @version  V1.0.1 | ||||||
|  |  * @date     15. April 2020 | ||||||
|  |  ******************************************************************************/ | ||||||
|  | /* | ||||||
|  |  * Copyright (c) 2020 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_PMU_ARMV8_H | ||||||
|  | #define ARM_PMU_ARMV8_H | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * \brief PMU Events | ||||||
|  |  * \note  See the Armv8.1-M Architecture Reference Manual for full details on these PMU events. | ||||||
|  |  * */ | ||||||
|  |  | ||||||
|  | #define ARM_PMU_SW_INCR                              0x0000             /*!< Software update to the PMU_SWINC register, architecturally executed and condition code check pass */ | ||||||
|  | #define ARM_PMU_L1I_CACHE_REFILL                     0x0001             /*!< L1 I-Cache refill */ | ||||||
|  | #define ARM_PMU_L1D_CACHE_REFILL                     0x0003             /*!< L1 D-Cache refill */ | ||||||
|  | #define ARM_PMU_L1D_CACHE                            0x0004             /*!< L1 D-Cache access */ | ||||||
|  | #define ARM_PMU_LD_RETIRED                           0x0006             /*!< Memory-reading instruction architecturally executed and condition code check pass */ | ||||||
|  | #define ARM_PMU_ST_RETIRED                           0x0007             /*!< Memory-writing instruction architecturally executed and condition code check pass */ | ||||||
|  | #define ARM_PMU_INST_RETIRED                         0x0008             /*!< Instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_EXC_TAKEN                            0x0009             /*!< Exception entry */ | ||||||
|  | #define ARM_PMU_EXC_RETURN                           0x000A             /*!< Exception return instruction architecturally executed and the condition code check pass */ | ||||||
|  | #define ARM_PMU_PC_WRITE_RETIRED                     0x000C             /*!< Software change to the Program Counter (PC). Instruction is architecturally executed and condition code check pass */ | ||||||
|  | #define ARM_PMU_BR_IMMED_RETIRED                     0x000D             /*!< Immediate branch architecturally executed */ | ||||||
|  | #define ARM_PMU_BR_RETURN_RETIRED                    0x000E             /*!< Function return instruction architecturally executed and the condition code check pass */ | ||||||
|  | #define ARM_PMU_UNALIGNED_LDST_RETIRED               0x000F             /*!< Unaligned memory memory-reading or memory-writing instruction architecturally executed and condition code check pass */ | ||||||
|  | #define ARM_PMU_BR_MIS_PRED                          0x0010             /*!< Mispredicted or not predicted branch speculatively executed */ | ||||||
|  | #define ARM_PMU_CPU_CYCLES                           0x0011             /*!< Cycle */ | ||||||
|  | #define ARM_PMU_BR_PRED                              0x0012             /*!< Predictable branch speculatively executed */ | ||||||
|  | #define ARM_PMU_MEM_ACCESS                           0x0013             /*!< Data memory access */ | ||||||
|  | #define ARM_PMU_L1I_CACHE                            0x0014             /*!< Level 1 instruction cache access */ | ||||||
|  | #define ARM_PMU_L1D_CACHE_WB                         0x0015             /*!< Level 1 data cache write-back */ | ||||||
|  | #define ARM_PMU_L2D_CACHE                            0x0016             /*!< Level 2 data cache access */ | ||||||
|  | #define ARM_PMU_L2D_CACHE_REFILL                     0x0017             /*!< Level 2 data cache refill */ | ||||||
|  | #define ARM_PMU_L2D_CACHE_WB                         0x0018             /*!< Level 2 data cache write-back */ | ||||||
|  | #define ARM_PMU_BUS_ACCESS                           0x0019             /*!< Bus access */ | ||||||
|  | #define ARM_PMU_MEMORY_ERROR                         0x001A             /*!< Local memory error */ | ||||||
|  | #define ARM_PMU_INST_SPEC                            0x001B             /*!< Instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_BUS_CYCLES                           0x001D             /*!< Bus cycles */ | ||||||
|  | #define ARM_PMU_CHAIN                                0x001E             /*!< For an odd numbered counter, increment when an overflow occurs on the preceding even-numbered counter on the same PE */ | ||||||
|  | #define ARM_PMU_L1D_CACHE_ALLOCATE                   0x001F             /*!< Level 1 data cache allocation without refill */ | ||||||
|  | #define ARM_PMU_L2D_CACHE_ALLOCATE                   0x0020             /*!< Level 2 data cache allocation without refill */ | ||||||
|  | #define ARM_PMU_BR_RETIRED                           0x0021             /*!< Branch instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_BR_MIS_PRED_RETIRED                  0x0022             /*!< Mispredicted branch instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_STALL_FRONTEND                       0x0023             /*!< No operation issued because of the frontend */ | ||||||
|  | #define ARM_PMU_STALL_BACKEND                        0x0024             /*!< No operation issued because of the backend */ | ||||||
|  | #define ARM_PMU_L2I_CACHE                            0x0027             /*!< Level 2 instruction cache access */ | ||||||
|  | #define ARM_PMU_L2I_CACHE_REFILL                     0x0028             /*!< Level 2 instruction cache refill */ | ||||||
|  | #define ARM_PMU_L3D_CACHE_ALLOCATE                   0x0029             /*!< Level 3 data cache allocation without refill */ | ||||||
|  | #define ARM_PMU_L3D_CACHE_REFILL                     0x002A             /*!< Level 3 data cache refill */ | ||||||
|  | #define ARM_PMU_L3D_CACHE                            0x002B             /*!< Level 3 data cache access */ | ||||||
|  | #define ARM_PMU_L3D_CACHE_WB                         0x002C             /*!< Level 3 data cache write-back */ | ||||||
|  | #define ARM_PMU_LL_CACHE_RD                          0x0036             /*!< Last level data cache read */ | ||||||
|  | #define ARM_PMU_LL_CACHE_MISS_RD                     0x0037             /*!< Last level data cache read miss */ | ||||||
|  | #define ARM_PMU_L1D_CACHE_MISS_RD                    0x0039             /*!< Level 1 data cache read miss */ | ||||||
|  | #define ARM_PMU_OP_COMPLETE                          0x003A             /*!< Operation retired */ | ||||||
|  | #define ARM_PMU_OP_SPEC                              0x003B             /*!< Operation speculatively executed */ | ||||||
|  | #define ARM_PMU_STALL                                0x003C             /*!< Stall cycle for instruction or operation not sent for execution */ | ||||||
|  | #define ARM_PMU_STALL_OP_BACKEND                     0x003D             /*!< Stall cycle for instruction or operation not sent for execution due to pipeline backend */ | ||||||
|  | #define ARM_PMU_STALL_OP_FRONTEND                    0x003E             /*!< Stall cycle for instruction or operation not sent for execution due to pipeline frontend */ | ||||||
|  | #define ARM_PMU_STALL_OP                             0x003F             /*!< Instruction or operation slots not occupied each cycle */ | ||||||
|  | #define ARM_PMU_L1D_CACHE_RD                         0x0040             /*!< Level 1 data cache read */ | ||||||
|  | #define ARM_PMU_LE_RETIRED                           0x0100             /*!< Loop end instruction executed */ | ||||||
|  | #define ARM_PMU_LE_SPEC                              0x0101             /*!< Loop end instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_BF_RETIRED                           0x0104             /*!< Branch future instruction architecturally executed and condition code check pass */ | ||||||
|  | #define ARM_PMU_BF_SPEC                              0x0105             /*!< Branch future instruction speculatively executed and condition code check pass */ | ||||||
|  | #define ARM_PMU_LE_CANCEL                            0x0108             /*!< Loop end instruction not taken */ | ||||||
|  | #define ARM_PMU_BF_CANCEL                            0x0109             /*!< Branch future instruction not taken */ | ||||||
|  | #define ARM_PMU_SE_CALL_S                            0x0114             /*!< Call to secure function, resulting in Security state change */ | ||||||
|  | #define ARM_PMU_SE_CALL_NS                           0x0115             /*!< Call to non-secure function, resulting in Security state change */ | ||||||
|  | #define ARM_PMU_DWT_CMPMATCH0                        0x0118             /*!< DWT comparator 0 match */ | ||||||
|  | #define ARM_PMU_DWT_CMPMATCH1                        0x0119             /*!< DWT comparator 1 match */ | ||||||
|  | #define ARM_PMU_DWT_CMPMATCH2                        0x011A             /*!< DWT comparator 2 match */ | ||||||
|  | #define ARM_PMU_DWT_CMPMATCH3                        0x011B             /*!< DWT comparator 3 match */ | ||||||
|  | #define ARM_PMU_MVE_INST_RETIRED                     0x0200             /*!< MVE instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_INST_SPEC                        0x0201             /*!< MVE instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_FP_RETIRED                       0x0204             /*!< MVE floating-point instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_FP_SPEC                          0x0205             /*!< MVE floating-point instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_FP_HP_RETIRED                    0x0208             /*!< MVE half-precision floating-point instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_FP_HP_SPEC                       0x0209             /*!< MVE half-precision floating-point instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_FP_SP_RETIRED                    0x020C             /*!< MVE single-precision floating-point instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_FP_SP_SPEC                       0x020D             /*!< MVE single-precision floating-point instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_FP_MAC_RETIRED                   0x0214             /*!< MVE floating-point multiply or multiply-accumulate instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_FP_MAC_SPEC                      0x0215             /*!< MVE floating-point multiply or multiply-accumulate instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_INT_RETIRED                      0x0224             /*!< MVE integer instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_INT_SPEC                         0x0225             /*!< MVE integer instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_INT_MAC_RETIRED                  0x0228             /*!< MVE multiply or multiply-accumulate instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_INT_MAC_SPEC                     0x0229             /*!< MVE multiply or multiply-accumulate instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_RETIRED                     0x0238             /*!< MVE load or store instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_SPEC                        0x0239             /*!< MVE load or store instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_LD_RETIRED                       0x023C             /*!< MVE load instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_LD_SPEC                          0x023D             /*!< MVE load instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_ST_RETIRED                       0x0240             /*!< MVE store instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_ST_SPEC                          0x0241             /*!< MVE store instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_CONTIG_RETIRED              0x0244             /*!< MVE contiguous load or store instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_CONTIG_SPEC                 0x0245             /*!< MVE contiguous load or store instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_LD_CONTIG_RETIRED                0x0248             /*!< MVE contiguous load instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_LD_CONTIG_SPEC                   0x0249             /*!< MVE contiguous load instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_ST_CONTIG_RETIRED                0x024C             /*!< MVE contiguous store instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_ST_CONTIG_SPEC                   0x024D             /*!< MVE contiguous store instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_NONCONTIG_RETIRED           0x0250             /*!< MVE non-contiguous load or store instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_NONCONTIG_SPEC              0x0251             /*!< MVE non-contiguous load or store instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_LD_NONCONTIG_RETIRED             0x0254             /*!< MVE non-contiguous load instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_LD_NONCONTIG_SPEC                0x0255             /*!< MVE non-contiguous load instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_ST_NONCONTIG_RETIRED             0x0258             /*!< MVE non-contiguous store instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_ST_NONCONTIG_SPEC                0x0259             /*!< MVE non-contiguous store instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_MULTI_RETIRED               0x025C             /*!< MVE memory instruction targeting multiple registers architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_MULTI_SPEC                  0x025D             /*!< MVE memory instruction targeting multiple registers speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_LD_MULTI_RETIRED                 0x0260             /*!< MVE memory load instruction targeting multiple registers architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_LD_MULTI_SPEC                    0x0261             /*!< MVE memory load instruction targeting multiple registers speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_ST_MULTI_RETIRED                 0x0261             /*!< MVE memory store instruction targeting multiple registers architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_ST_MULTI_SPEC                    0x0265             /*!< MVE memory store instruction targeting multiple registers speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_UNALIGNED_RETIRED           0x028C             /*!< MVE unaligned memory load or store instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_UNALIGNED_SPEC              0x028D             /*!< MVE unaligned memory load or store instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_LD_UNALIGNED_RETIRED             0x0290             /*!< MVE unaligned load instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_LD_UNALIGNED_SPEC                0x0291             /*!< MVE unaligned load instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_ST_UNALIGNED_RETIRED             0x0294             /*!< MVE unaligned store instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_ST_UNALIGNED_SPEC                0x0295             /*!< MVE unaligned store instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_UNALIGNED_NONCONTIG_RETIRED 0x0298             /*!< MVE unaligned noncontiguous load or store instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_LDST_UNALIGNED_NONCONTIG_SPEC    0x0299             /*!< MVE unaligned noncontiguous load or store instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_VREDUCE_RETIRED                  0x02A0             /*!< MVE vector reduction instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_VREDUCE_SPEC                     0x02A1             /*!< MVE vector reduction instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_VREDUCE_FP_RETIRED               0x02A4             /*!< MVE floating-point vector reduction instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_VREDUCE_FP_SPEC                  0x02A5             /*!< MVE floating-point vector reduction instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_VREDUCE_INT_RETIRED              0x02A8             /*!< MVE integer vector reduction instruction architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_VREDUCE_INT_SPEC                 0x02A9             /*!< MVE integer vector reduction instruction speculatively executed */ | ||||||
|  | #define ARM_PMU_MVE_PRED                             0x02B8             /*!< Cycles where one or more predicated beats architecturally executed */ | ||||||
|  | #define ARM_PMU_MVE_STALL                            0x02CC             /*!< Stall cycles caused by an MVE instruction */ | ||||||
|  | #define ARM_PMU_MVE_STALL_RESOURCE                   0x02CD             /*!< Stall cycles caused by an MVE instruction because of resource conflicts */ | ||||||
|  | #define ARM_PMU_MVE_STALL_RESOURCE_MEM               0x02CE             /*!< Stall cycles caused by an MVE instruction because of memory resource conflicts */ | ||||||
|  | #define ARM_PMU_MVE_STALL_RESOURCE_FP                0x02CF             /*!< Stall cycles caused by an MVE instruction because of floating-point resource conflicts */ | ||||||
|  | #define ARM_PMU_MVE_STALL_RESOURCE_INT               0x02D0             /*!< Stall cycles caused by an MVE instruction because of integer resource conflicts */ | ||||||
|  | #define ARM_PMU_MVE_STALL_BREAK                      0x02D3             /*!< Stall cycles caused by an MVE chain break */ | ||||||
|  | #define ARM_PMU_MVE_STALL_DEPENDENCY                 0x02D4             /*!< Stall cycles caused by MVE register dependency */ | ||||||
|  | #define ARM_PMU_ITCM_ACCESS                          0x4007             /*!< Instruction TCM access */ | ||||||
|  | #define ARM_PMU_DTCM_ACCESS                          0x4008             /*!< Data TCM access */ | ||||||
|  | #define ARM_PMU_TRCEXTOUT0                           0x4010             /*!< ETM external output 0 */ | ||||||
|  | #define ARM_PMU_TRCEXTOUT1                           0x4011             /*!< ETM external output 1 */ | ||||||
|  | #define ARM_PMU_TRCEXTOUT2                           0x4012             /*!< ETM external output 2 */ | ||||||
|  | #define ARM_PMU_TRCEXTOUT3                           0x4013             /*!< ETM external output 3 */ | ||||||
|  | #define ARM_PMU_CTI_TRIGOUT4                         0x4018             /*!< Cross-trigger Interface output trigger 4 */ | ||||||
|  | #define ARM_PMU_CTI_TRIGOUT5                         0x4019             /*!< Cross-trigger Interface output trigger 5 */ | ||||||
|  | #define ARM_PMU_CTI_TRIGOUT6                         0x401A             /*!< Cross-trigger Interface output trigger 6 */ | ||||||
|  | #define ARM_PMU_CTI_TRIGOUT7                         0x401B             /*!< Cross-trigger Interface output trigger 7 */ | ||||||
|  |  | ||||||
|  | /** \brief PMU Functions */ | ||||||
|  |  | ||||||
|  | __STATIC_INLINE void ARM_PMU_Enable(void); | ||||||
|  | __STATIC_INLINE void ARM_PMU_Disable(void); | ||||||
|  |  | ||||||
|  | __STATIC_INLINE void ARM_PMU_Set_EVTYPER(uint32_t num, uint32_t type); | ||||||
|  |  | ||||||
|  | __STATIC_INLINE void ARM_PMU_CYCCNT_Reset(void); | ||||||
|  | __STATIC_INLINE void ARM_PMU_EVCNTR_ALL_Reset(void); | ||||||
|  |  | ||||||
|  | __STATIC_INLINE void ARM_PMU_CNTR_Enable(uint32_t mask); | ||||||
|  | __STATIC_INLINE void ARM_PMU_CNTR_Disable(uint32_t mask); | ||||||
|  |  | ||||||
|  | __STATIC_INLINE uint32_t ARM_PMU_Get_CCNTR(void); | ||||||
|  | __STATIC_INLINE uint32_t ARM_PMU_Get_EVCNTR(uint32_t num); | ||||||
|  |  | ||||||
|  | __STATIC_INLINE uint32_t ARM_PMU_Get_CNTR_OVS(void); | ||||||
|  | __STATIC_INLINE void ARM_PMU_Set_CNTR_OVS(uint32_t mask); | ||||||
|  |  | ||||||
|  | __STATIC_INLINE void ARM_PMU_Set_CNTR_IRQ_Enable(uint32_t mask); | ||||||
|  | __STATIC_INLINE void ARM_PMU_Set_CNTR_IRQ_Disable(uint32_t mask); | ||||||
|  |  | ||||||
|  | __STATIC_INLINE void ARM_PMU_CNTR_Increment(uint32_t mask); | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief   Enable the PMU | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_PMU_Enable(void)  | ||||||
|  | { | ||||||
|  |   PMU->CTRL |= PMU_CTRL_ENABLE_Msk; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief   Disable the PMU | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_PMU_Disable(void)  | ||||||
|  | { | ||||||
|  |   PMU->CTRL &= ~PMU_CTRL_ENABLE_Msk; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief   Set event to count for PMU eventer counter | ||||||
|  |   \param [in]    num     Event counter (0-30) to configure | ||||||
|  |   \param [in]    type    Event to count | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_PMU_Set_EVTYPER(uint32_t num, uint32_t type) | ||||||
|  | { | ||||||
|  |   PMU->EVTYPER[num] = type; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief  Reset cycle counter | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_PMU_CYCCNT_Reset(void) | ||||||
|  | { | ||||||
|  |   PMU->CTRL |= PMU_CTRL_CYCCNT_RESET_Msk; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief  Reset all event counters | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_PMU_EVCNTR_ALL_Reset(void) | ||||||
|  | { | ||||||
|  |   PMU->CTRL |= PMU_CTRL_EVENTCNT_RESET_Msk; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief  Enable counters  | ||||||
|  |   \param [in]     mask    Counters to enable | ||||||
|  |   \note   Enables one or more of the following: | ||||||
|  |           - event counters (0-30) | ||||||
|  |           - cycle counter | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_PMU_CNTR_Enable(uint32_t mask) | ||||||
|  | { | ||||||
|  |   PMU->CNTENSET = mask; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief  Disable counters | ||||||
|  |   \param [in]     mask    Counters to enable | ||||||
|  |   \note   Disables one or more of the following: | ||||||
|  |           - event counters (0-30) | ||||||
|  |           - cycle counter | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_PMU_CNTR_Disable(uint32_t mask) | ||||||
|  | { | ||||||
|  |   PMU->CNTENCLR = mask; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief  Read cycle counter | ||||||
|  |   \return                 Cycle count | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE uint32_t ARM_PMU_Get_CCNTR(void) | ||||||
|  | { | ||||||
|  |   return PMU->CCNTR; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief   Read event counter | ||||||
|  |   \param [in]     num     Event counter (0-30) to read | ||||||
|  |   \return                 Event count | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE uint32_t ARM_PMU_Get_EVCNTR(uint32_t num) | ||||||
|  | { | ||||||
|  |   return PMU_EVCNTR_CNT_Msk & PMU->EVCNTR[num]; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief   Read counter overflow status | ||||||
|  |   \return  Counter overflow status bits for the following: | ||||||
|  |           - event counters (0-30) | ||||||
|  |           - cycle counter | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE uint32_t ARM_PMU_Get_CNTR_OVS(void) | ||||||
|  | { | ||||||
|  |   return PMU->OVSSET;	 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief   Clear counter overflow status | ||||||
|  |   \param [in]     mask    Counter overflow status bits to clear | ||||||
|  |   \note    Clears overflow status bits for one or more of the following: | ||||||
|  |            - event counters (0-30) | ||||||
|  |            - cycle counter | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_PMU_Set_CNTR_OVS(uint32_t mask) | ||||||
|  | { | ||||||
|  |   PMU->OVSCLR = mask; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief   Enable counter overflow interrupt request  | ||||||
|  |   \param [in]     mask    Counter overflow interrupt request bits to set | ||||||
|  |   \note    Sets overflow interrupt request bits for one or more of the following: | ||||||
|  |            - event counters (0-30) | ||||||
|  |            - cycle counter | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_PMU_Set_CNTR_IRQ_Enable(uint32_t mask) | ||||||
|  | { | ||||||
|  |   PMU->INTENSET = mask; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief   Disable counter overflow interrupt request  | ||||||
|  |   \param [in]     mask    Counter overflow interrupt request bits to clear | ||||||
|  |   \note    Clears overflow interrupt request bits for one or more of the following: | ||||||
|  |            - event counters (0-30) | ||||||
|  |            - cycle counter | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_PMU_Set_CNTR_IRQ_Disable(uint32_t mask) | ||||||
|  | { | ||||||
|  |   PMU->INTENCLR = mask; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |   \brief   Software increment event counter  | ||||||
|  |   \param [in]     mask    Counters to increment | ||||||
|  |   \note    Software increment bits for one or more event counters (0-30) | ||||||
|  | */ | ||||||
|  | __STATIC_INLINE void ARM_PMU_CNTR_Increment(uint32_t mask) | ||||||
|  | { | ||||||
|  |   PMU->SWINC = mask; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #endif | ||||||
							
								
								
									
										70
									
								
								Drivers/CMSIS/Include/tz_context.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								Drivers/CMSIS/Include/tz_context.h
									
									
									
									
									
										Normal file
									
								
							| @@ -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 <stdint.h> | ||||||
|  |   | ||||||
|  | #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 | ||||||
							
								
								
									
										201
									
								
								Drivers/CMSIS/LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										201
									
								
								Drivers/CMSIS/LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,201 @@ | |||||||
|  |                                  Apache License | ||||||
|  |                            Version 2.0, January 2004 | ||||||
|  |                         http://www.apache.org/licenses/ | ||||||
|  |  | ||||||
|  |    TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||||||
|  |  | ||||||
|  |    1. Definitions. | ||||||
|  |  | ||||||
|  |       "License" shall mean the terms and conditions for use, reproduction, | ||||||
|  |       and distribution as defined by Sections 1 through 9 of this document. | ||||||
|  |  | ||||||
|  |       "Licensor" shall mean the copyright owner or entity authorized by | ||||||
|  |       the copyright owner that is granting the License. | ||||||
|  |  | ||||||
|  |       "Legal Entity" shall mean the union of the acting entity and all | ||||||
|  |       other entities that control, are controlled by, or are under common | ||||||
|  |       control with that entity. For the purposes of this definition, | ||||||
|  |       "control" means (i) the power, direct or indirect, to cause the | ||||||
|  |       direction or management of such entity, whether by contract or | ||||||
|  |       otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||||||
|  |       outstanding shares, or (iii) beneficial ownership of such entity. | ||||||
|  |  | ||||||
|  |       "You" (or "Your") shall mean an individual or Legal Entity | ||||||
|  |       exercising permissions granted by this License. | ||||||
|  |  | ||||||
|  |       "Source" form shall mean the preferred form for making modifications, | ||||||
|  |       including but not limited to software source code, documentation | ||||||
|  |       source, and configuration files. | ||||||
|  |  | ||||||
|  |       "Object" form shall mean any form resulting from mechanical | ||||||
|  |       transformation or translation of a Source form, including but | ||||||
|  |       not limited to compiled object code, generated documentation, | ||||||
|  |       and conversions to other media types. | ||||||
|  |  | ||||||
|  |       "Work" shall mean the work of authorship, whether in Source or | ||||||
|  |       Object form, made available under the License, as indicated by a | ||||||
|  |       copyright notice that is included in or attached to the work | ||||||
|  |       (an example is provided in the Appendix below). | ||||||
|  |  | ||||||
|  |       "Derivative Works" shall mean any work, whether in Source or Object | ||||||
|  |       form, that is based on (or derived from) the Work and for which the | ||||||
|  |       editorial revisions, annotations, elaborations, or other modifications | ||||||
|  |       represent, as a whole, an original work of authorship. For the purposes | ||||||
|  |       of this License, Derivative Works shall not include works that remain | ||||||
|  |       separable from, or merely link (or bind by name) to the interfaces of, | ||||||
|  |       the Work and Derivative Works thereof. | ||||||
|  |  | ||||||
|  |       "Contribution" shall mean any work of authorship, including | ||||||
|  |       the original version of the Work and any modifications or additions | ||||||
|  |       to that Work or Derivative Works thereof, that is intentionally | ||||||
|  |       submitted to Licensor for inclusion in the Work by the copyright owner | ||||||
|  |       or by an individual or Legal Entity authorized to submit on behalf of | ||||||
|  |       the copyright owner. For the purposes of this definition, "submitted" | ||||||
|  |       means any form of electronic, verbal, or written communication sent | ||||||
|  |       to the Licensor or its representatives, including but not limited to | ||||||
|  |       communication on electronic mailing lists, source code control systems, | ||||||
|  |       and issue tracking systems that are managed by, or on behalf of, the | ||||||
|  |       Licensor for the purpose of discussing and improving the Work, but | ||||||
|  |       excluding communication that is conspicuously marked or otherwise | ||||||
|  |       designated in writing by the copyright owner as "Not a Contribution." | ||||||
|  |  | ||||||
|  |       "Contributor" shall mean Licensor and any individual or Legal Entity | ||||||
|  |       on behalf of whom a Contribution has been received by Licensor and | ||||||
|  |       subsequently incorporated within the Work. | ||||||
|  |  | ||||||
|  |    2. Grant of Copyright License. Subject to the terms and conditions of | ||||||
|  |       this License, each Contributor hereby grants to You a perpetual, | ||||||
|  |       worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||||||
|  |       copyright license to reproduce, prepare Derivative Works of, | ||||||
|  |       publicly display, publicly perform, sublicense, and distribute the | ||||||
|  |       Work and such Derivative Works in Source or Object form. | ||||||
|  |  | ||||||
|  |    3. Grant of Patent License. Subject to the terms and conditions of | ||||||
|  |       this License, each Contributor hereby grants to You a perpetual, | ||||||
|  |       worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||||||
|  |       (except as stated in this section) patent license to make, have made, | ||||||
|  |       use, offer to sell, sell, import, and otherwise transfer the Work, | ||||||
|  |       where such license applies only to those patent claims licensable | ||||||
|  |       by such Contributor that are necessarily infringed by their | ||||||
|  |       Contribution(s) alone or by combination of their Contribution(s) | ||||||
|  |       with the Work to which such Contribution(s) was submitted. If You | ||||||
|  |       institute patent litigation against any entity (including a | ||||||
|  |       cross-claim or counterclaim in a lawsuit) alleging that the Work | ||||||
|  |       or a Contribution incorporated within the Work constitutes direct | ||||||
|  |       or contributory patent infringement, then any patent licenses | ||||||
|  |       granted to You under this License for that Work shall terminate | ||||||
|  |       as of the date such litigation is filed. | ||||||
|  |  | ||||||
|  |    4. Redistribution. You may reproduce and distribute copies of the | ||||||
|  |       Work or Derivative Works thereof in any medium, with or without | ||||||
|  |       modifications, and in Source or Object form, provided that You | ||||||
|  |       meet the following conditions: | ||||||
|  |  | ||||||
|  |       (a) You must give any other recipients of the Work or | ||||||
|  |           Derivative Works a copy of this License; and | ||||||
|  |  | ||||||
|  |       (b) You must cause any modified files to carry prominent notices | ||||||
|  |           stating that You changed the files; and | ||||||
|  |  | ||||||
|  |       (c) You must retain, in the Source form of any Derivative Works | ||||||
|  |           that You distribute, all copyright, patent, trademark, and | ||||||
|  |           attribution notices from the Source form of the Work, | ||||||
|  |           excluding those notices that do not pertain to any part of | ||||||
|  |           the Derivative Works; and | ||||||
|  |  | ||||||
|  |       (d) If the Work includes a "NOTICE" text file as part of its | ||||||
|  |           distribution, then any Derivative Works that You distribute must | ||||||
|  |           include a readable copy of the attribution notices contained | ||||||
|  |           within such NOTICE file, excluding those notices that do not | ||||||
|  |           pertain to any part of the Derivative Works, in at least one | ||||||
|  |           of the following places: within a NOTICE text file distributed | ||||||
|  |           as part of the Derivative Works; within the Source form or | ||||||
|  |           documentation, if provided along with the Derivative Works; or, | ||||||
|  |           within a display generated by the Derivative Works, if and | ||||||
|  |           wherever such third-party notices normally appear. The contents | ||||||
|  |           of the NOTICE file are for informational purposes only and | ||||||
|  |           do not modify the License. You may add Your own attribution | ||||||
|  |           notices within Derivative Works that You distribute, alongside | ||||||
|  |           or as an addendum to the NOTICE text from the Work, provided | ||||||
|  |           that such additional attribution notices cannot be construed | ||||||
|  |           as modifying the License. | ||||||
|  |  | ||||||
|  |       You may add Your own copyright statement to Your modifications and | ||||||
|  |       may provide additional or different license terms and conditions | ||||||
|  |       for use, reproduction, or distribution of Your modifications, or | ||||||
|  |       for any such Derivative Works as a whole, provided Your use, | ||||||
|  |       reproduction, and distribution of the Work otherwise complies with | ||||||
|  |       the conditions stated in this License. | ||||||
|  |  | ||||||
|  |    5. Submission of Contributions. Unless You explicitly state otherwise, | ||||||
|  |       any Contribution intentionally submitted for inclusion in the Work | ||||||
|  |       by You to the Licensor shall be under the terms and conditions of | ||||||
|  |       this License, without any additional terms or conditions. | ||||||
|  |       Notwithstanding the above, nothing herein shall supersede or modify | ||||||
|  |       the terms of any separate license agreement you may have executed | ||||||
|  |       with Licensor regarding such Contributions. | ||||||
|  |  | ||||||
|  |    6. Trademarks. This License does not grant permission to use the trade | ||||||
|  |       names, trademarks, service marks, or product names of the Licensor, | ||||||
|  |       except as required for reasonable and customary use in describing the | ||||||
|  |       origin of the Work and reproducing the content of the NOTICE file. | ||||||
|  |  | ||||||
|  |    7. Disclaimer of Warranty. Unless required by applicable law or | ||||||
|  |       agreed to in writing, Licensor provides the Work (and each | ||||||
|  |       Contributor provides its Contributions) on an "AS IS" BASIS, | ||||||
|  |       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||||||
|  |       implied, including, without limitation, any warranties or conditions | ||||||
|  |       of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||||||
|  |       PARTICULAR PURPOSE. You are solely responsible for determining the | ||||||
|  |       appropriateness of using or redistributing the Work and assume any | ||||||
|  |       risks associated with Your exercise of permissions under this License. | ||||||
|  |  | ||||||
|  |    8. Limitation of Liability. In no event and under no legal theory, | ||||||
|  |       whether in tort (including negligence), contract, or otherwise, | ||||||
|  |       unless required by applicable law (such as deliberate and grossly | ||||||
|  |       negligent acts) or agreed to in writing, shall any Contributor be | ||||||
|  |       liable to You for damages, including any direct, indirect, special, | ||||||
|  |       incidental, or consequential damages of any character arising as a | ||||||
|  |       result of this License or out of the use or inability to use the | ||||||
|  |       Work (including but not limited to damages for loss of goodwill, | ||||||
|  |       work stoppage, computer failure or malfunction, or any and all | ||||||
|  |       other commercial damages or losses), even if such Contributor | ||||||
|  |       has been advised of the possibility of such damages. | ||||||
|  |  | ||||||
|  |    9. Accepting Warranty or Additional Liability. While redistributing | ||||||
|  |       the Work or Derivative Works thereof, You may choose to offer, | ||||||
|  |       and charge a fee for, acceptance of support, warranty, indemnity, | ||||||
|  |       or other liability obligations and/or rights consistent with this | ||||||
|  |       License. However, in accepting such obligations, You may act only | ||||||
|  |       on Your own behalf and on Your sole responsibility, not on behalf | ||||||
|  |       of any other Contributor, and only if You agree to indemnify, | ||||||
|  |       defend, and hold each Contributor harmless for any liability | ||||||
|  |       incurred by, or claims asserted against, such Contributor by reason | ||||||
|  |       of your accepting any such warranty or additional liability. | ||||||
|  |  | ||||||
|  |    END OF TERMS AND CONDITIONS | ||||||
|  |  | ||||||
|  |    APPENDIX: How to apply the Apache License to your work. | ||||||
|  |  | ||||||
|  |       To apply the Apache License to your work, attach the following | ||||||
|  |       boilerplate notice, with the fields enclosed by brackets "{}" | ||||||
|  |       replaced with your own identifying information. (Don't include | ||||||
|  |       the brackets!)  The text should be enclosed in the appropriate | ||||||
|  |       comment syntax for the file format. We also recommend that a | ||||||
|  |       file or class name and description of purpose be included on the | ||||||
|  |       same "printed page" as the copyright notice for easier | ||||||
|  |       identification within third-party archives. | ||||||
|  |  | ||||||
|  |    Copyright {yyyy} {name of copyright owner} | ||||||
|  |  | ||||||
|  |    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. | ||||||
							
								
								
									
										4422
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4422
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										934
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										934
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,934 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   This file contains all the functions prototypes for the HAL | ||||||
|  |   *          module driver. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef __STM32H5xx_HAL_H | ||||||
|  | #define __STM32H5xx_HAL_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal_conf.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup HAL | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported types ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup HAL_Exported_Types HAL Exported Types | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @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 variables --------------------------------------------------------*/ | ||||||
|  | /** @defgroup HAL_Exported_Variables HAL Exported Variables | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | extern __IO uint32_t            uwTick; | ||||||
|  | extern uint32_t                 uwTickPrio; | ||||||
|  | extern HAL_TickFreqTypeDef      uwTickFreq; | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported constants --------------------------------------------------------*/ | ||||||
|  | /** @defgroup SBS_Exported_Constants SBS Exported Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup SBS_FPU_Interrupts FPU Interrupts | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_IT_FPU_IOC              SBS_FPUIMR_FPU_IE_0  /*!< Floating Point Unit Invalid operation Interrupt */ | ||||||
|  | #define SBS_IT_FPU_DZC              SBS_FPUIMR_FPU_IE_1  /*!< Floating Point Unit Divide-by-zero Interrupt */ | ||||||
|  | #define SBS_IT_FPU_UFC              SBS_FPUIMR_FPU_IE_2  /*!< Floating Point Unit Underflow Interrupt */ | ||||||
|  | #define SBS_IT_FPU_OFC              SBS_FPUIMR_FPU_IE_3  /*!< Floating Point Unit Overflow Interrupt */ | ||||||
|  | #define SBS_IT_FPU_IDC              SBS_FPUIMR_FPU_IE_4  /*!< Floating Point Unit Input denormal Interrupt */ | ||||||
|  | #define SBS_IT_FPU_IXC              SBS_FPUIMR_FPU_IE_5  /*!< Floating Point Unit Inexact Interrupt */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup SBS_BREAK_CONFIG SBS Break Config | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_BREAK_FLASH_ECC         SBS_CFGR2_ECCL  /*!< Enable and lock the FLASH ECC double error with TIM1/8/15/16/17 | ||||||
|  |                                                          Break inputs.*/ | ||||||
|  | #define SBS_BREAK_PVD               SBS_CFGR2_PVDL  /*!< Enable and lock the PVD connection with TIM1/8/15/16/17 | ||||||
|  |                                                          Break inputs. */ | ||||||
|  | #define SBS_BREAK_SRAM_ECC          SBS_CFGR2_SEL   /*!< Enable and lock the SRAM ECC double error signal with | ||||||
|  |                                                          TIM1/8/15/16/17 Break inputs.*/ | ||||||
|  | #define SBS_BREAK_LOCKUP            SBS_CFGR2_CLL   /*!< Enable and lock the connection of Cortex-M33 LOCKUP (hardfault) | ||||||
|  |                                                          output to TIM1/8/15/16/17 Break inputs.*/ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(VREFBUF) | ||||||
|  | /** @defgroup VREFBUF_VoltageScale VREFBUF Voltage Scale | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define VREFBUF_VOLTAGE_SCALE0    ((uint32_t)0x00000000)                   /*!< Voltage reference scale 0 (VREF_OUT1) */ | ||||||
|  | #define VREFBUF_VOLTAGE_SCALE1    VREFBUF_CSR_VRS_0                        /*!< Voltage reference scale 1 (VREF_OUT2) */ | ||||||
|  | #define VREFBUF_VOLTAGE_SCALE2    VREFBUF_CSR_VRS_1                        /*!< Voltage reference scale 2 (VREF_OUT3) */ | ||||||
|  | #define VREFBUF_VOLTAGE_SCALE3    (VREFBUF_CSR_VRS_0 | VREFBUF_CSR_VRS_1)  /*!< Voltage reference scale 3 (VREF_OUT4) */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup VREFBUF_HighImpedance VREFBUF High Impedance | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define VREFBUF_HIGH_IMPEDANCE_DISABLE  ((uint32_t)0x00000000)             /*!< VREF_plus pin is internally connected to | ||||||
|  |                                                                                 Voltage reference buffer output */ | ||||||
|  | #define VREFBUF_HIGH_IMPEDANCE_ENABLE   VREFBUF_CSR_HIZ                    /*!< VREF_plus pin is high impedance */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /* VREFBUF */ | ||||||
|  |  | ||||||
|  | /** @defgroup SBS_FastModePlus_GPIO Fast-mode Plus on GPIO | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @brief  Fast-mode Plus driving capability on a specific GPIO | ||||||
|  |   */ | ||||||
|  | #define SBS_FASTMODEPLUS_PB6        SBS_PMCR_PB6_FMP  /*!< Enable Fast-mode Plus on PB6 */ | ||||||
|  | #define SBS_FASTMODEPLUS_PB7        SBS_PMCR_PB7_FMP  /*!< Enable Fast-mode Plus on PB7 */ | ||||||
|  | #define SBS_FASTMODEPLUS_PB8        SBS_PMCR_PB8_FMP  /*!< Enable Fast-mode Plus on PB8 */ | ||||||
|  | #if defined(SBS_PMCR_PB9_FMP) | ||||||
|  | #define SBS_FASTMODEPLUS_PB9        SBS_PMCR_PB9_FMP  /*!< Enable Fast-mode Plus on PB9 */ | ||||||
|  | #endif /* SBS_PMCR_PB9_FMP */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(SBS_PMCR_ETH_SEL_PHY) | ||||||
|  | /** @defgroup SBS_Ethernet_Config  Ethernet Config | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_ETH_MII             ((uint32_t)0x00000000)     /*!< Select the Media Independent Interface (MII) or GMII  */ | ||||||
|  | #define SBS_ETH_RMII            SBS_PMCR_ETH_SEL_PHY_2     /*!< Select the Reduced Media Independent Interface (RMII) */ | ||||||
|  |  | ||||||
|  | #define IS_SBS_ETHERNET_CONFIG(CONFIG) (((CONFIG) == SBS_ETH_MII)        || \ | ||||||
|  |                                         ((CONFIG) == SBS_ETH_RMII)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /* SBS_PMCR_ETH_SEL_PHY */ | ||||||
|  |  | ||||||
|  | /** @defgroup SBS_Memories_Erase_Flag_Status  Memory Erase Flags Status | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_MEMORIES_ERASE_FLAG_IPMEE     SBS_MESR_IPMEE    /*!< Select the Status of End Of Erase for ICACHE | ||||||
|  |                                                                  and PKA RAMs */ | ||||||
|  | #define SBS_MEMORIES_ERASE_FLAG_MCLR      SBS_MESR_MCLR     /*!< Select the Status of Erase after Power-on Reset | ||||||
|  |                                                                 (SRAM2, BKPRAM, ICACHE, DCACHE, PKA rams) */ | ||||||
|  |  | ||||||
|  | #define IS_SBS_MEMORIES_ERASE_FLAG(FLAG) (((FLAG) == SBS_MEMORIES_ERASE_FLAG_IPMEE)        || \ | ||||||
|  |                                           ((FLAG) == SBS_MEMORIES_ERASE_FLAG_MCLR)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup SBS_IOCompenstionCell_Config  IOCompenstionCell Config | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_VDD_CELL_CODE                ((uint32_t)0x00000000)  /*!< Select Code from the cell */ | ||||||
|  | #define SBS_VDD_REGISTER_CODE             SBS_CCCSR_CS1        /*!< Code from the SBS compensation cell code register */ | ||||||
|  |  | ||||||
|  | #define IS_SBS_VDD_CODE_SELECT(SELECT)   (((SELECT) == SBS_VDD_CELL_CODE)|| \ | ||||||
|  |                                           ((SELECT) == SBS_VDD_REGISTER_CODE)) | ||||||
|  |  | ||||||
|  | #define SBS_VDDIO_CELL_CODE              ((uint32_t)0x00000000)  /*!< Select Code from the cell */ | ||||||
|  | #define SBS_VDDIO_REGISTER_CODE           SBS_CCCSR_CS2        /*!< Code from the SBS compensation cell code register */ | ||||||
|  |  | ||||||
|  | #define IS_SBS_VDDIO_CODE_SELECT(SELECT) (((SELECT) == SBS_VDDIO_CELL_CODE)|| \ | ||||||
|  |                                           ((SELECT) == SBS_VDDIO_REGISTER_CODE)) | ||||||
|  |  | ||||||
|  | #define IS_SBS_CODE_CONFIG(CONFIG) ((CONFIG) < (0x10UL)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(SBS_EPOCHSELCR_EPOCH_SEL) | ||||||
|  | /** @defgroup SBS_EPOCH_Selection  EPOCH Selection | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_EPOCH_SEL_NONSECURE          0x0UL                         /*!< EPOCH non secure selected */ | ||||||
|  | #define SBS_EPOCH_SEL_SECURE             SBS_EPOCHSELCR_EPOCH_SEL_0    /*!< EPOCH secure selected */ | ||||||
|  | #define SBS_EPOCH_SEL_PUFCHECK           SBS_EPOCHSELCR_EPOCH_SEL_1    /*!< EPOCH all zeros for PUF integrity check */ | ||||||
|  |  | ||||||
|  | #define IS_SBS_EPOCH_SELECTION(SELECT) (((SELECT) == SBS_EPOCH_SEL_SECURE)    || \ | ||||||
|  |                                         ((SELECT) == SBS_EPOCH_SEL_NONSECURE) || \ | ||||||
|  |                                         ((SELECT) == SBS_EPOCH_SEL_PUFCHECK)) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /* SBS_EPOCHSELCR_EPOCH_SEL */ | ||||||
|  |  | ||||||
|  | #if defined(SBS_NEXTHDPLCR_NEXTHDPL) | ||||||
|  | /** @defgroup SBS_NextHDPL_Selection  Next HDPL Selection | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_OBKHDPL_INCR_0                   0x00U                      /*!< Index to add to the current HDPL to point (through OBK-HDPL) to the next secure storage areas */ | ||||||
|  | #define SBS_OBKHDPL_INCR_1                   SBS_NEXTHDPLCR_NEXTHDPL_0  /*!< Index to add to the current HDPL to point (through OBK-HDPL) to the next secure storage areas */ | ||||||
|  | #define SBS_OBKHDPL_INCR_2                   SBS_NEXTHDPLCR_NEXTHDPL_1  /*!< Index to add to the current HDPL to point (through OBK-HDPL) to the next secure storage areas */ | ||||||
|  | #define SBS_OBKHDPL_INCR_3                   SBS_NEXTHDPLCR_NEXTHDPL    /*!< Index to add to the current HDPL to point (through OBK-HDPL) to the next secure storage areas */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /* SBS_NEXTHDPLCR_NEXTHDPL */ | ||||||
|  |  | ||||||
|  | /** @defgroup SBS_HDPL_Value  HDPL Value | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_HDPL_VALUE_0                     0x000000B4U   /*!< Hide protection level 0 */ | ||||||
|  | #define SBS_HDPL_VALUE_1                     0x00000051U   /*!< Hide protection level 1 */ | ||||||
|  | #define SBS_HDPL_VALUE_2                     0x0000008AU   /*!< Hide protection level 2 */ | ||||||
|  | #define SBS_HDPL_VALUE_3                     0x0000006FU   /*!< Hide protection level 3 */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(SBS_DBGCR_DBG_AUTH_SEC) | ||||||
|  | /** @defgroup SBS_DEBUG_SEC_Value  Debug sec Value | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_DEBUG_SEC_NSEC                   0x000000B4U   /*!< Debug opening for secure and non-secure */ | ||||||
|  | #define SBS_DEBUG_NSEC                       0x0000003CU   /*!< Debug opening for non-secure only */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /* SBS_DBGCR_DBG_AUTH_SEC */ | ||||||
|  |  | ||||||
|  | /** @defgroup SBS_Lock_items SBS Lock items | ||||||
|  |   * @brief SBS items to set lock on | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_MPU_NSEC                SBS_CNSLCKR_LOCKNSMPU            /*!< Non-secure MPU lock (privileged secure or | ||||||
|  |                                                                           non-secure only) */ | ||||||
|  | #define SBS_VTOR_NSEC               SBS_CNSLCKR_LOCKNSVTOR           /*!< Non-secure VTOR lock (privileged secure or | ||||||
|  |                                                                           non-secure only) */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | #define SBS_SAU                     (SBS_CSLCKR_LOCKSAU << 16U)      /*!< SAU lock (privileged secure code only) */ | ||||||
|  | #define SBS_MPU_SEC                 (SBS_CSLCKR_LOCKSMPU << 16U)     /*!< Secure MPU lock (privileged secure code only) | ||||||
|  |                                                                       */ | ||||||
|  | #define SBS_VTOR_AIRCR_SEC          (SBS_CSLCKR_LOCKSVTAIRCR << 16U) /*!< VTOR_S and AIRCR lock (privileged secure | ||||||
|  |                                                                           code only) */ | ||||||
|  | #define SBS_LOCK_ALL                (SBS_MPU_NSEC|SBS_VTOR_NSEC|SBS_SAU|SBS_MPU_SEC|SBS_VTOR_AIRCR_SEC)  /*!< All */ | ||||||
|  | #else | ||||||
|  | #define SBS_LOCK_ALL                (SBS_MPU_NSEC|SBS_VTOR_NSEC)     /*!< All (privileged secure or non-secure only) */ | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup SBS_Attributes_items SBS Attributes items | ||||||
|  |   * @brief SBS items to configure secure or non-secure attributes on | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_CLK                     SBS_SECCFGR_SBSSEC      /*!< SBS clock control */ | ||||||
|  | #define SBS_CLASSB                  SBS_SECCFGR_CLASSBSEC   /*!< Class B */ | ||||||
|  | #define SBS_FPU                     SBS_SECCFGR_FPUSEC      /*!< FPU */ | ||||||
|  | #define SBS_ALL                     (SBS_CLK | SBS_CLASSB | SBS_FPU) /*!< All */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup SBS_attributes SBS attributes | ||||||
|  |   * @brief SBS secure or non-secure attributes | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SBS_SEC                     0x00000001U   /*!< Secure attribute      */ | ||||||
|  | #define SBS_NSEC                    0x00000000U   /*!< Non-secure attribute  */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported macros -----------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup DBGMCU_Exported_Macros DBGMCU Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @brief  Freeze/Unfreeze Peripherals in Debug mode | ||||||
|  |   */ | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_TIM2_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM2()           SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM2_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM2()         CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM2_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_TIM2_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_TIM3_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM3()           SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM3_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM3()         CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM3_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_TIM3_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_TIM4_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM4()           SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM4_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM4()         CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM4_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_TIM4_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_TIM5_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM5()           SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM5_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM5()         CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM5_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_TIM5_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_TIM6_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM6()           SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM6_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM6()         CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM6_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_TIM6_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_TIM7_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM7()           SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM7_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM7()         CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM7_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_TIM7_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_TIM12_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM12()           SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM12_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM12()         CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM12_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_TIM12_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_TIM13_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM13()           SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM13_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM13()         CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM13_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_TIM13_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_TIM14_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM14()           SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM14_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM14()         CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_TIM14_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_TIM14_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_WWDG_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_WWDG()           SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_WWDG_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_WWDG()         CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_WWDG_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_WWDG_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_IWDG_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_IWDG()           SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_IWDG_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_IWDG()         CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_IWDG_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_IWDG_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_I2C1_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_I2C1()              SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_I2C1_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_I2C1()            CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_I2C1_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_I2C1_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_I2C2_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_I2C2()              SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_I2C2_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_I2C2()            CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_I2C2_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_I2C2_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR1_DBG_I3C1_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_I3C1()              SET_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_I3C1_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_I3C1()            CLEAR_BIT(DBGMCU->APB1FZR1, DBGMCU_APB1FZR1_DBG_I3C1_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR1_DBG_I3C1_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB1FZR2_DBG_LPTIM2_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_LPTIM2()            SET_BIT(DBGMCU->APB1FZR2, DBGMCU_APB1FZR2_DBG_LPTIM2_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_LPTIM2()          CLEAR_BIT(DBGMCU->APB1FZR2, DBGMCU_APB1FZR2_DBG_LPTIM2_STOP) | ||||||
|  | #endif /* DBGMCU_APB1FZR2_DBG_LPTIM2_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB2FZR_DBG_TIM1_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM1()              SET_BIT(DBGMCU->APB2FZR, DBGMCU_APB2FZR_DBG_TIM1_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM1()            CLEAR_BIT(DBGMCU->APB2FZR, DBGMCU_APB2FZR_DBG_TIM1_STOP) | ||||||
|  | #endif /* DBGMCU_APB2FZR_DBG_TIM1_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB2FZR_DBG_TIM8_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM8()              SET_BIT(DBGMCU->APB2FZR, DBGMCU_APB2FZR_DBG_TIM8_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM8()            CLEAR_BIT(DBGMCU->APB2FZR, DBGMCU_APB2FZR_DBG_TIM8_STOP) | ||||||
|  | #endif /* DBGMCU_APB2FZR_DBG_TIM8_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB2FZR_DBG_TIM15_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM15()             SET_BIT(DBGMCU->APB2FZR, DBGMCU_APB2FZR_DBG_TIM15_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM15()           CLEAR_BIT(DBGMCU->APB2FZR, DBGMCU_APB2FZR_DBG_TIM15_STOP) | ||||||
|  | #endif /* DBGMCU_APB2FZR_DBG_TIM15_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB2FZR_DBG_TIM16_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM16()             SET_BIT(DBGMCU->APB2FZR, DBGMCU_APB2FZR_DBG_TIM16_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM16()           CLEAR_BIT(DBGMCU->APB2FZR, DBGMCU_APB2FZR_DBG_TIM16_STOP) | ||||||
|  | #endif /* DBGMCU_APB2FZR_DBG_TIM16_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB2FZR_DBG_TIM17_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_TIM17()             SET_BIT(DBGMCU->APB2FZR, DBGMCU_APB2FZR_DBG_TIM17_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_TIM17()           CLEAR_BIT(DBGMCU->APB2FZR, DBGMCU_APB2FZR_DBG_TIM17_STOP) | ||||||
|  | #endif /* DBGMCU_APB2FZR_DBG_TIM17_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB3FZR_DBG_I2C3_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_I2C3()              SET_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_I2C3_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_I2C3()            CLEAR_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_I2C3_STOP) | ||||||
|  | #endif /* DBGMCU_APB3FZR_DBG_I2C3_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB3FZR_DBG_I2C4_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_I2C4()              SET_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_I2C4_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_I2C4()            CLEAR_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_I2C4_STOP) | ||||||
|  | #endif /* DBGMCU_APB3FZR_DBG_I2C4_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB3FZR_DBG_I3C2_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_I3C2()            SET_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_I3C2_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_I3C2()          CLEAR_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_I3C2_STOP) | ||||||
|  | #endif /* DBGMCU_APB3FZR_DBG_I3C2_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB3FZR_DBG_LPTIM1_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_LPTIM1()            SET_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_LPTIM1_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_LPTIM1()          CLEAR_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_LPTIM1_STOP) | ||||||
|  | #endif /* DBGMCU_APB3FZR_DBG_LPTIM1_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB3FZR_DBG_LPTIM3_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_LPTIM3()            SET_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_LPTIM3_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_LPTIM3()          CLEAR_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_LPTIM3_STOP) | ||||||
|  | #endif /* DBGMCU_APB3FZR_DBG_LPTIM3_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB3FZR_DBG_LPTIM4_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_LPTIM4()            SET_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_LPTIM4_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_LPTIM4()          CLEAR_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_LPTIM4_STOP) | ||||||
|  | #endif /* DBGMCU_APB3FZR_DBG_LPTIM4_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB3FZR_DBG_LPTIM5_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_LPTIM5()            SET_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_LPTIM5_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_LPTIM5()          CLEAR_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_LPTIM5_STOP) | ||||||
|  | #endif /* DBGMCU_APB3FZR_DBG_LPTIM5_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB3FZR_DBG_LPTIM6_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_LPTIM6()            SET_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_LPTIM6_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_LPTIM6()          CLEAR_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_LPTIM6_STOP) | ||||||
|  | #endif /* DBGMCU_APB3FZR_DBG_LPTIM6_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_APB3FZR_DBG_RTC_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_RTC()               SET_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_RTC_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_RTC()             CLEAR_BIT(DBGMCU->APB3FZR, DBGMCU_APB3FZR_DBG_RTC_STOP) | ||||||
|  | #endif /* DBGMCU_APB3FZR_DBG_RTC_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH0_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_0()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH0_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_0()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH0_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH0_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH1_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_1()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH1_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_1()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH1_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH1_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH2_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_2()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH2_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_2()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH2_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH2_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH3_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_3()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH3_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_3()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH3_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH3_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH4_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_4()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH4_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_4()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH4_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH4_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH5_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_5()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH5_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_5()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH5_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH5_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH6_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_6()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH6_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_6()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH6_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH6_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH7_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_7()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH7_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_7()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH7_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH7_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH8_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_8()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH8_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_8()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH8_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH8_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH9_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_9()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH9_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_9()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH9_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH9_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH10_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_10()           SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH10_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_10()         CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH10_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH10_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA1_CH11_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA1_11()           SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH11_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA1_11()         CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA1_CH11_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA1_CH11_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH0_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_0()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH0_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_0()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH0_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH0_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH1_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_1()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH1_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_1()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH1_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH1_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH2_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_2()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH2_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_2()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH2_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH2_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH3_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_3()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH3_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_3()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH3_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH3_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH4_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_4()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH4_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_4()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH4_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH4_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH5_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_5()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH5_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_5()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH5_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH5_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH6_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_6()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH6_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_6()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH6_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH6_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH7_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_7()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH7_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_7()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH7_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH7_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH8_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_8()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH8_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_8()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH8_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH8_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH9_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_9()            SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH9_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_9()          CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH9_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH9_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH10_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_10()           SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH10_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_10()         CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH10_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH10_STOP */ | ||||||
|  |  | ||||||
|  | #if defined(DBGMCU_AHB1FZR_DBG_GPDMA2_CH11_STOP) | ||||||
|  | #define __HAL_DBGMCU_FREEZE_GPDMA2_11()           SET_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH11_STOP) | ||||||
|  | #define __HAL_DBGMCU_UNFREEZE_GPDMA2_11()         CLEAR_BIT(DBGMCU->AHB1FZR, DBGMCU_AHB1FZR_DBG_GPDMA2_CH11_STOP) | ||||||
|  | #endif /* DBGMCU_AHB1FZR_DBG_GPDMA2_CH11_STOP */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup SBS_Exported_Macros SBS Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @brief  Floating Point Unit interrupt enable/disable macros | ||||||
|  |   * @param __INTERRUPT__: This parameter can be a value of @ref SBS_FPU_Interrupts | ||||||
|  |   */ | ||||||
|  | #define __HAL_SBS_FPU_INTERRUPT_ENABLE(__INTERRUPT__)    do {assert_param(IS_SBS_FPU_INTERRUPT((__INTERRUPT__)));\ | ||||||
|  |                                                                 SET_BIT(SBS->FPUIMR, (__INTERRUPT__));\ | ||||||
|  |                                                             }while(0) | ||||||
|  |  | ||||||
|  | #define __HAL_SBS_FPU_INTERRUPT_DISABLE(__INTERRUPT__)   do {assert_param(IS_SBS_FPU_INTERRUPT((__INTERRUPT__)));\ | ||||||
|  |                                                                 CLEAR_BIT(SBS->FPUIMR, (__INTERRUPT__));\ | ||||||
|  |                                                             }while(0) | ||||||
|  |  | ||||||
|  | /** @brief  SBS Break ECC lock. | ||||||
|  |   *         Enable and lock the connection of Flash ECC error connection to TIM1/8/15/16/17 Break input. | ||||||
|  |   * @note   The selected configuration is locked and can be unlocked only by system reset. | ||||||
|  |   */ | ||||||
|  | #define __HAL_SBS_BREAK_ECC_LOCK()        SET_BIT(SBS->CFGR2, SBS_CFGR2_ECCL) | ||||||
|  |  | ||||||
|  | /** @brief  SBS Break Cortex-M33 Lockup lock. | ||||||
|  |   *         Enable and lock the connection of Cortex-M33 LOCKUP (Hardfault) output to TIM1/8/15/16/17 Break input. | ||||||
|  |   * @note   The selected configuration is locked and can be unlocked only by system reset. | ||||||
|  |   */ | ||||||
|  | #define __HAL_SBS_BREAK_LOCKUP_LOCK()     SET_BIT(SBS->CFGR2, SBS_CFGR2_CLL) | ||||||
|  |  | ||||||
|  | /** @brief  SBS Break PVD lock. | ||||||
|  |   *         Enable and lock the PVD connection to Timer1/8/15/16/17 Break input, as well as the PVDE and PLS[2:0] | ||||||
|  |   *         in the PWR_CR2 register. | ||||||
|  |   * @note   The selected configuration is locked and can be unlocked only by system reset. | ||||||
|  |   */ | ||||||
|  | #define __HAL_SBS_BREAK_PVD_LOCK()        SET_BIT(SBS->CFGR2, SBS_CFGR2_PVDL) | ||||||
|  |  | ||||||
|  | /** @brief  SBS Break SRAM double ECC lock. | ||||||
|  |   *         Enable and lock the connection of SRAM double ECC error to TIM1/8/15/16/17 Break input. | ||||||
|  |   * @note   The selected configuration is locked and can be unlocked only by system reset. | ||||||
|  |   */ | ||||||
|  | #define __HAL_SBS_BREAK_SRAM_ECC_LOCK()    SET_BIT(SBS->CFGR2, SBS_CFGR2_SEL) | ||||||
|  |  | ||||||
|  | /** @brief  Fast-mode Plus driving capability enable/disable macros | ||||||
|  |   * @param __FASTMODEPLUS__: This parameter can be a value of : | ||||||
|  |   *     @arg @ref SBS_FASTMODEPLUS_PB6 Fast-mode Plus driving capability activation on PB6 | ||||||
|  |   *     @arg @ref SBS_FASTMODEPLUS_PB7 Fast-mode Plus driving capability activation on PB7 | ||||||
|  |   *     @arg @ref SBS_FASTMODEPLUS_PB8 Fast-mode Plus driving capability activation on PB8 | ||||||
|  |   *     @arg @ref SBS_FASTMODEPLUS_PB9 Fast-mode Plus driving capability activation on PB9 | ||||||
|  |   */ | ||||||
|  | #define __HAL_SBS_FASTMODEPLUS_ENABLE(__FASTMODEPLUS__)  do {assert_param(IS_SBS_FASTMODEPLUS((__FASTMODEPLUS__)));\ | ||||||
|  |                                                                 SET_BIT(SBS->PMCR, (__FASTMODEPLUS__));\ | ||||||
|  |                                                                }while(0) | ||||||
|  |  | ||||||
|  | #define __HAL_SBS_FASTMODEPLUS_DISABLE(__FASTMODEPLUS__) do {assert_param(IS_SBS_FASTMODEPLUS((__FASTMODEPLUS__)));\ | ||||||
|  |                                                                 CLEAR_BIT(SBS->PMCR, (__FASTMODEPLUS__));\ | ||||||
|  |                                                                }while(0) | ||||||
|  |  | ||||||
|  | /** @brief  Check SBS Memories Erase Status Flags. | ||||||
|  |   * @param  __FLAG__: specifies the flag to check. | ||||||
|  |   *         This parameter can be one of the following values: | ||||||
|  |   *            @arg @ref SBS_MEMORIES_ERASE_FLAG_IPMEE   Status of End Of Erase for ICACHE and PKA RAMs | ||||||
|  |   *            @arg @ref SBS_MEMORIES_ERASE_FLAG_MCLR    Status of Erase after Power-on Reset ((SRAM2, BKPRAM, | ||||||
|  |   *                                                      ICACHE, DCACHE, PKA RAMs) | ||||||
|  |   * @retval The new state of __FLAG__ (TRUE or FALSE). | ||||||
|  |   */ | ||||||
|  | #define __HAL_SBS_GET_MEMORIES_ERASE_STATUS(__FLAG__)      ((((SBS->MESR) & (__FLAG__))!= 0) ? 1 : 0) | ||||||
|  |  | ||||||
|  | /** @brief  Clear SBS Memories Erase Status Flags. | ||||||
|  |   * @param  __FLAG__: specifies the flag to clear. | ||||||
|  |   *         This parameter can be one of the following values: | ||||||
|  |   *            @arg @ref SBS_MEMORIES_ERASE_FLAG_IPMEE   Status of End Of Erase for ICACHE and PKA RAMs | ||||||
|  |   *            @arg @ref SBS_MEMORIES_ERASE_FLAG_MCLR    Status of Erase after Power-on Reset ((SRAM2, BKPRAM, | ||||||
|  |   *                                                      ICACHE, DCACHE, PKA RAMs) | ||||||
|  |   */ | ||||||
|  | #define __HAL_SBS_CLEAR_MEMORIES_ERASE_STATUS(__FLAG__)    do {assert_param(IS_SBS_MEMORIES_ERASE_FLAG((__FLAG__)));\ | ||||||
|  |                                                                 WRITE_REG(SBS->MESR, (__FLAG__));\ | ||||||
|  |                                                               }while(0) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private macros ------------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup SBS_Private_Macros SBS Private Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #define IS_SBS_FPU_INTERRUPT(__INTERRUPT__)    ((((__INTERRUPT__) & SBS_IT_FPU_IOC) == SBS_IT_FPU_IOC) || \ | ||||||
|  |                                                 (((__INTERRUPT__) & SBS_IT_FPU_DZC) == SBS_IT_FPU_DZC) || \ | ||||||
|  |                                                 (((__INTERRUPT__) & SBS_IT_FPU_UFC) == SBS_IT_FPU_UFC) || \ | ||||||
|  |                                                 (((__INTERRUPT__) & SBS_IT_FPU_OFC) == SBS_IT_FPU_OFC) || \ | ||||||
|  |                                                 (((__INTERRUPT__) & SBS_IT_FPU_IDC) == SBS_IT_FPU_IDC) || \ | ||||||
|  |                                                 (((__INTERRUPT__) & SBS_IT_FPU_IXC) == SBS_IT_FPU_IXC)) | ||||||
|  |  | ||||||
|  | #define IS_SBS_BREAK_CONFIG(__CONFIG__)    (((__CONFIG__) == SBS_BREAK_FLASH_ECC)  || \ | ||||||
|  |                                             ((__CONFIG__) == SBS_BREAK_PVD)        || \ | ||||||
|  |                                             ((__CONFIG__) == SBS_BREAK_SRAM_ECC)   || \ | ||||||
|  |                                             ((__CONFIG__) == SBS_BREAK_LOCKUP)) | ||||||
|  |  | ||||||
|  | #if defined(VREFBUF) | ||||||
|  | #define IS_VREFBUF_VOLTAGE_SCALE(__SCALE__)  (((__SCALE__) == VREFBUF_VOLTAGE_SCALE0) || \ | ||||||
|  |                                               ((__SCALE__) == VREFBUF_VOLTAGE_SCALE1) || \ | ||||||
|  |                                               ((__SCALE__) == VREFBUF_VOLTAGE_SCALE2) || \ | ||||||
|  |                                               ((__SCALE__) == VREFBUF_VOLTAGE_SCALE3)) | ||||||
|  |  | ||||||
|  | #define IS_VREFBUF_HIGH_IMPEDANCE(__VALUE__)  (((__VALUE__) == VREFBUF_HIGH_IMPEDANCE_DISABLE) || \ | ||||||
|  |                                                ((__VALUE__) == VREFBUF_HIGH_IMPEDANCE_ENABLE)) | ||||||
|  |  | ||||||
|  | #define IS_VREFBUF_TRIMMING(__VALUE__)  (((__VALUE__) > 0U) && ((__VALUE__) <= VREFBUF_CCR_TRIM)) | ||||||
|  | #endif /* VREFBUF*/ | ||||||
|  |  | ||||||
|  | #if defined(SBS_FASTMODEPLUS_PB9) | ||||||
|  | #define IS_SBS_FASTMODEPLUS(__PIN__)    ((((__PIN__) & SBS_FASTMODEPLUS_PB6) == SBS_FASTMODEPLUS_PB6) || \ | ||||||
|  |                                          (((__PIN__) & SBS_FASTMODEPLUS_PB7) == SBS_FASTMODEPLUS_PB7) || \ | ||||||
|  |                                          (((__PIN__) & SBS_FASTMODEPLUS_PB8) == SBS_FASTMODEPLUS_PB8) || \ | ||||||
|  |                                          (((__PIN__) & SBS_FASTMODEPLUS_PB9) == SBS_FASTMODEPLUS_PB9)) | ||||||
|  | #else | ||||||
|  | #define IS_SBS_FASTMODEPLUS(__PIN__)    ((((__PIN__) & SBS_FASTMODEPLUS_PB6) == SBS_FASTMODEPLUS_PB6) || \ | ||||||
|  |                                          (((__PIN__) & SBS_FASTMODEPLUS_PB7) == SBS_FASTMODEPLUS_PB7) || \ | ||||||
|  |                                          (((__PIN__) & SBS_FASTMODEPLUS_PB8) == SBS_FASTMODEPLUS_PB8)) | ||||||
|  | #endif /* SBS_FASTMODEPLUS_PB9 */ | ||||||
|  |  | ||||||
|  | #define IS_SBS_HDPL(__LEVEL__)          (((__LEVEL__) == SBS_HDPL_VALUE_0) || ((__LEVEL__) == SBS_HDPL_VALUE_1) || \ | ||||||
|  |                                          ((__LEVEL__) == SBS_HDPL_VALUE_2) || ((__LEVEL__) == SBS_HDPL_VALUE_3)) | ||||||
|  |  | ||||||
|  | #define IS_SBS_OBKHDPL_SELECTION(__SELECT__)    (((__SELECT__) == SBS_OBKHDPL_INCR_0)  || \ | ||||||
|  |                                                  ((__SELECT__) == SBS_OBKHDPL_INCR_1)  || \ | ||||||
|  |                                                  ((__SELECT__) == SBS_OBKHDPL_INCR_2)  || \ | ||||||
|  |                                                  ((__SELECT__) == SBS_OBKHDPL_INCR_3)) | ||||||
|  |  | ||||||
|  | #define IS_SBS_ITEMS_ATTRIBUTES(__ITEM__) ((((__ITEM__) & SBS_CLK)    == SBS_CLK)    || \ | ||||||
|  |                                            (((__ITEM__) & SBS_CLASSB) == SBS_CLASSB) || \ | ||||||
|  |                                            (((__ITEM__) & SBS_FPU)    == SBS_FPU)    || \ | ||||||
|  |                                            (((__ITEM__) & ~(SBS_ALL)) == 0U)) | ||||||
|  |  | ||||||
|  | #define IS_SBS_ATTRIBUTES(__ATTRIBUTES__) (((__ATTRIBUTES__) == SBS_SEC)  ||\ | ||||||
|  |                                            ((__ATTRIBUTES__) == SBS_NSEC)) | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |  | ||||||
|  | #define IS_SBS_LOCK_ITEMS(__ITEM__) ((((__ITEM__) & SBS_MPU_NSEC)       == SBS_MPU_NSEC)       || \ | ||||||
|  |                                      (((__ITEM__) & SBS_VTOR_NSEC)      == SBS_VTOR_NSEC)      || \ | ||||||
|  |                                      (((__ITEM__) & SBS_SAU)            == SBS_SAU)            || \ | ||||||
|  |                                      (((__ITEM__) & SBS_MPU_SEC)        == SBS_MPU_SEC)        || \ | ||||||
|  |                                      (((__ITEM__) & SBS_VTOR_AIRCR_SEC) == SBS_VTOR_AIRCR_SEC) || \ | ||||||
|  |                                      (((__ITEM__) & ~(SBS_LOCK_ALL)) == 0U)) | ||||||
|  |  | ||||||
|  | #else | ||||||
|  |  | ||||||
|  | #define IS_SBS_LOCK_ITEMS(__ITEM__) ((((__ITEM__) & SBS_MPU_NSEC)  == SBS_MPU_NSEC)    || \ | ||||||
|  |                                      (((__ITEM__) & SBS_VTOR_NSEC) == SBS_VTOR_NSEC)   || \ | ||||||
|  |                                      (((__ITEM__) & ~(SBS_LOCK_ALL)) == 0U)) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @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); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup HAL_Exported_Functions_Group3 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* DBGMCU Peripheral Control functions  *****************************************/ | ||||||
|  | void                 HAL_DBGMCU_EnableDBGStopMode(void); | ||||||
|  | void                 HAL_DBGMCU_DisableDBGStopMode(void); | ||||||
|  | void                 HAL_DBGMCU_EnableDBGStandbyMode(void); | ||||||
|  | void                 HAL_DBGMCU_DisableDBGStandbyMode(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup HAL_Exported_Functions_Group4 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* VREFBUF Control functions  ****************************************************/ | ||||||
|  | #if defined(VREFBUF) | ||||||
|  | void                 HAL_VREFBUF_VoltageScalingConfig(uint32_t VoltageScaling); | ||||||
|  | void                 HAL_VREFBUF_HighImpedanceConfig(uint32_t Mode); | ||||||
|  | void                 HAL_VREFBUF_TrimmingConfig(uint32_t TrimmingValue); | ||||||
|  | HAL_StatusTypeDef    HAL_EnableVREFBUF(void); | ||||||
|  | void                 HAL_DisableVREFBUF(void); | ||||||
|  | #endif /* VREFBUF */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup HAL_Exported_Functions_Group5 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* SBS System Configuration functions  *******************************************/ | ||||||
|  | void                 HAL_SBS_ETHInterfaceSelect(uint32_t SBS_ETHInterface); | ||||||
|  | void                 HAL_SBS_EnableVddIO1CompensationCell(void); | ||||||
|  | void                 HAL_SBS_DisableVddIO1CompensationCell(void); | ||||||
|  | void                 HAL_SBS_EnableVddIO2CompensationCell(void); | ||||||
|  | void                 HAL_SBS_DisableVddIO2CompensationCell(void); | ||||||
|  | void                 HAL_SBS_VDDCompensationCodeSelect(uint32_t SBS_CompCode); | ||||||
|  | void                 HAL_SBS_VDDIOCompensationCodeSelect(uint32_t SBS_CompCode); | ||||||
|  | uint32_t             HAL_SBS_GetVddIO1CompensationCellReadyFlag(void); | ||||||
|  | uint32_t             HAL_SBS_GetVddIO2CompensationCellReadyFlag(void); | ||||||
|  | void                 HAL_SBS_VDDCompensationCodeConfig(uint32_t SBS_PMOSCode, uint32_t SBS_NMOSCode); | ||||||
|  | void                 HAL_SBS_VDDIOCompensationCodeConfig(uint32_t SBS_PMOSCode, uint32_t SBS_NMOSCode); | ||||||
|  | uint32_t             HAL_SBS_GetNMOSVddCompensationValue(void); | ||||||
|  | uint32_t             HAL_SBS_GetPMOSVddCompensationValue(void); | ||||||
|  | uint32_t             HAL_SBS_GetNMOSVddIO2CompensationValue(void); | ||||||
|  | uint32_t             HAL_SBS_GetPMOSVddIO2CompensationValue(void); | ||||||
|  | void                 HAL_SBS_FLASH_EnableECCNMI(void); | ||||||
|  | void                 HAL_SBS_FLASH_DisableECCNMI(void); | ||||||
|  | uint32_t             HAL_SBS_FLASH_ECCNMI_IsDisabled(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup HAL_Exported_Functions_Group6 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* SBS Boot control functions  ***************************************************/ | ||||||
|  | void                 HAL_SBS_IncrementHDPLValue(void); | ||||||
|  | uint32_t             HAL_SBS_GetHDPLValue(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup HAL_Exported_Functions_Group7 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* SBS Hardware secure storage control functions  ********************************/ | ||||||
|  | void                 HAL_SBS_EPOCHSelection(uint32_t Epoch_Selection); | ||||||
|  | uint32_t             HAL_SBS_GetEPOCHSelection(void); | ||||||
|  | void                 HAL_SBS_SetOBKHDPL(uint32_t OBKHDPL_Value); | ||||||
|  | uint32_t             HAL_SBS_GetOBKHDPL(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup HAL_Exported_Functions_Group8 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* SBS Debug control functions  ***************************************************/ | ||||||
|  | void                 HAL_SBS_OpenAccessPort(void); | ||||||
|  | void                 HAL_SBS_OpenDebug(void); | ||||||
|  | HAL_StatusTypeDef    HAL_SBS_ConfigDebugLevel(uint32_t Level); | ||||||
|  | uint32_t             HAL_SBS_GetDebugLevel(void); | ||||||
|  | void                 HAL_SBS_LockDebugConfig(void); | ||||||
|  | void                 HAL_SBS_ConfigDebugSecurity(uint32_t Security); | ||||||
|  | uint32_t             HAL_SBS_GetDebugSecurity(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** @addtogroup HAL_Exported_Functions_Group9 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* SBS Lock functions ********************************************/ | ||||||
|  | void              HAL_SBS_Lock(uint32_t Item); | ||||||
|  | HAL_StatusTypeDef HAL_SBS_GetLock(uint32_t *pItem); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup HAL_Exported_Functions_Group10 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* SBS Attributes functions ********************************************/ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | void              HAL_SBS_ConfigAttributes(uint32_t Item, uint32_t Attributes); | ||||||
|  | HAL_StatusTypeDef HAL_SBS_GetConfigAttributes(uint32_t Item, uint32_t *pAttributes); | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
|  | #endif /* __STM32H5xx_HAL_H */ | ||||||
|  |  | ||||||
							
								
								
									
										429
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_cortex.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										429
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_cortex.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,429 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_cortex.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   Header file of CORTEX HAL module. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef __STM32H5xx_HAL_CORTEX_H | ||||||
|  | #define __STM32H5xx_HAL_CORTEX_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal_def.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX CORTEX | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported types ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup CORTEX_Exported_Types CORTEX Exported Types | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_MPU_Region_Initialization_Structure_definition MPU Region Initialization Structure Definition | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | 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 index 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.                 */ | ||||||
|  |   uint32_t               LimitAddress;      /*!< Specifies the limit address of the region to protect.                */ | ||||||
|  |   uint8_t                AttributesIndex;   /*!< Specifies the memory attributes index. | ||||||
|  |                                                  This parameter can be a value of @ref CORTEX_MPU_Attributes_Number   */ | ||||||
|  |   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    */ | ||||||
|  | } MPU_Region_InitTypeDef; | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_MPU_Attributes_Initialization_Structure_definition MPU Attributes | ||||||
|  |   *           Initialization Structure Definition | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint8_t                Number;            /*!< Specifies the number of the memory attributes to configure. | ||||||
|  |                                                  This parameter can be a value of @ref CORTEX_MPU_Attributes_Number   */ | ||||||
|  |  | ||||||
|  |   uint8_t                Attributes;        /*!< Specifies the memory attributes value. Attributes This parameter | ||||||
|  |                                                  can be a combination of @ref CORTEX_MPU_Attributes                   */ | ||||||
|  |  | ||||||
|  | } MPU_Attributes_InitTypeDef; | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported constants --------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_Exported_Constants CORTEX Exported Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_Preemption_Priority_Group CORTEX Preemption Priority Group | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define NVIC_PRIORITYGROUP_0            0x7U /*!< 0 bit  for pre-emption priority, | ||||||
|  |                                                                  4 bits for subpriority */ | ||||||
|  | #define NVIC_PRIORITYGROUP_1            0x6U /*!< 1 bit  for pre-emption priority, | ||||||
|  |                                                                  3 bits for subpriority */ | ||||||
|  | #define NVIC_PRIORITYGROUP_2            0x5U /*!< 2 bits for pre-emption priority, | ||||||
|  |                                                                  2 bits for subpriority */ | ||||||
|  | #define NVIC_PRIORITYGROUP_3            0x4U /*!< 3 bits for pre-emption priority, | ||||||
|  |                                                                  1 bit  for subpriority */ | ||||||
|  | #define NVIC_PRIORITYGROUP_4            0x3U /*!< 4 bits for pre-emption priority, | ||||||
|  |                                                                  0 bit  for subpriority */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_SysTick_clock_source CORTEX SysTick clock source | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define SYSTICK_CLKSOURCE_HCLK_DIV8     0x0U /*!< AHB clock divided by 8 selected as SysTick clock source */ | ||||||
|  | #define SYSTICK_CLKSOURCE_LSI           0x1U /*!< LSI clock selected as SysTick clock source              */ | ||||||
|  | #define SYSTICK_CLKSOURCE_LSE           0x2U /*!< LSE clock selected as SysTick clock source              */ | ||||||
|  | #define SYSTICK_CLKSOURCE_HCLK          0x4U /*!< AHB clock selected as SysTick clock source              */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_MPU_HFNMI_PRIVDEF_Control CORTEX MPU HFNMI and PRIVILEGED Access control | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define  MPU_HFNMI_PRIVDEF_NONE          0U /*!< Background region access not allowed, MPU disabled for Hardfaults, NMIs, and exception handlers when FAULTMASK=1 */ | ||||||
|  | #define  MPU_HARDFAULT_NMI               2U /*!< Background region access not allowed, MPU enabled for Hardfaults, NMIs, and exception handlers when FAULTMASK=1 */ | ||||||
|  | #define  MPU_PRIVILEGED_DEFAULT          4U /*!< Background region privileged-only access allowed, MPU disabled for Hardfaults, NMIs, and exception handlers when FAULTMASK=1 */ | ||||||
|  | #define  MPU_HFNMI_PRIVDEF               6U /*!< Background region privileged-only access allowed, MPU enabled for Hardfaults, NMIs, and exception handlers when FAULTMASK=1 */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_MPU_Region_Enable CORTEX MPU Region Enable | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define  MPU_REGION_ENABLE               1U /*!< Enable region */ | ||||||
|  | #define  MPU_REGION_DISABLE              0U /*!< Disable region */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_MPU_Instruction_Access CORTEX MPU Instruction Access | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define  MPU_INSTRUCTION_ACCESS_ENABLE   0U /*!< Execute attribute */ | ||||||
|  | #define  MPU_INSTRUCTION_ACCESS_DISABLE  1U /*!< Execute never attribute */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_MPU_Access_Shareable CORTEX MPU Instruction Access Shareable | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define  MPU_ACCESS_NOT_SHAREABLE        0U /*!< Not shareable attribute */ | ||||||
|  | #define  MPU_ACCESS_OUTER_SHAREABLE      2U /*!< Outer shareable attribute */ | ||||||
|  | #define  MPU_ACCESS_INNER_SHAREABLE      3U /*!< Inner shareable attribute */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_MPU_Region_Permission_Attributes CORTEX MPU Region Permission Attributes | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define  MPU_REGION_PRIV_RW              0U /*!< Read/write privileged-only attribute */ | ||||||
|  | #define  MPU_REGION_ALL_RW               1U /*!< Read/write privileged/unprivileged attribute */ | ||||||
|  | #define  MPU_REGION_PRIV_RO              2U /*!< Read-only privileged-only attribute */ | ||||||
|  | #define  MPU_REGION_ALL_RO               3U /*!< Read-only privileged/unprivileged attribute */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_MPU_Region_Number CORTEX MPU Region Number | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define  MPU_REGION_NUMBER0              0U  /*!< MPU region number 0  */ | ||||||
|  | #define  MPU_REGION_NUMBER1              1U  /*!< MPU region number 1  */ | ||||||
|  | #define  MPU_REGION_NUMBER2              2U  /*!< MPU region number 2  */ | ||||||
|  | #define  MPU_REGION_NUMBER3              3U  /*!< MPU region number 3  */ | ||||||
|  | #define  MPU_REGION_NUMBER4              4U  /*!< MPU region number 4  */ | ||||||
|  | #define  MPU_REGION_NUMBER5              5U  /*!< MPU region number 5  */ | ||||||
|  | #define  MPU_REGION_NUMBER6              6U  /*!< MPU region number 6  */ | ||||||
|  | #define  MPU_REGION_NUMBER7              7U  /*!< MPU region number 7  */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | #define  MPU_REGION_NUMBER8              8U  /*!< MPU region number 8  */ | ||||||
|  | #define  MPU_REGION_NUMBER9              9U  /*!< MPU region number 9  */ | ||||||
|  | #define  MPU_REGION_NUMBER10             10U /*!< MPU region number 10 */ | ||||||
|  | #define  MPU_REGION_NUMBER11             11U /*!< MPU region number 11 */ | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_MPU_Attributes_Number CORTEX MPU Memory Attributes Number | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define  MPU_ATTRIBUTES_NUMBER0          0U /*!< MPU attribute number 0 */ | ||||||
|  | #define  MPU_ATTRIBUTES_NUMBER1          1U /*!< MPU attribute number 1 */ | ||||||
|  | #define  MPU_ATTRIBUTES_NUMBER2          2U /*!< MPU attribute number 2 */ | ||||||
|  | #define  MPU_ATTRIBUTES_NUMBER3          3U /*!< MPU attribute number 3 */ | ||||||
|  | #define  MPU_ATTRIBUTES_NUMBER4          4U /*!< MPU attribute number 4 */ | ||||||
|  | #define  MPU_ATTRIBUTES_NUMBER5          5U /*!< MPU attribute number 5 */ | ||||||
|  | #define  MPU_ATTRIBUTES_NUMBER6          6U /*!< MPU attribute number 6 */ | ||||||
|  | #define  MPU_ATTRIBUTES_NUMBER7          7U /*!< MPU attribute number 7 */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_MPU_Attributes CORTEX MPU Attributes | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* Device memory attributes */ | ||||||
|  | #define  MPU_DEVICE_nGnRnE          0x0U  /*!< Device non-Gathering, non-Reordering, no Early write acknowledgement */ | ||||||
|  | #define  MPU_DEVICE_nGnRE           0x4U  /*!< Device non-Gathering, non-Reordering, Early write acknowledgement */ | ||||||
|  | #define  MPU_DEVICE_nGRE            0x8U  /*!< Device non-Gathering, Reordering, Early write acknowledgement */ | ||||||
|  | #define  MPU_DEVICE_GRE             0xCU  /*!< Device Gathering, Reordering, Early write acknowledgement */ | ||||||
|  |  | ||||||
|  | /* Normal memory attributes */ | ||||||
|  | /* To set with INNER_OUTER() macro for both inner/outer cache attributes */ | ||||||
|  |  | ||||||
|  | /* Non-cacheable memory attribute */ | ||||||
|  | #define  MPU_NOT_CACHEABLE          0x4U  /*!< Normal memory, non-cacheable. */ | ||||||
|  |  | ||||||
|  | /* Cacheable memory attributes: combination of cache write policy, transient and allocation */ | ||||||
|  | /* - cache write policy */ | ||||||
|  | #define  MPU_WRITE_THROUGH          0x0U  /*!< Normal memory, write-through. */ | ||||||
|  | #define  MPU_WRITE_BACK             0x4U  /*!< Normal memory, write-back.    */ | ||||||
|  | /* - transient mode attribute */ | ||||||
|  | #define  MPU_TRANSIENT              0x0U  /*!< Normal memory, transient.     */ | ||||||
|  | #define  MPU_NON_TRANSIENT          0x8U  /*!< Normal memory, non-transient. */ | ||||||
|  | /* - allocation attribute */ | ||||||
|  | #define  MPU_NO_ALLOCATE            0x0U  /*!< Normal memory, no allocate.         */ | ||||||
|  | #define  MPU_W_ALLOCATE             0x1U  /*!< Normal memory, write allocate.      */ | ||||||
|  | #define  MPU_R_ALLOCATE             0x2U  /*!< Normal memory, read allocate.       */ | ||||||
|  | #define  MPU_RW_ALLOCATE            0x3U  /*!< Normal memory, read/write allocate. */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported macros -----------------------------------------------------------*/ | ||||||
|  | /** @defgroup CORTEX_Exported_Macros CORTEX Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define OUTER(__ATTR__)        ((__ATTR__) << 4U) | ||||||
|  | #define INNER_OUTER(__ATTR__)  ((__ATTR__) | ((__ATTR__) << 4U)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported functions --------------------------------------------------------*/ | ||||||
|  | /** @defgroup CORTEX_Exported_Functions CORTEX Exported Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_Exported_Functions_Group1 NVIC functions | ||||||
|  |   * @brief    NVIC functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* NVIC 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_NVIC_GetPriorityGrouping(void); | ||||||
|  | void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t *const pPreemptPriority, | ||||||
|  |                           uint32_t *const 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); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_Exported_Functions_Group2 SYSTICK functions | ||||||
|  |   * @brief   SYSTICK functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* SYSTICK functions ***********************************************/ | ||||||
|  | uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb); | ||||||
|  | void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource); | ||||||
|  | uint32_t HAL_SYSTICK_GetCLKSourceConfig(void); | ||||||
|  | void HAL_SYSTICK_IRQHandler(void); | ||||||
|  | void HAL_SYSTICK_Callback(void); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CORTEX_Exported_Functions_Group3 MPU functions | ||||||
|  |   * @brief   MPU functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* MPU functions ***********************************************/ | ||||||
|  | void HAL_MPU_Enable(uint32_t MPU_Control); | ||||||
|  | void HAL_MPU_Disable(void); | ||||||
|  | void HAL_MPU_EnableRegion(uint32_t RegionNumber); | ||||||
|  | void HAL_MPU_DisableRegion(uint32_t RegionNumber); | ||||||
|  | void HAL_MPU_ConfigRegion(const MPU_Region_InitTypeDef *const pMPU_RegionInit); | ||||||
|  | void HAL_MPU_ConfigMemoryAttributes(const MPU_Attributes_InitTypeDef *const pMPU_AttributesInit); | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /* MPU_NS Control functions ***********************************************/ | ||||||
|  | void HAL_MPU_Enable_NS(uint32_t MPU_Control); | ||||||
|  | void HAL_MPU_Disable_NS(void); | ||||||
|  | void HAL_MPU_EnableRegion_NS(uint32_t RegionNumber); | ||||||
|  | void HAL_MPU_DisableRegion_NS(uint32_t RegionNumber); | ||||||
|  | void HAL_MPU_ConfigRegion_NS(const MPU_Region_InitTypeDef *const pMPU_RegionInit); | ||||||
|  | void HAL_MPU_ConfigMemoryAttributes_NS(const MPU_Attributes_InitTypeDef *const pMPU_AttributesInit); | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* 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) < (1UL<<__NVIC_PRIO_BITS)) | ||||||
|  |  | ||||||
|  | #define IS_NVIC_SUB_PRIORITY(PRIORITY)         ((PRIORITY) < (1UL<<__NVIC_PRIO_BITS)) | ||||||
|  |  | ||||||
|  | #define IS_NVIC_DEVICE_IRQ(IRQ)                ((IRQ) > SysTick_IRQn) | ||||||
|  |  | ||||||
|  | #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_LSI) || \ | ||||||
|  |                                        ((SOURCE) == SYSTICK_CLKSOURCE_LSE) || \ | ||||||
|  |                                        ((SOURCE) == SYSTICK_CLKSOURCE_HCLK)|| \ | ||||||
|  |                                        ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8)) | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | #define IS_MPU_INSTANCE(INSTANCE) (((INSTANCE) == MPU) || ((INSTANCE) == MPU_NS)) | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | #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_OUTER_SHAREABLE) || \ | ||||||
|  |                                           ((STATE) == MPU_ACCESS_INNER_SHAREABLE) || \ | ||||||
|  |                                           ((STATE) == MPU_ACCESS_NOT_SHAREABLE)) | ||||||
|  |  | ||||||
|  | #define IS_MPU_REGION_PERMISSION_ATTRIBUTE(TYPE) (((TYPE) == MPU_REGION_PRIV_RW) || \ | ||||||
|  |                                                   ((TYPE) == MPU_REGION_ALL_RW)  || \ | ||||||
|  |                                                   ((TYPE) == MPU_REGION_PRIV_RO)     || \ | ||||||
|  |                                                   ((TYPE) == MPU_REGION_ALL_RO)) | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | #define IS_MPU_REGION_NUMBER(NUMBER)    (((NUMBER) == MPU_REGION_NUMBER0) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER1) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER2) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER3) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER4) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER5) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER6) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER7) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER8) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER9) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER10)|| \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER11)) | ||||||
|  |  | ||||||
|  | #define IS_MPU_REGION_NUMBER_NS(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)) | ||||||
|  | #else | ||||||
|  | #define IS_MPU_REGION_NUMBER(NUMBER)    (((NUMBER) == MPU_REGION_NUMBER0) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER1) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER2) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER3) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER4) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER5) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER6) || \ | ||||||
|  |                                          ((NUMBER) == MPU_REGION_NUMBER7)) | ||||||
|  | #endif /*  __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | #define IS_MPU_ATTRIBUTES_NUMBER(NUMBER)  (((NUMBER) == MPU_ATTRIBUTES_NUMBER0) || \ | ||||||
|  |                                            ((NUMBER) == MPU_ATTRIBUTES_NUMBER1) || \ | ||||||
|  |                                            ((NUMBER) == MPU_ATTRIBUTES_NUMBER2) || \ | ||||||
|  |                                            ((NUMBER) == MPU_ATTRIBUTES_NUMBER3) || \ | ||||||
|  |                                            ((NUMBER) == MPU_ATTRIBUTES_NUMBER4) || \ | ||||||
|  |                                            ((NUMBER) == MPU_ATTRIBUTES_NUMBER5) || \ | ||||||
|  |                                            ((NUMBER) == MPU_ATTRIBUTES_NUMBER6) || \ | ||||||
|  |                                            ((NUMBER) == MPU_ATTRIBUTES_NUMBER7)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private functions ---------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* __STM32H5xx_HAL_CORTEX_H */ | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										231
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_def.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										231
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_def.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,231 @@ | |||||||
|  | /** | ||||||
|  |   ********************************************************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_def.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   This file contains HAL common defines, enumeration, macros and | ||||||
|  |   *          structures definitions. | ||||||
|  |   ********************************************************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ********************************************************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/ | ||||||
|  | #ifndef __STM32H5xx_HAL_DEF | ||||||
|  | #define __STM32H5xx_HAL_DEF | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
|  | /* Includes ----------------------------------------------------------------------------------------------------------*/ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) &&  (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | #include <arm_cmse.h> | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | #include "stm32h5xx.h" | ||||||
|  | #include "Legacy/stm32_hal_legacy.h"  /* Aliases file for old names compatibility */ | ||||||
|  | #include <stddef.h> | ||||||
|  | #include <math.h> | ||||||
|  |  | ||||||
|  | /* Exported types ----------------------------------------------------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  HAL Status structures definition | ||||||
|  |   */ | ||||||
|  | typedef enum | ||||||
|  | { | ||||||
|  |   HAL_OK       = 0x00, | ||||||
|  |   HAL_ERROR    = 0x01, | ||||||
|  |   HAL_BUSY     = 0x02, | ||||||
|  |   HAL_TIMEOUT  = 0x03 | ||||||
|  | } HAL_StatusTypeDef; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  HAL Lock structures definition | ||||||
|  |   */ | ||||||
|  | typedef enum | ||||||
|  | { | ||||||
|  |   HAL_UNLOCKED = 0x00, | ||||||
|  |   HAL_LOCKED   = 0x01 | ||||||
|  | } HAL_LockTypeDef; | ||||||
|  |  | ||||||
|  | /* Exported macros ---------------------------------------------------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | #define HAL_MAX_DELAY      0xFFFFFFFFU | ||||||
|  | #define ARMCC_MIN_VERSION  6010050 | ||||||
|  |  | ||||||
|  | #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(0) | ||||||
|  |  | ||||||
|  | #if !defined(UNUSED) | ||||||
|  | #define UNUSED(x) ((void)(x)) | ||||||
|  | #endif /* UNUSED */ | ||||||
|  |  | ||||||
|  | /** @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 = 0) | ||||||
|  |  | ||||||
|  | #if (USE_RTOS == 1) | ||||||
|  | /* 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 (0) | ||||||
|  |  | ||||||
|  | #define __HAL_UNLOCK(__HANDLE__)           \ | ||||||
|  |   do{                                      \ | ||||||
|  |     (__HANDLE__)->Lock = HAL_UNLOCKED;     \ | ||||||
|  |   }while (0) | ||||||
|  | #endif /* USE_RTOS */ | ||||||
|  |  | ||||||
|  | #if  defined ( __GNUC__ ) | ||||||
|  | #ifndef __weak | ||||||
|  | #define __weak   __attribute__((weak)) | ||||||
|  | #endif /* __weak */ | ||||||
|  | #ifndef __packed | ||||||
|  | #define __packed __attribute__((__packed__)) | ||||||
|  | #endif /* __packed */ | ||||||
|  | #endif /* __GNUC__ */ | ||||||
|  |  | ||||||
|  | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= ARMCC_MIN_VERSION) | ||||||
|  | #ifndef __weak | ||||||
|  | #define __weak  __WEAK | ||||||
|  | #endif /* __weak */ | ||||||
|  | #ifndef __packed | ||||||
|  | #define __packed  __PACKED | ||||||
|  | #endif /* __packed */ | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" | ||||||
|  |    must be used instead */ | ||||||
|  | #if defined   (__GNUC__)        /* GNU Compiler */ | ||||||
|  | #ifndef __ALIGN_END | ||||||
|  | #define __ALIGN_END    __attribute__ ((aligned (4))) | ||||||
|  | #endif /* __ALIGN_END */ | ||||||
|  | #ifndef __ALIGN_BEGIN | ||||||
|  | #define __ALIGN_BEGIN | ||||||
|  | #endif /* __ALIGN_BEGIN */ | ||||||
|  | #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= ARMCC_MIN_VERSION) | ||||||
|  | #ifndef __ALIGN_END | ||||||
|  | #define __ALIGN_END    __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__ */ | ||||||
|  |  | ||||||
|  | /* Macro to get variable aligned on 32-bytes,needed for cache maintenance purpose */ | ||||||
|  | #if defined   (__GNUC__)        /* GNU Compiler */ | ||||||
|  | #define ALIGN_32BYTES(buf)  buf __attribute__ ((aligned (32))) | ||||||
|  | #elif defined (__ICCARM__)    /* IAR Compiler */ | ||||||
|  | #define ALIGN_32BYTES(buf) _Pragma("data_alignment=32") buf | ||||||
|  | #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= ARMCC_MIN_VERSION) | ||||||
|  | #define ALIGN_32BYTES(buf) __ALIGNED(32) buf | ||||||
|  | #elif defined   (__CC_ARM)      /* ARM Compiler */ | ||||||
|  | #define ALIGN_32BYTES(buf) __align(32) buf | ||||||
|  | #endif /* __GNUC__ */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  __RAM_FUNC definition | ||||||
|  |   */ | ||||||
|  | #if defined ( __CC_ARM   ) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= ARMCC_MIN_VERSION)) | ||||||
|  |  | ||||||
|  | /* 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 HAL_StatusTypeDef | ||||||
|  |  | ||||||
|  | #elif defined ( __ICCARM__ ) | ||||||
|  | /* ICCARM Compiler | ||||||
|  |  | ||||||
|  |    RAM functions are defined using a specific toolchain keyword "__ramfunc". | ||||||
|  | */ | ||||||
|  | #define __RAM_FUNC __ramfunc HAL_StatusTypeDef | ||||||
|  |  | ||||||
|  | #elif defined   (  __GNUC__  ) | ||||||
|  | /* GNU Compiler | ||||||
|  |  | ||||||
|  |   RAM functions are defined using a specific toolchain attribute | ||||||
|  |    "__attribute__((section(".RamFunc")))". | ||||||
|  | */ | ||||||
|  | #define __RAM_FUNC HAL_StatusTypeDef  __attribute__((section(".RamFunc"))) | ||||||
|  |  | ||||||
|  | #endif /* defined ( __CC_ARM   ) || ((__ARMCC_VERSION) && (__ARMCC_VERSION >= ARMCC_MIN_VERSION)) */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  __NOINLINE definition | ||||||
|  |   */ | ||||||
|  | #if defined ( __CC_ARM   ) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= ARMCC_MIN_VERSION)) || defined   (  __GNUC__  ) | ||||||
|  | /* ARM & GNUCompiler | ||||||
|  |  | ||||||
|  | */ | ||||||
|  | #define __NOINLINE __attribute__ ( (noinline) ) | ||||||
|  |  | ||||||
|  | #elif defined ( __ICCARM__ ) | ||||||
|  | /* ICCARM Compiler | ||||||
|  |  | ||||||
|  | */ | ||||||
|  | #define __NOINLINE _Pragma("optimize = no_inline") | ||||||
|  |  | ||||||
|  | #endif /* ( __CC_ARM   ) || ((__ARMCC_VERSION) && (__ARMCC_VERSION >= ARMCC_MIN_VERSION)) || defined   (  __GNUC__  ) */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
|  | #endif /* ___STM32H5xx_HAL_DEF */ | ||||||
|  |  | ||||||
							
								
								
									
										1179
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_dma.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1179
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_dma.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										735
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_dma_ex.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										735
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_dma_ex.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,735 @@ | |||||||
|  | /** | ||||||
|  |   ********************************************************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_dma_ex.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   Header file of DMA HAL extension module. | ||||||
|  |   ********************************************************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ********************************************************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/ | ||||||
|  | #ifndef STM32H5xx_HAL_DMA_EX_H | ||||||
|  | #define STM32H5xx_HAL_DMA_EX_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ----------------------------------------------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal_def.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup DMAEx | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported types ----------------------------------------------------------------------------------------------------*/ | ||||||
|  | /** @defgroup DMAEx_Exported_Types DMAEx Exported Types | ||||||
|  |   * @brief DMAEx Exported types | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief DMAEx Data Handling Configuration Structure Definition. | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t DataExchange;  /*!< Specifies the DMA channel data exchange mode. | ||||||
|  |                                This parameter can be a value of @ref DMAEx_Data_Exchange  */ | ||||||
|  |  | ||||||
|  |   uint32_t DataAlignment; /*!< Specifies the DMA channel data padding and alignment mode | ||||||
|  |                                This parameter can be a value of @ref DMAEx_Data_Alignment */ | ||||||
|  |  | ||||||
|  | } DMA_DataHandlingConfTypeDef; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief DMAEx Trigger Configuration Structure Definition. | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t TriggerMode;      /*!< Specifies the DMA channel trigger mode. | ||||||
|  |                                   This parameter can be a value of @ref DMAEx_Trigger_Mode      */ | ||||||
|  |  | ||||||
|  |   uint32_t TriggerPolarity;  /*!< Specifies the DMA channel trigger event polarity. | ||||||
|  |                                   This parameter can be a value of @ref DMAEx_Trigger_Polarity  */ | ||||||
|  |  | ||||||
|  |   uint32_t TriggerSelection; /*!< Specifies the DMA channel trigger event selection. | ||||||
|  |                                   This parameter can be a value of @ref DMAEx_Trigger_Selection */ | ||||||
|  |  | ||||||
|  | } DMA_TriggerConfTypeDef; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief DMAEx Repeated Block Configuration Structure Definition. | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t RepeatCount;      /*!< Specifies the DMA channel repeat count (the number of repetitions of block). | ||||||
|  |                                   This parameter can be a value between 1 and 2048                                    */ | ||||||
|  |  | ||||||
|  |   int32_t SrcAddrOffset;     /*!< Specifies the DMA channel single/burst source address offset : | ||||||
|  |                                   This parameter can be a value between -8191 and 8191. | ||||||
|  |                                   * If source address offset > 0 => Increment the source address by offset from where | ||||||
|  |                                     the last single/burst transfer ends. | ||||||
|  |                                   * If source address offset < 0 => Decrement the source address by offset from where | ||||||
|  |                                     the last single/burst transfer ends. | ||||||
|  |                                   * If source address offset == 0 => The next single/burst source address starts from | ||||||
|  |                                     where the last transfer ends                                                      */ | ||||||
|  |  | ||||||
|  |   int32_t DestAddrOffset;    /*!< Specifies the DMA channel single/burst destination address offset signed value : | ||||||
|  |                                   This parameter can be a value between -8191 and 8191. | ||||||
|  |                                   * If destination address offset > 0 => Increment the destination address by offset | ||||||
|  |                                     from where the last single/burst transfer ends. | ||||||
|  |                                   * If destination address offset < 0 => Decrement the destination address by offset | ||||||
|  |                                     from where the last single/burst transfer ends. | ||||||
|  |                                   * If destination address offset == 0 => The next single/burst destination address | ||||||
|  |                                     starts from where the last transfer ends.                                         */ | ||||||
|  |  | ||||||
|  |   int32_t BlkSrcAddrOffset;  /*!< Specifies the DMA channel block source address offset signed value : | ||||||
|  |                                   This parameter can be a value between -65535 and 65535. | ||||||
|  |                                   * If block source address offset > 0 => Increment the block source address by offset | ||||||
|  |                                     from where the last block ends. | ||||||
|  |                                   * If block source address offset < 0 => Decrement the next block source address by | ||||||
|  |                                     offset from where the last block ends. | ||||||
|  |                                   * If block source address offset == 0 =>  the next block source address starts from | ||||||
|  |                                     where the last block ends                                                         */ | ||||||
|  |  | ||||||
|  |   int32_t BlkDestAddrOffset; /*!< Specifies the DMA channel block destination address offset signed value : | ||||||
|  |                                   This parameter can be a value between -65535 and 65535. | ||||||
|  |                                   * If block destination address offset > 0 => Increment the block destination address | ||||||
|  |                                     by offset from where the last block ends. | ||||||
|  |                                   * If block destination address offset < 0 => Decrement the next block destination | ||||||
|  |                                     address by offset from where the last block ends. | ||||||
|  |                                   * If block destination address offset == 0 =>  the next block destination address | ||||||
|  |                                     starts from where the last block ends                                             */ | ||||||
|  |  | ||||||
|  | } DMA_RepeatBlockConfTypeDef; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief DMAEx Queue State Enumeration Definition. | ||||||
|  |   */ | ||||||
|  | typedef enum | ||||||
|  | { | ||||||
|  |   HAL_DMA_QUEUE_STATE_RESET = 0x00U, /*!< DMA queue empty              */ | ||||||
|  |   HAL_DMA_QUEUE_STATE_READY = 0x01U, /*!< DMA queue ready for use      */ | ||||||
|  |   HAL_DMA_QUEUE_STATE_BUSY  = 0x02U  /*!< DMA queue execution on going */ | ||||||
|  |  | ||||||
|  | } HAL_DMA_QStateTypeDef; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  DMAEx Linked-List Node Configuration Structure Definition. | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t                    NodeType;           /*!< Specifies the DMA channel node type. | ||||||
|  |                                                        This parameter can be a value of @ref DMAEx_Node_Type          */ | ||||||
|  |  | ||||||
|  |   DMA_InitTypeDef             Init;               /*!< Specifies the DMA channel basic configuration                  */ | ||||||
|  |  | ||||||
|  |   DMA_DataHandlingConfTypeDef DataHandlingConfig; /*!< Specifies the DMA channel data handling channel configuration  */ | ||||||
|  |  | ||||||
|  |   DMA_TriggerConfTypeDef      TriggerConfig;      /*!< Specifies the DMA channel trigger configuration                */ | ||||||
|  |  | ||||||
|  |   DMA_RepeatBlockConfTypeDef  RepeatBlockConfig;  /*!< Specifies the DMA channel repeated block configuration         */ | ||||||
|  |  | ||||||
|  |   uint32_t                    SrcAddress;         /*!< Specifies the source memory address                            */ | ||||||
|  |   uint32_t                    DstAddress;         /*!< Specifies the destination memory address                       */ | ||||||
|  |   uint32_t                    DataSize;           /*!< Specifies the source data size in bytes                        */ | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |   uint32_t                    SrcSecure;          /*!< Specifies the source security attribute                        */ | ||||||
|  |   uint32_t                    DestSecure;         /*!< Specifies the destination security attribute                   */ | ||||||
|  | #endif /* (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ | ||||||
|  |  | ||||||
|  | } DMA_NodeConfTypeDef; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  DMAEx Linked-List Node Structure Definition. | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t LinkRegisters[8U]; /*!< Physical Node register description */ | ||||||
|  |   uint32_t NodeInfo;          /*!< Node information                   */ | ||||||
|  |  | ||||||
|  | } DMA_NodeTypeDef; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief DMAEx Linked-List Queue Structure Definition. | ||||||
|  |   */ | ||||||
|  | typedef struct __DMA_QListTypeDef | ||||||
|  | { | ||||||
|  |   DMA_NodeTypeDef                *Head;              /*!< Specifies the queue head node                    */ | ||||||
|  |  | ||||||
|  |   DMA_NodeTypeDef                *FirstCircularNode; /*!< Specifies the queue first circular node          */ | ||||||
|  |  | ||||||
|  |   uint32_t                       NodeNumber;         /*!< Specifies the queue node number                  */ | ||||||
|  |  | ||||||
|  |   __IO HAL_DMA_QStateTypeDef     State;              /*!< Specifies the queue state                        */ | ||||||
|  |  | ||||||
|  |   __IO uint32_t                  ErrorCode;          /*!< Specifies the queue error code                   */ | ||||||
|  |  | ||||||
|  |   __IO uint32_t                  Type;               /*!< Specifies whether the queue is static or dynamic */ | ||||||
|  |  | ||||||
|  | } DMA_QListTypeDef; | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported constants ------------------------------------------------------------------------------------------------*/ | ||||||
|  | /** @defgroup DMAEx_Exported_Constants DMAEx Exported Constants | ||||||
|  |   * @brief    DMAEx Exported Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup Queue_Error_Codes Queue Error Codes | ||||||
|  |   * @brief    Queue Error Codes | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define HAL_DMA_QUEUE_ERROR_NONE        (0x00U) /*!< No error                                                */ | ||||||
|  | #define HAL_DMA_QUEUE_ERROR_BUSY        (0x01U) /*!< Error busy                                              */ | ||||||
|  | #define HAL_DMA_QUEUE_ERROR_EMPTY       (0x02U) /*!< Error unallowed operation for empty queue               */ | ||||||
|  | #define HAL_DMA_QUEUE_ERROR_UNSUPPORTED (0x03U) /*!< Error unsupported feature                               */ | ||||||
|  | #define HAL_DMA_QUEUE_ERROR_INVALIDTYPE (0x04U) /*!< Error incompatible node type or circular initialization | ||||||
|  |                                                      and queue circular types are incompatible               */ | ||||||
|  | #define HAL_DMA_QUEUE_ERROR_OUTOFRANGE  (0x05U) /*!< Error out of range node memory                          */ | ||||||
|  | #define HAL_DMA_QUEUE_ERROR_NOTFOUND    (0x06U) /*!< Error node not found in queue                           */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_LinkedList_Mode DMAEx LinkedList Mode | ||||||
|  |   * @brief    DMAEx LinkedList Mode | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define DMA_LINKEDLIST_NORMAL   DMA_LINKEDLIST             /*!< Linear linked-list DMA channel transfer   */ | ||||||
|  | #define DMA_LINKEDLIST_CIRCULAR (DMA_LINKEDLIST | (0x01U)) /*!< Circular linked-list DMA channel transfer */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Data_Alignment DMAEx Data Alignment | ||||||
|  |   * @brief    DMAEx Data Alignment | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define DMA_DATA_RIGHTALIGN_ZEROPADDED 0x00000000U    /*!< If source data width < destination data width | ||||||
|  |                                                            => Right aligned padded with 0 up to destination data | ||||||
|  |                                                               width                                              */ | ||||||
|  | #define DMA_DATA_RIGHTALIGN_LEFTTRUNC  0x00000000U    /*!< If source data width > destination data width | ||||||
|  |                                                            => Right aligned left Truncated down to destination | ||||||
|  |                                                               data width                                         */ | ||||||
|  | #define DMA_DATA_RIGHTALIGN_SIGNEXT    DMA_CTR1_PAM_0 /*!< If source data width < destination data width | ||||||
|  |                                                            => Right Aligned padded with sign extended up to | ||||||
|  |                                                               destination data width                             */ | ||||||
|  | #define DMA_DATA_LEFTALIGN_RIGHTTRUNC  DMA_CTR1_PAM_0 /*!< If source data width > destination data width | ||||||
|  |                                                            => Left Aligned Right Truncated down to the | ||||||
|  |                                                               destination data width                             */ | ||||||
|  | #define DMA_DATA_PACK                  DMA_CTR1_PAM_1 /*!< If source data width < destination data width | ||||||
|  |                                                            => Packed at the destination data width               */ | ||||||
|  | #define DMA_DATA_UNPACK                DMA_CTR1_PAM_1 /*!< If source data width > destination data width | ||||||
|  |                                                            => Unpacked at the destination data width             */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Data_Exchange DMAEx Data Exchange | ||||||
|  |   * @brief    DMAEx Data Exchange | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define DMA_EXCHANGE_NONE          0x00000000U  /*!< No data exchange                                                          */ | ||||||
|  | #define DMA_EXCHANGE_DEST_BYTE     DMA_CTR1_DBX /*!< Destination Byte exchange when destination data width is > Byte           */ | ||||||
|  | #define DMA_EXCHANGE_DEST_HALFWORD DMA_CTR1_DHX /*!< Destination Half-Word exchange when destination data width is > Half-Word */ | ||||||
|  | #define DMA_EXCHANGE_SRC_BYTE      DMA_CTR1_SBX /*!< Source Byte endianness exchange when source data width is word            */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Trigger_Polarity DMAEx Trigger Polarity | ||||||
|  |   * @brief    DMAEx Trigger Polarity | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define DMA_TRIG_POLARITY_MASKED  0x00000000U        /*!< No trigger of the selected DMA request. Masked trigger event                                */ | ||||||
|  | #define DMA_TRIG_POLARITY_RISING  DMA_CTR2_TRIGPOL_0 /*!< Trigger of the selected DMA request on the rising edge of the selected trigger event input  */ | ||||||
|  | #define DMA_TRIG_POLARITY_FALLING DMA_CTR2_TRIGPOL_1 /*!< Trigger of the selected DMA request on the falling edge of the selected trigger event input */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Trigger_Mode DMAEx Trigger Mode | ||||||
|  |   * @brief    DMAEx Trigger Mode | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define DMA_TRIGM_BLOCK_TRANSFER          0x00000000U      /*!< A block transfer is conditioned by (at least) one hit trigger          */ | ||||||
|  | #define DMA_TRIGM_REPEATED_BLOCK_TRANSFER DMA_CTR2_TRIGM_0 /*!< A repeated block transfer is conditioned by (at least) one hit trigger */ | ||||||
|  | #define DMA_TRIGM_LLI_LINK_TRANSFER       DMA_CTR2_TRIGM_1 /*!< A LLI link transfer is conditioned by (at least) one hit trigger       */ | ||||||
|  | #define DMA_TRIGM_SINGLE_BURST_TRANSFER   DMA_CTR2_TRIGM   /*!< A single/burst transfer is conditioned by (at least) one hit trigger   */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Trigger_Selection DMAEx Trigger Selection | ||||||
|  |   * @brief    DMAEx Trigger Selection | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* GPDMA1 triggers */ | ||||||
|  | #define GPDMA1_TRIGGER_EXTI_LINE0       0U       /*!< GPDMA1 HW Trigger signal is EXTI_LINE0      */ | ||||||
|  | #define GPDMA1_TRIGGER_EXTI_LINE1       1U       /*!< GPDMA1 HW Trigger signal is EXTI_LINE1      */ | ||||||
|  | #define GPDMA1_TRIGGER_EXTI_LINE2       2U       /*!< GPDMA1 HW Trigger signal is EXTI_LINE2      */ | ||||||
|  | #define GPDMA1_TRIGGER_EXTI_LINE3       3U       /*!< GPDMA1 HW Trigger signal is EXTI_LINE3      */ | ||||||
|  | #define GPDMA1_TRIGGER_EXTI_LINE4       4U       /*!< GPDMA1 HW Trigger signal is EXTI_LINE4      */ | ||||||
|  | #define GPDMA1_TRIGGER_EXTI_LINE5       5U       /*!< GPDMA1 HW Trigger signal is EXTI_LINE5      */ | ||||||
|  | #define GPDMA1_TRIGGER_EXTI_LINE6       6U       /*!< GPDMA1 HW Trigger signal is EXTI_LINE6      */ | ||||||
|  | #define GPDMA1_TRIGGER_EXTI_LINE7       7U       /*!< GPDMA1 HW Trigger signal is EXTI_LINE7      */ | ||||||
|  | #define GPDMA1_TRIGGER_TAMP_TRG1        8U       /*!< GPDMA1 HW Trigger signal is TAMP_TRG1       */ | ||||||
|  | #define GPDMA1_TRIGGER_TAMP_TRG2        9U       /*!< GPDMA1 HW Trigger signal is TAMP_TRG2       */ | ||||||
|  | #if defined (TAMP_CR1_TAMP3E) | ||||||
|  | #define GPDMA1_TRIGGER_TAMP_TRG3        10U      /*!< GPDMA1 HW Trigger signal is TAMP_TRG3       */ | ||||||
|  | #endif /* TAMP_CR1_TAMP3E */ | ||||||
|  | #define GPDMA1_TRIGGER_LPTIM1_CH1       11U      /*!< GPDMA1 HW Trigger signal is LPTIM1_CH1      */ | ||||||
|  | #define GPDMA1_TRIGGER_LPTIM1_CH2       12U      /*!< GPDMA1 HW Trigger signal is LPTIM1_CH2      */ | ||||||
|  | #define GPDMA1_TRIGGER_LPTIM2_CH1       13U      /*!< GPDMA1 HW Trigger signal is LPTIM2_CH1      */ | ||||||
|  | #define GPDMA1_TRIGGER_LPTIM2_CH2       14U      /*!< GPDMA1 HW Trigger signal is LPTIM2_CH2      */ | ||||||
|  | #define GPDMA1_TRIGGER_RTC_ALRA_TRG     15U      /*!< GPDMA1 HW Trigger signal is RTC_ALRA_TRG    */ | ||||||
|  | #define GPDMA1_TRIGGER_RTC_ALRB_TRG     16U      /*!< GPDMA1 HW Trigger signal is RTC_ALRB_TRG    */ | ||||||
|  | #define GPDMA1_TRIGGER_RTC_WUT_TRG      17U      /*!< GPDMA1 HW Trigger signal is RTC_WUT_TRG     */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA1_CH0_TCF   18U      /*!< GPDMA1 HW Trigger signal is GPDMA1_CH0_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA1_CH1_TCF   19U      /*!< GPDMA1 HW Trigger signal is GPDMA1_CH1_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA1_CH2_TCF   20U      /*!< GPDMA1 HW Trigger signal is GPDMA1_CH2_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA1_CH3_TCF   21U      /*!< GPDMA1 HW Trigger signal is GPDMA1_CH3_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA1_CH4_TCF   22U      /*!< GPDMA1 HW Trigger signal is GPDMA1_CH4_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA1_CH5_TCF   23U      /*!< GPDMA1 HW Trigger signal is GPDMA1_CH5_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA1_CH6_TCF   24U      /*!< GPDMA1 HW Trigger signal is GPDMA1_CH6_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA1_CH7_TCF   25U      /*!< GPDMA1 HW Trigger signal is GPDMA1_CH7_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA2_CH0_TCF   26U      /*!< GPDMA1 HW Trigger signal is GPDMA2_CH0_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA2_CH1_TCF   27U      /*!< GPDMA1 HW Trigger signal is GPDMA2_CH1_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA2_CH2_TCF   28U      /*!< GPDMA1 HW Trigger signal is GPDMA2_CH2_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA2_CH3_TCF   29U      /*!< GPDMA1 HW Trigger signal is GPDMA2_CH3_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA2_CH4_TCF   30U      /*!< GPDMA1 HW Trigger signal is GPDMA2_CH4_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA2_CH5_TCF   31U      /*!< GPDMA1 HW Trigger signal is GPDMA2_CH5_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA2_CH6_TCF   32U      /*!< GPDMA1 HW Trigger signal is GPDMA2_CH6_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_GPDMA2_CH7_TCF   33U      /*!< GPDMA1 HW Trigger signal is GPDMA2_CH7_TCF  */ | ||||||
|  | #define GPDMA1_TRIGGER_TIM2_TRGO        34U      /*!< GPDMA1 HW Trigger signal is TIM2_TRGO       */ | ||||||
|  | #if defined (TIM15) | ||||||
|  | #define GPDMA1_TRIGGER_TIM15_TRGO       35U      /*!< GPDMA1 HW Trigger signal is TIM15_TRGO      */ | ||||||
|  | #endif /* TIM15 */ | ||||||
|  | #if defined (TIM12) | ||||||
|  | #define GPDMA1_TRIGGER_TIM12_TRGO       36U      /*!< GPDMA1 HW Trigger signal is TIM12_TRGO      */ | ||||||
|  | #endif /* TIM12 */ | ||||||
|  | #if defined (LPTIM3) | ||||||
|  | #define GPDMA1_TRIGGER_LPTIM3_CH1       37U      /*!< GPDMA1 HW Trigger signal is LPTIM3_CH1      */ | ||||||
|  | #define GPDMA1_TRIGGER_LPTIM3_CH2       38U      /*!< GPDMA1 HW Trigger signal is LPTIM3_CH2      */ | ||||||
|  | #endif /* LPTIM3 */ | ||||||
|  | #if defined (LPTIM4) | ||||||
|  | #define GPDMA1_TRIGGER_LPTIM4_AIT       39U      /*!< GPDMA1 HW Trigger signal is LPTIM4_AIT      */ | ||||||
|  | #endif /* LPTIM4 */ | ||||||
|  | #if defined (LPTIM5) | ||||||
|  | #define GPDMA1_TRIGGER_LPTIM5_CH1       40U      /*!< GPDMA1 HW Trigger signal is LPTIM5_CH1      */ | ||||||
|  | #define GPDMA1_TRIGGER_LPTIM5_CH2       41U      /*!< GPDMA1 HW Trigger signal is LPTIM5_CH2      */ | ||||||
|  | #endif /* LPTIM5 */ | ||||||
|  | #if defined (LPTIM6) | ||||||
|  | #define GPDMA1_TRIGGER_LPTIM6_CH1       42U      /*!< GPDMA1 HW Trigger signal is LPTIM6_CH1      */ | ||||||
|  | #define GPDMA1_TRIGGER_LPTIM6_CH2       43U      /*!< GPDMA1 HW Trigger signal is LPTIM6_CH2      */ | ||||||
|  | #endif /* LPTIM6 */ | ||||||
|  | #if defined (COMP1) | ||||||
|  | #define GPDMA1_TRIGGER_COMP1_OUT        44U      /*!< GPDMA1 HW Trigger signal is COMP1_OUT       */ | ||||||
|  | #endif /* COMP1 */ | ||||||
|  | #if defined (STM32H503xx) || defined(STM32H523xx) || defined(STM32H533xx) | ||||||
|  | #define GPDMA1_TRIGGER_EVENTOUT         45U      /*!< GPDMA1 HW Trigger signal is EVENTOUT        */ | ||||||
|  | #endif /* STM32H503xx || STM32H523xx || STM32H533xx */ | ||||||
|  |  | ||||||
|  | /* GPDMA2 triggers */ | ||||||
|  | #define GPDMA2_TRIGGER_EXTI_LINE0       0U       /*!< GPDMA2 HW Trigger signal is EXTI_LINE0      */ | ||||||
|  | #define GPDMA2_TRIGGER_EXTI_LINE1       1U       /*!< GPDMA2 HW Trigger signal is EXTI_LINE1      */ | ||||||
|  | #define GPDMA2_TRIGGER_EXTI_LINE2       2U       /*!< GPDMA2 HW Trigger signal is EXTI_LINE2      */ | ||||||
|  | #define GPDMA2_TRIGGER_EXTI_LINE3       3U       /*!< GPDMA2 HW Trigger signal is EXTI_LINE3      */ | ||||||
|  | #define GPDMA2_TRIGGER_EXTI_LINE4       4U       /*!< GPDMA2 HW Trigger signal is EXTI_LINE4      */ | ||||||
|  | #define GPDMA2_TRIGGER_EXTI_LINE5       5U       /*!< GPDMA2 HW Trigger signal is EXTI_LINE5      */ | ||||||
|  | #define GPDMA2_TRIGGER_EXTI_LINE6       6U       /*!< GPDMA2 HW Trigger signal is EXTI_LINE6      */ | ||||||
|  | #define GPDMA2_TRIGGER_EXTI_LINE7       7U       /*!< GPDMA2 HW Trigger signal is EXTI_LINE7      */ | ||||||
|  | #define GPDMA2_TRIGGER_TAMP_TRG1        8U       /*!< GPDMA2 HW Trigger signal is TAMP_TRG1       */ | ||||||
|  | #define GPDMA2_TRIGGER_TAMP_TRG2        9U       /*!< GPDMA2 HW Trigger signal is TAMP_TRG2       */ | ||||||
|  | #define GPDMA2_TRIGGER_TAMP_TRG3        10U      /*!< GPDMA2 HW Trigger signal is TAMP_TRG3       */ | ||||||
|  | #define GPDMA2_TRIGGER_LPTIM1_CH1       11U      /*!< GPDMA2 HW Trigger signal is LPTIM1_CH1      */ | ||||||
|  | #define GPDMA2_TRIGGER_LPTIM1_CH2       12U      /*!< GPDMA2 HW Trigger signal is LPTIM1_CH2      */ | ||||||
|  | #define GPDMA2_TRIGGER_LPTIM2_CH1       13U      /*!< GPDMA2 HW Trigger signal is LPTIM2_CH1      */ | ||||||
|  | #define GPDMA2_TRIGGER_LPTIM2_CH2       14U      /*!< GPDMA2 HW Trigger signal is LPTIM2_CH2      */ | ||||||
|  | #define GPDMA2_TRIGGER_RTC_ALRA_TRG     15U      /*!< GPDMA2 HW Trigger signal is RTC_ALRA_TRG    */ | ||||||
|  | #define GPDMA2_TRIGGER_RTC_ALRB_TRG     16U      /*!< GPDMA2 HW Trigger signal is RTC_ALRB_TRG    */ | ||||||
|  | #define GPDMA2_TRIGGER_RTC_WUT_TRG      17U      /*!< GPDMA2 HW Trigger signal is RTC_WUT_TRG     */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA1_CH0_TCF   18U      /*!< GPDMA2 HW Trigger signal is GPDMA1_CH0_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA1_CH1_TCF   19U      /*!< GPDMA2 HW Trigger signal is GPDMA1_CH1_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA1_CH2_TCF   20U      /*!< GPDMA2 HW Trigger signal is GPDMA1_CH2_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA1_CH3_TCF   21U      /*!< GPDMA2 HW Trigger signal is GPDMA1_CH3_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA1_CH4_TCF   22U      /*!< GPDMA2 HW Trigger signal is GPDMA1_CH4_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA1_CH5_TCF   23U      /*!< GPDMA2 HW Trigger signal is GPDMA1_CH5_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA1_CH6_TCF   24U      /*!< GPDMA2 HW Trigger signal is GPDMA1_CH6_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA1_CH7_TCF   25U      /*!< GPDMA2 HW Trigger signal is GPDMA1_CH7_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA2_CH0_TCF   26U      /*!< GPDMA2 HW Trigger signal is GPDMA2_CH0_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA2_CH1_TCF   27U      /*!< GPDMA2 HW Trigger signal is GPDMA2_CH1_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA2_CH2_TCF   28U      /*!< GPDMA2 HW Trigger signal is GPDMA2_CH2_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA2_CH3_TCF   29U      /*!< GPDMA2 HW Trigger signal is GPDMA2_CH3_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA2_CH4_TCF   30U      /*!< GPDMA2 HW Trigger signal is GPDMA2_CH4_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA2_CH5_TCF   31U      /*!< GPDMA2 HW Trigger signal is GPDMA2_CH5_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA2_CH6_TCF   32U      /*!< GPDMA2 HW Trigger signal is GPDMA2_CH6_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_GPDMA2_CH7_TCF   33U      /*!< GPDMA2 HW Trigger signal is GPDMA2_CH7_TCF  */ | ||||||
|  | #define GPDMA2_TRIGGER_TIM2_TRGO        34U      /*!< GPDMA2 HW Trigger signal is TIM2_TRGO       */ | ||||||
|  | #if defined (TIM15) | ||||||
|  | #define GPDMA2_TRIGGER_TIM15_TRGO       35U      /*!< GPDMA2 HW Trigger signal is TIM15_TRGO      */ | ||||||
|  | #endif /* TIM15 */ | ||||||
|  | #if defined (TIM12) | ||||||
|  | #define GPDMA2_TRIGGER_TIM12_TRGO       36U      /*!< GPDMA2 HW Trigger signal is TIM12_TRGO      */ | ||||||
|  | #endif /* TIM12 */ | ||||||
|  | #if defined (LPTIM3) | ||||||
|  | #define GPDMA2_TRIGGER_LPTIM3_CH1       37U      /*!< GPDMA2 HW Trigger signal is LPTIM3_CH1      */ | ||||||
|  | #define GPDMA2_TRIGGER_LPTIM3_CH2       38U      /*!< GPDMA2 HW Trigger signal is LPTIM3_CH2      */ | ||||||
|  | #endif /* LPTIM3 */ | ||||||
|  | #if defined (LPTIM4) | ||||||
|  | #define GPDMA2_TRIGGER_LPTIM4_AIT       39U      /*!< GPDMA2 HW Trigger signal is LPTIM4_AIT      */ | ||||||
|  | #endif /* LPTIM4 */ | ||||||
|  | #if defined (LPTIM5) | ||||||
|  | #define GPDMA2_TRIGGER_LPTIM5_CH1       40U      /*!< GPDMA2 HW Trigger signal is LPTIM5_CH1      */ | ||||||
|  | #define GPDMA2_TRIGGER_LPTIM5_CH2       41U      /*!< GPDMA2 HW Trigger signal is LPTIM5_CH2      */ | ||||||
|  | #endif /* LPTIM5 */ | ||||||
|  | #if defined (LPTIM6) | ||||||
|  | #define GPDMA2_TRIGGER_LPTIM6_CH1       42U      /*!< GPDMA2 HW Trigger signal is LPTIM6_CH1      */ | ||||||
|  | #define GPDMA2_TRIGGER_LPTIM6_CH2       43U      /*!< GPDMA2 HW Trigger signal is LPTIM6_CH2      */ | ||||||
|  | #endif /* LPTIM6 */ | ||||||
|  | #if defined (COMP1) | ||||||
|  | #define GPDMA2_TRIGGER_COMP1_OUT        44U      /*!< GPDMA2 HW Trigger signal is COMP1_OUT       */ | ||||||
|  | #endif /* COMP1 */ | ||||||
|  | #if defined (STM32H503xx) || defined(STM32H523xx) || defined(STM32H533xx) | ||||||
|  | #define GPDMA2_TRIGGER_EVENTOUT         45U      /*!< GPDMA2 HW Trigger signal is EVENTOUT        */ | ||||||
|  | #endif /* STM32H503xx || STM32H523xx || STM32H533xx */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Node_Type DMAEx Node Type | ||||||
|  |   * @brief    DMAEx Node Type | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define DMA_GPDMA_LINEAR_NODE (DMA_CHANNEL_TYPE_GPDMA | DMA_CHANNEL_TYPE_LINEAR_ADDR) /*!< Defines the GPDMA linear addressing node type      */ | ||||||
|  | #define DMA_GPDMA_2D_NODE     (DMA_CHANNEL_TYPE_GPDMA | DMA_CHANNEL_TYPE_2D_ADDR)     /*!< Defines the GPDMA 2 dimension addressing node type */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Link_Allocated_Port DMAEx Linked-List Allocated Port | ||||||
|  |   * @brief    DMAEx Linked-List Allocated Port | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define DMA_LINK_ALLOCATED_PORT0 0x00000000U /*!< Link allocated port 0 */ | ||||||
|  | #define DMA_LINK_ALLOCATED_PORT1 DMA_CCR_LAP /*!< Link allocated port 1 */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Link_Step_Mode DMAEx Link Step Mode | ||||||
|  |   * @brief    DMAEx Link Step Mode | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define DMA_LSM_FULL_EXECUTION  0x00000000U /*!< Channel is executed for the full linked-list */ | ||||||
|  | #define DMA_LSM_1LINK_EXECUTION DMA_CCR_LSM /*!< Channel is executed once for the current LLI */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported functions ------------------------------------------------------------------------------------------------*/ | ||||||
|  | /** @defgroup DMAEx_Exported_Functions DMAEx Exported Functions | ||||||
|  |   * @brief    DMAEx Exported functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Exported_Functions_Group1 Linked-List Initialization and De-Initialization Functions | ||||||
|  |   * @brief    Linked-List Initialization and De-Initialization Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_Init(DMA_HandleTypeDef *const hdma); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_DeInit(DMA_HandleTypeDef *const hdma); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Exported_Functions_Group2 Linked-List IO Operation Functions | ||||||
|  |   * @brief    Linked-List IO Operation Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_Start(DMA_HandleTypeDef *const hdma); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_Start_IT(DMA_HandleTypeDef *const hdma); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Exported_Functions_Group3 Linked-List Management Functions | ||||||
|  |   * @brief    Linked-List Management Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_BuildNode(DMA_NodeConfTypeDef const *const pNodeConfig, | ||||||
|  |                                            DMA_NodeTypeDef *const pNode); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_GetNodeConfig(DMA_NodeConfTypeDef *const pNodeConfig, | ||||||
|  |                                                DMA_NodeTypeDef const *const pNode); | ||||||
|  |  | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_InsertNode(DMA_QListTypeDef *const pQList, | ||||||
|  |                                             DMA_NodeTypeDef *const pPrevNode, | ||||||
|  |                                             DMA_NodeTypeDef *const pNewNode); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_InsertNode_Head(DMA_QListTypeDef *const pQList, | ||||||
|  |                                                  DMA_NodeTypeDef *const pNewNode); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_InsertNode_Tail(DMA_QListTypeDef *const pQList, | ||||||
|  |                                                  DMA_NodeTypeDef *const pNewNode); | ||||||
|  |  | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_RemoveNode(DMA_QListTypeDef *const pQList, | ||||||
|  |                                             DMA_NodeTypeDef *const pNode); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_RemoveNode_Head(DMA_QListTypeDef *const pQList); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_RemoveNode_Tail(DMA_QListTypeDef *const pQList); | ||||||
|  |  | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_ReplaceNode(DMA_QListTypeDef *const pQList, | ||||||
|  |                                              DMA_NodeTypeDef *const pOldNode, | ||||||
|  |                                              DMA_NodeTypeDef *const pNewNode); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_ReplaceNode_Head(DMA_QListTypeDef *const pQList, | ||||||
|  |                                                   DMA_NodeTypeDef *const pNewNode); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_ReplaceNode_Tail(DMA_QListTypeDef *const pQList, | ||||||
|  |                                                   DMA_NodeTypeDef *const pNewNode); | ||||||
|  |  | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_ResetQ(DMA_QListTypeDef *const pQList); | ||||||
|  |  | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_InsertQ(DMA_QListTypeDef *const pSrcQList, | ||||||
|  |                                          DMA_NodeTypeDef const *const pPrevNode, | ||||||
|  |                                          DMA_QListTypeDef *const pDestQList); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_InsertQ_Head(DMA_QListTypeDef *const pSrcQList, | ||||||
|  |                                               DMA_QListTypeDef *const pDestQList); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_InsertQ_Tail(DMA_QListTypeDef *const pSrcQList, | ||||||
|  |                                               DMA_QListTypeDef *const pDestQList); | ||||||
|  |  | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_SetCircularModeConfig(DMA_QListTypeDef *const pQList, | ||||||
|  |                                                        DMA_NodeTypeDef *const pFirstCircularNode); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_SetCircularMode(DMA_QListTypeDef *const pQList); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_ClearCircularMode(DMA_QListTypeDef *const pQList); | ||||||
|  |  | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_ConvertQToDynamic(DMA_QListTypeDef *const pQList); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_ConvertQToStatic(DMA_QListTypeDef *const pQList); | ||||||
|  |  | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_LinkQ(DMA_HandleTypeDef *const hdma, | ||||||
|  |                                        DMA_QListTypeDef *const pQList); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_List_UnLinkQ(DMA_HandleTypeDef *const hdma); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Exported_Functions_Group4 Data Handling, Repeated Block and Trigger Configuration Functions | ||||||
|  |   * @brief    Data Handling, Repeated Block and Trigger Configuration Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_ConfigDataHandling(DMA_HandleTypeDef *const hdma, | ||||||
|  |                                                DMA_DataHandlingConfTypeDef const *const pConfigDataHandling); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_ConfigTrigger(DMA_HandleTypeDef *const hdma, | ||||||
|  |                                           DMA_TriggerConfTypeDef const *const pConfigTrigger); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_ConfigRepeatBlock(DMA_HandleTypeDef *const hdma, | ||||||
|  |                                               DMA_RepeatBlockConfTypeDef const *const pConfigRepeatBlock); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Exported_Functions_Group5 Suspend and Resume Operation Functions | ||||||
|  |   * @brief    Suspend and Resume Operation Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_Suspend(DMA_HandleTypeDef *const hdma); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_Suspend_IT(DMA_HandleTypeDef *const hdma); | ||||||
|  | HAL_StatusTypeDef HAL_DMAEx_Resume(DMA_HandleTypeDef *const hdma); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup DMAEx_Exported_Functions_Group6 FIFO Status Function | ||||||
|  |   * @brief    FIFO Status Function | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | uint32_t HAL_DMAEx_GetFifoLevel(DMA_HandleTypeDef const *const hdma); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private types -----------------------------------------------------------------------------------------------------*/ | ||||||
|  | /** @defgroup DMAEx_Private_Types DMAEx Private Types | ||||||
|  |   * @brief    DMAEx Private Types | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief DMA Node in Queue Information Structure Definition. | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t cllr_offset;       /* CLLR register offset  */ | ||||||
|  |  | ||||||
|  |   uint32_t previousnode_addr; /* Previous node address */ | ||||||
|  |  | ||||||
|  |   uint32_t currentnode_pos;   /* Current node position */ | ||||||
|  |  | ||||||
|  |   uint32_t currentnode_addr;  /* Current node address  */ | ||||||
|  |  | ||||||
|  |   uint32_t nextnode_addr;     /* Next node address     */ | ||||||
|  |  | ||||||
|  | } DMA_NodeInQInfoTypeDef; | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private constants -------------------------------------------------------------------------------------------------*/ | ||||||
|  | /** @defgroup DMAEx_Private_Constants DMAEx Private Constants | ||||||
|  |   * @brief    DMAEx Private Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define DMA_LINKEDLIST                  (0x0080U) /* DMA channel linked-list mode          */ | ||||||
|  |  | ||||||
|  | #define DMA_CHANNEL_TYPE_LINEAR_ADDR    (0x0001U) /* DMA channel linear addressing mode    */ | ||||||
|  | #define DMA_CHANNEL_TYPE_2D_ADDR        (0x0002U) /* DMA channel 2D addressing mode        */ | ||||||
|  | #define DMA_CHANNEL_TYPE_GPDMA          (0x0020U) /* GPDMA channel node                    */ | ||||||
|  |  | ||||||
|  | #define NODE_TYPE_MASK                  (0x00FFU) /* DMA channel node type                 */ | ||||||
|  | #define NODE_CLLR_IDX                   (0x0700U) /* DMA channel node CLLR index mask      */ | ||||||
|  | #define NODE_CLLR_IDX_POS               (0x0008U) /* DMA channel node CLLR index position  */ | ||||||
|  |  | ||||||
|  | #define NODE_MAXIMUM_SIZE               (0x0008U) /* Amount of registers of the node       */ | ||||||
|  |  | ||||||
|  | #define NODE_STATIC_FORMAT              (0x0000U) /* DMA channel node static format        */ | ||||||
|  | #define NODE_DYNAMIC_FORMAT             (0x0001U) /* DMA channel node dynamic format       */ | ||||||
|  |  | ||||||
|  | #define UPDATE_CLLR_POSITION            (0x0000U) /* DMA channel update CLLR position      */ | ||||||
|  | #define UPDATE_CLLR_VALUE               (0x0001U) /* DMA channel update CLLR value         */ | ||||||
|  |  | ||||||
|  | #define LASTNODE_ISNOT_CIRCULAR         (0x0000U) /* Last node is not first circular node  */ | ||||||
|  | #define LASTNODE_IS_CIRCULAR            (0x0001U) /* Last node is first circular node      */ | ||||||
|  |  | ||||||
|  | #define QUEUE_TYPE_STATIC               (0x0000U) /* DMA channel static queue              */ | ||||||
|  | #define QUEUE_TYPE_DYNAMIC              (0x0001U) /* DMA channel dynamic queue             */ | ||||||
|  |  | ||||||
|  | #define NODE_CTR1_DEFAULT_OFFSET        (0x0000U) /* CTR1 default offset                   */ | ||||||
|  | #define NODE_CTR2_DEFAULT_OFFSET        (0x0001U) /* CTR2 default offset                   */ | ||||||
|  | #define NODE_CBR1_DEFAULT_OFFSET        (0x0002U) /* CBR1 default offset                   */ | ||||||
|  | #define NODE_CSAR_DEFAULT_OFFSET        (0x0003U) /* CSAR default offset                   */ | ||||||
|  | #define NODE_CDAR_DEFAULT_OFFSET        (0x0004U) /* CDAR default offset                   */ | ||||||
|  | #define NODE_CTR3_DEFAULT_OFFSET        (0x0005U) /* CTR3 2D addressing default offset     */ | ||||||
|  | #define NODE_CBR2_DEFAULT_OFFSET        (0x0006U) /* CBR2 2D addressing default offset     */ | ||||||
|  | #define NODE_CLLR_2D_DEFAULT_OFFSET     (0x0007U) /* CLLR 2D addressing default offset     */ | ||||||
|  | #define NODE_CLLR_LINEAR_DEFAULT_OFFSET (0x0005U) /* CLLR linear addressing default offset */ | ||||||
|  |  | ||||||
|  | #define DMA_BURST_ADDR_OFFSET_MIN       (-8192L)  /* DMA burst minimum address offset      */ | ||||||
|  | #define DMA_BURST_ADDR_OFFSET_MAX       (8192L)   /* DMA burst maximum address offset      */ | ||||||
|  | #define DMA_BLOCK_ADDR_OFFSET_MIN       (-65536L) /* DMA block minimum address offset      */ | ||||||
|  | #define DMA_BLOCK_ADDR_OFFSET_MAX       (65536L)  /* DMA block maximum address offset      */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private macros ----------------------------------------------------------------------------------------------------*/ | ||||||
|  | /** @defgroup DMAEx_Private_Macros DMAEx Private Macros | ||||||
|  |   * @brief    DMAEx Private Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define IS_DMA_DATA_ALIGNMENT(ALIGNMENT)              \ | ||||||
|  |   (((ALIGNMENT) == DMA_DATA_RIGHTALIGN_ZEROPADDED) || \ | ||||||
|  |    ((ALIGNMENT) == DMA_DATA_RIGHTALIGN_SIGNEXT)    || \ | ||||||
|  |    ((ALIGNMENT) == DMA_DATA_PACK)) | ||||||
|  |  | ||||||
|  | #define IS_DMA_DATA_EXCHANGE(EXCHANGE) \ | ||||||
|  |   (((EXCHANGE) & (~(DMA_EXCHANGE_SRC_BYTE | DMA_EXCHANGE_DEST_BYTE | DMA_EXCHANGE_DEST_HALFWORD))) == 0U) | ||||||
|  |  | ||||||
|  | #define IS_DMA_REPEAT_COUNT(COUNT) \ | ||||||
|  |   (((COUNT) > 0U) && ((COUNT) <= (DMA_CBR1_BRC >> DMA_CBR1_BRC_Pos))) | ||||||
|  |  | ||||||
|  | #define IS_DMA_BURST_ADDR_OFFSET(BURST_ADDR_OFFSET)     \ | ||||||
|  |   (((BURST_ADDR_OFFSET) > DMA_BURST_ADDR_OFFSET_MIN) && \ | ||||||
|  |    ((BURST_ADDR_OFFSET) < DMA_BURST_ADDR_OFFSET_MAX)) | ||||||
|  |  | ||||||
|  | #define IS_DMA_BLOCK_ADDR_OFFSET(BLOCK_ADDR_OFFSET)     \ | ||||||
|  |   (((BLOCK_ADDR_OFFSET) > DMA_BLOCK_ADDR_OFFSET_MIN) && \ | ||||||
|  |    ((BLOCK_ADDR_OFFSET) < DMA_BLOCK_ADDR_OFFSET_MAX)) | ||||||
|  |  | ||||||
|  | #define IS_DMA_LINK_ALLOCATED_PORT(LINK_ALLOCATED_PORT) \ | ||||||
|  |   (((LINK_ALLOCATED_PORT) & (~(DMA_CCR_LAP))) == 0U) | ||||||
|  |  | ||||||
|  | #define IS_DMA_LINK_STEP_MODE(MODE)      \ | ||||||
|  |   (((MODE) == DMA_LSM_FULL_EXECUTION) || \ | ||||||
|  |    ((MODE) == DMA_LSM_1LINK_EXECUTION)) | ||||||
|  |  | ||||||
|  | #define IS_DMA_TRIGGER_MODE(MODE)                   \ | ||||||
|  |   (((MODE) == DMA_TRIGM_BLOCK_TRANSFER)          || \ | ||||||
|  |    ((MODE) == DMA_TRIGM_REPEATED_BLOCK_TRANSFER) || \ | ||||||
|  |    ((MODE) == DMA_TRIGM_LLI_LINK_TRANSFER)       || \ | ||||||
|  |    ((MODE) == DMA_TRIGM_SINGLE_BURST_TRANSFER)) | ||||||
|  |  | ||||||
|  | #define IS_DMA_TCEM_LINKEDLIST_EVENT_MODE(MODE)    \ | ||||||
|  |   (((MODE) == DMA_TCEM_BLOCK_TRANSFER)          || \ | ||||||
|  |    ((MODE) == DMA_TCEM_REPEATED_BLOCK_TRANSFER) || \ | ||||||
|  |    ((MODE) == DMA_TCEM_EACH_LL_ITEM_TRANSFER)   || \ | ||||||
|  |    ((MODE) == DMA_TCEM_LAST_LL_ITEM_TRANSFER)) | ||||||
|  |  | ||||||
|  | #define IS_DMA_LINKEDLIST_MODE(MODE)    \ | ||||||
|  |   (((MODE) == DMA_LINKEDLIST_NORMAL) || \ | ||||||
|  |    ((MODE) == DMA_LINKEDLIST_CIRCULAR)) | ||||||
|  |  | ||||||
|  | #define IS_DMA_TRIGGER_POLARITY(POLARITY)      \ | ||||||
|  |   (((POLARITY) == DMA_TRIG_POLARITY_MASKED) || \ | ||||||
|  |    ((POLARITY) == DMA_TRIG_POLARITY_RISING) || \ | ||||||
|  |    ((POLARITY) == DMA_TRIG_POLARITY_FALLING)) | ||||||
|  |  | ||||||
|  | #if defined (I3C2) | ||||||
|  | #define IS_DMA_TRIGGER_SELECTION(TRIGGER)        ((TRIGGER) <= GPDMA1_TRIGGER_EVENTOUT) | ||||||
|  | #else | ||||||
|  | #define IS_DMA_TRIGGER_SELECTION(TRIGGER)        ((TRIGGER) <= GPDMA1_TRIGGER_LPTIM6_CH2) | ||||||
|  | #endif /* I3C2 */ | ||||||
|  |  | ||||||
|  | #define IS_DMA_NODE_TYPE(TYPE)          \ | ||||||
|  |   (((TYPE) == DMA_GPDMA_LINEAR_NODE) || \ | ||||||
|  |    ((TYPE) == DMA_GPDMA_2D_NODE)) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Private functions -------------------------------------------------------------------------------------------------*/ | ||||||
|  | /** @defgroup DMAEx_Private_Functions DMAEx Private Functions | ||||||
|  |   * @brief    DMAEx Private Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
|  | #endif /* STM32H5xx_HAL_DMA_EX_H */ | ||||||
							
								
								
									
										483
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_exti.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										483
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_exti.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,483 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_exti.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   Header file of EXTI HAL module. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef STM32H5xx_HAL_EXTI_H | ||||||
|  | #define STM32H5xx_HAL_EXTI_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal_def.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_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, | ||||||
|  |   HAL_EXTI_RISING_CB_ID          = 0x01U, | ||||||
|  |   HAL_EXTI_FALLING_CB_ID         = 0x02U, | ||||||
|  | } EXTI_CallbackIDTypeDef; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  EXTI Handle structure definition | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t Line;                    /*!<  Exti line number */ | ||||||
|  |   void (* RisingCallback)(void);    /*!<  Exti rising callback */ | ||||||
|  |   void (* FallingCallback)(void);   /*!<  Exti falling 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     | EXTI_REG1 | 0x00U) | ||||||
|  | #define EXTI_LINE_1                         (EXTI_GPIO     | EXTI_REG1 | 0x01U) | ||||||
|  | #define EXTI_LINE_2                         (EXTI_GPIO     | EXTI_REG1 | 0x02U) | ||||||
|  | #define EXTI_LINE_3                         (EXTI_GPIO     | EXTI_REG1 | 0x03U) | ||||||
|  | #define EXTI_LINE_4                         (EXTI_GPIO     | EXTI_REG1 | 0x04U) | ||||||
|  | #define EXTI_LINE_5                         (EXTI_GPIO     | EXTI_REG1 | 0x05U) | ||||||
|  | #define EXTI_LINE_6                         (EXTI_GPIO     | EXTI_REG1 | 0x06U) | ||||||
|  | #define EXTI_LINE_7                         (EXTI_GPIO     | EXTI_REG1 | 0x07U) | ||||||
|  | #define EXTI_LINE_8                         (EXTI_GPIO     | EXTI_REG1 | 0x08U) | ||||||
|  | #define EXTI_LINE_9                         (EXTI_GPIO     | EXTI_REG1 | 0x09U) | ||||||
|  | #define EXTI_LINE_10                        (EXTI_GPIO     | EXTI_REG1 | 0x0AU) | ||||||
|  | #define EXTI_LINE_11                        (EXTI_GPIO     | EXTI_REG1 | 0x0BU) | ||||||
|  | #define EXTI_LINE_12                        (EXTI_GPIO     | EXTI_REG1 | 0x0CU) | ||||||
|  | #define EXTI_LINE_13                        (EXTI_GPIO     | EXTI_REG1 | 0x0DU) | ||||||
|  | #define EXTI_LINE_14                        (EXTI_GPIO     | EXTI_REG1 | 0x0EU) | ||||||
|  | #define EXTI_LINE_15                        (EXTI_GPIO     | EXTI_REG1 | 0x0FU) | ||||||
|  | #define EXTI_LINE_16                        (EXTI_CONFIG   | EXTI_REG1 | 0x10U) | ||||||
|  | #define EXTI_LINE_17                        (EXTI_DIRECT   | EXTI_REG1 | 0x11U) | ||||||
|  | #if defined(EXTI_IMR1_IM18) | ||||||
|  | #define EXTI_LINE_18                        (EXTI_DIRECT   | EXTI_REG1 | 0x12U) | ||||||
|  | #endif /* EXTI_IMR1_IM18 */ | ||||||
|  | #define EXTI_LINE_19                        (EXTI_DIRECT   | EXTI_REG1 | 0x13U) | ||||||
|  | #if defined(EXTI_IMR1_IM20) | ||||||
|  | #define EXTI_LINE_20                        (EXTI_DIRECT   | EXTI_REG1 | 0x14U) | ||||||
|  | #endif /* EXTI_IMR1_IM20 */ | ||||||
|  | #define EXTI_LINE_21                        (EXTI_DIRECT   | EXTI_REG1 | 0x15U) | ||||||
|  | #define EXTI_LINE_22                        (EXTI_DIRECT   | EXTI_REG1 | 0x16U) | ||||||
|  | #if defined(EXTI_IMR1_IM23) | ||||||
|  | #define EXTI_LINE_23                        (EXTI_DIRECT   | EXTI_REG1 | 0x17U) | ||||||
|  | #endif /* EXTI_IMR1_IM23 */ | ||||||
|  | #define EXTI_LINE_24                        (EXTI_DIRECT   | EXTI_REG1 | 0x18U) | ||||||
|  | #define EXTI_LINE_25                        (EXTI_DIRECT   | EXTI_REG1 | 0x19U) | ||||||
|  | #define EXTI_LINE_26                        (EXTI_DIRECT   | EXTI_REG1 | 0x1AU) | ||||||
|  | #define EXTI_LINE_27                        (EXTI_DIRECT   | EXTI_REG1 | 0x1BU) | ||||||
|  | #define EXTI_LINE_28                        (EXTI_DIRECT   | EXTI_REG1 | 0x1CU) | ||||||
|  | #define EXTI_LINE_29                        (EXTI_DIRECT   | EXTI_REG1 | 0x1DU) | ||||||
|  | #if defined(EXTI_IMR1_IM30) | ||||||
|  | #define EXTI_LINE_30                        (EXTI_DIRECT   | EXTI_REG1 | 0x1EU) | ||||||
|  | #endif /* EXTI_IMR1_IM30 */ | ||||||
|  | #define EXTI_LINE_31                        (EXTI_DIRECT   | EXTI_REG1 | 0x1FU) | ||||||
|  | #if defined(EXTI_IMR2_IM32) | ||||||
|  | #define EXTI_LINE_32                        (EXTI_DIRECT   | EXTI_REG2 | 0x00U) | ||||||
|  | #endif /* EXTI_IMR2_IM32 */ | ||||||
|  | #if defined(EXTI_IMR2_IM33) | ||||||
|  | #define EXTI_LINE_33                        (EXTI_DIRECT   | EXTI_REG2 | 0x01U) | ||||||
|  | #endif /* EXTI_IMR2_IM33 */ | ||||||
|  | #if defined(EXTI_IMR2_IM34) | ||||||
|  | #define EXTI_LINE_34                        (EXTI_DIRECT   | EXTI_REG2 | 0x02U) | ||||||
|  | #endif /* EXTI_IMR2_IM34 */ | ||||||
|  | #if defined(EXTI_IMR2_IM35) | ||||||
|  | #define EXTI_LINE_35                        (EXTI_DIRECT   | EXTI_REG2 | 0x03U) | ||||||
|  | #endif /* EXTI_IMR2_IM35 */ | ||||||
|  | #if defined(EXTI_IMR2_IM36) | ||||||
|  | #define EXTI_LINE_36                        (EXTI_DIRECT   | EXTI_REG2 | 0x04U) | ||||||
|  | #endif /* EXTI_IMR2_IM36 */ | ||||||
|  | #define EXTI_LINE_37                        (EXTI_DIRECT   | EXTI_REG2 | 0x05U) | ||||||
|  | #define EXTI_LINE_38                        (EXTI_DIRECT   | EXTI_REG2 | 0x06U) | ||||||
|  | #define EXTI_LINE_39                        (EXTI_DIRECT   | EXTI_REG2 | 0x07U) | ||||||
|  | #define EXTI_LINE_40                        (EXTI_DIRECT   | EXTI_REG2 | 0x08U) | ||||||
|  | #define EXTI_LINE_41                        (EXTI_DIRECT   | EXTI_REG2 | 0x09U) | ||||||
|  | #define EXTI_LINE_42                        (EXTI_DIRECT   | EXTI_REG2 | 0x0AU) | ||||||
|  | #if defined(EXTI_IMR2_IM43) | ||||||
|  | #define EXTI_LINE_43                        (EXTI_DIRECT   | EXTI_REG2 | 0x0BU) | ||||||
|  | #endif /* EXTI_IMR2_IM43 */ | ||||||
|  | #if defined(EXTI_IMR2_IM44) | ||||||
|  | #define EXTI_LINE_44                        (EXTI_DIRECT   | EXTI_REG2 | 0x0CU) | ||||||
|  | #endif /* EXTI_IMR2_IM44 */ | ||||||
|  | #if defined(EXTI_IMR2_IM45) | ||||||
|  | #endif /* EXTI_IMR2_IM45 */ | ||||||
|  | #define EXTI_LINE_45                        (EXTI_DIRECT   | EXTI_REG2 | 0x0DU) | ||||||
|  | #if defined(ETH) | ||||||
|  | #define EXTI_LINE_46                        (EXTI_CONFIG   | EXTI_REG2 | 0x0EU) | ||||||
|  | #endif /* ETH */ | ||||||
|  | #define EXTI_LINE_47                        (EXTI_DIRECT   | EXTI_REG2 | 0x0FU) | ||||||
|  | #if defined(EXTI_IMR2_IM48) | ||||||
|  | #define EXTI_LINE_48                        (EXTI_DIRECT   | EXTI_REG2 | 0x10U) | ||||||
|  | #endif /* EXTI_IMR2_IM48 */ | ||||||
|  | #define EXTI_LINE_49                        (EXTI_DIRECT   | EXTI_REG2 | 0x11U) | ||||||
|  | #define EXTI_LINE_50                        (EXTI_CONFIG   | EXTI_REG2 | 0x12U) | ||||||
|  | #if defined(EXTI_IMR2_IM51) | ||||||
|  | #define EXTI_LINE_51                        (EXTI_DIRECT   | EXTI_REG2 | 0x13U) | ||||||
|  | #endif /* EXTI_IMR2_IM51 */ | ||||||
|  | #if defined(EXTI_IMR2_IM52) | ||||||
|  | #define EXTI_LINE_52                        (EXTI_DIRECT   | EXTI_REG2 | 0x14U) | ||||||
|  | #endif /* EXTI_IMR2_IM52 */ | ||||||
|  | #define EXTI_LINE_53                        (EXTI_CONFIG   | EXTI_REG2 | 0x15U) | ||||||
|  | #if defined(EXTI_IMR2_IM54) | ||||||
|  | #define EXTI_LINE_54                        (EXTI_DIRECT   | EXTI_REG2 | 0x16U) | ||||||
|  | #endif /* EXTI_IMR2_IM54 */ | ||||||
|  | #if defined(EXTI_IMR2_IM55) | ||||||
|  | #define EXTI_LINE_55                        (EXTI_DIRECT   | EXTI_REG2 | 0x17U) | ||||||
|  | #endif /* EXTI_IMR2_IM55 */ | ||||||
|  | #if defined(EXTI_IMR2_IM56) | ||||||
|  | #define EXTI_LINE_56                        (EXTI_DIRECT   | EXTI_REG2 | 0x18U) | ||||||
|  | #endif /* EXTI_IMR2_IM56 */ | ||||||
|  | #if defined(EXTI_IMR2_IM57) | ||||||
|  | #define EXTI_LINE_57                        (EXTI_DIRECT   | EXTI_REG2 | 0x19U) | ||||||
|  | #endif /* EXTI_IMR2_IM57 */ | ||||||
|  | #if defined(EXTI_IMR2_IM58) | ||||||
|  | #if defined(I3C2) | ||||||
|  | #define EXTI_LINE_58                        (EXTI_DIRECT   | EXTI_REG2 | 0x1AU) | ||||||
|  | #endif /* I3C2 */ | ||||||
|  | #endif /* EXTI_IMR2_IM58 */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @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 */ | ||||||
|  | #define EXTI_GPIOH                          0x00000007U | ||||||
|  | #if defined(GPIOI) | ||||||
|  | #define EXTI_GPIOI                          0x00000008U | ||||||
|  | #endif /* GPIOI */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup EXTI_Line_attributes EXTI line attributes | ||||||
|  |   * @brief EXTI line secure or non-secure and privileged or non-privileged attributes | ||||||
|  |   * @note secure and non-secure attributes are only available from secure state when the system | ||||||
|  |   *       implement the security (TZEN=1) | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /*!< Secure line attribute          */ | ||||||
|  | #define  EXTI_LINE_SEC                      (EXTI_LINE_ATTR_SEC_MASK | 0x00000001U) | ||||||
|  | /*!< Non-secure line attribute      */ | ||||||
|  | #define  EXTI_LINE_NSEC                     (EXTI_LINE_ATTR_SEC_MASK | 0x00000000U) | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  | /*!< Privileged line attribute      */ | ||||||
|  | #define  EXTI_LINE_PRIV                     (EXTI_LINE_ATTR_PRIV_MASK | 0x00000002U) | ||||||
|  | /*!< Non-privileged line attribute  */ | ||||||
|  | #define  EXTI_LINE_NPRIV                    (EXTI_LINE_ATTR_PRIV_MASK | 0x00000000U) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | /** @defgroup EXTI_Security_Privilege_Configuration EXTI Security Privilege Configuration | ||||||
|  |   * @brief EXTI security and privilege configurations | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /* Security and privilege configuration open, can be modified */ | ||||||
|  | #define EXTI_ATTRIBUTES_UNLOCKED  0x00000000U | ||||||
|  | /* Security and privilege configuration locked, can no longer be modified */ | ||||||
|  | #define EXTI_ATTRIBUTES_LOCKED    0x00000001U | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported macro ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup EXTI_Exported_Macros EXTI Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private constants --------------------------------------------------------*/ | ||||||
|  | /** @defgroup EXTI_Private_Constants EXTI Private Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /** | ||||||
|  |   * @brief  EXTI Line property definition | ||||||
|  |   */ | ||||||
|  | #define EXTI_PROPERTY_SHIFT                  24U | ||||||
|  | #define EXTI_DIRECT                         (0x01U << EXTI_PROPERTY_SHIFT) | ||||||
|  | #define EXTI_CONFIG                         (0x02U << EXTI_PROPERTY_SHIFT) | ||||||
|  | #define EXTI_GPIO                           ((0x04U << EXTI_PROPERTY_SHIFT) | EXTI_CONFIG) | ||||||
|  | #define EXTI_RESERVED                       (0x08U << EXTI_PROPERTY_SHIFT) | ||||||
|  | #define EXTI_PROPERTY_MASK                  (EXTI_DIRECT | EXTI_CONFIG | EXTI_GPIO) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  EXTI Register and bit usage | ||||||
|  |   */ | ||||||
|  | #define EXTI_REG_SHIFT                      16U | ||||||
|  | #define EXTI_REG1                           (0x00U << EXTI_REG_SHIFT) | ||||||
|  | #define EXTI_REG2                           (0x01U << EXTI_REG_SHIFT) | ||||||
|  | #define EXTI_REG_MASK                       (EXTI_REG1 | EXTI_REG2) | ||||||
|  | #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_IMR2_IM58) | ||||||
|  | #define EXTI_LINE_NB                        59U | ||||||
|  | #elif defined(EXTI_IMR2_IM57) | ||||||
|  | #define EXTI_LINE_NB                        58U | ||||||
|  | #else | ||||||
|  | #define EXTI_LINE_NB                        54U | ||||||
|  | #endif /* EXTI_IMR2_IM58 */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  EXTI Mask for secure & privilege attributes | ||||||
|  |   */ | ||||||
|  | #define EXTI_LINE_ATTR_SEC_MASK             0x100U | ||||||
|  | #define EXTI_LINE_ATTR_PRIV_MASK            0x200U | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private macros ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup EXTI_Private_Macros EXTI Private Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define IS_EXTI_LINE(__EXTI_LINE__)   ((((__EXTI_LINE__) & ~(EXTI_PROPERTY_MASK | \ | ||||||
|  |                                                              EXTI_REG_MASK | EXTI_PIN_MASK)) == 0x00U)  \ | ||||||
|  |                                        &&((((__EXTI_LINE__) & EXTI_PROPERTY_MASK) == EXTI_DIRECT)  || \ | ||||||
|  |                                           (((__EXTI_LINE__) & EXTI_PROPERTY_MASK) == EXTI_CONFIG)   || \ | ||||||
|  |                                           (((__EXTI_LINE__) & EXTI_PROPERTY_MASK) == EXTI_GPIO))    && \ | ||||||
|  |                                        (((__EXTI_LINE__) & (EXTI_REG_MASK | EXTI_PIN_MASK))      < \ | ||||||
|  |                                         (((EXTI_LINE_NB / 32U) << EXTI_REG_SHIFT) | (EXTI_LINE_NB % 32U)))) | ||||||
|  |  | ||||||
|  | #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) || \ | ||||||
|  |                                               ((__EXTI_LINE__) == EXTI_TRIGGER_FALLING)) | ||||||
|  |  | ||||||
|  | #define IS_EXTI_CONFIG_LINE(__EXTI_LINE__)   (((__EXTI_LINE__) & EXTI_CONFIG) != 0x00U) | ||||||
|  |  | ||||||
|  | #if 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) || \ | ||||||
|  |                                          ((__PORT__) == EXTI_GPIOI)) | ||||||
|  | #elif defined(GPIOE) | ||||||
|  | #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)) | ||||||
|  | #else | ||||||
|  | #define IS_EXTI_GPIO_PORT(__PORT__)     (((__PORT__) == EXTI_GPIOA) || \ | ||||||
|  |                                          ((__PORT__) == EXTI_GPIOB) || \ | ||||||
|  |                                          ((__PORT__) == EXTI_GPIOC) || \ | ||||||
|  |                                          ((__PORT__) == EXTI_GPIOD) || \ | ||||||
|  |                                          ((__PORT__) == EXTI_GPIOH)) | ||||||
|  | #endif /* GPIOI */ | ||||||
|  |  | ||||||
|  | #define IS_EXTI_GPIO_PIN(__PIN__)        ((__PIN__) < 16U) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |  | ||||||
|  | #define IS_EXTI_LINE_ATTRIBUTES(__ATTRIBUTES__) (((((__ATTRIBUTES__) & EXTI_LINE_SEC) == EXTI_LINE_SEC) || \ | ||||||
|  |                                                   (((__ATTRIBUTES__) & EXTI_LINE_NSEC) == EXTI_LINE_NSEC) || \ | ||||||
|  |                                                   (((__ATTRIBUTES__) & EXTI_LINE_PRIV) == EXTI_LINE_PRIV) || \ | ||||||
|  |                                                   (((__ATTRIBUTES__) & EXTI_LINE_NPRIV) == EXTI_LINE_NPRIV)) && \ | ||||||
|  |                                                  (((__ATTRIBUTES__) & ~(EXTI_LINE_SEC|EXTI_LINE_NSEC|EXTI_LINE_PRIV| \ | ||||||
|  |                                                                         EXTI_LINE_NPRIV)) == 0U)) | ||||||
|  |  | ||||||
|  | #else | ||||||
|  |  | ||||||
|  | #define IS_EXTI_LINE_ATTRIBUTES(__ATTRIBUTES__) (((((__ATTRIBUTES__) & EXTI_LINE_PRIV) == EXTI_LINE_PRIV) || \ | ||||||
|  |                                                   (((__ATTRIBUTES__) & EXTI_LINE_NPRIV) == EXTI_LINE_NPRIV)) && \ | ||||||
|  |                                                  (((__ATTRIBUTES__) & ~(EXTI_LINE_PRIV|EXTI_LINE_NPRIV)) == 0U)) | ||||||
|  |  | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* 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(const 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(const EXTI_HandleTypeDef *hexti); | ||||||
|  | uint32_t          HAL_EXTI_GetPending(const EXTI_HandleTypeDef *hexti, uint32_t Edge); | ||||||
|  | void              HAL_EXTI_ClearPending(const EXTI_HandleTypeDef *hexti, uint32_t Edge); | ||||||
|  | void              HAL_EXTI_GenerateSWI(const EXTI_HandleTypeDef *hexti); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup EXTI_Exported_Functions_Group3 EXTI line attributes management functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* EXTI line attributes management functions **********************************/ | ||||||
|  | void              HAL_EXTI_ConfigLineAttributes(uint32_t ExtiLine, uint32_t LineAttributes); | ||||||
|  | HAL_StatusTypeDef HAL_EXTI_GetConfigLineAttributes(uint32_t ExtiLine, uint32_t *pLineAttributes); | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | HAL_StatusTypeDef HAL_EXTI_LockConfigAttributes(void); | ||||||
|  | HAL_StatusTypeDef HAL_EXTI_GetLockConfigAttributes(uint32_t *const pLockState); | ||||||
|  | #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* STM32H5xx_HAL_EXTI_H */ | ||||||
							
								
								
									
										823
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_flash.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										823
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_flash.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,823 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_flash.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   Header file of FLASH HAL module. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef STM32H5xx_HAL_FLASH_H | ||||||
|  | #define STM32H5xx_HAL_FLASH_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal_def.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup FLASH | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported types ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup FLASH_Exported_Types FLASH Exported Types | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  FLASH handle Structure definition | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   HAL_LockTypeDef        Lock;               /*!< FLASH locking object                                                */ | ||||||
|  |  | ||||||
|  |   uint32_t               ErrorCode;          /*!< FLASH error code                                                    */ | ||||||
|  |  | ||||||
|  |   uint32_t               ProcedureOnGoing;   /*!< Internal variable to indicate which procedure is ongoing or not | ||||||
|  |                                                   in IT context */ | ||||||
|  |  | ||||||
|  |   uint32_t               Address;            /*!< Internal variable to save address selected for program              */ | ||||||
|  |  | ||||||
|  |   uint32_t               Bank;               /*!< Internal variable to save current bank selected during erase in | ||||||
|  |                                                   IT context */ | ||||||
|  |  | ||||||
|  |   uint32_t               Sector;             /*!< Internal variable to define the current sector which is erasing     */ | ||||||
|  |  | ||||||
|  |   uint32_t               NbSectorsToErase;   /*!< Internal variable to save the remaining sectors to erase in | ||||||
|  |                                                   IT context  */ | ||||||
|  |  | ||||||
|  | } FLASH_ProcessTypeDef; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported constants --------------------------------------------------------*/ | ||||||
|  | /** @defgroup FLASH_Exported_Constants FLASH Exported Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup FLASH_Flag_definition FLASH Flag definition | ||||||
|  |   * @brief Flag definition | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define FLASH_FLAG_BSY                     FLASH_SR_BSY             /*!< FLASH Busy flag */ | ||||||
|  | #define FLASH_FLAG_WBNE                    FLASH_SR_WBNE            /*!< FLASH Write Buffer Not Empty flag */ | ||||||
|  | #define FLASH_FLAG_DBNE                    FLASH_SR_DBNE            /*!< FLASH data Buffer Not Empty flag */ | ||||||
|  | #define FLASH_FLAG_EOP                     FLASH_SR_EOP             /*!< FLASH End Of operation flag */ | ||||||
|  | #define FLASH_FLAG_WRPERR                  FLASH_SR_WRPERR          /*!< FLASH Write Protection Error flag */ | ||||||
|  | #define FLASH_FLAG_PGSERR                  FLASH_SR_PGSERR          /*!< FLASH Program Sequence Error flag */ | ||||||
|  | #define FLASH_FLAG_STRBERR                 FLASH_SR_STRBERR         /*!< FLASH Strobe Error flag */ | ||||||
|  | #define FLASH_FLAG_INCERR                  FLASH_SR_INCERR          /*!< FLASH Inconsistency Error flag */ | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | #define FLASH_FLAG_OBKERR                  FLASH_SR_OBKERR          /*!< FLASH OBK Error flag */ | ||||||
|  | #define FLASH_FLAG_OBKWERR                 FLASH_SR_OBKWERR         /*!< FLASH OBK Write Error flag */ | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | #define FLASH_FLAG_OPTCHANGEERR            FLASH_SR_OPTCHANGEERR    /*!< FLASH Option Byte change Error flag */ | ||||||
|  | #define FLASH_FLAG_ECCC                    FLASH_ECCR_ECCC          /*!< FLASH ECC Correction flag */ | ||||||
|  | #define FLASH_FLAG_ECCD                    FLASH_ECCR_ECCD          /*!< FLASH ECC Detection flag */ | ||||||
|  |  | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | #define FLASH_FLAG_SR_ERRORS               (FLASH_SR_WRPERR      | FLASH_SR_PGSERR    | \ | ||||||
|  |                                             FLASH_SR_STRBERR     | FLASH_SR_INCERR    | \ | ||||||
|  |                                             FLASH_SR_OBKERR      | FLASH_SR_OBKWERR   | \ | ||||||
|  |                                             FLASH_SR_OPTCHANGEERR) | ||||||
|  | #else | ||||||
|  | #define FLASH_FLAG_SR_ERRORS               (FLASH_SR_WRPERR      | FLASH_SR_PGSERR    | \ | ||||||
|  |                                             FLASH_SR_STRBERR     | FLASH_SR_INCERR    | \ | ||||||
|  |                                             FLASH_SR_OPTCHANGEERR) | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | #define FLASH_FLAG_ECCR_ERRORS             (FLASH_FLAG_ECCC      | FLASH_FLAG_ECCD) | ||||||
|  | #define FLASH_FLAG_ALL_ERRORS              (FLASH_FLAG_SR_ERRORS | FLASH_FLAG_ECCR_ERRORS) /*!< All FLASH error flags */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup FLASH_Interrupt_definition FLASH Interrupts definition | ||||||
|  |   * @brief FLASH Interrupt definition | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define FLASH_IT_EOP                  FLASH_CR_EOPIE        /*!< End of FLASH Operation interrupt enable */ | ||||||
|  | #define FLASH_IT_WRPERR               FLASH_CR_WRPERRIE     /*!< Write Protection Error interrupt enable */ | ||||||
|  | #define FLASH_IT_PGSERR               FLASH_CR_PGSERRIE     /*!< Program Sequence Error interrupt enable */ | ||||||
|  | #define FLASH_IT_STRBERR              FLASH_CR_STRBERRIE    /*!< Strobe Error interrupt enable */ | ||||||
|  | #define FLASH_IT_INCERR               FLASH_CR_INCERRIE     /*!< Inconsistency Error interrupt enable */ | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | #define FLASH_IT_OBKERR               FLASH_CR_OBKERRIE     /*!< OBK Error interrupt enable */ | ||||||
|  | #define FLASH_IT_OBKWERR              FLASH_CR_OBKWERRIE    /*!< OBK Write Error interrupt enable */ | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | #define FLASH_IT_OPTCHANGEERR         FLASH_CR_OPTCHANGEERRIE /*!< Option Byte change Error interrupt enable */ | ||||||
|  | #define FLASH_IT_ECCC                 FLASH_ECCR_ECCIE      /*!< Single ECC Error Correction interrupt enable */ | ||||||
|  |  | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | #define FLASH_IT_ALL                 (FLASH_IT_EOP       | FLASH_IT_WRPERR   | \ | ||||||
|  |                                       FLASH_IT_PGSERR    | FLASH_IT_STRBERR  | \ | ||||||
|  |                                       FLASH_IT_INCERR    | FLASH_IT_OBKERR   | \ | ||||||
|  |                                       FLASH_IT_OBKWERR   | FLASH_IT_OPTCHANGEERR   | \ | ||||||
|  |                                       FLASH_IT_ECCC) /*!< All Flash interrupt sources */ | ||||||
|  | #else | ||||||
|  | #define FLASH_IT_ALL                 (FLASH_IT_EOP       | FLASH_IT_WRPERR       | \ | ||||||
|  |                                       FLASH_IT_PGSERR    | FLASH_IT_STRBERR      | \ | ||||||
|  |                                       FLASH_IT_INCERR    | FLASH_IT_OPTCHANGEERR | \ | ||||||
|  |                                       FLASH_IT_ECCC) /*!< All Flash interrupt sources */ | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup FLASH_Error_Code FLASH Error Code | ||||||
|  |   * @brief    FLASH Error Code | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define HAL_FLASH_ERROR_NONE         0x00000000U               /*!< No error                              */ | ||||||
|  | #define HAL_FLASH_ERROR_WRP          FLASH_FLAG_WRPERR         /*!< Write Protection Error                */ | ||||||
|  | #define HAL_FLASH_ERROR_PGS          FLASH_FLAG_PGSERR         /*!< Program Sequence Error                */ | ||||||
|  | #define HAL_FLASH_ERROR_STRB         FLASH_FLAG_STRBERR        /*!< Strobe Error                          */ | ||||||
|  | #define HAL_FLASH_ERROR_INC          FLASH_FLAG_INCERR         /*!< Inconsistency Error                   */ | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | #define HAL_FLASH_ERROR_OBK          FLASH_FLAG_OBKERR         /*!< OBK Error                             */ | ||||||
|  | #define HAL_FLASH_ERROR_OBKW         FLASH_FLAG_OBKWERR        /*!< OBK Write Error                       */ | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | #define HAL_FLASH_ERROR_OB_CHANGE    FLASH_FLAG_OPTCHANGEERR   /*!< Option Byte Change Error              */ | ||||||
|  | #define HAL_FLASH_ERROR_ECCC         FLASH_FLAG_ECCC           /*!< ECC Single Correction Error           */ | ||||||
|  | #define HAL_FLASH_ERROR_ECCD         FLASH_FLAG_ECCD           /*!< ECC Double Detection Error            */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup FLASH_Type_Program FLASH Program Type | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | #define FLASH_TYPEPROGRAM_QUADWORD         FLASH_CR_PG                                        /*!< Program a quad-word | ||||||
|  |                                                                              (128-bit) at  a specified secure address */ | ||||||
|  | #define FLASH_TYPEPROGRAM_QUADWORD_NS       (FLASH_CR_PG | FLASH_NON_SECURE_MASK)              /*!< Program a quad-word | ||||||
|  |                                                                           (128-bit) at a specified non-secure address */ | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | #define FLASH_TYPEPROGRAM_QUADWORD_OBK      (FLASH_CR_PG | FLASH_OBK)                          /*!< Program a quad-word | ||||||
|  |                                                                                    (128-bit) of OBK to current sector */ | ||||||
|  | #define FLASH_TYPEPROGRAM_QUADWORD_OBK_ALT  (FLASH_CR_PG | FLASH_OBK | FLASH_OBKCFGR_ALT_SECT) /*!< Program a quad-word | ||||||
|  |                                                                                  (128-bit) of OBK to alternate sector */ | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | #if defined (FLASH_EDATAR_EDATA_EN) | ||||||
|  | #define FLASH_TYPEPROGRAM_HALFWORD_EDATA    (FLASH_CR_PG | FLASH_EDATA_HALFWORD)               /*!< Program a flash | ||||||
|  |                                                       high-cycle data half-word (16-bit)at a specified secure address */ | ||||||
|  | #define FLASH_TYPEPROGRAM_HALFWORD_EDATA_NS (FLASH_CR_PG | FLASH_EDATA_HALFWORD | FLASH_NON_SECURE_MASK)  /*!< Program a flash | ||||||
|  |                                                   high-cycle data half-word (16-bit)at a specified non-secure address */ | ||||||
|  | #define FLASH_TYPEPROGRAM_WORD_EDATA    (FLASH_CR_PG | FLASH_EDATA_WORD)                          /*!< Program a flash | ||||||
|  |                                                       high-cycle data word (32-bit)at a specified secure address */ | ||||||
|  | #define FLASH_TYPEPROGRAM_WORD_EDATA_NS (FLASH_CR_PG | FLASH_EDATA_WORD | FLASH_NON_SECURE_MASK)  /*!< Program a flash | ||||||
|  |                                                   high-cycle data word (32-bit)at a specified non-secure address */ | ||||||
|  | #endif /* FLASH_EDATAR_EDATA_EN */ | ||||||
|  | #else | ||||||
|  | #define FLASH_TYPEPROGRAM_QUADWORD           FLASH_CR_PG                                        /*!< Program a quad-word | ||||||
|  |                                                                                      (128-bit) at a specified address */ | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | #define FLASH_TYPEPROGRAM_QUADWORD_OBK     (FLASH_CR_PG | FLASH_OBK)                           /*!< Program a quad-word | ||||||
|  |                                                                                    (128-bit) of OBK to current sector */ | ||||||
|  | #define FLASH_TYPEPROGRAM_QUADWORD_OBK_ALT (FLASH_CR_PG | FLASH_OBK | FLASH_OBKCFGR_ALT_SECT)  /*!< Program a quad-word | ||||||
|  |                                                                                  (128-bit) of OBK to alternate sector */ | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | #if defined (FLASH_EDATAR_EDATA_EN) | ||||||
|  | #define FLASH_TYPEPROGRAM_HALFWORD_EDATA    (FLASH_CR_PG | FLASH_EDATA_HALFWORD)                /*!< Program a flash | ||||||
|  |                                                              high-cycle data half-word (16-bit)at a specified address */ | ||||||
|  | #define FLASH_TYPEPROGRAM_WORD_EDATA        (FLASH_CR_PG | FLASH_EDATA_WORD)                          /*!< Program a flash | ||||||
|  |                                                              high-cycle data half-word (32-bit)at a specified address */ | ||||||
|  | #endif /* FLASH_EDATAR_EDATA_EN */ | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  | #define FLASH_TYPEPROGRAM_HALFWORD_OTP      (FLASH_CR_PG | FLASH_OTP | FLASH_NON_SECURE_MASK)   /*!< Program an OTP | ||||||
|  |                                                                              half-word (16-bit)at a specified address */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup FLASH_Latency FLASH Latency | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define FLASH_LATENCY_0          FLASH_ACR_LATENCY_0WS   /*!< FLASH Zero wait cycle      */ | ||||||
|  | #define FLASH_LATENCY_1          FLASH_ACR_LATENCY_1WS   /*!< FLASH One wait cycle       */ | ||||||
|  | #define FLASH_LATENCY_2          FLASH_ACR_LATENCY_2WS   /*!< FLASH Two wait cycles      */ | ||||||
|  | #define FLASH_LATENCY_3          FLASH_ACR_LATENCY_3WS   /*!< FLASH Three wait cycles    */ | ||||||
|  | #define FLASH_LATENCY_4          FLASH_ACR_LATENCY_4WS   /*!< FLASH Four wait cycles     */ | ||||||
|  | #define FLASH_LATENCY_5          FLASH_ACR_LATENCY_5WS   /*!< FLASH Five wait cycles     */ | ||||||
|  | #define FLASH_LATENCY_6          FLASH_ACR_LATENCY_6WS   /*!< FLASH Six wait cycles      */ | ||||||
|  | #define FLASH_LATENCY_7          FLASH_ACR_LATENCY_7WS   /*!< FLASH Seven wait cycles    */ | ||||||
|  | #define FLASH_LATENCY_8          FLASH_ACR_LATENCY_8WS   /*!< FLASH Eight wait cycle     */ | ||||||
|  | #define FLASH_LATENCY_9          FLASH_ACR_LATENCY_9WS   /*!< FLASH Nine wait cycle      */ | ||||||
|  | #define FLASH_LATENCY_10         FLASH_ACR_LATENCY_10WS  /*!< FLASH Ten wait cycles      */ | ||||||
|  | #define FLASH_LATENCY_11         FLASH_ACR_LATENCY_11WS  /*!< FLASH Eleven wait cycles   */ | ||||||
|  | #define FLASH_LATENCY_12         FLASH_ACR_LATENCY_12WS  /*!< FLASH Twelve wait cycles   */ | ||||||
|  | #define FLASH_LATENCY_13         FLASH_ACR_LATENCY_13WS  /*!< FLASH Thirteen wait cycles */ | ||||||
|  | #define FLASH_LATENCY_14         FLASH_ACR_LATENCY_14WS  /*!< FLASH Fourteen wait cycles */ | ||||||
|  | #define FLASH_LATENCY_15         FLASH_ACR_LATENCY_15WS  /*!< FLASH Fifteen wait cycles  */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup FLASH_Keys FLASH Keys | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define FLASH_KEY1                 0x45670123U | ||||||
|  | #define FLASH_KEY2                 0xCDEF89ABU | ||||||
|  | #define FLASH_OPT_KEY1             0x08192A3BU | ||||||
|  | #define FLASH_OPT_KEY2             0x4C5D6E7FU | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | #define FLASH_OBK_KEY1             0x192A083BU | ||||||
|  | #define FLASH_OBK_KEY2             0x6E7F4C5DU | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup FLASH_Sectors FLASH Sectors | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define FLASH_SECTOR_0             0U       /*!< Sector Number 0   */ | ||||||
|  | #define FLASH_SECTOR_1             1U       /*!< Sector Number 1   */ | ||||||
|  | #define FLASH_SECTOR_2             2U       /*!< Sector Number 2   */ | ||||||
|  | #define FLASH_SECTOR_3             3U       /*!< Sector Number 3   */ | ||||||
|  | #define FLASH_SECTOR_4             4U       /*!< Sector Number 4   */ | ||||||
|  | #define FLASH_SECTOR_5             5U       /*!< Sector Number 5   */ | ||||||
|  | #define FLASH_SECTOR_6             6U       /*!< Sector Number 6   */ | ||||||
|  | #define FLASH_SECTOR_7             7U       /*!< Sector Number 7   */ | ||||||
|  | #if (FLASH_SECTOR_NB >= 32) | ||||||
|  | #define FLASH_SECTOR_8             8U       /*!< Sector Number 8   */ | ||||||
|  | #define FLASH_SECTOR_9             9U       /*!< Sector Number 9   */ | ||||||
|  | #define FLASH_SECTOR_10            10U      /*!< Sector Number 10  */ | ||||||
|  | #define FLASH_SECTOR_11            11U      /*!< Sector Number 11  */ | ||||||
|  | #define FLASH_SECTOR_12            12U      /*!< Sector Number 12  */ | ||||||
|  | #define FLASH_SECTOR_13            13U      /*!< Sector Number 13  */ | ||||||
|  | #define FLASH_SECTOR_14            14U      /*!< Sector Number 14  */ | ||||||
|  | #define FLASH_SECTOR_15            15U      /*!< Sector Number 15  */ | ||||||
|  | #define FLASH_SECTOR_16            16U      /*!< Sector Number 16  */ | ||||||
|  | #define FLASH_SECTOR_17            17U      /*!< Sector Number 17  */ | ||||||
|  | #define FLASH_SECTOR_18            18U      /*!< Sector Number 18  */ | ||||||
|  | #define FLASH_SECTOR_19            19U      /*!< Sector Number 19  */ | ||||||
|  | #define FLASH_SECTOR_20            20U      /*!< Sector Number 20  */ | ||||||
|  | #define FLASH_SECTOR_21            21U      /*!< Sector Number 21  */ | ||||||
|  | #define FLASH_SECTOR_22            22U      /*!< Sector Number 22  */ | ||||||
|  | #define FLASH_SECTOR_23            23U      /*!< Sector Number 23  */ | ||||||
|  | #define FLASH_SECTOR_24            24U      /*!< Sector Number 24  */ | ||||||
|  | #define FLASH_SECTOR_25            25U      /*!< Sector Number 25  */ | ||||||
|  | #define FLASH_SECTOR_26            26U      /*!< Sector Number 26  */ | ||||||
|  | #define FLASH_SECTOR_27            27U      /*!< Sector Number 27  */ | ||||||
|  | #define FLASH_SECTOR_28            28U      /*!< Sector Number 28  */ | ||||||
|  | #define FLASH_SECTOR_29            29U      /*!< Sector Number 29  */ | ||||||
|  | #define FLASH_SECTOR_30            30U      /*!< Sector Number 30  */ | ||||||
|  | #define FLASH_SECTOR_31            31U      /*!< Sector Number 31  */ | ||||||
|  | #endif /* (FLASH_SECTOR_NB >= 32) */ | ||||||
|  | #if (FLASH_SECTOR_NB >= 128) | ||||||
|  | #define FLASH_SECTOR_32            32U      /*!< Sector Number 32  */ | ||||||
|  | #define FLASH_SECTOR_33            33U      /*!< Sector Number 33  */ | ||||||
|  | #define FLASH_SECTOR_34            34U      /*!< Sector Number 34  */ | ||||||
|  | #define FLASH_SECTOR_35            35U      /*!< Sector Number 35  */ | ||||||
|  | #define FLASH_SECTOR_36            36U      /*!< Sector Number 36  */ | ||||||
|  | #define FLASH_SECTOR_37            37U      /*!< Sector Number 37  */ | ||||||
|  | #define FLASH_SECTOR_38            38U      /*!< Sector Number 38  */ | ||||||
|  | #define FLASH_SECTOR_39            39U      /*!< Sector Number 39  */ | ||||||
|  | #define FLASH_SECTOR_40            40U      /*!< Sector Number 40  */ | ||||||
|  | #define FLASH_SECTOR_41            41U      /*!< Sector Number 41  */ | ||||||
|  | #define FLASH_SECTOR_42            42U      /*!< Sector Number 42  */ | ||||||
|  | #define FLASH_SECTOR_43            43U      /*!< Sector Number 43  */ | ||||||
|  | #define FLASH_SECTOR_44            44U      /*!< Sector Number 44  */ | ||||||
|  | #define FLASH_SECTOR_45            45U      /*!< Sector Number 45  */ | ||||||
|  | #define FLASH_SECTOR_46            46U      /*!< Sector Number 46  */ | ||||||
|  | #define FLASH_SECTOR_47            47U      /*!< Sector Number 47  */ | ||||||
|  | #define FLASH_SECTOR_48            48U      /*!< Sector Number 48  */ | ||||||
|  | #define FLASH_SECTOR_49            49U      /*!< Sector Number 49  */ | ||||||
|  | #define FLASH_SECTOR_50            50U      /*!< Sector Number 50  */ | ||||||
|  | #define FLASH_SECTOR_51            51U      /*!< Sector Number 51  */ | ||||||
|  | #define FLASH_SECTOR_52            52U      /*!< Sector Number 52  */ | ||||||
|  | #define FLASH_SECTOR_53            53U      /*!< Sector Number 53  */ | ||||||
|  | #define FLASH_SECTOR_54            54U      /*!< Sector Number 54  */ | ||||||
|  | #define FLASH_SECTOR_55            55U      /*!< Sector Number 55  */ | ||||||
|  | #define FLASH_SECTOR_56            56U      /*!< Sector Number 56  */ | ||||||
|  | #define FLASH_SECTOR_57            57U      /*!< Sector Number 57  */ | ||||||
|  | #define FLASH_SECTOR_58            58U      /*!< Sector Number 58  */ | ||||||
|  | #define FLASH_SECTOR_59            59U      /*!< Sector Number 59  */ | ||||||
|  | #define FLASH_SECTOR_60            60U      /*!< Sector Number 60  */ | ||||||
|  | #define FLASH_SECTOR_61            61U      /*!< Sector Number 61  */ | ||||||
|  | #define FLASH_SECTOR_62            62U      /*!< Sector Number 62  */ | ||||||
|  | #define FLASH_SECTOR_63            63U      /*!< Sector Number 63  */ | ||||||
|  | #define FLASH_SECTOR_64            64U      /*!< Sector Number 64  */ | ||||||
|  | #define FLASH_SECTOR_65            65U      /*!< Sector Number 65  */ | ||||||
|  | #define FLASH_SECTOR_66            66U      /*!< Sector Number 66  */ | ||||||
|  | #define FLASH_SECTOR_67            67U      /*!< Sector Number 67  */ | ||||||
|  | #define FLASH_SECTOR_68            68U      /*!< Sector Number 68  */ | ||||||
|  | #define FLASH_SECTOR_69            69U      /*!< Sector Number 69  */ | ||||||
|  | #define FLASH_SECTOR_70            70U      /*!< Sector Number 70  */ | ||||||
|  | #define FLASH_SECTOR_71            71U      /*!< Sector Number 71  */ | ||||||
|  | #define FLASH_SECTOR_72            72U      /*!< Sector Number 72  */ | ||||||
|  | #define FLASH_SECTOR_73            73U      /*!< Sector Number 73  */ | ||||||
|  | #define FLASH_SECTOR_74            74U      /*!< Sector Number 74  */ | ||||||
|  | #define FLASH_SECTOR_75            75U      /*!< Sector Number 75  */ | ||||||
|  | #define FLASH_SECTOR_76            76U      /*!< Sector Number 76  */ | ||||||
|  | #define FLASH_SECTOR_77            77U      /*!< Sector Number 77  */ | ||||||
|  | #define FLASH_SECTOR_78            78U      /*!< Sector Number 78  */ | ||||||
|  | #define FLASH_SECTOR_79            79U      /*!< Sector Number 79  */ | ||||||
|  | #define FLASH_SECTOR_80            80U      /*!< Sector Number 80  */ | ||||||
|  | #define FLASH_SECTOR_81            81U      /*!< Sector Number 81  */ | ||||||
|  | #define FLASH_SECTOR_82            82U      /*!< Sector Number 82  */ | ||||||
|  | #define FLASH_SECTOR_83            83U      /*!< Sector Number 83  */ | ||||||
|  | #define FLASH_SECTOR_84            84U      /*!< Sector Number 84  */ | ||||||
|  | #define FLASH_SECTOR_85            85U      /*!< Sector Number 85  */ | ||||||
|  | #define FLASH_SECTOR_86            86U      /*!< Sector Number 86  */ | ||||||
|  | #define FLASH_SECTOR_87            87U      /*!< Sector Number 87  */ | ||||||
|  | #define FLASH_SECTOR_88            88U      /*!< Sector Number 88  */ | ||||||
|  | #define FLASH_SECTOR_89            89U      /*!< Sector Number 89  */ | ||||||
|  | #define FLASH_SECTOR_90            90U      /*!< Sector Number 90  */ | ||||||
|  | #define FLASH_SECTOR_91            91U      /*!< Sector Number 91  */ | ||||||
|  | #define FLASH_SECTOR_92            92U      /*!< Sector Number 92  */ | ||||||
|  | #define FLASH_SECTOR_93            93U      /*!< Sector Number 93  */ | ||||||
|  | #define FLASH_SECTOR_94            94U      /*!< Sector Number 94  */ | ||||||
|  | #define FLASH_SECTOR_95            95U      /*!< Sector Number 95  */ | ||||||
|  | #define FLASH_SECTOR_96            96U      /*!< Sector Number 96  */ | ||||||
|  | #define FLASH_SECTOR_97            97U      /*!< Sector Number 97  */ | ||||||
|  | #define FLASH_SECTOR_98            98U      /*!< Sector Number 98  */ | ||||||
|  | #define FLASH_SECTOR_99            99U      /*!< Sector Number 99  */ | ||||||
|  | #define FLASH_SECTOR_100           100U     /*!< Sector Number 100 */ | ||||||
|  | #define FLASH_SECTOR_101           101U     /*!< Sector Number 101 */ | ||||||
|  | #define FLASH_SECTOR_102           102U     /*!< Sector Number 102 */ | ||||||
|  | #define FLASH_SECTOR_103           103U     /*!< Sector Number 103 */ | ||||||
|  | #define FLASH_SECTOR_104           104U     /*!< Sector Number 104 */ | ||||||
|  | #define FLASH_SECTOR_105           105U     /*!< Sector Number 105 */ | ||||||
|  | #define FLASH_SECTOR_106           106U     /*!< Sector Number 106 */ | ||||||
|  | #define FLASH_SECTOR_107           107U     /*!< Sector Number 107 */ | ||||||
|  | #define FLASH_SECTOR_108           108U     /*!< Sector Number 108 */ | ||||||
|  | #define FLASH_SECTOR_109           109U     /*!< Sector Number 109 */ | ||||||
|  | #define FLASH_SECTOR_110           110U     /*!< Sector Number 110 */ | ||||||
|  | #define FLASH_SECTOR_111           111U     /*!< Sector Number 111 */ | ||||||
|  | #define FLASH_SECTOR_112           112U     /*!< Sector Number 112 */ | ||||||
|  | #define FLASH_SECTOR_113           113U     /*!< Sector Number 113 */ | ||||||
|  | #define FLASH_SECTOR_114           114U     /*!< Sector Number 114 */ | ||||||
|  | #define FLASH_SECTOR_115           115U     /*!< Sector Number 115 */ | ||||||
|  | #define FLASH_SECTOR_116           116U     /*!< Sector Number 116 */ | ||||||
|  | #define FLASH_SECTOR_117           117U     /*!< Sector Number 117 */ | ||||||
|  | #define FLASH_SECTOR_118           118U     /*!< Sector Number 118 */ | ||||||
|  | #define FLASH_SECTOR_119           119U     /*!< Sector Number 119 */ | ||||||
|  | #define FLASH_SECTOR_120           120U     /*!< Sector Number 120 */ | ||||||
|  | #define FLASH_SECTOR_121           121U     /*!< Sector Number 121 */ | ||||||
|  | #define FLASH_SECTOR_122           122U     /*!< Sector Number 122 */ | ||||||
|  | #define FLASH_SECTOR_123           123U     /*!< Sector Number 123 */ | ||||||
|  | #define FLASH_SECTOR_124           124U     /*!< Sector Number 124 */ | ||||||
|  | #define FLASH_SECTOR_125           125U     /*!< Sector Number 125 */ | ||||||
|  | #define FLASH_SECTOR_126           126U     /*!< Sector Number 126 */ | ||||||
|  | #define FLASH_SECTOR_127           127U     /*!< Sector Number 127 */ | ||||||
|  | #endif /* (FLASH_SECTOR_NB >= 128) */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported macros ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup FLASH_Exported_Macros FLASH Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /** | ||||||
|  |   * @brief  Set the FLASH Latency. | ||||||
|  |   * @param  __LATENCY__: FLASH Latency | ||||||
|  |   *         This parameter can be one of the following values : | ||||||
|  |   *     @arg FLASH_LATENCY_0: FLASH Zero wait state | ||||||
|  |   *     @arg FLASH_LATENCY_1: FLASH One wait state | ||||||
|  |   *     @arg FLASH_LATENCY_2: FLASH Two wait states | ||||||
|  |   *     @arg FLASH_LATENCY_3: FLASH Three wait states | ||||||
|  |   *     @arg FLASH_LATENCY_4: FLASH Four wait states | ||||||
|  |   *     @arg FLASH_LATENCY_5: FLASH Five wait states | ||||||
|  |   *     @arg FLASH_LATENCY_6: FLASH Six wait states | ||||||
|  |   *     @arg FLASH_LATENCY_7: FLASH Seven wait states | ||||||
|  |   *     @arg FLASH_LATENCY_8: FLASH Eight wait states | ||||||
|  |   *     @arg FLASH_LATENCY_9: FLASH Nine wait states | ||||||
|  |   *     @arg FLASH_LATENCY_10: FLASH Ten wait states | ||||||
|  |   *     @arg FLASH_LATENCY_11: FLASH Eleven wait states | ||||||
|  |   *     @arg FLASH_LATENCY_12: FLASH Twelve wait states | ||||||
|  |   *     @arg FLASH_LATENCY_13: FLASH Thirteen wait states | ||||||
|  |   *     @arg FLASH_LATENCY_14: FLASH Fourteen wait states | ||||||
|  |   *     @arg FLASH_LATENCY_15: FLASH Fifteen wait states | ||||||
|  |   * @retval none | ||||||
|  |   */ | ||||||
|  | #define __HAL_FLASH_SET_LATENCY(__LATENCY__)    MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (__LATENCY__)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the FLASH Latency. | ||||||
|  |   * @retval FLASH Latency | ||||||
|  |   *         This return value can be one of the following values : | ||||||
|  |   *     @arg FLASH_LATENCY_0: FLASH Zero wait state | ||||||
|  |   *     @arg FLASH_LATENCY_1: FLASH One wait state | ||||||
|  |   *     @arg FLASH_LATENCY_2: FLASH Two wait states | ||||||
|  |   *     @arg FLASH_LATENCY_3: FLASH Three wait states | ||||||
|  |   *     @arg FLASH_LATENCY_4: FLASH Four wait states | ||||||
|  |   *     @arg FLASH_LATENCY_5: FLASH Five wait states | ||||||
|  |   *     @arg FLASH_LATENCY_6: FLASH Six wait states | ||||||
|  |   *     @arg FLASH_LATENCY_7: FLASH Seven wait states | ||||||
|  |   *     @arg FLASH_LATENCY_8: FLASH Eight wait states | ||||||
|  |   *     @arg FLASH_LATENCY_9: FLASH Nine wait states | ||||||
|  |   *     @arg FLASH_LATENCY_10: FLASH Ten wait states | ||||||
|  |   *     @arg FLASH_LATENCY_11: FLASH Eleven wait states | ||||||
|  |   *     @arg FLASH_LATENCY_12: FLASH Twelve wait states | ||||||
|  |   *     @arg FLASH_LATENCY_13: FLASH Thirteen wait states | ||||||
|  |   *     @arg FLASH_LATENCY_14: FLASH Fourteen wait states | ||||||
|  |   *     @arg FLASH_LATENCY_15: FLASH Fifteen wait states | ||||||
|  |   */ | ||||||
|  | #define __HAL_FLASH_GET_LATENCY()               READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @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_WRPERR    : Write Protection Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_PGSERR    : Program Sequence Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_STRBERR   : Strobe Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_INCERR    : Inconsistency Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_OBKERR    : OBK Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_OBKWERR   : OBK Write Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_OPTCHANGEERR : Option Byte Change Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_ECCC      : Single ECC Error Correction Interrupt | ||||||
|  |   * @retval none | ||||||
|  |   */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /* Enable secure FLASH interrupts from the secure world */ | ||||||
|  | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) do { if(((__INTERRUPT__) & FLASH_IT_ECCC) != 0U)                          \ | ||||||
|  |                                                     { SET_BIT(FLASH->ECCCORR, FLASH_IT_ECCC); }                        \ | ||||||
|  |                                                   if(((__INTERRUPT__) & FLASH_IT_OPTCHANGEERR) != 0U)                  \ | ||||||
|  |                                                     { SET_BIT(FLASH->NSCR, FLASH_IT_OPTCHANGEERR); }                   \ | ||||||
|  |                                                   if(((__INTERRUPT__) & (~FLASH_IT_ECCC)) != 0U)                       \ | ||||||
|  |                                                     { SET_BIT(FLASH->SECCR, ((__INTERRUPT__) & (~(FLASH_IT_ECCC |      \ | ||||||
|  |                                                       FLASH_IT_OPTCHANGEERR)))); }\ | ||||||
|  |                                                 } while(0) | ||||||
|  | /* Enable non-secure FLASH interrupts from the secure world */ | ||||||
|  | #define __HAL_FLASH_ENABLE_IT_NS(__INTERRUPT__) do { if(((__INTERRUPT__) & FLASH_IT_ECCC) != 0U)                       \ | ||||||
|  |                                                        { SET_BIT(FLASH->ECCCORR, FLASH_IT_ECCC); }                     \ | ||||||
|  |                                                      if(((__INTERRUPT__) & (~FLASH_IT_ECCC)) != 0U)                    \ | ||||||
|  |                                                        { SET_BIT(FLASH->NSCR, ((__INTERRUPT__) & (~FLASH_IT_ECCC))); } \ | ||||||
|  |                                                    } while(0) | ||||||
|  | #else | ||||||
|  | /* Enable non-secure FLASH interrupts from the non-secure world */ | ||||||
|  | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__)    do { if(((__INTERRUPT__) & FLASH_IT_ECCC) != 0U)                       \ | ||||||
|  |                                                        { SET_BIT(FLASH->ECCCORR, FLASH_IT_ECCC); }                     \ | ||||||
|  |                                                      if(((__INTERRUPT__) & (~FLASH_IT_ECCC)) != 0U)                    \ | ||||||
|  |                                                        { SET_BIT(FLASH->NSCR, ((__INTERRUPT__) & (~FLASH_IT_ECCC))); } \ | ||||||
|  |                                                    } while(0) | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @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_WRPERR    : Write Protection Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_PGSERR    : Program Sequence Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_STRBERR   : Strobe Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_INCERR    : Inconsistency Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_OBKERR    : OBK Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_OBKWERR   : OBK Write Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_OPTCHANGEERR : Option Byte Change Error Interrupt | ||||||
|  |   *     @arg FLASH_IT_ECCC      : Single ECC Error Correction Interrupt | ||||||
|  |   * @retval none | ||||||
|  |   */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /* Disable secure FLASH interrupts from the secure world */ | ||||||
|  | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) do { if(((__INTERRUPT__) & FLASH_IT_ECCC) != 0U)                         \ | ||||||
|  |                                                      { CLEAR_BIT(FLASH->ECCCORR, FLASH_IT_ECCC); }                     \ | ||||||
|  |                                                    if(((__INTERRUPT__) & FLASH_IT_OPTCHANGEERR) != 0U)                 \ | ||||||
|  |                                                      { CLEAR_BIT(FLASH->NSCR, FLASH_IT_OPTCHANGEERR); }                \ | ||||||
|  |                                                    if(((__INTERRUPT__) & (~(FLASH_IT_ECCC | FLASH_IT_OPTCHANGEERR)))   \ | ||||||
|  |                                                      != 0U){ CLEAR_BIT(FLASH->SECCR, ((__INTERRUPT__) &                \ | ||||||
|  |                                                      (~(FLASH_IT_ECCC | FLASH_IT_OPTCHANGEERR)))); }\ | ||||||
|  |                                                  } while(0) | ||||||
|  | /* Disable non-secure FLASH interrupts from the secure world */ | ||||||
|  | #define __HAL_FLASH_DISABLE_IT_NS(__INTERRUPT__) do { if(((__INTERRUPT__) & FLASH_IT_ECCC) != 0U) { CLEAR_BIT          \ | ||||||
|  |                                                         (FLASH->ECCCORR, FLASH_IT_ECCC); }                             \ | ||||||
|  |                                                       if(((__INTERRUPT__) & (~FLASH_IT_ECCC)) != 0U)                   \ | ||||||
|  |                                                         { CLEAR_BIT(FLASH->NSCR, ((__INTERRUPT__) & (~FLASH_IT_ECCC)));\ | ||||||
|  |                                                         }                                                              \ | ||||||
|  |                                                     } while(0) | ||||||
|  | #else | ||||||
|  | /* Disable non-secure FLASH interrupts from the non-secure world */ | ||||||
|  | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__)   do { if(((__INTERRUPT__) & FLASH_IT_ECCC) != 0U) { CLEAR_BIT           \ | ||||||
|  |                                                        (FLASH->ECCCORR, FLASH_IT_ECCC); }                              \ | ||||||
|  |                                                      if(((__INTERRUPT__) & (~FLASH_IT_ECCC)) != 0U) { CLEAR_BIT        \ | ||||||
|  |                                                        (FLASH->NSCR, ((__INTERRUPT__) & (~FLASH_IT_ECCC))); }          \ | ||||||
|  |                                                     } while(0) | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Checks whether the specified FLASH flag is set or not. | ||||||
|  |   * @param  __FLAG__: specifies the FLASH flag to check. | ||||||
|  |   *   This parameter can be one of the following values : | ||||||
|  |   *     @arg FLASH_FLAG_BSY      : FLASH Busy flag | ||||||
|  |   *     @arg FLASH_FLAG_WBNE     : Write Buffer Not Empty flag | ||||||
|  |   *     @arg FLASH_FLAG_EOP      : End Of Operation flag | ||||||
|  |   *     @arg FLASH_FLAG_WRPERR   : Write Protection Error flag | ||||||
|  |   *     @arg FLASH_FLAG_PGSERR   : Program Sequence Error flag | ||||||
|  |   *     @arg FLASH_FLAG_STRBERR  : Strobe Error flag | ||||||
|  |   *     @arg FLASH_FLAG_INCERR   : Inconsistency Error flag | ||||||
|  |   *     @arg FLASH_FLAG_OBKERR   : OBK Error flag | ||||||
|  |   *     @arg FLASH_FLAG_OBKWERR  : OBK Write Error flag | ||||||
|  |   *     @arg FLASH_FLAG_OPTCHANGEERR : Option Byte Change Error flag | ||||||
|  |   *     @arg FLASH_FLAG_ECCC     : Single ECC Error Correction flag | ||||||
|  |   *     @arg FLASH_FLAG_ECCD     : Double Detection ECC Error flag | ||||||
|  |   * @retval The new state of FLASH_FLAG (SET or RESET). | ||||||
|  |   */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /* Get secure FLASH flags from the secure world */ | ||||||
|  | #define __HAL_FLASH_GET_FLAG(__FLAG__)          ((((__FLAG__) & (FLASH_FLAG_ECCC)) != 0U) ?                            \ | ||||||
|  |                                                  (READ_BIT(FLASH->ECCCORR, (__FLAG__)) == (__FLAG__))  :               \ | ||||||
|  |                                                  (((__FLAG__) & (FLASH_FLAG_ECCD)) != 0U) ?                            \ | ||||||
|  |                                                  (READ_BIT(FLASH->ECCDETR, (__FLAG__)) == (__FLAG__))  :               \ | ||||||
|  |                                                  ((((__FLAG__) & (FLASH_FLAG_OPTCHANGEERR)) != 0U) ?                   \ | ||||||
|  |                                                   (READ_BIT(FLASH->NSSR, (__FLAG__)) == (__FLAG__)) :                  \ | ||||||
|  |                                                   (READ_BIT(FLASH->SECSR, (__FLAG__)) == (__FLAG__)))) | ||||||
|  | /* Get non-secure FLASH flags from the secure world */ | ||||||
|  | #define __HAL_FLASH_GET_FLAG_NS(__FLAG__)       ((((__FLAG__) & (FLASH_FLAG_ECCC)) != 0U) ?                            \ | ||||||
|  |                                                  (READ_BIT(FLASH->ECCCORR, (__FLAG__)) == (__FLAG__))  :               \ | ||||||
|  |                                                  (((__FLAG__) & (FLASH_FLAG_ECCD)) != 0U) ?                            \ | ||||||
|  |                                                  (READ_BIT(FLASH->ECCDETR, (__FLAG__)) == (__FLAG__))  :               \ | ||||||
|  |                                                  (READ_BIT(FLASH->NSSR, (__FLAG__)) == (__FLAG__)))) | ||||||
|  | #else | ||||||
|  | /* Get non-secure FLASH flags from the non-secure world */ | ||||||
|  | #define __HAL_FLASH_GET_FLAG(__FLAG__)          ((((__FLAG__) & (FLASH_FLAG_ECCC)) != 0U) ?                            \ | ||||||
|  |                                                  (READ_BIT(FLASH->ECCCORR, (__FLAG__)) == (__FLAG__))  :               \ | ||||||
|  |                                                  (((__FLAG__) & (FLASH_FLAG_ECCD)) != 0U) ?                            \ | ||||||
|  |                                                  (READ_BIT(FLASH->ECCDETR, (__FLAG__)) == (__FLAG__))  :               \ | ||||||
|  |                                                  (READ_BIT(FLASH->NSSR, (__FLAG__)) == (__FLAG__))) | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear the specified FLASH flag. | ||||||
|  |   * @param  __FLAG__: specifies the FLASH flags to clear. | ||||||
|  |   *   This parameter can be one of the following values : | ||||||
|  |   *     @arg FLASH_FLAG_BSY       : FLASH Busy flag | ||||||
|  |   *     @arg FLASH_FLAG_WBNE      : Write Buffer Not Empty flag | ||||||
|  |   *     @arg FLASH_FLAG_EOP       : End Of Operation flag | ||||||
|  |   *     @arg FLASH_FLAG_WRPERR    : Write Protection Error flag | ||||||
|  |   *     @arg FLASH_FLAG_PGSERR    : Program Sequence Error flag | ||||||
|  |   *     @arg FLASH_FLAG_STRBERR   : Strobe Error flag | ||||||
|  |   *     @arg FLASH_FLAG_INCERR    : Inconsistency Error flag | ||||||
|  |   *     @arg FLASH_FLAG_OBKERR    : OBK Error flag | ||||||
|  |   *     @arg FLASH_FLAG_OBKWERR   : OBK Write Error flag | ||||||
|  |   *     @arg FLASH_FLAG_OPTCHANGEERR : Option Byte Change Error flag | ||||||
|  |   *     @arg FLASH_FLAG_ECCC      : Single ECC Error Correction flag | ||||||
|  |   *     @arg FLASH_FLAG_ECCD      : Double Detection ECC Error flag | ||||||
|  |   *     @arg FLASH_FLAG_ALL_ERRORS: All errors flags | ||||||
|  |   * @retval none | ||||||
|  |   */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /* Clear secure FLASH flags from the secure world */ | ||||||
|  | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__)        do { if(((__FLAG__) & FLASH_FLAG_ECCC) != 0U) { SET_BIT(FLASH->ECCCORR,\ | ||||||
|  |                                                         ((__FLAG__) & FLASH_FLAG_ECCC)); }                             \ | ||||||
|  |                                                      if(((__FLAG__) & FLASH_FLAG_ECCD) != 0U) { SET_BIT(FLASH->ECCDETR,\ | ||||||
|  |                                                         ((__FLAG__) & FLASH_FLAG_ECCD)); }                             \ | ||||||
|  |                                                      if(((__FLAG__) & FLASH_FLAG_OPTCHANGEERR) != 0U) { SET_BIT        \ | ||||||
|  |                                                          (FLASH->NSCCR, ((__FLAG__) & (FLASH_FLAG_OPTCHANGEERR))); }   \ | ||||||
|  |                                                      if(((__FLAG__) & ~(FLASH_FLAG_ECCR_ERRORS |                       \ | ||||||
|  |                                                           FLASH_FLAG_OPTCHANGEERR)) != 0U) { WRITE_REG(FLASH->SECCCR,  \ | ||||||
|  |                                                         ((__FLAG__) & ~(FLASH_FLAG_ECCR_ERRORS |                       \ | ||||||
|  |                                                           FLASH_FLAG_OPTCHANGEERR))); }                                \ | ||||||
|  |                                                    } while(0) | ||||||
|  | /* Clear non-secure FLASH flags from the secure world */ | ||||||
|  | #define __HAL_FLASH_CLEAR_FLAG_NS(__FLAG__)     do { if(((__FLAG__) & FLASH_FLAG_ECCC) != 0U) { SET_BIT(FLASH->ECCCORR,\ | ||||||
|  |                                                         ((__FLAG__) & FLASH_FLAG_ECCC)); }                             \ | ||||||
|  |                                                      if(((__FLAG__) & FLASH_FLAG_ECCD) != 0U) { SET_BIT(FLASH->ECCDETR,\ | ||||||
|  |                                                         ((__FLAG__) & FLASH_FLAG_ECCD)); }                             \ | ||||||
|  |                                                      if(((__FLAG__) & (~FLASH_FLAG_ECCR_ERRORS)) != 0U) { WRITE_REG    \ | ||||||
|  |                                                          (FLASH->NSCCR, ((__FLAG__) & (~FLASH_FLAG_ECCR_ERRORS))); }   \ | ||||||
|  |                                                    } while(0) | ||||||
|  | #else | ||||||
|  | /* Clear non-secure FLASH flags from the non-secure world */ | ||||||
|  | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__)        do { if(((__FLAG__) & FLASH_FLAG_ECCC) != 0U) { SET_BIT(FLASH->ECCCORR,\ | ||||||
|  |                                                         ((__FLAG__) & FLASH_FLAG_ECCC)); }                             \ | ||||||
|  |                                                      if(((__FLAG__) & FLASH_FLAG_ECCD) != 0U) { SET_BIT(FLASH->ECCDETR,\ | ||||||
|  |                                                         ((__FLAG__) & FLASH_FLAG_ECCD)); }                             \ | ||||||
|  |                                                      if(((__FLAG__) & (~FLASH_FLAG_ECCR_ERRORS)) != 0U) { WRITE_REG    \ | ||||||
|  |                                                          (FLASH->NSCCR, ((__FLAG__) & (~FLASH_FLAG_ECCR_ERRORS))); }   \ | ||||||
|  |                                                    } while(0) | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Include FLASH HAL Extension module */ | ||||||
|  | #include "stm32h5xx_hal_flash_ex.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 FlashAddress, uint32_t DataAddress); | ||||||
|  | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t FlashAddress, uint32_t DataAddress); | ||||||
|  | /* FLASH IRQ handler method */ | ||||||
|  | void HAL_FLASH_IRQHandler(void); | ||||||
|  | /* Callbacks in non blocking modes */ | ||||||
|  | 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); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | /* Private types -------------------------------------------------------------*/ | ||||||
|  | /* Private variables ---------------------------------------------------------*/ | ||||||
|  | /** @defgroup FLASH_Private_Variables FLASH Private Variables | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | extern FLASH_ProcessTypeDef pFlash; | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | /* Private constants ---------------------------------------------------------*/ | ||||||
|  | /** @defgroup FLASH_Private_Constants FLASH Private Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define FLASH_TIMEOUT_VALUE             1000U   /*!< 1 s */ | ||||||
|  |  | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | #define FLASH_OBK                       0x10000000U | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  |  | ||||||
|  | #define FLASH_OTP                       0x20000000U | ||||||
|  |  | ||||||
|  | #if defined (FLASH_EDATAR_EDATA_EN) | ||||||
|  | #define FLASH_EDATA_HALFWORD            0x40000000U | ||||||
|  | #define FLASH_EDATA_WORD                0x60000000U | ||||||
|  | #endif /* FLASH_EDATAR_EDATA_EN */ | ||||||
|  |  | ||||||
|  | #define FLASH_NON_SECURE_MASK           0x80000000U | ||||||
|  |  | ||||||
|  | #define FLASH_EDATA_SECTOR_NB           8U       /*!< Maximum number of FLASH high-cycle data sectors */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private macros ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup FLASH_Private_Macros FLASH Private Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | #if defined (FLASH_SR_OBKERR) && defined (FLASH_EDATAR_EDATA_EN) | ||||||
|  | #define IS_FLASH_TYPEPROGRAM(VALUE)      (((VALUE) == FLASH_TYPEPROGRAM_QUADWORD)                                   || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_QUADWORD_NS)                                || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_HALFWORD_OTP)                               || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_HALFWORD_EDATA)                             || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_HALFWORD_EDATA_NS)                          || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_WORD_EDATA)                                 || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_WORD_EDATA_NS)                              || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_QUADWORD_OBK)                               || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_QUADWORD_OBK_ALT)) | ||||||
|  | #else | ||||||
|  | #define IS_FLASH_TYPEPROGRAM(VALUE)      (((VALUE) == FLASH_TYPEPROGRAM_QUADWORD)                                   || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_QUADWORD_NS)                                || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_HALFWORD_OTP)) | ||||||
|  | #endif /* FLASH_SR_OBKERR && FLASH_EDATAR_EDATA_EN */ | ||||||
|  | #else | ||||||
|  | #if defined (FLASH_SR_OBKERR) && defined (FLASH_EDATAR_EDATA_EN) | ||||||
|  | #define IS_FLASH_TYPEPROGRAM(VALUE)      (((VALUE) == FLASH_TYPEPROGRAM_QUADWORD)                                   || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_HALFWORD_OTP)                               || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_HALFWORD_EDATA)                             || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_WORD_EDATA)                                 || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_QUADWORD_OBK)                               || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_QUADWORD_OBK_ALT)) | ||||||
|  | #else | ||||||
|  | #define IS_FLASH_TYPEPROGRAM(VALUE)      (((VALUE) == FLASH_TYPEPROGRAM_QUADWORD)                                   || \ | ||||||
|  |                                           ((VALUE) == FLASH_TYPEPROGRAM_HALFWORD_OTP)) | ||||||
|  | #endif /* FLASH_SR_OBKERR && FLASH_EDATAR_EDATA_EN */ | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | #define IS_FLASH_USER_MEM_ADDRESS(ADDRESS) ((((ADDRESS) >= FLASH_BASE) && ((ADDRESS) < (FLASH_BASE+FLASH_SIZE)))    || \ | ||||||
|  |                                             (((ADDRESS) >= FLASH_BASE_NS) && ((ADDRESS) < (FLASH_BASE_NS+FLASH_SIZE)))) | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | #define IS_FLASH_OBK_ADDRESS(ADDRESS)      ((((ADDRESS) >= FLASH_OBK_BASE)                                          && \ | ||||||
|  |                                              ((ADDRESS)  < (FLASH_OBK_BASE+FLASH_OBK_SIZE)))                        || \ | ||||||
|  |                                             (((ADDRESS) >= FLASH_OBK_BASE_NS)                                       && \ | ||||||
|  |                                              ((ADDRESS)  < (FLASH_OBK_BASE_NS+FLASH_OBK_SIZE)))) | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | #if defined (FLASH_EDATAR_EDATA_EN) | ||||||
|  | #define IS_FLASH_EDATA_ADDRESS(ADDRESS)    ((((ADDRESS) >= FLASH_EDATA_BASE_S)                                      && \ | ||||||
|  |                                              ((ADDRESS)  < (FLASH_EDATA_BASE_S+FLASH_EDATA_SIZE)))                  || \ | ||||||
|  |                                             (((ADDRESS) >= FLASH_EDATA_BASE_NS)                                     && \ | ||||||
|  |                                              ((ADDRESS)  < (FLASH_EDATA_BASE_NS+FLASH_EDATA_SIZE)))) | ||||||
|  | #endif /* FLASH_EDATAR_EDATA_EN */ | ||||||
|  | #else | ||||||
|  | #define IS_FLASH_USER_MEM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE)                                               && \ | ||||||
|  |                                             ((ADDRESS) < (FLASH_BASE+FLASH_SIZE))) | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | #define IS_FLASH_OBK_ADDRESS(ADDRESS)      (((ADDRESS) >= FLASH_OBK_BASE)                                           && \ | ||||||
|  |                                             ((ADDRESS) < (FLASH_OBK_BASE + FLASH_OBK_SIZE))) | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | #if defined (FLASH_EDATAR_EDATA_EN) | ||||||
|  | #define IS_FLASH_EDATA_ADDRESS(ADDRESS)    (((ADDRESS) >= FLASH_EDATA_BASE_NS)                                      && \ | ||||||
|  |                                             ((ADDRESS) < (FLASH_EDATA_BASE_NS + FLASH_EDATA_SIZE))) | ||||||
|  | #endif /* FLASH_EDATAR_EDATA_EN */ | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | #define IS_FLASH_OTP_ADDRESS(ADDRESS)      (((ADDRESS) >= FLASH_OTP_BASE)                                           && \ | ||||||
|  |                                             ((ADDRESS) < (FLASH_OTP_BASE + FLASH_OTP_SIZE))) | ||||||
|  |  | ||||||
|  | #define IS_FLASH_BANK(BANK)              (((BANK) == FLASH_BANK_1)                                                  || \ | ||||||
|  |                                           ((BANK) == FLASH_BANK_2)                                                  || \ | ||||||
|  |                                           ((BANK) == FLASH_BANK_BOTH)) | ||||||
|  |  | ||||||
|  | #define IS_FLASH_BANK_EXCLUSIVE(BANK)    (((BANK) == FLASH_BANK_1)                                                  || \ | ||||||
|  |                                           ((BANK) == FLASH_BANK_2)) | ||||||
|  |  | ||||||
|  | #define IS_FLASH_SECTOR(SECTOR)          ((SECTOR) < FLASH_SECTOR_NB) | ||||||
|  |  | ||||||
|  | #define IS_FLASH_LATENCY(LATENCY)        (((LATENCY) == FLASH_LATENCY_0)                                            || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_1)                                            || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_2)                                            || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_3)                                            || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_4)                                            || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_5)                                            || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_6)                                            || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_7)                                            || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_8)                                            || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_9)                                            || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_10)                                           || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_11)                                           || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_12)                                           || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_13)                                           || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_14)                                           || \ | ||||||
|  |                                           ((LATENCY) == FLASH_LATENCY_15)) | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | #define IS_FLASH_SECURE_OPERATION()        ((pFlash.ProcedureOnGoing & FLASH_NON_SECURE_MASK) == 0U) | ||||||
|  | #else | ||||||
|  | #define IS_FLASH_SECURE_OPERATION()        (1U == 0U) | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | /* Private functions ---------------------------------------------------------*/ | ||||||
|  | /** @defgroup FLASH_Private_Functions FLASH Private Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* STM32H5xx_HAL_FLASH_H */ | ||||||
							
								
								
									
										1069
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_flash_ex.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1069
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_flash_ex.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										410
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_gpio.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										410
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_gpio.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,410 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_gpio.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   Header file of GPIO HAL module. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef STM32H5xx_HAL_GPIO_H | ||||||
|  | #define STM32H5xx_HAL_GPIO_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal_def.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup GPIO GPIO | ||||||
|  |   * @brief GPIO HAL module driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* 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 a value of @ref GPIO_pins */ | ||||||
|  |  | ||||||
|  |   uint32_t Mode;       /*!< Specifies the operating mode for the selected pins. | ||||||
|  |                            This parameter can be a value of @ref GPIO_mode */ | ||||||
|  |  | ||||||
|  |   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 */ | ||||||
|  |  | ||||||
|  |   uint32_t Speed;      /*!< Specifies the speed for the selected pins. | ||||||
|  |                            This parameter can be a value of @ref GPIO_speed */ | ||||||
|  |  | ||||||
|  |   uint32_t Alternate;  /*!< Peripheral to be connected to the selected pins | ||||||
|  |                             This parameter can be a value of @ref GPIOEx_Alternate_function_selection */ | ||||||
|  | } 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 GPIO pins | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #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 GPIO mode | ||||||
|  |   * @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)) | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /*!< Input Floating Mode                                                 */ | ||||||
|  | #define  GPIO_MODE_INPUT                        (0x00000000U) | ||||||
|  | /*!< Output Push Pull Mode                                               */ | ||||||
|  | #define  GPIO_MODE_OUTPUT_PP                    (0x00000001U) | ||||||
|  | /*!< Output Open Drain Mode                                             */ | ||||||
|  | #define  GPIO_MODE_OUTPUT_OD                    (0x00000011U) | ||||||
|  | /*!< Alternate Function Push Pull Mode                                   */ | ||||||
|  | #define  GPIO_MODE_AF_PP                        (0x00000002U) | ||||||
|  | /*!< Alternate Function Open Drain Mode                                  */ | ||||||
|  | #define  GPIO_MODE_AF_OD                        (0x00000012U) | ||||||
|  | /*!< Analog Mode                                                         */ | ||||||
|  | #define  GPIO_MODE_ANALOG                       (0x00000003U) | ||||||
|  | /*!< External Interrupt Mode with Rising edge trigger detection          */ | ||||||
|  | #define  GPIO_MODE_IT_RISING                    (0x10110000U) | ||||||
|  | /*!< External Interrupt Mode with Falling edge trigger detection         */ | ||||||
|  | #define  GPIO_MODE_IT_FALLING                   (0x10210000U) | ||||||
|  | /*!< External Interrupt Mode with Rising/Falling edge trigger detection  */ | ||||||
|  | #define  GPIO_MODE_IT_RISING_FALLING            (0x10310000U) | ||||||
|  | /*!< External Event Mode with Rising edge trigger detection             */ | ||||||
|  | #define  GPIO_MODE_EVT_RISING                   (0x10120000U) | ||||||
|  | /*!< External Event Mode with Falling edge trigger detection            */ | ||||||
|  | #define  GPIO_MODE_EVT_FALLING                  (0x10220000U) | ||||||
|  | /*!< External Event Mode with Rising/Falling edge trigger detection      */ | ||||||
|  | #define  GPIO_MODE_EVT_RISING_FALLING           (0x10320000U) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup GPIO_speed GPIO speed | ||||||
|  |   * @brief GPIO Output Maximum frequency | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define  GPIO_SPEED_FREQ_LOW        (0x00000000U)   /*!< Low speed       */ | ||||||
|  | #define  GPIO_SPEED_FREQ_MEDIUM     (0x00000001U)   /*!< Medium speed    */ | ||||||
|  | #define  GPIO_SPEED_FREQ_HIGH       (0x00000002U)   /*!< High speed      */ | ||||||
|  | #define  GPIO_SPEED_FREQ_VERY_HIGH  (0x00000003U)   /*!< Very-high speed */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup GPIO_pull GPIO pull | ||||||
|  |   * @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                */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |  | ||||||
|  | /** @defgroup GPIO_attributes GPIO attributes | ||||||
|  |   * @brief GPIO pin secure or non-secure attributes | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define  GPIO_PIN_SEC       (0x00000001U)   /*!< Secure pin attribute      */ | ||||||
|  | #define  GPIO_PIN_NSEC      (0x00000000U)   /*!< Non-secure pin attribute  */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported macro ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup GPIO_Exported_Macros GPIO Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check whether the specified EXTI line is rising edge 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_RISING_IT(__EXTI_LINE__)         (EXTI->RPR1 & (__EXTI_LINE__)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear the EXTI's line rising 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_RISING_IT(__EXTI_LINE__)       (EXTI->RPR1 = (__EXTI_LINE__)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check whether the specified EXTI line is falling edge 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_FALLING_IT(__EXTI_LINE__)        (EXTI->FPR1 & (__EXTI_LINE__)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear the EXTI's line falling 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_FALLING_IT(__EXTI_LINE__)      (EXTI->FPR1 = (__EXTI_LINE__)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check 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__)         (__HAL_GPIO_EXTI_GET_RISING_IT(__EXTI_LINE__) || \ | ||||||
|  |                                                        __HAL_GPIO_EXTI_GET_FALLING_IT(__EXTI_LINE__)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear 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__)         \ | ||||||
|  |   do {                                                  \ | ||||||
|  |     __HAL_GPIO_EXTI_CLEAR_RISING_IT(__EXTI_LINE__);     \ | ||||||
|  |     __HAL_GPIO_EXTI_CLEAR_FALLING_IT(__EXTI_LINE__);    \ | ||||||
|  |   } while(0) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Generate a Software interrupt on selected EXTI line(s). | ||||||
|  |   * @param  __EXTI_LINE__: specifies the EXTI line to set. | ||||||
|  |   *          This parameter can be any combination of GPIO_PIN_x where x can be (0..15) | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | #define __HAL_GPIO_EXTI_GENERATE_SWIT(__EXTI_LINE__)  (EXTI->SWIER1 = (__EXTI_LINE__)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check 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__)       __HAL_GPIO_EXTI_GET_IT(__EXTI_LINE__) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear the EXTI 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__)     __HAL_GPIO_EXTI_CLEAR_IT(__EXTI_LINE__) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* 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_SINGLE_PIN(__PIN__) (((__PIN__) == GPIO_PIN_0)   ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_1)   ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_2)   ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_3)   ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_4)   ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_5)   ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_6)   ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_7)   ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_8)   ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_9)   ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_10)  ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_11)  ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_12)  ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_13)  ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_14)  ||\ | ||||||
|  |                                      ((__PIN__) == GPIO_PIN_15)) | ||||||
|  |  | ||||||
|  | #define IS_GPIO_COMMON_PIN(__RESETMASK__, __SETMASK__)  \ | ||||||
|  |   (((uint32_t)(__RESETMASK__) & (uint32_t)(__SETMASK__)) == 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)) | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |  | ||||||
|  | #define IS_GPIO_PIN_ATTRIBUTES(__ATTRIBUTES__)  (((__ATTRIBUTES__) == GPIO_PIN_SEC)  ||\ | ||||||
|  |                                                  ((__ATTRIBUTES__) == GPIO_PIN_NSEC)) | ||||||
|  |  | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Include GPIO HAL Extended module */ | ||||||
|  | #include "stm32h5xx_hal_gpio_ex.h" | ||||||
|  |  | ||||||
|  | /* Exported functions --------------------------------------------------------*/ | ||||||
|  | /** @addtogroup GPIO_Exported_Functions GPIO Exported Functions | ||||||
|  |   *  @brief    GPIO Exported Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup GPIO_Exported_Functions_Group1 Initialization/de-initialization functions | ||||||
|  |   *  @brief    Initialization and Configuration functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Initialization and de-initialization functions *****************************/ | ||||||
|  | void              HAL_GPIO_Init(GPIO_TypeDef  *GPIOx, const GPIO_InitTypeDef *pGPIO_Init); | ||||||
|  | void              HAL_GPIO_DeInit(GPIO_TypeDef  *GPIOx, uint32_t GPIO_Pin); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup GPIO_Exported_Functions_Group2 IO operation functions | ||||||
|  |   *  @brief    IO operation functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* IO operation functions *****************************************************/ | ||||||
|  | GPIO_PinState     HAL_GPIO_ReadPin(const GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin); | ||||||
|  | void              HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState); | ||||||
|  | void              HAL_GPIO_WriteMultipleStatePin(GPIO_TypeDef *GPIOx, uint16_t PinReset, uint16_t PinSet); | ||||||
|  | void              HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin); | ||||||
|  | void              HAL_GPIO_EnableHighSPeedLowVoltage(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin); | ||||||
|  | void              HAL_GPIO_DisableHighSPeedLowVoltage(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_Rising_Callback(uint16_t GPIO_Pin); | ||||||
|  | void              HAL_GPIO_EXTI_Falling_Callback(uint16_t GPIO_Pin); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |  | ||||||
|  | /** @addtogroup GPIO_Exported_Functions_Group3 IO attributes management functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* IO attributes management functions *****************************************/ | ||||||
|  | void              HAL_GPIO_ConfigPinAttributes(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t PinAttributes); | ||||||
|  | HAL_StatusTypeDef HAL_GPIO_GetConfigPinAttributes(const GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, | ||||||
|  |                                                   uint32_t *pPinAttributes); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* STM32H5xx_HAL_GPIO_H */ | ||||||
							
								
								
									
										502
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_gpio_ex.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										502
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_gpio_ex.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,502 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_gpio_ex.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   Header file of GPIO HAL Extended module. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef STM32H5xx_HAL_GPIO_EX_H | ||||||
|  | #define STM32H5xx_HAL_GPIO_EX_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal_def.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup GPIOEx GPIOEx | ||||||
|  |   * @brief GPIO Extended HAL module driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported types ------------------------------------------------------------*/ | ||||||
|  | /* Exported constants --------------------------------------------------------*/ | ||||||
|  | /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @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                          */ | ||||||
|  | #define GPIO_AF0_CSLEEP        ((uint8_t)0x00)  /* CSLEEP Alternate Function mapping                         */ | ||||||
|  | #define GPIO_AF0_CSTOP         ((uint8_t)0x00)  /* CSTOP Alternate Function mapping                          */ | ||||||
|  | #define GPIO_AF0_CRS           ((uint8_t)0x00)  /* CRS 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                           */ | ||||||
|  | #if defined(TIM16) | ||||||
|  | #define GPIO_AF1_TIM16         ((uint8_t)0x01)  /* TIM16 Alternate Function mapping                          */ | ||||||
|  | #endif /* TIM16 */ | ||||||
|  | #if defined(TIM17) | ||||||
|  | #define GPIO_AF1_TIM17         ((uint8_t)0x01)  /* TIM17 Alternate Function mapping                          */ | ||||||
|  | #endif /* TIM17 */ | ||||||
|  | #if !defined(STM32H503xx) | ||||||
|  | #define GPIO_AF1_LPTIM1        ((uint8_t)0x01)  /* LPTIM1 Alternate Function mapping                         */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 2 selection | ||||||
|  |   */ | ||||||
|  | #if defined(STM32H503xx) | ||||||
|  | #define GPIO_AF2_LPTIM1        ((uint8_t)0x02)  /* LPTIM1 Alternate Function mapping                         */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  | #if defined(LPTIM3) | ||||||
|  | #define GPIO_AF2_LPTIM3        ((uint8_t)0x02)  /* LPTIM3 Alternate Function mapping                         */ | ||||||
|  | #endif /* LPTIM3 */ | ||||||
|  | #if defined(SAI1) | ||||||
|  | #define GPIO_AF2_SAI1          ((uint8_t)0x02)  /* SAI1 Alternate Function mapping                           */ | ||||||
|  | #endif /* SAI1 */ | ||||||
|  | #define GPIO_AF2_TIM3          ((uint8_t)0x02)  /* TIM3 Alternate Function mapping                           */ | ||||||
|  | #if defined(TIM4) | ||||||
|  | #define GPIO_AF2_TIM4          ((uint8_t)0x02)  /* TIM4 Alternate Function mapping                           */ | ||||||
|  | #endif /* TIM4 */ | ||||||
|  | #if defined(TIM5) | ||||||
|  | #define GPIO_AF2_TIM5          ((uint8_t)0x02)  /* TIM5 Alternate Function mapping                           */ | ||||||
|  | #endif /* TIM5 */ | ||||||
|  | #if (defined(STM32H533xx) || defined(STM32H523xx)) | ||||||
|  | #define GPIO_AF2_TIM8          ((uint8_t)0x02)  /* TIM8 Alternate Function mapping                           */ | ||||||
|  | #endif /* STM32H533xx || STM32H523xx */ | ||||||
|  | #if defined(TIM12) | ||||||
|  | #define GPIO_AF2_TIM12         ((uint8_t)0x02)  /* TIM12 Alternate Function mapping                          */ | ||||||
|  | #endif /* TIM12 */ | ||||||
|  | #if defined(TIM15) | ||||||
|  | #define GPIO_AF2_TIM15         ((uint8_t)0x02)  /* TIM15 Alternate Function mapping                          */ | ||||||
|  | #endif /* TIM15 */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 3 selection | ||||||
|  |   */ | ||||||
|  | #define GPIO_AF3_I3C1          ((uint8_t)0x03)  /* I3C1 Alternate Function mapping                           */ | ||||||
|  | #if defined(I3C2) | ||||||
|  | #define GPIO_AF3_I3C2          ((uint8_t)0x03)  /* I3C2 Alternate Function mapping                           */ | ||||||
|  | #endif /* I3C2 */ | ||||||
|  | #define GPIO_AF3_LPTIM2        ((uint8_t)0x03)  /* LPTIM2 Alternate Function mapping                         */ | ||||||
|  | #if defined(LPTIM3) | ||||||
|  | #define GPIO_AF3_LPTIM3        ((uint8_t)0x03)  /* LPTIM3 Alternate Function mapping                         */ | ||||||
|  | #endif /* LPTIM3 */ | ||||||
|  | #define GPIO_AF3_LPUART1       ((uint8_t)0x03)  /* LPUART1 Alternate Function mapping                        */ | ||||||
|  | #if defined(OCTOSPI1) | ||||||
|  | #define GPIO_AF3_OCTOSPI1      ((uint8_t)0x03)  /* OCTOSPI1 Alternate Function mapping                       */ | ||||||
|  | #endif /* OCTOSPI1 */ | ||||||
|  | #if !defined(STM32H503xx) | ||||||
|  | #define GPIO_AF3_TIM1          ((uint8_t)0x03)  /* TIM1 Alternate Function mapping                           */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  | #if defined(TIM8) | ||||||
|  | #define GPIO_AF3_TIM8          ((uint8_t)0x03)  /* TIM8 Alternate Function mapping                           */ | ||||||
|  | #endif /* TIM8 */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 4 selection | ||||||
|  |   */ | ||||||
|  | #if defined(CEC) | ||||||
|  | #define GPIO_AF4_CEC           ((uint8_t)0x04)  /* CEC Alternate Function mapping                            */ | ||||||
|  | #endif /* CEC */ | ||||||
|  | #if defined(DCMI) | ||||||
|  | #define GPIO_AF4_DCMI          ((uint8_t)0x04)  /* DCMI Alternate Function mapping                           */ | ||||||
|  | #endif /* DCMI */ | ||||||
|  | #if defined(PSSI) | ||||||
|  | #define GPIO_AF4_PSSI          ((uint8_t)0x04)  /* PSSI Alternate Function mapping                           */ | ||||||
|  | #endif /* PSSI */ | ||||||
|  | #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping                           */ | ||||||
|  | #if defined(I2C3) | ||||||
|  | #define GPIO_AF4_I2C3          ((uint8_t)0x04)  /* I2C3 Alternate Function mapping                           */ | ||||||
|  | #endif /* I2C3 */ | ||||||
|  | #if defined(I2C4) | ||||||
|  | #define GPIO_AF4_I2C4          ((uint8_t)0x04)  /* I2C4 Alternate Function mapping                           */ | ||||||
|  | #endif /* I2C4 */ | ||||||
|  | #define GPIO_AF4_LPTIM1        ((uint8_t)0x04)  /* LPTIM1 Alternate Function mapping                         */ | ||||||
|  | #define GPIO_AF4_LPTIM2        ((uint8_t)0x04)  /* LPTIM2 Alternate Function mapping                         */ | ||||||
|  | #define GPIO_AF4_SPI1          ((uint8_t)0x04)  /* SPI1 Alternate Function mapping                           */ | ||||||
|  | #if (defined(STM32H533xx) || defined(STM32H523xx)) | ||||||
|  | #define GPIO_AF4_SPI3          ((uint8_t)0x04)  /* SPI3 Alternate Function mapping                           */ | ||||||
|  | #endif /* STM32H533xx || STM32H523xx */ | ||||||
|  | #if defined(TIM15) | ||||||
|  | #define GPIO_AF4_TIM15         ((uint8_t)0x04)  /* TIM15 Alternate Function mapping                          */ | ||||||
|  | #endif /* TIM15 */ | ||||||
|  | #define GPIO_AF4_USART1        ((uint8_t)0x04)  /* USART1 Alternate Function mapping                         */ | ||||||
|  | #if defined(STM32H503xx) | ||||||
|  | #define GPIO_AF4_USART2        ((uint8_t)0x04)  /* USART2 Alternate Function mapping                         */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 5 selection | ||||||
|  |   */ | ||||||
|  | #if defined(CEC) | ||||||
|  | #define GPIO_AF5_CEC           ((uint8_t)0x05)  /* CEC Alternate Function mapping                            */ | ||||||
|  | #endif /* CEC */ | ||||||
|  | #if !defined(STM32H503xx) | ||||||
|  | #define GPIO_AF5_I3C1          ((uint8_t)0x05)  /* I3C1 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3 Alternate Function mapping                           */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  | #define GPIO_AF5_LPTIM1        ((uint8_t)0x05)  /* LPTIM1 Alternate Function mapping                         */ | ||||||
|  | #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2 Alternate Function mapping                           */ | ||||||
|  | #if defined(SPI4) | ||||||
|  | #define GPIO_AF5_SPI4          ((uint8_t)0x05)  /* SPI4 Alternate Function mapping                           */ | ||||||
|  | #endif /* SPI4 */ | ||||||
|  | #if defined(SPI5) | ||||||
|  | #define GPIO_AF5_SPI5          ((uint8_t)0x05)  /* SPI5 Alternate Function mapping                           */ | ||||||
|  | #endif /* SPI5 */ | ||||||
|  | #if defined(SPI6) | ||||||
|  | #define GPIO_AF5_SPI6          ((uint8_t)0x05)  /* SPI6 Alternate Function mapping                           */ | ||||||
|  | #endif /* SPI6 */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 6 selection | ||||||
|  |   */ | ||||||
|  | #if defined(I2C4) | ||||||
|  | #define GPIO_AF6_I2C4          ((uint8_t)0x06)  /* I2C4 Alternate Function mapping                           */ | ||||||
|  | #endif /* I2C4 */ | ||||||
|  | #if defined(OCTOSPI1) | ||||||
|  | #define GPIO_AF6_OCTOSPI1      ((uint8_t)0x06)  /* OCTOSPI1 Alternate Function mapping                       */ | ||||||
|  | #endif /* OCTOSPI1 */ | ||||||
|  | #if defined(SAI1) | ||||||
|  | #define GPIO_AF6_SAI1          ((uint8_t)0x06)  /* SAI1 Alternate Function mapping                           */ | ||||||
|  | #endif /* SAI1 */ | ||||||
|  | #if (defined(STM32H503xx) || defined(STM32H533xx) || defined(STM32H523xx)) | ||||||
|  | #define GPIO_AF6_SPI1          ((uint8_t)0x06)  /* SPI1 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF6_SPI2          ((uint8_t)0x06)  /* SPI2 Alternate Function mapping                           */ | ||||||
|  | #endif /* STM32H503xx || STM32H533xx || STM32H523xx */ | ||||||
|  | #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3 Alternate Function mapping                           */ | ||||||
|  | #if defined(SPI4) | ||||||
|  | #define GPIO_AF6_SPI4          ((uint8_t)0x06)  /* SPI4 Alternate Function mapping                           */ | ||||||
|  | #endif /* SPI4 */ | ||||||
|  | #if defined(UART4) | ||||||
|  | #define GPIO_AF6_UART4         ((uint8_t)0x06)  /* UART4 Alternate Function mapping                          */ | ||||||
|  | #endif /* UART4 */ | ||||||
|  | #if (defined(STM32H533xx) || defined(STM32H523xx)) | ||||||
|  | #define GPIO_AF6_USART6        ((uint8_t)0x06)  /* USART6 Alternate Function mapping                         */ | ||||||
|  | #endif /* STM32H533xx || STM32H523xx */ | ||||||
|  | #if defined(UART12) | ||||||
|  | #define GPIO_AF6_UART12        ((uint8_t)0x06)  /* UART12 Alternate Function mapping                         */ | ||||||
|  | #endif /* UART12 */ | ||||||
|  | #if defined(USART10) | ||||||
|  | #define GPIO_AF6_USART10       ((uint8_t)0x06)  /* USART10 Alternate Function mapping                        */ | ||||||
|  | #endif /* USART10 */ | ||||||
|  | #if defined(UCPD1) | ||||||
|  | #define GPIO_AF6_UCPD1         ((uint8_t)0x06)  /* UCPD1 Alternate Function mapping                          */ | ||||||
|  | #endif /* UCPD1 */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 7 selection | ||||||
|  |   */ | ||||||
|  | #if defined(SDMMC1) | ||||||
|  | #define GPIO_AF7_SDMMC1        ((uint8_t)0x07)  /* SDMMC1 Alternate Function mapping                         */ | ||||||
|  | #endif /* SDMMC1 */ | ||||||
|  | #define GPIO_AF7_SPI2          ((uint8_t)0x07)  /* SPI2 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF7_SPI3          ((uint8_t)0x07)  /* SPI3 Alternate Function mapping                           */ | ||||||
|  | #if defined(SPI6) | ||||||
|  | #define GPIO_AF7_SPI6          ((uint8_t)0x07)  /* SPI6 Alternate Function mapping                           */ | ||||||
|  | #endif /* SPI6 */ | ||||||
|  | #if defined(UART7) | ||||||
|  | #define GPIO_AF7_UART7         ((uint8_t)0x07)  /* UART7 Alternate Function mapping                          */ | ||||||
|  | #endif /* UART7 */ | ||||||
|  | #if defined(UART8) | ||||||
|  | #define GPIO_AF7_UART8         ((uint8_t)0x07)  /* UART8 Alternate Function mapping                          */ | ||||||
|  | #endif /* UART8 */ | ||||||
|  | #if defined(UART12) | ||||||
|  | #define GPIO_AF7_UART12        ((uint8_t)0x07)  /* UART12 Alternate Function mapping                         */ | ||||||
|  | #endif /* UART12 */ | ||||||
|  | #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                         */ | ||||||
|  | #if defined(USART6) | ||||||
|  | #define GPIO_AF7_USART6        ((uint8_t)0x07)  /* USART6 Alternate Function mapping                         */ | ||||||
|  | #endif /* USART6 */ | ||||||
|  | #if defined(USART10) | ||||||
|  | #define GPIO_AF7_USART10       ((uint8_t)0x07)  /* USART10 Alternate Function mapping                        */ | ||||||
|  | #endif /* USART10 */ | ||||||
|  | #if defined(USART11) | ||||||
|  | #define GPIO_AF7_USART11       ((uint8_t)0x07)  /* USART11 Alternate Function mapping                        */ | ||||||
|  | #endif /* USART11 */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 8 selection | ||||||
|  |   */ | ||||||
|  | #if defined(STM32H503xx) | ||||||
|  | #define GPIO_AF8_I2C2          ((uint8_t)0x08)  /* I2C2 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF8_I3C1          ((uint8_t)0x08)  /* I3C1 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF8_USART1        ((uint8_t)0x08)  /* USART1 Alternate Function mapping                         */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  | #define GPIO_AF8_LPUART1       ((uint8_t)0x08)  /* LPUART1 Alternate Function mapping                        */ | ||||||
|  | #if defined(SAI2) | ||||||
|  | #define GPIO_AF8_SAI2          ((uint8_t)0x08)  /* SAI2 Alternate Function mapping                           */ | ||||||
|  | #endif /* SAI2 */ | ||||||
|  | #if defined(SDMMC1) | ||||||
|  | #define GPIO_AF8_SDMMC1        ((uint8_t)0x08)  /* SDMMC1 Alternate Function mapping                         */ | ||||||
|  | #endif /* SDMMC1 */ | ||||||
|  | #if defined(SPI6) | ||||||
|  | #define GPIO_AF8_SPI6          ((uint8_t)0x08)  /* SPI6 Alternate Function mapping                           */ | ||||||
|  | #endif /* SPI6 */ | ||||||
|  | #if defined(UART4) | ||||||
|  | #define GPIO_AF8_UART4         ((uint8_t)0x08)  /* UART4 Alternate Function mapping                          */ | ||||||
|  | #endif /* UART4 */ | ||||||
|  | #if defined(UART5) | ||||||
|  | #define GPIO_AF8_UART5         ((uint8_t)0x08)  /* UART5 Alternate Function mapping                          */ | ||||||
|  | #endif /* UART5 */ | ||||||
|  | #if defined(UART8) | ||||||
|  | #define GPIO_AF8_UART8         ((uint8_t)0x08)  /* UART8 Alternate Function mapping                          */ | ||||||
|  | #endif /* UART8 */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 9 selection | ||||||
|  |   */ | ||||||
|  | #define GPIO_AF9_FDCAN1        ((uint8_t)0x09)  /* FDCAN1 Alternate Function mapping                         */ | ||||||
|  | #if defined(FDCAN2) | ||||||
|  | #define GPIO_AF9_FDCAN2        ((uint8_t)0x09)  /* FDCAN2 Alternate Function mapping                         */ | ||||||
|  | #endif /* FDCAN2 */ | ||||||
|  | #if defined(FMC_BANK1) | ||||||
|  | #define GPIO_AF9_FMC           ((uint8_t)0x09)  /* FMC Alternate Function mapping                            */ | ||||||
|  | #endif /* FMC_BANK1 */ | ||||||
|  | #if defined(OCTOSPI1) | ||||||
|  | #define GPIO_AF9_OCTOSPI1      ((uint8_t)0x09)  /* OCTOSPI1 Alternate Function mapping                       */ | ||||||
|  | #endif /* OCTOSPI1 */ | ||||||
|  | #if defined(SDMMC2) | ||||||
|  | #define GPIO_AF9_SDMMC2        ((uint8_t)0x09)  /* SDMMC2 Alternate Function mapping                         */ | ||||||
|  | #endif /* SDMMC2 */ | ||||||
|  | #if defined(TIM13) | ||||||
|  | #define GPIO_AF9_TIM13         ((uint8_t)0x09)  /* TIM13 Alternate Function mapping                          */ | ||||||
|  | #endif /* TIM13 */ | ||||||
|  | #if defined(TIM14) | ||||||
|  | #define GPIO_AF9_TIM14         ((uint8_t)0x09)  /* TIM14 Alternate Function mapping                          */ | ||||||
|  | #endif /* TIM14 */ | ||||||
|  | #if defined(STM32H503xx) | ||||||
|  | #define GPIO_AF9_USART2        ((uint8_t)0x09)  /* USART2 Alternate Function mapping                         */ | ||||||
|  | #define GPIO_AF9_USART3        ((uint8_t)0x09)  /* USART3 Alternate Function mapping                         */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  | #if (defined(STM32H533xx) || defined(STM32H523xx)) | ||||||
|  | #define GPIO_AF9_I2C3          ((uint8_t)0x09)  /* I2C3 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF9_I3C2          ((uint8_t)0x09)  /* I3C2 Alternate Function mapping                           */ | ||||||
|  | #endif /* STM32H533xx || STM32H523xx */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 10 selection | ||||||
|  |   */ | ||||||
|  | #define GPIO_AF10_CRS          ((uint8_t)0x0A)  /* CRS Alternate Function mapping                            */ | ||||||
|  | #if defined(STM32H503xx) | ||||||
|  | #define GPIO_AF10_I3C1         ((uint8_t)0x0A)  /* I3C1 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF10_SPI3         ((uint8_t)0x0A)  /* SPI3 Alternate Function mapping                           */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  | #if (defined(STM32H503xx) || defined(STM32H533xx) || defined(STM32H523xx)) | ||||||
|  | #define GPIO_AF10_I3C2         ((uint8_t)0x0A)  /* I3C2 Alternate Function mapping                           */ | ||||||
|  | #endif /* STM32H503xx || STM32H533xx || STM32H523xx */ | ||||||
|  | #if defined(FMC_BANK1) | ||||||
|  | #define GPIO_AF10_FMC          ((uint8_t)0x0A)  /* FMC Alternate Function mapping                            */ | ||||||
|  | #endif /* FMC_BANK1 */ | ||||||
|  | #if defined(OCTOSPI1) | ||||||
|  | #define GPIO_AF10_OCTOSPI1     ((uint8_t)0x0A)  /* OCTOSPI1 Alternate Function mapping                       */ | ||||||
|  | #endif /* OCTOSPI1 */ | ||||||
|  | #if defined(SAI2) | ||||||
|  | #define GPIO_AF10_SAI2         ((uint8_t)0x0A)  /* SAI2 Alternate Function mapping                           */ | ||||||
|  | #endif /* SAI2 */ | ||||||
|  | #if (defined(STM32H533xx) || defined(STM32H523xx)) | ||||||
|  | #define GPIO_AF10_SDMMC1       ((uint8_t)0x0A)  /* SDMMC1 Alternate Function mapping                         */ | ||||||
|  | #endif /* STM32H533xx || STM32H523xx */ | ||||||
|  | #if defined(SDMMC2) | ||||||
|  | #define GPIO_AF10_SDMMC2       ((uint8_t)0x0A)  /* SDMMC2 Alternate Function mapping                         */ | ||||||
|  | #endif /* SDMMC2 */ | ||||||
|  | #if defined(TIM8) | ||||||
|  | #define GPIO_AF10_TIM8         ((uint8_t)0x0A)  /* TIM8 Alternate Function mapping                           */ | ||||||
|  | #endif /* TIM8 */ | ||||||
|  | #if defined(USB_DRD_FS) | ||||||
|  | #define GPIO_AF10_USB          ((uint8_t)0x0A)  /* USB Alternate Function mapping                            */ | ||||||
|  | #endif /* USB_DRD_FS */ | ||||||
|  | #if defined(LTDC) | ||||||
|  | #define GPIO_AF10_LTDC         ((uint8_t)0x0A)  /* LTDC Alternate Function mapping                           */ | ||||||
|  | #endif /* LTDC */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 11 selection | ||||||
|  |   */ | ||||||
|  | #if defined(ETH) | ||||||
|  | #define GPIO_AF11_ETH          ((uint8_t)0x0B)  /* ETH Alternate Function mapping                            */ | ||||||
|  | #endif /* ETH */ | ||||||
|  | #if defined(FMC_BANK1) | ||||||
|  | #define GPIO_AF11_FMC          ((uint8_t)0x0B)  /* FMC Alternate Function mapping                            */ | ||||||
|  | #endif /* FMC_BANK1 */ | ||||||
|  | #if defined(OCTOSPI1) | ||||||
|  | #define GPIO_AF11_OCTOSPI1     ((uint8_t)0x0B)  /* OCTOSPI1 Alternate Function mapping                       */ | ||||||
|  | #endif /* OCTOSPI1 */ | ||||||
|  | #if (defined(STM32H533xx) || defined(STM32H523xx)) | ||||||
|  | #define GPIO_AF11_SDMMC1       ((uint8_t)0x0B)  /* SDMMC1 Alternate Function mapping                         */ | ||||||
|  | #endif /* STM32H533xx || STM32H523xx */ | ||||||
|  | #if defined(SDMMC2) | ||||||
|  | #define GPIO_AF11_SDMMC2       ((uint8_t)0x0B)  /* SDMMC2 Alternate Function mapping                         */ | ||||||
|  | #endif /* SDMMC2 */ | ||||||
|  | #if defined(UART7) | ||||||
|  | #define GPIO_AF11_UART7        ((uint8_t)0x0B)  /* UART7 Alternate Function mapping                          */ | ||||||
|  | #endif /* UART7 */ | ||||||
|  | #if defined(UART9) | ||||||
|  | #define GPIO_AF11_UART9        ((uint8_t)0x0B)  /* UART9 Alternate Function mapping                          */ | ||||||
|  | #endif /* UART9 */ | ||||||
|  | #if defined(UCPD1) | ||||||
|  | #define GPIO_AF11_UCPD1        ((uint8_t)0x0B)  /* UCPD1 Alternate Function mapping                          */ | ||||||
|  | #endif /* UCPD1 */ | ||||||
|  | #if defined(STM32H503xx) | ||||||
|  | #define GPIO_AF11_I2C1         ((uint8_t)0x0B)  /* I2C1 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF11_I2C2         ((uint8_t)0x0B)  /* I2C2 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF11_SPI2         ((uint8_t)0x0B)  /* SPI2 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF11_USART2       ((uint8_t)0x0B)  /* USART2 Alternate Function mapping                         */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 12 selection | ||||||
|  |   */ | ||||||
|  | #if defined(FMC_BANK1) | ||||||
|  | #define GPIO_AF12_FMC          ((uint8_t)0x0C)  /* FMC Alternate Function mapping                            */ | ||||||
|  | #endif /* FMC_BANK1 */ | ||||||
|  | #if defined(SDMMC1) | ||||||
|  | #define GPIO_AF12_SDMMC1       ((uint8_t)0x0C)  /* SDMMC1 Alternate Function mapping                         */ | ||||||
|  | #endif /* SDMMC1 */ | ||||||
|  | #if defined(STM32H503xx) | ||||||
|  | #define GPIO_AF12_COMP1        ((uint8_t)0x0C)  /* COMP1 Alternate Function mapping                          */ | ||||||
|  | #define GPIO_AF12_SPI1         ((uint8_t)0x0C)  /* SPI1 Alternate Function mapping                           */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 13 selection | ||||||
|  |   */ | ||||||
|  | #if defined(DCMI) | ||||||
|  | #define GPIO_AF13_DCMI         ((uint8_t)0x0D)  /* DCMI Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF13_PSSI         ((uint8_t)0x0D)  /* PSSI Alternate Function mapping                           */ | ||||||
|  | #endif /* DCMI */ | ||||||
|  | #if defined(FMC_BANK1) | ||||||
|  | #define GPIO_AF13_FMC          ((uint8_t)0x0D)  /* FMC Alternate Function mapping                            */ | ||||||
|  | #endif /* FMC_BANK1 */ | ||||||
|  | #if defined(LPTIM5) | ||||||
|  | #define GPIO_AF13_LPTIM5       ((uint8_t)0x0D)  /* LPTIM5 Alternate Function mapping                         */ | ||||||
|  | #endif /* LPTIM5 */ | ||||||
|  | #if defined(STM32H503xx) | ||||||
|  | #define GPIO_AF13_USART2       ((uint8_t)0x0D)  /* USART2 Alternate Function mapping                         */ | ||||||
|  | #define GPIO_AF13_USART3       ((uint8_t)0x0D)  /* USART3 Alternate Function mapping                         */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 14 selection | ||||||
|  |   */ | ||||||
|  | #if defined(STM32H503xx) | ||||||
|  | #define GPIO_AF14_LPTIM1       ((uint8_t)0x0E)  /* LPTIM1 Alternate Function mapping                         */ | ||||||
|  | #define GPIO_AF14_LPTIM2       ((uint8_t)0x0E)  /* LPTIM2 Alternate Function mapping                         */ | ||||||
|  | #define GPIO_AF14_TIM1         ((uint8_t)0x0E)  /* TIM1 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF14_TIM2         ((uint8_t)0x0E)  /* TIM2 Alternate Function mapping                           */ | ||||||
|  | #define GPIO_AF14_TIM3         ((uint8_t)0x0E)  /* TIM3 Alternate Function mapping                           */ | ||||||
|  | #endif /* STM32H503xx */ | ||||||
|  | #if defined(LPTIM3) | ||||||
|  | #define GPIO_AF14_LPTIM3       ((uint8_t)0x0E)  /* LPTIM3 Alternate Function mapping                         */ | ||||||
|  | #endif /* LPTIM3 */ | ||||||
|  | #if defined(LPTIM4) | ||||||
|  | #define GPIO_AF14_LPTIM4       ((uint8_t)0x0E)  /* LPTIM4 Alternate Function mapping                         */ | ||||||
|  | #endif /* LPTIM4 */ | ||||||
|  | #if defined(LPTIM5) | ||||||
|  | #define GPIO_AF14_LPTIM5       ((uint8_t)0x0E)  /* LPTIM5 Alternate Function mapping                         */ | ||||||
|  | #endif /* LPTIM5 */ | ||||||
|  | #if defined(LPTIM6) | ||||||
|  | #define GPIO_AF14_LPTIM6       ((uint8_t)0x0E)  /* LPTIM6 Alternate Function mapping                         */ | ||||||
|  | #endif /* LPTIM6 */ | ||||||
|  | #if defined(STM32H573xx) || defined(STM32H563xx) || defined(STM32H562xx) || defined(STM32H533xx) || defined(STM32H523xx) | ||||||
|  | #define GPIO_AF14_TIM2         ((uint8_t)0x0E)  /* TIM2 Alternate Function mapping                           */ | ||||||
|  | #endif /* STM32H573xx || STM32H563xx || STM32H562xx || STM32H533xx || STM32H523xx */ | ||||||
|  | #if defined(UART5) | ||||||
|  | #define GPIO_AF14_UART5        ((uint8_t)0x0E)  /* UART5 Alternate Function mapping                          */ | ||||||
|  | #endif /* UART5 */ | ||||||
|  | #if (defined(STM32H533xx) || defined(STM32H523xx)) | ||||||
|  | #define GPIO_AF14_USART6       ((uint8_t)0x0E)  /* USART6 Alternate Function mapping                         */ | ||||||
|  | #endif /* STM32H533xx || STM32H523xx */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief   AF 15 selection | ||||||
|  |   */ | ||||||
|  | #define GPIO_AF15_EVENTOUT     ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */ | ||||||
|  |  | ||||||
|  | #define IS_GPIO_AF(AF)   ((AF) <= (uint8_t)0x0F) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported macro ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup GPIOEx_Get_Port_Index GPIOEx_Get Port Index | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* GPIO_Peripheral_Memory_Mapping Peripheral Memory Mapping */ | ||||||
|  |  | ||||||
|  | #if defined(STM32H573xx) || defined(STM32H563xx) || defined(STM32H562xx) || defined(STM32H533xx) || \ | ||||||
|  |     defined(STM32H523xx) || defined(STM32H503xx) | ||||||
|  | #define GPIO_GET_INDEX(__GPIOx__)           (((uint32_t )(__GPIOx__) & (~GPIOA_BASE)) >> 10) | ||||||
|  | #endif /* (defined(STM32H573xx) || defined(STM32H563xx) || defined(STM32H562xx) || defined(STM32H533xx) || \ | ||||||
|  |           defined(STM32H523xx) || defined(STM32H503xx) */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported functions --------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* STM32H5xx_HAL_GPIO_EX_H */ | ||||||
							
								
								
									
										300
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_icache.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										300
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_icache.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,300 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_icache.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   Header file of ICACHE HAL module. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion ------------------------------------*/ | ||||||
|  | #ifndef STM32H5xx_HAL_ICACHE_H | ||||||
|  | #define STM32H5xx_HAL_ICACHE_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes -----------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal_def.h" | ||||||
|  |  | ||||||
|  | #if defined(ICACHE) | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup ICACHE | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported types -----------------------------------------------------------*/ | ||||||
|  | #if defined(ICACHE_CRRx_REN) | ||||||
|  | /** @defgroup ICACHE_Exported_Types ICACHE Exported Types | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  HAL ICACHE region configuration structure definition | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t BaseAddress;              /*!< Configures the Base address of Region i to be remapped */ | ||||||
|  |  | ||||||
|  |   uint32_t RemapAddress;             /*!< Configures the Remap address of Region i to be remapped */ | ||||||
|  |  | ||||||
|  |   uint32_t Size;                     /*!< Configures the Region size. | ||||||
|  |                                           This parameter can be a value of @ref ICACHE_Region_Size */ | ||||||
|  |  | ||||||
|  |   uint32_t TrafficRoute;             /*!< Selects the traffic route. | ||||||
|  |                                           This parameter can be a value of @ref ICACHE_Traffic_Route */ | ||||||
|  |  | ||||||
|  |   uint32_t OutputBurstType;          /*!< Selects the output burst type. | ||||||
|  |                                           This parameter can be a value of @ref ICACHE_Output_Burst_Type */ | ||||||
|  | } ICACHE_RegionConfigTypeDef; | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /*  ICACHE_CRRx_REN */ | ||||||
|  |  | ||||||
|  | /* Exported constants -------------------------------------------------------*/ | ||||||
|  | /** @defgroup ICACHE_Exported_Constants ICACHE Exported Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_WaysSelection Ways selection | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define ICACHE_1WAY                    0U                /*!< 1-way cache (direct mapped cache) */ | ||||||
|  | #define ICACHE_2WAYS                   ICACHE_CR_WAYSEL  /*!< 2-ways set associative cache (default) */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_Monitor_Type Monitor type | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define ICACHE_MONITOR_HIT_MISS        (ICACHE_CR_HITMEN | ICACHE_CR_MISSMEN) /*!< Hit & Miss monitoring */ | ||||||
|  | #define ICACHE_MONITOR_HIT             ICACHE_CR_HITMEN                       /*!< Hit monitoring */ | ||||||
|  | #define ICACHE_MONITOR_MISS            ICACHE_CR_MISSMEN                      /*!< Miss monitoring */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(ICACHE_CRRx_REN) | ||||||
|  | /** @defgroup ICACHE_Region Remapped Region number | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define ICACHE_REGION_0                0U  /*!< Region 0 */ | ||||||
|  | #define ICACHE_REGION_1                1U  /*!< Region 1 */ | ||||||
|  | #define ICACHE_REGION_2                2U  /*!< Region 2 */ | ||||||
|  | #define ICACHE_REGION_3                3U  /*!< Region 3 */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_Region_Size Remapped Region size | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define ICACHE_REGIONSIZE_2MB          1U  /*!< Region size 2MB */ | ||||||
|  | #define ICACHE_REGIONSIZE_4MB          2U  /*!< Region size 4MB */ | ||||||
|  | #define ICACHE_REGIONSIZE_8MB          3U  /*!< Region size 8MB */ | ||||||
|  | #define ICACHE_REGIONSIZE_16MB         4U  /*!< Region size 16MB */ | ||||||
|  | #define ICACHE_REGIONSIZE_32MB         5U  /*!< Region size 32MB */ | ||||||
|  | #define ICACHE_REGIONSIZE_64MB         6U  /*!< Region size 64MB */ | ||||||
|  | #define ICACHE_REGIONSIZE_128MB        7U  /*!< Region size 128MB */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_Traffic_Route Remapped Traffic route | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define ICACHE_MASTER1_PORT            0U                  /*!< Master1 port */ | ||||||
|  | #define ICACHE_MASTER2_PORT            ICACHE_CRRx_MSTSEL  /*!< Master2 port */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_Output_Burst_Type Remapped Output burst type | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define ICACHE_OUTPUT_BURST_WRAP       0U                  /*!< WRAP */ | ||||||
|  | #define ICACHE_OUTPUT_BURST_INCR       ICACHE_CRRx_HBURST  /*!< INCR */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /*  ICACHE_CRRx_REN */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_Interrupts Interrupts | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define ICACHE_IT_BUSYEND              ICACHE_IER_BSYENDIE /*!< Busy end interrupt */ | ||||||
|  | #define ICACHE_IT_ERROR                ICACHE_IER_ERRIE    /*!< Cache error interrupt */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_Flags Flags | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define ICACHE_FLAG_BUSY               ICACHE_SR_BUSYF     /*!< Busy flag */ | ||||||
|  | #define ICACHE_FLAG_BUSYEND            ICACHE_SR_BSYENDF   /*!< Busy end flag */ | ||||||
|  | #define ICACHE_FLAG_ERROR              ICACHE_SR_ERRF      /*!< Cache error flag */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported macros ----------------------------------------------------------*/ | ||||||
|  | /** @defgroup ICACHE_Exported_Macros ICACHE Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_Flags_Interrupts_Management Flags and Interrupts Management | ||||||
|  |   * @brief macros to manage the specified ICACHE flags and interrupts. | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @brief  Enable ICACHE interrupts. | ||||||
|  |   * @param  __INTERRUPT__ specifies the ICACHE interrupt sources to be enabled. | ||||||
|  |   *         This parameter can be any combination of the following values: | ||||||
|  |   *            @arg @ref ICACHE_IT_BUSYEND  Busy end interrupt | ||||||
|  |   *            @arg @ref ICACHE_IT_ERROR  Cache error interrupt | ||||||
|  |   */ | ||||||
|  | #define __HAL_ICACHE_ENABLE_IT(__INTERRUPT__) SET_BIT(ICACHE->IER, (__INTERRUPT__)) | ||||||
|  |  | ||||||
|  | /** @brief  Disable ICACHE interrupts. | ||||||
|  |   * @param  __INTERRUPT__ specifies the ICACHE interrupt sources to be disabled. | ||||||
|  |   *         This parameter can be any combination of the following values: | ||||||
|  |   *            @arg @ref ICACHE_IT_BUSYEND  Busy end interrupt | ||||||
|  |   *            @arg @ref ICACHE_IT_ERROR  Cache error interrupt | ||||||
|  |   */ | ||||||
|  | #define __HAL_ICACHE_DISABLE_IT(__INTERRUPT__) CLEAR_BIT(ICACHE->IER, (__INTERRUPT__)) | ||||||
|  |  | ||||||
|  | /** @brief  Check whether the specified ICACHE interrupt source is enabled or not. | ||||||
|  |   * @param  __INTERRUPT__ specifies the ICACHE interrupt source to check. | ||||||
|  |   *         This parameter can be any combination of the following values: | ||||||
|  |   *            @arg @ref ICACHE_IT_BUSYEND  Busy end interrupt | ||||||
|  |   *            @arg @ref ICACHE_IT_ERROR  Cache error interrupt | ||||||
|  |   * @retval The state of __INTERRUPT__ (0 or 1). | ||||||
|  |   */ | ||||||
|  | #define __HAL_ICACHE_GET_IT_SOURCE(__INTERRUPT__)  \ | ||||||
|  |   ((READ_BIT(ICACHE->IER, (__INTERRUPT__)) == (__INTERRUPT__)) ? 1U : 0U) | ||||||
|  |  | ||||||
|  | /** @brief  Check whether the selected ICACHE flag is set or not. | ||||||
|  |   * @param  __FLAG__ specifies the flag to check. | ||||||
|  |   *         This parameter can be one of the following values: | ||||||
|  |   *            @arg @ref ICACHE_FLAG_BUSY  Busy flag | ||||||
|  |   *            @arg @ref ICACHE_FLAG_BUSYEND  Busy end flag | ||||||
|  |   *            @arg @ref ICACHE_FLAG_ERROR  Cache error flag | ||||||
|  |   * @retval The state of __FLAG__ (0 or 1). | ||||||
|  |   */ | ||||||
|  | #define __HAL_ICACHE_GET_FLAG(__FLAG__) ((READ_BIT(ICACHE->SR, (__FLAG__)) != 0U) ? 1U : 0U) | ||||||
|  |  | ||||||
|  | /** @brief  Clear the selected ICACHE flags. | ||||||
|  |   * @param  __FLAG__ specifies the ICACHE flags to clear. | ||||||
|  |   *         This parameter can be any combination of the following values: | ||||||
|  |   *            @arg @ref ICACHE_FLAG_BUSYEND  Busy end flag | ||||||
|  |   *            @arg @ref ICACHE_FLAG_ERROR  Cache error flag | ||||||
|  |   */ | ||||||
|  | #define __HAL_ICACHE_CLEAR_FLAG(__FLAG__) WRITE_REG(ICACHE->FCR, (__FLAG__)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported functions -------------------------------------------------------*/ | ||||||
|  | /** @addtogroup ICACHE_Exported_Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup ICACHE_Exported_Functions_Group1 | ||||||
|  |   * @brief    Initialization and control functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* Peripheral Control functions **********************************************/ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Enable(void); | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Disable(void); | ||||||
|  | uint32_t HAL_ICACHE_IsEnabled(void); | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_ConfigAssociativityMode(uint32_t AssociativityMode); | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_DeInit(void); | ||||||
|  |  | ||||||
|  | /******* Invalidate in blocking mode (Polling) */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Invalidate(void); | ||||||
|  | /******* Invalidate in non-blocking mode (Interrupt) */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Invalidate_IT(void); | ||||||
|  | /******* Wait for Invalidate complete in blocking mode (Polling) */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_WaitForInvalidateComplete(void); | ||||||
|  |  | ||||||
|  | /******* Performance instruction cache monitoring functions */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Monitor_Start(uint32_t MonitorType); | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Monitor_Stop(uint32_t MonitorType); | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Monitor_Reset(uint32_t MonitorType); | ||||||
|  | uint32_t HAL_ICACHE_Monitor_GetHitValue(void); | ||||||
|  | uint32_t HAL_ICACHE_Monitor_GetMissValue(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup ICACHE_Exported_Functions_Group2 | ||||||
|  |   * @brief    IRQ and callback functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /******* IRQHandler and Callbacks used in non-blocking mode (Interrupt) */ | ||||||
|  | void HAL_ICACHE_IRQHandler(void); | ||||||
|  | void HAL_ICACHE_InvalidateCompleteCallback(void); | ||||||
|  | void HAL_ICACHE_ErrorCallback(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(ICACHE_CRRx_REN) | ||||||
|  | /** @addtogroup ICACHE_Exported_Functions_Group3 | ||||||
|  |   * @brief    Memory remapped regions functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /******* Memory remapped regions functions */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_EnableRemapRegion(uint32_t Region, const ICACHE_RegionConfigTypeDef *const pRegionConfig); | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_DisableRemapRegion(uint32_t Region); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /*  ICACHE_CRRx_REN */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /* ICACHE */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* STM32H5xx_HAL_ICACHE_H */ | ||||||
							
								
								
									
										695
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_pwr.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										695
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_pwr.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,695 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_pwr.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   Header file of PWR HAL module. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef STM32H5xx_HAL_PWR_H | ||||||
|  | #define STM32H5xx_HAL_PWR_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal_def.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup PWR | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported types ------------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup PWR_Exported_Types PWR Exported Types | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  PWR PVD configuration structure definition | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t PVDLevel; /*!< Specifies the PVD detection level. | ||||||
|  |                           This parameter can be a value of | ||||||
|  |                           @ref PWR_PVD_Detection_Level.                       */ | ||||||
|  |  | ||||||
|  |   uint32_t 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_PVD_Detection_Level Programmable Voltage Detection Level | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_PVDLEVEL_0 0x00000000UL                      /*!< PVD threshold around 1.95 V      */ | ||||||
|  | #define PWR_PVDLEVEL_1 (PWR_VMCR_PLS_0)                  /*!< PVD threshold around 2.1  V      */ | ||||||
|  | #define PWR_PVDLEVEL_2 (PWR_VMCR_PLS_1)                  /*!< PVD threshold around 2.25 V      */ | ||||||
|  | #define PWR_PVDLEVEL_3 (PWR_VMCR_PLS_0 | PWR_VMCR_PLS_1) /*!< PVD threshold around 2.4  V      */ | ||||||
|  | #define PWR_PVDLEVEL_4 (PWR_VMCR_PLS_2)                  /*!< PVD threshold around 2.55 V      */ | ||||||
|  | #define PWR_PVDLEVEL_5 (PWR_VMCR_PLS_0 | PWR_VMCR_PLS_2) /*!< PVD threshold around 2.7  V      */ | ||||||
|  | #define PWR_PVDLEVEL_6 (PWR_VMCR_PLS_1 | PWR_VMCR_PLS_2) /*!< PVD threshold around 2.85 V      */ | ||||||
|  | #define PWR_PVDLEVEL_7 (PWR_VMCR_PLS)                    /*!< External input analog voltage | ||||||
|  |                                                               (compared internally to VREFINT) */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWR_PVD_Mode PWR PVD Mode | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_PVD_MODE_NORMAL               (0x00U) /*!< Basic Mode is used                                            */ | ||||||
|  | #define PWR_PVD_MODE_IT_RISING            (0x05U) /*!< External Interrupt Mode with Rising edge trigger detection    */ | ||||||
|  | #define PWR_PVD_MODE_IT_FALLING           (0x06U) /*!< External Interrupt Mode with Falling | ||||||
|  |                                                        edge trigger detection                                        */ | ||||||
|  | #define PWR_PVD_MODE_IT_RISING_FALLING    (0x07U) /*!< External Interrupt Mode with Rising/Falling | ||||||
|  |                                                        edge trigger detection                                        */ | ||||||
|  | #define PWR_PVD_MODE_EVENT_RISING         (0x09U) /*!< Event Mode with Rising edge trigger detection                 */ | ||||||
|  | #define PWR_PVD_MODE_EVENT_FALLING        (0x0AU) /*!< Event Mode with Falling edge trigger detection                */ | ||||||
|  | #define PWR_PVD_MODE_EVENT_RISING_FALLING (0x0BU) /*!< Event Mode with Rising/Falling edge trigger detection         */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWR_Regulator_In_LowPower_Mode PWR Regulator State in SLEEP/STOP Mode | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_MAINREGULATOR_ON     (0x00U)  /*!< Main Regulator ON in Run Mode       */ | ||||||
|  | #define PWR_LOWPOWERREGULATOR_ON (0x00U)  /*!< Main Regulator ON in Low Power Mode */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWR_SLEEP_Mode_Entry PWR SLEEP Mode Entry | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_SLEEPENTRY_WFI (0x01U) /*!< Wait For Interruption instruction to enter Sleep mode */ | ||||||
|  | #define PWR_SLEEPENTRY_WFE (0x02U) /*!< Wait For Event instruction to enter Sleep mode        */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWR_STOP_Mode_Entry PWR STOP Mode Entry | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_STOPENTRY_WFI (0x01U) /*!< Wait For Interruption instruction to enter Stop mode */ | ||||||
|  | #define PWR_STOPENTRY_WFE (0x02U) /*!< Wait For Event instruction to enter Stop mode        */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWR_Flags PWR Flags | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_FLAG_STOPF      (0x01U) /*!< STOP flag                                                */ | ||||||
|  | #define PWR_FLAG_SBF        (0x02U) /*!< STANDBY flag                                             */ | ||||||
|  | #define PWR_FLAG_VOSRDY     (0x03U) /*!< Voltage scaling ready flag                               */ | ||||||
|  | #define PWR_FLAG_ACTVOSRDY  (0x04U) /*!< Currently applied VOS ready flag                         */ | ||||||
|  | #define PWR_FLAG_BRR        (0x05U) /*!< Backup regulator ready flag                              */ | ||||||
|  | #define PWR_FLAG_VBATL      (0x06U) /*!< Backup domain voltage level flag (versus low threshold)  */ | ||||||
|  | #define PWR_FLAG_VBATH      (0x07U) /*!< Backup domain voltage level flag (versus high threshold) */ | ||||||
|  | #define PWR_FLAG_TEMPL      (0x08U) /*!< Temperature level flag (versus low threshold)            */ | ||||||
|  | #define PWR_FLAG_TEMPH      (0x09U) /*!< Temperature level flag (versus high threshold)           */ | ||||||
|  | #define PWR_FLAG_AVDO       (0x0AU) /*!< VDDA voltage detector output flag                        */ | ||||||
|  | #define PWR_FLAG_VDDIO2RDY  (0x0BU) /*!< VDDIO2 voltage detector output flag                      */ | ||||||
|  | #define PWR_FLAG_PVDO       (0x0CU) /*!< VDD voltage detector output flag                         */ | ||||||
|  | #define PWR_FLAG_USB33RDY   (0x0DU) /*!< VDDUSB33 ready flag                                      */ | ||||||
|  |  | ||||||
|  | #define PWR_WAKEUP_FLAG1    (0x10U) /*!< Wake up line 1 flag                                      */ | ||||||
|  | #define PWR_WAKEUP_FLAG2    (0x20U) /*!< Wake up line 2 flag                                      */ | ||||||
|  | #define PWR_WAKEUP_FLAG3    (0x30U) /*!< Wake up line 3 flag                                      */ | ||||||
|  | #define PWR_WAKEUP_FLAG4    (0x40U) /*!< Wake up line 4 flag                                      */ | ||||||
|  | #define PWR_WAKEUP_FLAG5    (0x50U) /*!< Wake up line 5 flag                                      */ | ||||||
|  | #define PWR_WAKEUP_FLAG6    (0x60U) /*!< Wake up line 6 flag                                      */ | ||||||
|  | #define PWR_WAKEUP_FLAG7    (0x70U) /*!< Wake up line 7 flag                                      */ | ||||||
|  | #define PWR_WAKEUP_FLAG8    (0x80U) /*!< Wake up line 8 flag                                      */ | ||||||
|  | #define PWR_WAKEUP_ALL_FLAG (0x90U) /*!< Wakeup flag all                                          */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_WakeUp_Pins PWREx Wake-Up Pins | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* High level and No pull (default configuration) */ | ||||||
|  | #define PWR_WAKEUP_PIN1      PWR_WUCR_WUPEN1 | ||||||
|  | #define PWR_WAKEUP_PIN2      PWR_WUCR_WUPEN2 | ||||||
|  | #define PWR_WAKEUP_PIN3      PWR_WUCR_WUPEN3 | ||||||
|  | #define PWR_WAKEUP_PIN4      PWR_WUCR_WUPEN4 | ||||||
|  | #define PWR_WAKEUP_PIN5      PWR_WUCR_WUPEN5 | ||||||
|  | #if defined (PWR_WUCR_WUPEN6) | ||||||
|  | #define PWR_WAKEUP_PIN6      PWR_WUCR_WUPEN6 | ||||||
|  | #define PWR_WAKEUP_PIN7      PWR_WUCR_WUPEN7 | ||||||
|  | #define PWR_WAKEUP_PIN8      PWR_WUCR_WUPEN8 | ||||||
|  | #endif /* PWR_WUCR_WUPEN6 */ | ||||||
|  |  | ||||||
|  | /* High level and No pull */ | ||||||
|  | #define PWR_WAKEUP_PIN1_HIGH PWR_WUCR_WUPEN1 | ||||||
|  | #define PWR_WAKEUP_PIN2_HIGH PWR_WUCR_WUPEN2 | ||||||
|  | #define PWR_WAKEUP_PIN3_HIGH PWR_WUCR_WUPEN3 | ||||||
|  | #define PWR_WAKEUP_PIN4_HIGH PWR_WUCR_WUPEN4 | ||||||
|  | #define PWR_WAKEUP_PIN5_HIGH PWR_WUCR_WUPEN5 | ||||||
|  | #if defined (PWR_WUCR_WUPEN6) | ||||||
|  | #define PWR_WAKEUP_PIN6_HIGH PWR_WUCR_WUPEN6 | ||||||
|  | #define PWR_WAKEUP_PIN7_HIGH PWR_WUCR_WUPEN7 | ||||||
|  | #define PWR_WAKEUP_PIN8_HIGH PWR_WUCR_WUPEN8 | ||||||
|  | #endif /* PWR_WUCR_WUPEN6 */ | ||||||
|  |  | ||||||
|  | /* Low level and No pull */ | ||||||
|  | #define PWR_WAKEUP_PIN1_LOW (PWR_WUCR_WUPP1 | PWR_WUCR_WUPEN1) | ||||||
|  | #define PWR_WAKEUP_PIN2_LOW (PWR_WUCR_WUPP2 | PWR_WUCR_WUPEN2) | ||||||
|  | #define PWR_WAKEUP_PIN3_LOW (PWR_WUCR_WUPP3 | PWR_WUCR_WUPEN3) | ||||||
|  | #define PWR_WAKEUP_PIN4_LOW (PWR_WUCR_WUPP4 | PWR_WUCR_WUPEN4) | ||||||
|  | #define PWR_WAKEUP_PIN5_LOW (PWR_WUCR_WUPP5 | PWR_WUCR_WUPEN5) | ||||||
|  | #if defined (PWR_WUCR_WUPEN6) | ||||||
|  | #define PWR_WAKEUP_PIN6_LOW (PWR_WUCR_WUPP6 | PWR_WUCR_WUPEN6) | ||||||
|  | #define PWR_WAKEUP_PIN7_LOW (PWR_WUCR_WUPP7 | PWR_WUCR_WUPEN7) | ||||||
|  | #define PWR_WAKEUP_PIN8_LOW (PWR_WUCR_WUPP8 | PWR_WUCR_WUPEN8) | ||||||
|  | #endif /* PWR_WUCR_WUPEN6 */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWR_Items PWR Items | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #if defined(PWR_SECCFGR_WUP1SEC) | ||||||
|  | #define PWR_WKUP1 (PWR_SECCFGR_WUP1SEC) /*!< WUP1 secure protection                             */ | ||||||
|  | #define PWR_WKUP2 (PWR_SECCFGR_WUP2SEC) /*!< WUP2 secure protection                             */ | ||||||
|  | #define PWR_WKUP3 (PWR_SECCFGR_WUP3SEC) /*!< WUP3 secure protection                             */ | ||||||
|  | #define PWR_WKUP4 (PWR_SECCFGR_WUP4SEC) /*!< WUP4 secure protection                             */ | ||||||
|  | #define PWR_WKUP5 (PWR_SECCFGR_WUP5SEC) /*!< WUP5 secure protection                             */ | ||||||
|  | #define PWR_WKUP6 (PWR_SECCFGR_WUP6SEC) /*!< WUP6 secure protection                             */ | ||||||
|  | #define PWR_WKUP7 (PWR_SECCFGR_WUP7SEC) /*!< WUP7 secure protection                             */ | ||||||
|  | #define PWR_WKUP8 (PWR_SECCFGR_WUP8SEC) /*!< WUP8 secure protection                             */ | ||||||
|  | #define PWR_RET   (PWR_SECCFGR_RETSEC)  /*!< IO Retention secure protection                     */ | ||||||
|  | #define PWR_LPM   (PWR_SECCFGR_LPMSEC)  /*!< Low power modes secure protection                  */ | ||||||
|  | #define PWR_SCM   (PWR_SECCFGR_SCMSEC)  /*!< Voltage detection and monitoring secure protection */ | ||||||
|  | #define PWR_VB    (PWR_SECCFGR_VBSEC)   /*!< Backup domain secure protection                    */ | ||||||
|  | #define PWR_VUSB  (PWR_SECCFGR_VUSBSEC) /*!< Voltage USB secure protection                      */ | ||||||
|  | #define PWR_ALL   (PWR_WKUP1 | PWR_WKUP2 | PWR_WKUP3 | PWR_WKUP4    | \ | ||||||
|  |                    PWR_WKUP5 | PWR_WKUP6 | PWR_WKUP7 | PWR_WKUP8    | \ | ||||||
|  |                    PWR_LPM   | PWR_SCM   | PWR_VB    | PWR_VUSB     | \ | ||||||
|  |                    PWR_RET) | ||||||
|  | #else | ||||||
|  | #define PWR_ALL    0xFF                 /*!< Dummy Value                                        */ | ||||||
|  | #endif /* PWR_SECCFGR_WUP1SEC */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWR_Attributes PWR Attributes | ||||||
|  |   * @brief PWR Privilege/NPrivilege and Secure/NSecure Attributes | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #if defined(PWR_PRIVCFGR_NSPRIV) | ||||||
|  | #define PWR_NSEC_PRIV  (PWR_ITEM_ATTR_NSEC_PRIV_MASK | 0x01U) /*!< NSecure and Privileged attribute  */ | ||||||
|  | #define PWR_NSEC_NPRIV (PWR_ITEM_ATTR_NSEC_PRIV_MASK)         /*!< NSecure and NPrivileged attribute */ | ||||||
|  | #else | ||||||
|  | #define PWR_PRIV       (PWR_ITEM_ATTR_NSEC_PRIV_MASK | 0x01U) /*!<  Privileged attribute             */ | ||||||
|  | #define PWR_NPRIV      (PWR_ITEM_ATTR_NSEC_PRIV_MASK)         /*!<  NPrivileged attribute            */ | ||||||
|  | #endif /* PWR_PRIVCFGR_NSPRIV */ | ||||||
|  | #define PWR_SEC_PRIV   (PWR_ITEM_ATTR_SEC_PRIV_MASK  | 0x02U) /*!< Secure and Privileged attribute   */ | ||||||
|  | #define PWR_SEC_NPRIV  (PWR_ITEM_ATTR_SEC_PRIV_MASK)          /*!< Secure and NPrivileged attribute  */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported macros -----------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup PWR_Exported_Macros PWR Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @brief  Check PWR flags are set or not. | ||||||
|  |   * @param  __FLAG__ : Specifies the flag to check. | ||||||
|  |   *                    This parameter can be one of the following values : | ||||||
|  |   *                    @arg @ref PWR_FLAG_STOPF     : Stop flag. | ||||||
|  |   *                                                   Indicates that the device was resumed from Stop mode. | ||||||
|  |   *                    @arg @ref PWR_FLAG_SBF       : Standby flag. | ||||||
|  |   *                                                   Indicates that the device was resumed from Standby mode. | ||||||
|  |   *                    @arg @ref PWR_FLAG_VOSRDY    : Voltage scaling ready flag. | ||||||
|  |   *                                                   Indicates that the Vcore level at or above VOS selected level. | ||||||
|  |   *                    @arg @ref PWR_FLAG_ACTVOSRDY : Currently applied VOS ready flag. | ||||||
|  |   *                                                   Indicates that Vcore is equal to the current | ||||||
|  |   *                                                   voltage scaling provided by ACTVOS. | ||||||
|  |   *                    @arg @ref 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-on reset. | ||||||
|  |   *                    @arg @ref PWR_FLAG_VBATL     : Backup domain voltage level flag (versus low threshold). | ||||||
|  |   *                                                   Indicates the backup domain voltage | ||||||
|  |   *                                                   level is equal or above low threshold. | ||||||
|  |   *                    @arg @ref PWR_FLAG_VBATH     : Backup domain voltage level flag (versus high threshold). | ||||||
|  |   *                                                   Indicates the backup domain voltage | ||||||
|  |   *                                                   level is equal or above high threshold. | ||||||
|  |   *                    @arg @ref PWR_FLAG_TEMPL     : Temperature level flag (versus low threshold). | ||||||
|  |   *                                                   Indicates the temperature is equal or above low threshold. | ||||||
|  |   *                    @arg @ref PWR_FLAG_TEMPH     : Temperature level flag (versus high threshold). | ||||||
|  |   *                                                   Indicates the temperature is equal or above high threshold. | ||||||
|  |   *                    @arg @ref PWR_FLAG_AVDO      : Regulator selection flag. | ||||||
|  |   *                                                   Indicates the regulator selected. | ||||||
|  |   *                    @arg @ref PWR_FLAG_VDDIO2RDY : VDDIO2 ready flag (versus 0.9 V threshold). | ||||||
|  |   *                                                   Indicates that VDDIO2 is equal or above the threshold | ||||||
|  |   *                                                   of the VDDIO2 voltage monitor (around 0.9 V). | ||||||
|  |   *                    @arg @ref PWR_FLAG_PVDO      : Voltage detector output flag. | ||||||
|  |   *                                                   Indicates that Vdd is equal or above | ||||||
|  |   *                                                   the PVD threshold selected by PVDLS. | ||||||
|  |   *                    @arg @ref PWR_FLAG_USB33RDY  : VDDUSB ready flag (versus 1.2 V threshold). | ||||||
|  |   *                                                   Indicates that VDDUSB is equal or above the threshold | ||||||
|  |   *                                                   of the VDDUSB voltage monitor (around 1.2 V). | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG1   : Wakeup flag 1. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 1. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG2   : Wakeup flag 2. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 2. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG3   : Wakeup flag 3. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 3. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG4   : Wakeup flag 4. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 4. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG5   : Wakeup flag 5. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 5. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG6   : Wakeup flag 6. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 6. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG7   : Wakeup flag 7. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 7. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG8   : Wakeup flag 8. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 8. | ||||||
|  |   * @note   The PWR_WAKEUP_FLAG6, PWR_WAKEUP_FLAG7 AND PWR_WAKEUP_FLAG8 are not available for STM32H503xx devices. | ||||||
|  |   * @retval The state of __FLAG__ (TRUE or FALSE). | ||||||
|  |   */ | ||||||
|  | #if defined (PWR_WUSR_WUF6) | ||||||
|  | #define __HAL_PWR_GET_FLAG(__FLAG__)                                                                           \ | ||||||
|  |   (((__FLAG__) == PWR_FLAG_STOPF)     ? (READ_BIT(PWR->PMSR, PWR_PMSR_STOPF)           == PWR_PMSR_STOPF)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_SBF)       ? (READ_BIT(PWR->PMSR, PWR_PMSR_SBF)             == PWR_PMSR_SBF)        : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_VOSRDY)    ? (READ_BIT(PWR->VOSSR, PWR_VOSSR_VOSRDY)        == PWR_VOSSR_VOSRDY)    : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_ACTVOSRDY) ? (READ_BIT(PWR->VOSSR, PWR_VOSSR_ACTVOSRDY)     == PWR_VOSSR_ACTVOSRDY) : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_BRR)       ? (READ_BIT(PWR->BDSR, PWR_BDSR_BRRDY)           == PWR_BDSR_BRRDY)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_VBATL)     ? (READ_BIT(PWR->BDSR, PWR_BDSR_VBATL)           == PWR_BDSR_VBATL)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_VBATH)     ? (READ_BIT(PWR->BDSR, PWR_BDSR_VBATH)           == PWR_BDSR_VBATH)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_TEMPL)     ? (READ_BIT(PWR->BDSR, PWR_BDSR_TEMPL)           == PWR_BDSR_TEMPL)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_TEMPH)     ? (READ_BIT(PWR->BDSR, PWR_BDSR_TEMPH)           == PWR_BDSR_TEMPH)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_AVDO)      ? (READ_BIT(PWR->VMSR, PWR_VMSR_AVDO)            == PWR_VMSR_AVDO)       : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_VDDIO2RDY) ? (READ_BIT(PWR->VMSR, PWR_VMSR_VDDIO2RDY)       == PWR_VMSR_VDDIO2RDY)  : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_PVDO)      ? (READ_BIT(PWR->VMSR, PWR_VMSR_PVDO)            == PWR_VMSR_PVDO)       : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_USB33RDY)  ? (READ_BIT(PWR->VMSR, PWR_VMSR_USB33RDY)        == PWR_VMSR_USB33RDY)   : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG1)   ? (READ_BIT(PWR->WUSR, PWR_WUSR_WUF1)            == PWR_WUSR_WUF1)       : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG2)   ? (READ_BIT(PWR->WUSR, PWR_WUSR_WUF2)            == PWR_WUSR_WUF2)       : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG3)   ? (READ_BIT(PWR->WUSR, PWR_WUSR_WUF3)            == PWR_WUSR_WUF3)       : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG4)   ? (READ_BIT(PWR->WUSR, PWR_WUSR_WUF4)            == PWR_WUSR_WUF4)       : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG5)   ? (READ_BIT(PWR->WUSR, PWR_WUSR_WUF5)            == PWR_WUSR_WUF5)       : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG6)   ? (READ_BIT(PWR->WUSR, PWR_WUSR_WUF6)            == PWR_WUSR_WUF6)       : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG7)   ? (READ_BIT(PWR->WUSR, PWR_WUSR_WUF7)            == PWR_WUSR_WUF7)       : \ | ||||||
|  |    (READ_BIT(PWR->WUSR, PWR_WUSR_WUF8) == PWR_WUSR_WUF8)) | ||||||
|  | #else | ||||||
|  | #define __HAL_PWR_GET_FLAG(__FLAG__)                                                                           \ | ||||||
|  |   (((__FLAG__) == PWR_FLAG_STOPF)     ? (READ_BIT(PWR->PMSR, PWR_PMSR_STOPF)           == PWR_PMSR_STOPF)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_SBF)       ? (READ_BIT(PWR->PMSR, PWR_PMSR_SBF)             == PWR_PMSR_SBF)        : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_VOSRDY)    ? (READ_BIT(PWR->VOSSR, PWR_VOSSR_VOSRDY)        == PWR_VOSSR_VOSRDY)    : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_ACTVOSRDY) ? (READ_BIT(PWR->VOSSR, PWR_VOSSR_ACTVOSRDY)     == PWR_VOSSR_ACTVOSRDY) : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_BRR)       ? (READ_BIT(PWR->BDSR, PWR_BDSR_BRRDY)           == PWR_BDSR_BRRDY)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_VBATL)     ? (READ_BIT(PWR->BDSR, PWR_BDSR_VBATL)           == PWR_BDSR_VBATL)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_VBATH)     ? (READ_BIT(PWR->BDSR, PWR_BDSR_VBATH)           == PWR_BDSR_VBATH)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_TEMPL)     ? (READ_BIT(PWR->BDSR, PWR_BDSR_TEMPL)           == PWR_BDSR_TEMPL)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_TEMPH)     ? (READ_BIT(PWR->BDSR, PWR_BDSR_TEMPH)           == PWR_BDSR_TEMPH)      : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_AVDO)      ? (READ_BIT(PWR->VMSR, PWR_VMSR_AVDO)            == PWR_VMSR_AVDO)       : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_VDDIO2RDY) ? (READ_BIT(PWR->VMSR, PWR_VMSR_VDDIO2RDY)       == PWR_VMSR_VDDIO2RDY)  : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_PVDO)      ? (READ_BIT(PWR->VMSR, PWR_VMSR_PVDO)            == PWR_VMSR_PVDO)       : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG1)   ? (READ_BIT(PWR->WUSR, PWR_WUSR_WUF1)            == PWR_WUSR_WUF1)       : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG2)   ? (READ_BIT(PWR->WUSR, PWR_WUSR_WUF2)            == PWR_WUSR_WUF2)       : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG3)   ? (READ_BIT(PWR->WUSR, PWR_WUSR_WUF3)            == PWR_WUSR_WUF3)       : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG4)   ? (READ_BIT(PWR->WUSR, PWR_WUSR_WUF4)            == PWR_WUSR_WUF4)       : \ | ||||||
|  |    (READ_BIT(PWR->WUSR, PWR_WUSR_WUF5) == PWR_WUSR_WUF5)) | ||||||
|  | #endif /* PWR_WUSR_WUF6 */ | ||||||
|  |  | ||||||
|  | /** @brief  Clear PWR flags. | ||||||
|  |   * @param  __FLAG__ : Specifies the flag to clear. | ||||||
|  |   *                    This parameter can be one of the following values : | ||||||
|  |   *                    @arg @ref PWR_FLAG_STOPF     : STOP flag. | ||||||
|  |   *                                                   Indicates that the device was resumed from STOP mode. | ||||||
|  |   *                    @arg @ref PWR_FLAG_SBF       : STANDBY flag. | ||||||
|  |   *                                                   Indicates that the device was resumed from STANDBY mode. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG1   : Wakeup flag 1. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 1. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG2   : Wakeup flag 2. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 2. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG3   : Wakeup flag 3. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 3. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG4   : Wakeup flag 4. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 4. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG5   : Wakeup flag 5. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 5. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG6   : Wakeup flag 6. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 6. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG7   : Wakeup flag 7. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 7. | ||||||
|  |   *                    @arg @ref PWR_WAKEUP_FLAG8   : Wakeup flag 8. | ||||||
|  |   *                                                   Indicates that a wakeup event was received from the WKUP line 8. | ||||||
|  |   * @note   The PWR_WAKEUP_FLAG6, PWR_WAKEUP_FLAG7 AND PWR_WAKEUP_FLAG8 are not available for STM32H503xx devices. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #if defined (PWR_WUSCR_CWUF6) | ||||||
|  | #define __HAL_PWR_CLEAR_FLAG(__FLAG__)                                       \ | ||||||
|  |   (((__FLAG__) == PWR_FLAG_STOPF)   ? (SET_BIT(PWR->PMCR, PWR_PMCR_CSSF))    : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_SBF)     ? (SET_BIT(PWR->PMCR, PWR_PMCR_CSSF))    : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG1) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF1)) : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG2) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF2)) : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG3) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF3)) : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG4) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF4)) : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG5) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF5)) : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG6) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF6)) : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG7) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF7)) : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG8) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF8)) : \ | ||||||
|  |    (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF))) | ||||||
|  | #else | ||||||
|  | #define __HAL_PWR_CLEAR_FLAG(__FLAG__)                                       \ | ||||||
|  |   (((__FLAG__) == PWR_FLAG_STOPF)   ? (SET_BIT(PWR->PMCR, PWR_PMCR_CSSF))    : \ | ||||||
|  |    ((__FLAG__) == PWR_FLAG_SBF)     ? (SET_BIT(PWR->PMCR, PWR_PMCR_CSSF))    : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG1) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF1)) : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG2) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF2)) : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG3) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF3)) : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG4) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF4)) : \ | ||||||
|  |    ((__FLAG__) == PWR_WAKEUP_FLAG5) ? (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF5)) : \ | ||||||
|  |    (SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF))) | ||||||
|  | #endif /* PWR_WUSCR_CWUF6 */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable the PVD Extended Interrupt Line. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_PVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, PWR_EXTI_LINE_PVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the PVD Extended Interrupt Line. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_PVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, PWR_EXTI_LINE_PVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable the PVD Event Line. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, PWR_EXTI_LINE_PVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the PVD Event Line. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, 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->RTSR1, 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->RTSR1, 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->FTSR1, 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->FTSR1, PWR_EXTI_LINE_PVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable the PVD Extended Interrupt Rising & Falling 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(0) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the PVD Extended Interrupt Rising & Falling Trigger. | ||||||
|  |   * @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(0) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Generate a Software Interrupt on selected EXTI line. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, PWR_EXTI_LINE_PVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Check whether the specified PVD EXTI Rising interrupt flag is set or not. | ||||||
|  |   * @retval EXTI PVD Line Status. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_PVD_EXTI_GET_RISING_FLAG() \ | ||||||
|  |   ((READ_BIT(EXTI->RPR1, PWR_EXTI_LINE_PVD) == PWR_EXTI_LINE_PVD) ? 1UL : 0UL) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Check whether the specified PVD EXTI Falling interrupt flag is set or not. | ||||||
|  |   * @retval EXTI PVD Line Status. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_PVD_EXTI_GET_FALLING_FLAG()\ | ||||||
|  |   ((READ_BIT(EXTI->FPR1, PWR_EXTI_LINE_PVD) == PWR_EXTI_LINE_PVD) ? 1UL : 0UL) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear the PVD EXTI Interrupt Rising flag. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_PVD_EXTI_CLEAR_RISING_FLAG() WRITE_REG(EXTI->RPR1, PWR_EXTI_LINE_PVD); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear the PVD EXTI Interrupt Falling flag. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_PVD_EXTI_CLEAR_FALLING_FLAG() WRITE_REG(EXTI->FPR1, PWR_EXTI_LINE_PVD); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear the PVD EXTI Interrupt flag. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG()       \ | ||||||
|  |   do                                          \ | ||||||
|  |   {                                           \ | ||||||
|  |     WRITE_REG(EXTI->RPR1, PWR_EXTI_LINE_PVD); \ | ||||||
|  |     WRITE_REG(EXTI->FPR1, PWR_EXTI_LINE_PVD); \ | ||||||
|  |   } while(0) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private constants ---------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup PWR_Private_Constants PWR Private Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* Define PVD extended interrupts and event line */ | ||||||
|  | #define PWR_EXTI_LINE_PVD EXTI_IMR1_IM16 /*!< PVD EXTI Line */ | ||||||
|  |  | ||||||
|  | /* Defines wake up lines shift */ | ||||||
|  | #define  PWR_EWUP_MASK (0x0FFF3F3FU) | ||||||
|  |  | ||||||
|  | /* Defines attribute */ | ||||||
|  | #define PWR_ITEM_ATTR_NSEC_PRIV_MASK (0x10U) /*!< NSecure Privilege / NPrivilege attribute item mask */ | ||||||
|  | #define PWR_ITEM_ATTR_SEC_PRIV_MASK (0x20U)  /*!< Secure Privilege / NPrivilege attribute item mask  */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private macros ------------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup PWR_Private_Macros PWR Private Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #if defined(PWR_WUCR_WUPEN6) | ||||||
|  | /* Check wake up pin parameter */ | ||||||
|  | #define IS_PWR_WAKEUP_PIN(PIN)                                        \ | ||||||
|  |   (((PIN) == PWR_WAKEUP_PIN1)      || ((PIN) == PWR_WAKEUP_PIN2)      ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN3)      || ((PIN) == PWR_WAKEUP_PIN4)      ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN5)      || ((PIN) == PWR_WAKEUP_PIN6)      ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN7)      || ((PIN) == PWR_WAKEUP_PIN8)      ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN1_HIGH) || ((PIN) == PWR_WAKEUP_PIN2_HIGH) ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN3_HIGH) || ((PIN) == PWR_WAKEUP_PIN4_HIGH) ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN5_HIGH) || ((PIN) == PWR_WAKEUP_PIN6_HIGH) ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN7_HIGH) || ((PIN) == PWR_WAKEUP_PIN8_HIGH) ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN1_LOW)  || ((PIN) == PWR_WAKEUP_PIN2_LOW)  ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN3_LOW)  || ((PIN) == PWR_WAKEUP_PIN4_LOW)  ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN5_LOW)  || ((PIN) == PWR_WAKEUP_PIN6_LOW)  ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN7_LOW)  || ((PIN) == PWR_WAKEUP_PIN8_LOW)) | ||||||
|  | #else | ||||||
|  | /* Check wake up pin parameter */ | ||||||
|  | #define IS_PWR_WAKEUP_PIN(PIN)                                        \ | ||||||
|  |   (((PIN) == PWR_WAKEUP_PIN1)      || ((PIN) == PWR_WAKEUP_PIN2)      ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN3)      || ((PIN) == PWR_WAKEUP_PIN4)      ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN5)      || ((PIN) == PWR_WAKEUP_PIN1_HIGH) ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN2_HIGH) || ((PIN) == PWR_WAKEUP_PIN3_HIGH) ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN4_HIGH) || ((PIN) == PWR_WAKEUP_PIN5_HIGH) ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN1_LOW)  || ((PIN) == PWR_WAKEUP_PIN2_LOW)  ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN3_LOW)  || ((PIN) == PWR_WAKEUP_PIN4_LOW)  ||\ | ||||||
|  |    ((PIN) == PWR_WAKEUP_PIN5_LOW)) | ||||||
|  | #endif /* PWR_WUCR_WUPEN6 */ | ||||||
|  |  | ||||||
|  | /* PVD level check macro */ | ||||||
|  | #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)) | ||||||
|  |  | ||||||
|  | /* PVD mode check macro */ | ||||||
|  | #define IS_PWR_PVD_MODE(MODE)                     \ | ||||||
|  |   (((MODE) == PWR_PVD_MODE_NORMAL)                ||\ | ||||||
|  |    ((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)) | ||||||
|  |  | ||||||
|  | /* SLEEP mode entry check macro */ | ||||||
|  | #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE)) | ||||||
|  |  | ||||||
|  | /* STOP mode entry check macro */ | ||||||
|  | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE)) | ||||||
|  |  | ||||||
|  | #if defined (PWR_SECCFGR_WUP1SEC) | ||||||
|  | /* PWR items check macro */ | ||||||
|  | #define IS_PWR_ITEMS_ATTRIBUTES(ITEM) ((((ITEM) & (~PWR_ALL)) == 0U) && ((ITEM) != 0U)) | ||||||
|  | #endif /* PWR_SECCFGR_WUP1SEC */ | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /* PWR attribute check macro (Secure) */ | ||||||
|  | #define IS_PWR_ATTRIBUTES(ATTRIBUTES) \ | ||||||
|  |   ((((~(((ATTRIBUTES) & 0xF0U) >> 4U)) &((ATTRIBUTES) & 0x0FU)) == 0U) && (((ATTRIBUTES) & 0xFFFFFFCCU) == 0U)) | ||||||
|  | #elif defined(PWR_PRIVCFGR_NSPRIV) | ||||||
|  | /* PWR attribute check macro (NSecure) */ | ||||||
|  | #define IS_PWR_ATTRIBUTES(ATTRIBUTES) (((ATTRIBUTES) == PWR_NSEC_NPRIV) || ((ATTRIBUTES) == PWR_NSEC_PRIV)) | ||||||
|  | #else | ||||||
|  | /* PWR attribute check macro (NSecure) */ | ||||||
|  | #define IS_PWR_ATTRIBUTES(ATTRIBUTES) (((ATTRIBUTES) == PWR_NPRIV) || ((ATTRIBUTES) == PWR_PRIV)) | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Include PWR HAL Extended module */ | ||||||
|  | #include "stm32h5xx_hal_pwr_ex.h" | ||||||
|  |  | ||||||
|  | /* Exported functions --------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @addtogroup PWR_Exported_Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup PWR_Exported_Functions_Group1 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* 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 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* Programmable voltage detector functions ************************************/ | ||||||
|  | HAL_StatusTypeDef HAL_PWR_ConfigPVD(const PWR_PVDTypeDef *sConfigPVD); | ||||||
|  | void              HAL_PWR_EnablePVD(void); | ||||||
|  | void              HAL_PWR_DisablePVD(void); | ||||||
|  |  | ||||||
|  | /* Wake up pins configuration functions ***************************************/ | ||||||
|  | void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinPolarity); | ||||||
|  | void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx); | ||||||
|  |  | ||||||
|  | /* Low power modes configuration functions ************************************/ | ||||||
|  | void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry); | ||||||
|  | void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry); | ||||||
|  | void HAL_PWR_EnterSTANDBYMode(void); | ||||||
|  |  | ||||||
|  | /* Sleep on exit and sev on pending configuration functions *******************/ | ||||||
|  | void HAL_PWR_EnableSleepOnExit(void); | ||||||
|  | void HAL_PWR_DisableSleepOnExit(void); | ||||||
|  | void HAL_PWR_EnableSEVOnPend(void); | ||||||
|  | void HAL_PWR_DisableSEVOnPend(void); | ||||||
|  |  | ||||||
|  | /* Interrupt handler functions ************************************************/ | ||||||
|  | void HAL_PWR_PVD_IRQHandler(void); | ||||||
|  | void HAL_PWR_PVDCallback(void); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup PWR_Exported_Functions_Group3 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* Privileges and security configuration functions ****************************/ | ||||||
|  | void              HAL_PWR_ConfigAttributes(uint32_t Item, uint32_t Attributes); | ||||||
|  | HAL_StatusTypeDef HAL_PWR_GetConfigAttributes(uint32_t Item, uint32_t *pAttributes); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
|  | #endif /* STM32H5xx_HAL_PWR_H */ | ||||||
							
								
								
									
										562
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_pwr_ex.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										562
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_pwr_ex.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,562 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_pwr_ex.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   Header file of PWR HAL Extended module. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef STM32H5xx_HAL_PWR_EX_H | ||||||
|  | #define STM32H5xx_HAL_PWR_EX_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal_def.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup PWREx | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported types ------------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_Exported_Types PWR Extended Exported Types | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  PWREx AVD configuration structure definition | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t AVDLevel; /*!< AVDLevel: Specifies the AVD detection level. This | ||||||
|  |                                      parameter can be a value of @ref | ||||||
|  |                                      PWREx_AVD_detection_level | ||||||
|  |                      */ | ||||||
|  |  | ||||||
|  |   uint32_t Mode;     /*!< Mode: Specifies the EXTI operating mode for the AVD | ||||||
|  |                                  event. This parameter can be a value of @ref | ||||||
|  |                                  PWREx_AVD_Mode. | ||||||
|  |                      */ | ||||||
|  | } PWREx_AVDTypeDef; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  PWREx Wakeup pin configuration structure definition | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t WakeUpPin;   /*!< WakeUpPin: Specifies the Wake-Up pin to be enabled. | ||||||
|  |                                         This parameter can be a value of @ref | ||||||
|  |                                         PWREx_WakeUp_Pins | ||||||
|  |                         */ | ||||||
|  |  | ||||||
|  |   uint32_t PinPolarity; /*!< PinPolarity: Specifies the Wake-Up pin polarity. | ||||||
|  |                                           This parameter can be a value of @ref | ||||||
|  |                                           PWREx_PIN_Polarity | ||||||
|  |                         */ | ||||||
|  |  | ||||||
|  |   uint32_t PinPull;     /*!< PinPull: Specifies the Wake-Up pin pull. This | ||||||
|  |                                       parameter can be a value of @ref | ||||||
|  |                                       PWREx_PIN_Pull | ||||||
|  |                         */ | ||||||
|  | } PWREx_WakeupPinTypeDef; | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported constants --------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_Exported_Constants PWR Extended Exported Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_Supply_configuration PWREx Supply configuration | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_EXTERNAL_SOURCE_SUPPLY PWR_SCCR_BYPASS  /*!< The SMPS disabled and the LDO Bypass. The Core domains | ||||||
|  |                                                      are supplied from an external source                     */ | ||||||
|  |  | ||||||
|  | #if defined (SMPS) | ||||||
|  | #define PWR_SUPPLY_CONFIG_MASK (PWR_SCCR_SMPSEN | PWR_SCCR_LDOEN | PWR_SCCR_BYPASS) | ||||||
|  | #else | ||||||
|  | #define PWR_SUPPLY_CONFIG_MASK (PWR_SCCR_LDOEN | PWR_SCCR_BYPASS) | ||||||
|  | #endif /* defined (SMPS) */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_PIN_Polarity PWREx Pin Polarity configuration | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_PIN_POLARITY_HIGH (0x00000000U) | ||||||
|  | #define PWR_PIN_POLARITY_LOW  (0x00000001U) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_PIN_Pull PWREx Pin Pull configuration | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_PIN_NO_PULL   (0x00000000U) | ||||||
|  | #define PWR_PIN_PULL_UP   (0x00000001U) | ||||||
|  | #define PWR_PIN_PULL_DOWN (0x00000002U) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_AVD_detection_level PWREx AVD detection level | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_AVDLEVEL_0 (0x00000000U)  /*!< Analog voltage detector level 0 selection : 1V7     */ | ||||||
|  | #define PWR_AVDLEVEL_1 PWR_VMCR_ALS_0 /*!< Analog voltage detector level 1 selection : 2V1     */ | ||||||
|  | #define PWR_AVDLEVEL_2 PWR_VMCR_ALS_1 /*!< Analog voltage detector level 2 selection : 2V5     */ | ||||||
|  | #define PWR_AVDLEVEL_3 PWR_VMCR_ALS   /*!< Analog voltage detector level 3 selection : 2V8     */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_AVD_Mode PWREx AVD Mode | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_AVD_MODE_NORMAL               (0x00000000U)/*!< Basic mode is used                                        */ | ||||||
|  | #define PWR_AVD_MODE_IT_RISING            (0x00010001U)/*!< External Interrupt Mode with Rising edge trigger detection*/ | ||||||
|  | #define PWR_AVD_MODE_IT_FALLING           (0x00010002U)/*!< External Interrupt Mode with | ||||||
|  |                                                             Falling edge trigger detection                            */ | ||||||
|  | #define PWR_AVD_MODE_IT_RISING_FALLING    (0x00010003U)/*!< External Interrupt Mode with | ||||||
|  |                                                             Rising/Falling edge trigger detection                     */ | ||||||
|  | #define PWR_AVD_MODE_EVENT_RISING         (0x00020001U)/*!< Event Mode with Rising edge trigger detection             */ | ||||||
|  | #define PWR_AVD_MODE_EVENT_FALLING        (0x00020002U)/*!< Event Mode with Falling edge trigger detection            */ | ||||||
|  | #define PWR_AVD_MODE_EVENT_RISING_FALLING (0x00020003U)/*!< Event Mode with Rising/Falling edge trigger detection     */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_Regulator_Voltage_Scale PWREx Regulator Voltage Scale | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_REGULATOR_VOLTAGE_SCALE0 PWR_VOSCR_VOS   /*!< Voltage scaling range 0 */ | ||||||
|  | #define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_VOSCR_VOS_1 /*!< Voltage scaling range 1 */ | ||||||
|  | #define PWR_REGULATOR_VOLTAGE_SCALE2 PWR_VOSCR_VOS_0 /*!< Voltage scaling range 2 */ | ||||||
|  | #define PWR_REGULATOR_VOLTAGE_SCALE3 (0U)            /*!< Voltage scaling range 3 */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_System_Stop_Mode_Voltage_Scale PWREx System Stop Mode Voltage Scale | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_REGULATOR_SVOS_SCALE5 (PWR_PMCR_SVOS_0) | ||||||
|  | #define PWR_REGULATOR_SVOS_SCALE4 (PWR_PMCR_SVOS_1) | ||||||
|  | #define PWR_REGULATOR_SVOS_SCALE3 (PWR_PMCR_SVOS_0 | PWR_PMCR_SVOS_1) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_VBAT_Battery_Charging_Selection PWR Extended Battery Charging Resistor Selection | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_BATTERY_CHARGING_RESISTOR_5   (0U)          /*!< VBAT charging through a 5 kOhms resistor   */ | ||||||
|  | #define PWR_BATTERY_CHARGING_RESISTOR_1_5 PWR_BDCR_VBRS /*!< VBAT charging through a 1.5 kOhms resistor */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_Memory_Shut_Off Memory shut-off block selection | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_RAM1_MEMORY_BLOCK          PWR_PMCR_SRAM1SO       /*!< RAM1 shut-off control in Stop mode                   */ | ||||||
|  | #if defined (PWR_PMCR_SRAM2_16SO) | ||||||
|  | #define PWR_RAM2_16_MEMORY_BLOCK       PWR_PMCR_SRAM2_16SO    /*!< RAM2 16k byte shut-off control in Stop mode          */ | ||||||
|  | #define PWR_RAM2_48_MEMORY_BLOCK       PWR_PMCR_SRAM2_48SO    /*!< RAM2 48k byte shut-off control in Stop mode          */ | ||||||
|  | #elif defined (PWR_PMCR_SRAM2_16LSO) | ||||||
|  | #define PWR_RAM2_LOW_16_MEMORY_BLOCK   PWR_PMCR_SRAM2_16LSO   /*!< RAM2 low 16k byte shut-off control in Stop mode      */ | ||||||
|  | #define PWR_RAM2_HIGH_16_MEMORY_BLOCK  PWR_PMCR_SRAM2_16HSO   /*!< RAM2 High 16k byte shut-off control in Stop mode     */ | ||||||
|  | #define PWR_RAM2_48_MEMORY_BLOCK       PWR_PMCR_SRAM2_48SO    /*!< RAM2 48k byte shut-off control in Stop mode          */ | ||||||
|  | #else | ||||||
|  | #define PWR_RAM2_MEMORY_BLOCK          PWR_PMCR_SRAM2SO       /*!< RAM2 shut-off control in Stop mode                   */ | ||||||
|  | #endif /* PWR_PMCR_SRAM2_16SO */ | ||||||
|  | #if defined (PWR_PMCR_SRAM3SO) | ||||||
|  | #define PWR_RAM3_MEMORY_BLOCK          PWR_PMCR_SRAM3SO       /*!< RAM3 shut-off control in Stop mode                   */ | ||||||
|  | #endif /* PWR_PMCR_SRAM3SO */ | ||||||
|  | #if defined (PWR_PMCR_ETHERNETSO) | ||||||
|  | #define PWR_ETHERNET_MEMORY_BLOCK      PWR_PMCR_ETHERNETSO    /*!< Ethernet shut-off control in Stop mode               */ | ||||||
|  | #endif /* PWR_PMCR_ETHERNETSO */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_AVD_EXTI_Line PWREx AVD EXTI Line 16 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define PWR_EXTI_LINE_AVD EXTI_IMR1_IM16 /*!< External interrupt line 16 | ||||||
|  |                                               Connected to the AVD EXTI Line */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported macros -----------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_Exported_Macros PWR Extended Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Enable the AVD EXTI Line 16. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_AVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, PWR_EXTI_LINE_AVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Disable the AVD EXTI Line 16 | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_AVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, PWR_EXTI_LINE_AVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Enable event on AVD EXTI Line 16. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_AVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, PWR_EXTI_LINE_AVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Disable event on AVD EXTI Line 16. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_AVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, PWR_EXTI_LINE_AVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Enable the AVD Extended Interrupt Rising Trigger. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_AVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR1, PWR_EXTI_LINE_AVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Disable the AVD Extended Interrupt Rising Trigger. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_AVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR1, PWR_EXTI_LINE_AVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Enable the AVD Extended Interrupt Falling Trigger. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_AVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR1, PWR_EXTI_LINE_AVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Disable the AVD Extended Interrupt Falling Trigger. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_AVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR1, PWR_EXTI_LINE_AVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Enable the AVD Extended Interrupt Rising and Falling Trigger. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_AVD_EXTI_ENABLE_RISING_FALLING_EDGE()  \ | ||||||
|  |   do {                                                   \ | ||||||
|  |     __HAL_PWR_AVD_EXTI_ENABLE_RISING_EDGE();             \ | ||||||
|  |     __HAL_PWR_AVD_EXTI_ENABLE_FALLING_EDGE();            \ | ||||||
|  |   } while(0); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Disable the AVD Extended Interrupt Rising & Falling Trigger. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_AVD_EXTI_DISABLE_RISING_FALLING_EDGE() \ | ||||||
|  |   do {                                                   \ | ||||||
|  |     __HAL_PWR_AVD_EXTI_DISABLE_RISING_EDGE();            \ | ||||||
|  |     __HAL_PWR_AVD_EXTI_DISABLE_FALLING_EDGE();           \ | ||||||
|  |   } while(0); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Check whether the specified AVD EXTI Rising interrupt flag is set or not. | ||||||
|  |   * @retval EXTI AVD Line Status. | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #define __HAL_PWR_PVD_AVD_EXTI_GET_RISING_FLAG() ((READ_BIT(EXTI->RPR1, PWR_EXTI_LINE_AVD)\ | ||||||
|  |                                                    == PWR_EXTI_LINE_AVD) ? 1UL : 0UL) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Check whether the specified AVD EXTI Falling interrupt flag is set or not. | ||||||
|  |   * @retval EXTI AVD Line Status. | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #define __HAL_PWR_PVD_AVD_EXTI_GET_FALLING_FLAG() ((READ_BIT(EXTI->FPR1, PWR_EXTI_LINE_AVD)\ | ||||||
|  |                                                     == PWR_EXTI_LINE_AVD) ? 1UL : 0UL) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear the AVD EXTI flag. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_PVD_AVD_EXTI_CLEAR_FLAG()   \ | ||||||
|  |   do                                          \ | ||||||
|  |   {                                           \ | ||||||
|  |     WRITE_REG(EXTI->RPR1, PWR_EXTI_LINE_AVD); \ | ||||||
|  |     WRITE_REG(EXTI->FPR1, PWR_EXTI_LINE_AVD); \ | ||||||
|  |   } while(0) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Generates a Software interrupt on AVD EXTI line. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_AVD_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, PWR_EXTI_LINE_AVD) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Configure the main internal regulator output voltage. | ||||||
|  |   * @note  This macro is similar to HAL_PWREx_ControlVoltageScaling() API but | ||||||
|  |   *        doesn't check whether or not VOSREADY flag is set. User may resort | ||||||
|  |   *        to __HAL_PWR_GET_FLAG() macro to check VOSF bit state. | ||||||
|  |   * @param  __REGULATOR__ : Specifies the regulator output voltage to achieve a | ||||||
|  |   *                         tradeoff between performance and power consumption. | ||||||
|  |   *                         This parameter can be one of the following values : | ||||||
|  |   *                         @arg @ref PWR_REGULATOR_VOLTAGE_SCALE0 : Regulator voltage output scale 0. | ||||||
|  |   *                                                                  Provides a typical output voltage at 1.2 V. | ||||||
|  |   *                                                                  Used when system clock frequency is up to 160 MHz. | ||||||
|  |   *                         @arg @ref PWR_REGULATOR_VOLTAGE_SCALE1 : Regulator voltage output scale 1. | ||||||
|  |   *                                                                  Provides a typical output voltage at 1.1 V. | ||||||
|  |   *                                                                  Used when system clock frequency is up to 100 MHz. | ||||||
|  |   *                         @arg @ref PWR_REGULATOR_VOLTAGE_SCALE2 : Regulator voltage output scale 2. | ||||||
|  |   *                                                                  Provides a typical output voltage at 1.0 V. | ||||||
|  |   *                                                                  Used when system clock frequency is up to 50 MHz. | ||||||
|  |   *                         @arg @ref PWR_REGULATOR_VOLTAGE_SCALE3 : Regulator voltage output scale 3. | ||||||
|  |   *                                                                  Provides a typical output voltage at 0.9 V. | ||||||
|  |   *                                                                  Used when system clock frequency is up to 24 MHz. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__)      \ | ||||||
|  |   do                                                        \ | ||||||
|  |   {                                                         \ | ||||||
|  |     __IO uint32_t tmpreg;                                   \ | ||||||
|  |     MODIFY_REG(PWR->VOSCR, PWR_VOSCR_VOS, (__REGULATOR__)); \ | ||||||
|  |     /* Delay after an RCC peripheral clock enabling */      \ | ||||||
|  |     tmpreg = READ_BIT(PWR->VOSCR, PWR_VOSCR_VOS);           \ | ||||||
|  |     UNUSED(tmpreg);                                         \ | ||||||
|  |   } while(0) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private constants ---------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_Private_Constants PWR Extended Private Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_AVD_Mode_Mask PWR Extended AVD Mode Mask | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define AVD_MODE_IT             (0x00010000U) | ||||||
|  | #define AVD_MODE_EVT            (0x00020000U) | ||||||
|  | #define AVD_RISING_EDGE         (0x00000001U) | ||||||
|  | #define AVD_FALLING_EDGE        (0x00000002U) | ||||||
|  | #define AVD_RISING_FALLING_EDGE (0x00000003U) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private macros --------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup PWREx_Private_Macros PWR Extended Private Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /* Check PWR regulator configuration parameter */ | ||||||
|  | #define IS_PWR_SUPPLY(PWR_SOURCE) ((PWR_SOURCE) == PWR_EXTERNAL_SOURCE_SUPPLY) | ||||||
|  |  | ||||||
|  | /* Check wake up pin polarity parameter */ | ||||||
|  | #define IS_PWR_WAKEUP_PIN_POLARITY(POLARITY) (((POLARITY) == PWR_PIN_POLARITY_HIGH) ||\ | ||||||
|  |                                               ((POLARITY) == PWR_PIN_POLARITY_LOW)) | ||||||
|  |  | ||||||
|  | /* Check wake up pin pull configuration parameter */ | ||||||
|  | #define IS_PWR_WAKEUP_PIN_PULL(PULL) (((PULL) == PWR_PIN_NO_PULL) ||\ | ||||||
|  |                                       ((PULL) == PWR_PIN_PULL_UP) ||\ | ||||||
|  |                                       ((PULL) == PWR_PIN_PULL_DOWN)) | ||||||
|  |  | ||||||
|  | /* Check wake up flag parameter */ | ||||||
|  | #define IS_PWR_WAKEUP_FLAG(FLAG) (((FLAG) == PWR_WAKEUP_FLAG1) ||\ | ||||||
|  |                                   ((FLAG) == PWR_WAKEUP_FLAG2) ||\ | ||||||
|  |                                   ((FLAG) == PWR_WAKEUP_FLAG3) ||\ | ||||||
|  |                                   ((FLAG) == PWR_WAKEUP_FLAG4) ||\ | ||||||
|  |                                   ((FLAG) == PWR_WAKEUP_FLAG5) ||\ | ||||||
|  |                                   ((FLAG) == PWR_WAKEUP_FLAG6) ||\ | ||||||
|  |                                   ((FLAG) == PWR_WAKEUP_FLAG_ALL)) | ||||||
|  |  | ||||||
|  | /* Voltage scaling range check macro */ | ||||||
|  | #define IS_PWR_VOLTAGE_SCALING_RANGE(RANGE) (((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE0) ||\ | ||||||
|  |                                              ((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE1) ||\ | ||||||
|  |                                              ((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE2) ||\ | ||||||
|  |                                              ((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE3)) | ||||||
|  |  | ||||||
|  | /* Check PWR regulator configuration in STOP mode parameter */ | ||||||
|  | #define IS_PWR_STOP_MODE_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_SVOS_SCALE3)  ||\ | ||||||
|  |                                                      ((VOLTAGE) == PWR_REGULATOR_SVOS_SCALE4)  ||\ | ||||||
|  |                                                      ((VOLTAGE) == PWR_REGULATOR_SVOS_SCALE5)) | ||||||
|  |  | ||||||
|  | /* Battery charging resistor selection check macro */ | ||||||
|  | #define IS_PWR_BATTERY_RESISTOR_SELECT(RESISTOR) (((RESISTOR) == PWR_BATTERY_CHARGING_RESISTOR_5) ||\ | ||||||
|  |                                                   ((RESISTOR) == PWR_BATTERY_CHARGING_RESISTOR_1_5)) | ||||||
|  |  | ||||||
|  | /* Check memory block parameter */ | ||||||
|  | #if defined (PWR_PMCR_SRAM2_16SO) | ||||||
|  | #define IS_PWR_MEMORY_BLOCK(BLOCK) (((BLOCK) == PWR_ETHERNET_MEMORY_BLOCK) || \ | ||||||
|  |                                     ((BLOCK) == PWR_RAM3_MEMORY_BLOCK)     || \ | ||||||
|  |                                     ((BLOCK) == PWR_RAM2_16_MEMORY_BLOCK)  || \ | ||||||
|  |                                     ((BLOCK) == PWR_RAM2_48_MEMORY_BLOCK)  || \ | ||||||
|  |                                     ((BLOCK) == PWR_RAM1_MEMORY_BLOCK)) | ||||||
|  | #elif defined (PWR_PMCR_SRAM2_16LSO) | ||||||
|  | #define IS_PWR_MEMORY_BLOCK(BLOCK) (((BLOCK) == PWR_RAM3_MEMORY_BLOCK)          || \ | ||||||
|  |                                     ((BLOCK) == PWR_RAM2_LOW_16_MEMORY_BLOCK)   || \ | ||||||
|  |                                     ((BLOCK) == PWR_RAM2_HIGH_16_MEMORY_BLOCK)  || \ | ||||||
|  |                                     ((BLOCK) == PWR_RAM2_48_MEMORY_BLOCK)       || \ | ||||||
|  |                                     ((BLOCK) == PWR_RAM1_MEMORY_BLOCK)) | ||||||
|  | #else | ||||||
|  | #define IS_PWR_MEMORY_BLOCK(BLOCK) (((BLOCK) == PWR_RAM2_MEMORY_BLOCK)  || \ | ||||||
|  |                                     ((BLOCK) == PWR_RAM1_MEMORY_BLOCK)) | ||||||
|  | #endif /* PWR_PMCR_SRAM2_16SO */ | ||||||
|  |  | ||||||
|  | /* Check wake up flag parameter */ | ||||||
|  | #define IS_PWR_AVD_LEVEL(LEVEL) (((LEVEL) == PWR_AVDLEVEL_0) ||\ | ||||||
|  |                                  ((LEVEL) == PWR_AVDLEVEL_1) ||\ | ||||||
|  |                                  ((LEVEL) == PWR_AVDLEVEL_2) ||\ | ||||||
|  |                                  ((LEVEL) == PWR_AVDLEVEL_3)) | ||||||
|  |  | ||||||
|  | /* Check AVD mode parameter */ | ||||||
|  | #define IS_PWR_AVD_MODE(MODE) (((MODE) == PWR_AVD_MODE_IT_RISING)         ||\ | ||||||
|  |                                ((MODE) == PWR_AVD_MODE_IT_FALLING)        ||\ | ||||||
|  |                                ((MODE) == PWR_AVD_MODE_IT_RISING_FALLING) ||\ | ||||||
|  |                                ((MODE) == PWR_AVD_MODE_EVENT_RISING)      ||\ | ||||||
|  |                                ((MODE) == PWR_AVD_MODE_EVENT_FALLING)     ||\ | ||||||
|  |                                ((MODE) == PWR_AVD_MODE_NORMAL)            ||\ | ||||||
|  |                                ((MODE) == PWR_AVD_MODE_EVENT_RISING_FALLING)) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup PWREx_Exported_Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup PWREx_Exported_Functions_Group1 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_PWREx_ConfigSupply(uint32_t SupplySource); | ||||||
|  | uint32_t          HAL_PWREx_GetSupplyConfig(void); | ||||||
|  | HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling); | ||||||
|  | uint32_t          HAL_PWREx_GetVoltageRange(void); | ||||||
|  | HAL_StatusTypeDef HAL_PWREx_ControlStopModeVoltageScaling(uint32_t VoltageScaling); | ||||||
|  | uint32_t          HAL_PWREx_GetStopModeVoltageRange(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup PWREx_Exported_Functions_Group2 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | void HAL_PWREx_ConfigAVD(const PWREx_AVDTypeDef *sConfigAVD); | ||||||
|  | void HAL_PWREx_EnableAVD(void); | ||||||
|  | void HAL_PWREx_DisableAVD(void); | ||||||
|  | #if defined (PWR_USBSCR_USB33DEN) | ||||||
|  | void HAL_PWREx_EnableUSBVoltageDetector(void); | ||||||
|  | void HAL_PWREx_DisableUSBVoltageDetector(void); | ||||||
|  | void HAL_PWREx_EnableVddUSB(void); | ||||||
|  | void HAL_PWREx_DisableVddUSB(void); | ||||||
|  | #endif /* PWR_USBSCR_USB33DEN */ | ||||||
|  | void HAL_PWREx_EnableMonitoring(void); | ||||||
|  | void HAL_PWREx_DisableMonitoring(void); | ||||||
|  | void HAL_PWREx_EnableUCPDStandbyMode(void); | ||||||
|  | void HAL_PWREx_DisableUCPDStandbyMode(void); | ||||||
|  | void HAL_PWREx_EnableUCPDDeadBattery(void); | ||||||
|  | void HAL_PWREx_DisableUCPDDeadBattery(void); | ||||||
|  | void HAL_PWREx_EnableBatteryCharging(uint32_t ResistorValue); | ||||||
|  | void HAL_PWREx_DisableBatteryCharging(void); | ||||||
|  | void HAL_PWREx_EnableAnalogBooster(void); | ||||||
|  | void HAL_PWREx_DisableAnalogBooster(void); | ||||||
|  | void HAL_PWREx_PVD_AVD_IRQHandler(void); | ||||||
|  | void HAL_PWREx_PVD_AVD_Rising_Callback(void); | ||||||
|  | void HAL_PWREx_PVD_AVD_Falling_Callback(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup PWREx_Exported_Functions_Group3 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | void HAL_PWREx_EnableWakeUpPin(const PWREx_WakeupPinTypeDef *sPinParams); | ||||||
|  | void HAL_PWREx_DisableWakeUpPin(uint32_t WakeUpPinx); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup PWREx_Exported_Functions_Group4 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | void HAL_PWREx_EnableFlashPowerDown(void); | ||||||
|  | void HAL_PWREx_DisableFlashPowerDown(void); | ||||||
|  | void HAL_PWREx_EnableMemoryShutOff(uint32_t MemoryBlock); | ||||||
|  | void HAL_PWREx_DisableMemoryShutOff(uint32_t MemoryBlock); | ||||||
|  | HAL_StatusTypeDef HAL_PWREx_EnableBkupRAMRetention(void); | ||||||
|  | void HAL_PWREx_DisableBkupRAMRetention(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup PWREx_Exported_Functions_Group5 | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | void HAL_PWREx_EnableStandbyIORetention(void); | ||||||
|  | void HAL_PWREx_DisableStandbyIORetention(void); | ||||||
|  | void HAL_PWREx_EnableStandbyJTAGIORetention(void); | ||||||
|  | void HAL_PWREx_DisableStandbyJTAGIORetention(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif /* STM32H5xx_HAL_PWR_EX_H */ | ||||||
							
								
								
									
										5174
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_rcc.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5174
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_rcc.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										3849
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_rcc_ex.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3849
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_rcc_ex.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2537
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_tim.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2537
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_tim.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1386
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_tim_ex.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1386
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_tim_ex.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2813
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_bus.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2813
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_bus.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1388
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_cortex.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1388
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_cortex.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										797
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_crs.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										797
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_crs.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,797 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_ll_crs.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   Header file of CRS LL module. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef STM32H5xx_LL_CRS_H | ||||||
|  | #define STM32H5xx_LL_CRS_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_LL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(CRS) | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL CRS | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private types -------------------------------------------------------------*/ | ||||||
|  | /* Private variables ---------------------------------------------------------*/ | ||||||
|  | /* Private constants ---------------------------------------------------------*/ | ||||||
|  | /** @defgroup CRS_LL_Private_Constants CRS Private Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Defines used for the bit position in the register and perform offsets*/ | ||||||
|  | #define CRS_POSITION_TRIM        (CRS_CR_TRIM_Pos)     /* bit position in CR reg */ | ||||||
|  | #define CRS_POSITION_FECAP       (CRS_ISR_FECAP_Pos)   /* bit position in ISR reg */ | ||||||
|  | #define CRS_POSITION_FELIM       (CRS_CFGR_FELIM_Pos)  /* bit position in CFGR reg */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private macros ------------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /* Exported types ------------------------------------------------------------*/ | ||||||
|  | /* Exported constants --------------------------------------------------------*/ | ||||||
|  | /** @defgroup CRS_LL_Exported_Constants CRS Exported Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EC_GET_FLAG Get Flags Defines | ||||||
|  |   * @brief    Flags defines which can be used with LL_CRS_ReadReg function | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_CRS_ISR_SYNCOKF                 CRS_ISR_SYNCOKF | ||||||
|  | #define LL_CRS_ISR_SYNCWARNF               CRS_ISR_SYNCWARNF | ||||||
|  | #define LL_CRS_ISR_ERRF                    CRS_ISR_ERRF | ||||||
|  | #define LL_CRS_ISR_ESYNCF                  CRS_ISR_ESYNCF | ||||||
|  | #define LL_CRS_ISR_SYNCERR                 CRS_ISR_SYNCERR | ||||||
|  | #define LL_CRS_ISR_SYNCMISS                CRS_ISR_SYNCMISS | ||||||
|  | #define LL_CRS_ISR_TRIMOVF                 CRS_ISR_TRIMOVF | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EC_IT IT Defines | ||||||
|  |   * @brief    IT defines which can be used with LL_CRS_ReadReg and  LL_CRS_WriteReg functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_CRS_CR_SYNCOKIE                 CRS_CR_SYNCOKIE | ||||||
|  | #define LL_CRS_CR_SYNCWARNIE               CRS_CR_SYNCWARNIE | ||||||
|  | #define LL_CRS_CR_ERRIE                    CRS_CR_ERRIE | ||||||
|  | #define LL_CRS_CR_ESYNCIE                  CRS_CR_ESYNCIE | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EC_SYNC_DIV Synchronization Signal Divider | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_CRS_SYNC_DIV_1                  0x00000000U                               /*!< Synchro Signal not divided (default) */ | ||||||
|  | #define LL_CRS_SYNC_DIV_2                  CRS_CFGR_SYNCDIV_0                        /*!< Synchro Signal divided by 2 */ | ||||||
|  | #define LL_CRS_SYNC_DIV_4                  CRS_CFGR_SYNCDIV_1                        /*!< Synchro Signal divided by 4 */ | ||||||
|  | #define LL_CRS_SYNC_DIV_8                  (CRS_CFGR_SYNCDIV_1 | CRS_CFGR_SYNCDIV_0) /*!< Synchro Signal divided by 8 */ | ||||||
|  | #define LL_CRS_SYNC_DIV_16                 CRS_CFGR_SYNCDIV_2                        /*!< Synchro Signal divided by 16 */ | ||||||
|  | #define LL_CRS_SYNC_DIV_32                 (CRS_CFGR_SYNCDIV_2 | CRS_CFGR_SYNCDIV_0) /*!< Synchro Signal divided by 32 */ | ||||||
|  | #define LL_CRS_SYNC_DIV_64                 (CRS_CFGR_SYNCDIV_2 | CRS_CFGR_SYNCDIV_1) /*!< Synchro Signal divided by 64 */ | ||||||
|  | #define LL_CRS_SYNC_DIV_128                CRS_CFGR_SYNCDIV                          /*!< Synchro Signal divided by 128 */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EC_SYNC_SOURCE Synchronization Signal Source | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_CRS_SYNC_SOURCE_GPIO            0x00000000U                                   /*!< Synchro Signal source GPIO */ | ||||||
|  | #define LL_CRS_SYNC_SOURCE_LSE             CRS_CFGR_SYNCSRC_0                            /*!< Synchro Signal source LSE */ | ||||||
|  | #define LL_CRS_SYNC_SOURCE_USB             CRS_CFGR_SYNCSRC_1                            /*!< Synchro Signal source USB SOF (default)*/ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EC_SYNC_POLARITY Synchronization Signal Polarity | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_CRS_SYNC_POLARITY_RISING        0x00000000U           /*!< Synchro Active on rising edge (default) */ | ||||||
|  | #define LL_CRS_SYNC_POLARITY_FALLING       CRS_CFGR_SYNCPOL      /*!< Synchro Active on falling edge */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EC_FREQERRORDIR Frequency Error Direction | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_CRS_FREQ_ERROR_DIR_UP           0x00000000U         /*!< Upcounting direction, the actual frequency is above the target */ | ||||||
|  | #define LL_CRS_FREQ_ERROR_DIR_DOWN         CRS_ISR_FEDIR       /*!< Downcounting direction, the actual frequency is below the target */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EC_DEFAULTVALUES Default Values | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /** | ||||||
|  |   * @brief Reset value of the RELOAD field | ||||||
|  |   * @note The reset value of the RELOAD field corresponds to a target frequency of 48 MHz | ||||||
|  |   *       and a synchronization signal frequency of 1 kHz (SOF signal from USB) | ||||||
|  |   */ | ||||||
|  | #define LL_CRS_RELOADVALUE_DEFAULT         0x0000BB7FU | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Reset value of Frequency error limit. | ||||||
|  |   */ | ||||||
|  | #define LL_CRS_ERRORLIMIT_DEFAULT          0x00000022U | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Reset value of the HSI48 Calibration field | ||||||
|  |   * @note The default value is 32, which corresponds to the middle of the trimming interval. | ||||||
|  |   *       The trimming step is specified in the product datasheet. | ||||||
|  |   *       A higher TRIM value corresponds to a higher output frequency. | ||||||
|  |   */ | ||||||
|  | #define LL_CRS_HSI48CALIBRATION_DEFAULT    0x00000020U | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported macro ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup CRS_LL_Exported_Macros CRS Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EM_WRITE_READ Common Write and read registers Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Write a value in CRS register | ||||||
|  |   * @param  __INSTANCE__ CRS Instance | ||||||
|  |   * @param  __REG__ Register to be written | ||||||
|  |   * @param  __VALUE__ Value to be written in the register | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | #define LL_CRS_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Read a value in CRS register | ||||||
|  |   * @param  __INSTANCE__ CRS Instance | ||||||
|  |   * @param  __REG__ Register to be read | ||||||
|  |   * @retval Register value | ||||||
|  |   */ | ||||||
|  | #define LL_CRS_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EM_Exported_Macros_Calculate_Reload Exported_Macros_Calculate_Reload | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Macro to calculate reload value to be set in CRS register according to target and sync frequencies | ||||||
|  |   * @note   The RELOAD value should be selected according to the ratio between | ||||||
|  |   *         the target frequency and the frequency of the synchronization source after | ||||||
|  |   *         prescaling. It is then decreased by one in order to reach the expected | ||||||
|  |   *         synchronization on the zero value. The formula is the following: | ||||||
|  |   *              RELOAD = (fTARGET / fSYNC) -1 | ||||||
|  |   * @param  __FTARGET__ Target frequency (value in Hz) | ||||||
|  |   * @param  __FSYNC__ Synchronization signal frequency (value in Hz) | ||||||
|  |   * @retval Reload value (in Hz) | ||||||
|  |   */ | ||||||
|  | #define __LL_CRS_CALC_CALCULATE_RELOADVALUE(__FTARGET__, __FSYNC__) (((__FTARGET__) / (__FSYNC__)) - 1U) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported functions --------------------------------------------------------*/ | ||||||
|  | /** @defgroup CRS_LL_Exported_Functions CRS Exported Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EF_Configuration Configuration | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable Frequency error counter | ||||||
|  |   * @note When this bit is set, the CRS_CFGR register is write-protected and cannot be modified | ||||||
|  |   * @rmtoll CR           CEN           LL_CRS_EnableFreqErrorCounter | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_EnableFreqErrorCounter(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(CRS->CR, CRS_CR_CEN); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable Frequency error counter | ||||||
|  |   * @rmtoll CR           CEN           LL_CRS_DisableFreqErrorCounter | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_DisableFreqErrorCounter(void) | ||||||
|  | { | ||||||
|  |   CLEAR_BIT(CRS->CR, CRS_CR_CEN); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if Frequency error counter is enabled or not | ||||||
|  |   * @rmtoll CR           CEN           LL_CRS_IsEnabledFreqErrorCounter | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsEnabledFreqErrorCounter(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->CR, CRS_CR_CEN) == (CRS_CR_CEN)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable Automatic trimming counter | ||||||
|  |   * @rmtoll CR           AUTOTRIMEN    LL_CRS_EnableAutoTrimming | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_EnableAutoTrimming(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(CRS->CR, CRS_CR_AUTOTRIMEN); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable Automatic trimming counter | ||||||
|  |   * @rmtoll CR           AUTOTRIMEN    LL_CRS_DisableAutoTrimming | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_DisableAutoTrimming(void) | ||||||
|  | { | ||||||
|  |   CLEAR_BIT(CRS->CR, CRS_CR_AUTOTRIMEN); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if Automatic trimming is enabled or not | ||||||
|  |   * @rmtoll CR           AUTOTRIMEN    LL_CRS_IsEnabledAutoTrimming | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsEnabledAutoTrimming(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->CR, CRS_CR_AUTOTRIMEN) == (CRS_CR_AUTOTRIMEN)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Set HSI48 oscillator smooth trimming | ||||||
|  |   * @note   When the AUTOTRIMEN bit is set, this field is controlled by hardware and is read-only | ||||||
|  |   * @rmtoll CR           TRIM          LL_CRS_SetHSI48SmoothTrimming | ||||||
|  |   * @param  Value a number between Min_Data = 0 and Max_Data = 63 | ||||||
|  |   * @note   Default value can be set thanks to @ref LL_CRS_HSI48CALIBRATION_DEFAULT | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_SetHSI48SmoothTrimming(uint32_t Value) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(CRS->CR, CRS_CR_TRIM, Value << CRS_POSITION_TRIM); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get HSI48 oscillator smooth trimming | ||||||
|  |   * @rmtoll CR           TRIM          LL_CRS_GetHSI48SmoothTrimming | ||||||
|  |   * @retval a number between Min_Data = 0 and Max_Data = 63 | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_GetHSI48SmoothTrimming(void) | ||||||
|  | { | ||||||
|  |   return (uint32_t)(READ_BIT(CRS->CR, CRS_CR_TRIM) >> CRS_POSITION_TRIM); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Set counter reload value | ||||||
|  |   * @rmtoll CFGR         RELOAD        LL_CRS_SetReloadCounter | ||||||
|  |   * @param  Value a number between Min_Data = 0 and Max_Data = 0xFFFF | ||||||
|  |   * @note   Default value can be set thanks to @ref LL_CRS_RELOADVALUE_DEFAULT | ||||||
|  |   *         Otherwise it can be calculated in using macro @ref __LL_CRS_CALC_CALCULATE_RELOADVALUE (_FTARGET_, _FSYNC_) | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_SetReloadCounter(uint32_t Value) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(CRS->CFGR, CRS_CFGR_RELOAD, Value); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get counter reload value | ||||||
|  |   * @rmtoll CFGR         RELOAD        LL_CRS_GetReloadCounter | ||||||
|  |   * @retval a number between Min_Data = 0 and Max_Data = 0xFFFF | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_GetReloadCounter(void) | ||||||
|  | { | ||||||
|  |   return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_RELOAD)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Set frequency error limit | ||||||
|  |   * @rmtoll CFGR         FELIM         LL_CRS_SetFreqErrorLimit | ||||||
|  |   * @param  Value a number between Min_Data = 0 and Max_Data = 255 | ||||||
|  |   * @note   Default value can be set thanks to @ref LL_CRS_ERRORLIMIT_DEFAULT | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_SetFreqErrorLimit(uint32_t Value) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(CRS->CFGR, CRS_CFGR_FELIM, Value << CRS_POSITION_FELIM); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get frequency error limit | ||||||
|  |   * @rmtoll CFGR         FELIM         LL_CRS_GetFreqErrorLimit | ||||||
|  |   * @retval A number between Min_Data = 0 and Max_Data = 255 | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_GetFreqErrorLimit(void) | ||||||
|  | { | ||||||
|  |   return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_FELIM) >> CRS_POSITION_FELIM); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Set division factor for SYNC signal | ||||||
|  |   * @rmtoll CFGR         SYNCDIV       LL_CRS_SetSyncDivider | ||||||
|  |   * @param  Divider This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_1 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_2 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_4 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_8 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_16 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_32 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_64 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_128 | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_SetSyncDivider(uint32_t Divider) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(CRS->CFGR, CRS_CFGR_SYNCDIV, Divider); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get division factor for SYNC signal | ||||||
|  |   * @rmtoll CFGR         SYNCDIV       LL_CRS_GetSyncDivider | ||||||
|  |   * @retval Returned value can be one of the following values: | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_1 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_2 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_4 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_8 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_16 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_32 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_64 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_128 | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_GetSyncDivider(void) | ||||||
|  | { | ||||||
|  |   return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_SYNCDIV)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Set SYNC signal source | ||||||
|  |   * @rmtoll CFGR         SYNCSRC       LL_CRS_SetSyncSignalSource | ||||||
|  |   * @param  Source This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_SOURCE_GPIO | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_SOURCE_LSE | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_SOURCE_USB | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_SetSyncSignalSource(uint32_t Source) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(CRS->CFGR, CRS_CFGR_SYNCSRC, Source); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get SYNC signal source | ||||||
|  |   * @rmtoll CFGR         SYNCSRC       LL_CRS_GetSyncSignalSource | ||||||
|  |   * @retval Returned value can be one of the following values: | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_SOURCE_GPIO | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_SOURCE_LSE | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_SOURCE_USB | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_GetSyncSignalSource(void) | ||||||
|  | { | ||||||
|  |   return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_SYNCSRC)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Set input polarity for the SYNC signal source | ||||||
|  |   * @rmtoll CFGR         SYNCPOL       LL_CRS_SetSyncPolarity | ||||||
|  |   * @param  Polarity This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_POLARITY_RISING | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_POLARITY_FALLING | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_SetSyncPolarity(uint32_t Polarity) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(CRS->CFGR, CRS_CFGR_SYNCPOL, Polarity); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get input polarity for the SYNC signal source | ||||||
|  |   * @rmtoll CFGR         SYNCPOL       LL_CRS_GetSyncPolarity | ||||||
|  |   * @retval Returned value can be one of the following values: | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_POLARITY_RISING | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_POLARITY_FALLING | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_GetSyncPolarity(void) | ||||||
|  | { | ||||||
|  |   return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_SYNCPOL)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Configure CRS for the synchronization | ||||||
|  |   * @rmtoll CR           TRIM          LL_CRS_ConfigSynchronization\n | ||||||
|  |   *         CFGR         RELOAD        LL_CRS_ConfigSynchronization\n | ||||||
|  |   *         CFGR         FELIM         LL_CRS_ConfigSynchronization\n | ||||||
|  |   *         CFGR         SYNCDIV       LL_CRS_ConfigSynchronization\n | ||||||
|  |   *         CFGR         SYNCSRC       LL_CRS_ConfigSynchronization\n | ||||||
|  |   *         CFGR         SYNCPOL       LL_CRS_ConfigSynchronization | ||||||
|  |   * @param  HSI48CalibrationValue a number between Min_Data = 0 and Max_Data = 63 | ||||||
|  |   * @param  ErrorLimitValue a number between Min_Data = 0 and Max_Data = 0xFFFF | ||||||
|  |   * @param  ReloadValue a number between Min_Data = 0 and Max_Data = 255 | ||||||
|  |   * @param  Settings This parameter can be a combination of the following values: | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_DIV_1 or @ref LL_CRS_SYNC_DIV_2 or @ref LL_CRS_SYNC_DIV_4 or @ref LL_CRS_SYNC_DIV_8 | ||||||
|  |   *              or @ref LL_CRS_SYNC_DIV_16 or @ref LL_CRS_SYNC_DIV_32 or @ref LL_CRS_SYNC_DIV_64 | ||||||
|  |   *              or @ref LL_CRS_SYNC_DIV_128 | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_SOURCE_GPIO or @ref LL_CRS_SYNC_SOURCE_LSE or @ref LL_CRS_SYNC_SOURCE_USB | ||||||
|  |   *         @arg @ref LL_CRS_SYNC_POLARITY_RISING or @ref LL_CRS_SYNC_POLARITY_FALLING | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_ConfigSynchronization(uint32_t HSI48CalibrationValue, uint32_t ErrorLimitValue, | ||||||
|  |                                                   uint32_t ReloadValue, uint32_t Settings) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(CRS->CR, CRS_CR_TRIM, HSI48CalibrationValue); | ||||||
|  |   MODIFY_REG(CRS->CFGR, | ||||||
|  |              CRS_CFGR_RELOAD | CRS_CFGR_FELIM | CRS_CFGR_SYNCDIV | CRS_CFGR_SYNCSRC | CRS_CFGR_SYNCPOL, | ||||||
|  |              ReloadValue | (ErrorLimitValue << CRS_POSITION_FELIM) | Settings); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EF_CRS_Management CRS_Management | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Generate software SYNC event | ||||||
|  |   * @rmtoll CR           SWSYNC        LL_CRS_GenerateEvent_SWSYNC | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_GenerateEvent_SWSYNC(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(CRS->CR, CRS_CR_SWSYNC); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the frequency error direction latched in the time of the last | ||||||
|  |   * SYNC event | ||||||
|  |   * @rmtoll ISR          FEDIR         LL_CRS_GetFreqErrorDirection | ||||||
|  |   * @retval Returned value can be one of the following values: | ||||||
|  |   *         @arg @ref LL_CRS_FREQ_ERROR_DIR_UP | ||||||
|  |   *         @arg @ref LL_CRS_FREQ_ERROR_DIR_DOWN | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_GetFreqErrorDirection(void) | ||||||
|  | { | ||||||
|  |   return (uint32_t)(READ_BIT(CRS->ISR, CRS_ISR_FEDIR)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the frequency error counter value latched in the time of the last SYNC event | ||||||
|  |   * @rmtoll ISR          FECAP         LL_CRS_GetFreqErrorCapture | ||||||
|  |   * @retval A number between Min_Data = 0x0000 and Max_Data = 0xFFFF | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_GetFreqErrorCapture(void) | ||||||
|  | { | ||||||
|  |   return (uint32_t)(READ_BIT(CRS->ISR, CRS_ISR_FECAP) >> CRS_POSITION_FECAP); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EF_FLAG_Management FLAG_Management | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if SYNC event OK signal occurred or not | ||||||
|  |   * @rmtoll ISR          SYNCOKF       LL_CRS_IsActiveFlag_SYNCOK | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_SYNCOK(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->ISR, CRS_ISR_SYNCOKF) == (CRS_ISR_SYNCOKF)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if SYNC warning signal occurred or not | ||||||
|  |   * @rmtoll ISR          SYNCWARNF     LL_CRS_IsActiveFlag_SYNCWARN | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_SYNCWARN(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->ISR, CRS_ISR_SYNCWARNF) == (CRS_ISR_SYNCWARNF)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if Synchronization or trimming error signal occurred or not | ||||||
|  |   * @rmtoll ISR          ERRF          LL_CRS_IsActiveFlag_ERR | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_ERR(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->ISR, CRS_ISR_ERRF) == (CRS_ISR_ERRF)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if Expected SYNC signal occurred or not | ||||||
|  |   * @rmtoll ISR          ESYNCF        LL_CRS_IsActiveFlag_ESYNC | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_ESYNC(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->ISR, CRS_ISR_ESYNCF) == (CRS_ISR_ESYNCF)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if SYNC error signal occurred or not | ||||||
|  |   * @rmtoll ISR          SYNCERR       LL_CRS_IsActiveFlag_SYNCERR | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_SYNCERR(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->ISR, CRS_ISR_SYNCERR) == (CRS_ISR_SYNCERR)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if SYNC missed error signal occurred or not | ||||||
|  |   * @rmtoll ISR          SYNCMISS      LL_CRS_IsActiveFlag_SYNCMISS | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_SYNCMISS(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->ISR, CRS_ISR_SYNCMISS) == (CRS_ISR_SYNCMISS)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if Trimming overflow or underflow occurred or not | ||||||
|  |   * @rmtoll ISR          TRIMOVF       LL_CRS_IsActiveFlag_TRIMOVF | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsActiveFlag_TRIMOVF(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->ISR, CRS_ISR_TRIMOVF) == (CRS_ISR_TRIMOVF)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear the SYNC event OK flag | ||||||
|  |   * @rmtoll ICR          SYNCOKC       LL_CRS_ClearFlag_SYNCOK | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_ClearFlag_SYNCOK(void) | ||||||
|  | { | ||||||
|  |   WRITE_REG(CRS->ICR, CRS_ICR_SYNCOKC); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear the  SYNC warning flag | ||||||
|  |   * @rmtoll ICR          SYNCWARNC     LL_CRS_ClearFlag_SYNCWARN | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_ClearFlag_SYNCWARN(void) | ||||||
|  | { | ||||||
|  |   WRITE_REG(CRS->ICR, CRS_ICR_SYNCWARNC); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear TRIMOVF, SYNCMISS and SYNCERR bits and consequently also | ||||||
|  |   * the ERR flag | ||||||
|  |   * @rmtoll ICR          ERRC          LL_CRS_ClearFlag_ERR | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_ClearFlag_ERR(void) | ||||||
|  | { | ||||||
|  |   WRITE_REG(CRS->ICR, CRS_ICR_ERRC); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear Expected SYNC flag | ||||||
|  |   * @rmtoll ICR          ESYNCC        LL_CRS_ClearFlag_ESYNC | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_ClearFlag_ESYNC(void) | ||||||
|  | { | ||||||
|  |   WRITE_REG(CRS->ICR, CRS_ICR_ESYNCC); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup CRS_LL_EF_IT_Management IT_Management | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable SYNC event OK interrupt | ||||||
|  |   * @rmtoll CR           SYNCOKIE      LL_CRS_EnableIT_SYNCOK | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_EnableIT_SYNCOK(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(CRS->CR, CRS_CR_SYNCOKIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable SYNC event OK interrupt | ||||||
|  |   * @rmtoll CR           SYNCOKIE      LL_CRS_DisableIT_SYNCOK | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_DisableIT_SYNCOK(void) | ||||||
|  | { | ||||||
|  |   CLEAR_BIT(CRS->CR, CRS_CR_SYNCOKIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if SYNC event OK interrupt is enabled or not | ||||||
|  |   * @rmtoll CR           SYNCOKIE      LL_CRS_IsEnabledIT_SYNCOK | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsEnabledIT_SYNCOK(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->CR, CRS_CR_SYNCOKIE) == (CRS_CR_SYNCOKIE)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable SYNC warning interrupt | ||||||
|  |   * @rmtoll CR           SYNCWARNIE    LL_CRS_EnableIT_SYNCWARN | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_EnableIT_SYNCWARN(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(CRS->CR, CRS_CR_SYNCWARNIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable SYNC warning interrupt | ||||||
|  |   * @rmtoll CR           SYNCWARNIE    LL_CRS_DisableIT_SYNCWARN | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_DisableIT_SYNCWARN(void) | ||||||
|  | { | ||||||
|  |   CLEAR_BIT(CRS->CR, CRS_CR_SYNCWARNIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if SYNC warning interrupt is enabled or not | ||||||
|  |   * @rmtoll CR           SYNCWARNIE    LL_CRS_IsEnabledIT_SYNCWARN | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsEnabledIT_SYNCWARN(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->CR, CRS_CR_SYNCWARNIE) == (CRS_CR_SYNCWARNIE)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable Synchronization or trimming error interrupt | ||||||
|  |   * @rmtoll CR           ERRIE         LL_CRS_EnableIT_ERR | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_EnableIT_ERR(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(CRS->CR, CRS_CR_ERRIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable Synchronization or trimming error interrupt | ||||||
|  |   * @rmtoll CR           ERRIE         LL_CRS_DisableIT_ERR | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_DisableIT_ERR(void) | ||||||
|  | { | ||||||
|  |   CLEAR_BIT(CRS->CR, CRS_CR_ERRIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if Synchronization or trimming error interrupt is enabled or not | ||||||
|  |   * @rmtoll CR           ERRIE         LL_CRS_IsEnabledIT_ERR | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsEnabledIT_ERR(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->CR, CRS_CR_ERRIE) == (CRS_CR_ERRIE)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable Expected SYNC interrupt | ||||||
|  |   * @rmtoll CR           ESYNCIE       LL_CRS_EnableIT_ESYNC | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_EnableIT_ESYNC(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(CRS->CR, CRS_CR_ESYNCIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable Expected SYNC interrupt | ||||||
|  |   * @rmtoll CR           ESYNCIE       LL_CRS_DisableIT_ESYNC | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_CRS_DisableIT_ESYNC(void) | ||||||
|  | { | ||||||
|  |   CLEAR_BIT(CRS->CR, CRS_CR_ESYNCIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if Expected SYNC interrupt is enabled or not | ||||||
|  |   * @rmtoll CR           ESYNCIE       LL_CRS_IsEnabledIT_ESYNC | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_CRS_IsEnabledIT_ESYNC(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(CRS->CR, CRS_CR_ESYNCIE) == (CRS_CR_ESYNCIE)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(USE_FULL_LL_DRIVER) | ||||||
|  | /** @defgroup CRS_LL_EF_Init Initialization and de-initialization functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | ErrorStatus LL_CRS_DeInit(void); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /* USE_FULL_LL_DRIVER */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #endif /* defined(CRS) */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* STM32H5xx_LL_CRS_H */ | ||||||
|  |  | ||||||
							
								
								
									
										6345
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_dma.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6345
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_dma.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2267
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_exti.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2267
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_exti.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1181
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_gpio.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1181
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_gpio.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										788
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_icache.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										788
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_icache.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,788 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_ll_icache.h | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   Header file of ICACHE LL module. | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion ------------------------------------*/ | ||||||
|  | #ifndef STM32H5xx_LL_ICACHE_H | ||||||
|  | #define STM32H5xx_LL_ICACHE_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes -----------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_LL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(ICACHE) | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL ICACHE | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private types -------------------------------------------------------------*/ | ||||||
|  | /* Private variables ---------------------------------------------------------*/ | ||||||
|  | /* Private constants ---------------------------------------------------------*/ | ||||||
|  | /* Private macros ------------------------------------------------------------*/ | ||||||
|  | /* Exported types ------------------------------------------------------------*/ | ||||||
|  | #if defined(ICACHE_CRRx_REN) | ||||||
|  | /** @defgroup ICACHE_LL_REGION_CONFIG ICACHE Exported Configuration structure | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  LL ICACHE region configuration structure definition | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t BaseAddress;              /*!< Configures the C-AHB base address to be remapped */ | ||||||
|  |  | ||||||
|  |   uint32_t RemapAddress;             /*!< Configures the remap address to be remapped */ | ||||||
|  |  | ||||||
|  |   uint32_t Size;                     /*!< Configures the region size. | ||||||
|  |                                           This parameter can be a value of @ref ICACHE_LL_EC_Region_Size */ | ||||||
|  |  | ||||||
|  |   uint32_t TrafficRoute;             /*!< Selects the traffic route. | ||||||
|  |                                           This parameter can be a value of @ref ICACHE_LL_EC_Traffic_Route */ | ||||||
|  |  | ||||||
|  |   uint32_t OutputBurstType;          /*!< Selects the output burst type. | ||||||
|  |                                           This parameter can be a value of @ref ICACHE_LL_EC_Output_Burst_Type */ | ||||||
|  | } LL_ICACHE_RegionTypeDef; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /*  ICACHE_CRRx_REN */ | ||||||
|  |  | ||||||
|  | /* Exported constants -------------------------------------------------------*/ | ||||||
|  | /** @defgroup ICACHE_LL_Exported_Constants ICACHE Exported Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EC_WaysSelection Ways selection | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_ICACHE_1WAY                 0U                /*!< 1-way cache (direct mapped cache) */ | ||||||
|  | #define LL_ICACHE_2WAYS                ICACHE_CR_WAYSEL  /*!< 2-ways set associative cache (default) */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EC_Monitor_Type Monitor type | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_ICACHE_MONITOR_HIT          ICACHE_CR_HITMEN                       /*!< Hit monitor counter */ | ||||||
|  | #define LL_ICACHE_MONITOR_MISS         ICACHE_CR_MISSMEN                      /*!< Miss monitor counter */ | ||||||
|  | #define LL_ICACHE_MONITOR_ALL          (ICACHE_CR_HITMEN | ICACHE_CR_MISSMEN) /*!< All monitors counters */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EC_GET_FLAG Get Flags Defines | ||||||
|  |   * @brief    Flags defines which can be used with LL_ICACHE_ReadReg function | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_ICACHE_SR_BUSYF             ICACHE_SR_BUSYF     /*!< Busy flag */ | ||||||
|  | #define LL_ICACHE_SR_BSYENDF           ICACHE_SR_BSYENDF   /*!< Busy end flag */ | ||||||
|  | #define LL_ICACHE_SR_ERRF              ICACHE_SR_ERRF      /*!< Cache error flag */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EC_CLEAR_FLAG Clear Flags Defines | ||||||
|  |   * @brief    Flags defines which can be used with LL_ICACHE_WriteReg function | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_ICACHE_FCR_CBSYENDF         ICACHE_FCR_CBSYENDF /*!< Busy end flag */ | ||||||
|  | #define LL_ICACHE_FCR_CERRF            ICACHE_FCR_CERRF    /*!< Cache error flag */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EC_IT IT Defines | ||||||
|  |   * @brief    IT defines which can be used with LL_ICACHE_ReadReg and  LL_ICACHE_WriteReg functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_ICACHE_IER_BSYENDIE         ICACHE_IER_BSYENDIE /*!< Busy end interrupt */ | ||||||
|  | #define LL_ICACHE_IER_ERRIE            ICACHE_IER_ERRIE    /*!< Cache error interrupt */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(ICACHE_CRRx_REN) | ||||||
|  | /** @defgroup ICACHE_LL_EC_Region Remapped Region number | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_ICACHE_REGION_0             0U  /*!< Region 0 */ | ||||||
|  | #define LL_ICACHE_REGION_1             1U  /*!< Region 1 */ | ||||||
|  | #define LL_ICACHE_REGION_2             2U  /*!< Region 2 */ | ||||||
|  | #define LL_ICACHE_REGION_3             3U  /*!< Region 3 */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EC_Region_Size Remapped Region size | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_ICACHE_REGIONSIZE_2MB       1U  /*!< Region size 2MB */ | ||||||
|  | #define LL_ICACHE_REGIONSIZE_4MB       2U  /*!< Region size 4MB */ | ||||||
|  | #define LL_ICACHE_REGIONSIZE_8MB       3U  /*!< Region size 8MB */ | ||||||
|  | #define LL_ICACHE_REGIONSIZE_16MB      4U  /*!< Region size 16MB */ | ||||||
|  | #define LL_ICACHE_REGIONSIZE_32MB      5U  /*!< Region size 32MB */ | ||||||
|  | #define LL_ICACHE_REGIONSIZE_64MB      6U  /*!< Region size 64MB */ | ||||||
|  | #define LL_ICACHE_REGIONSIZE_128MB     7U  /*!< Region size 128MB */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EC_Traffic_Route Remapped Traffic route | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_ICACHE_MASTER1_PORT         0U                  /*!< Master1 port */ | ||||||
|  | #define LL_ICACHE_MASTER2_PORT         ICACHE_CRRx_MSTSEL  /*!< Master2 port */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EC_Output_Burst_Type Remapped Output burst type | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_ICACHE_OUTPUT_BURST_WRAP    0U                  /*!< WRAP */ | ||||||
|  | #define LL_ICACHE_OUTPUT_BURST_INCR    ICACHE_CRRx_HBURST  /*!< INCR */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /*  ICACHE_CRRx_REN */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported macros ----------------------------------------------------------*/ | ||||||
|  | /** @defgroup ICACHE_LL_Exported_Macros ICACHE Exported Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EM_WRITE_READ Common write and read registers Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Write a value in ICACHE register | ||||||
|  |   * @param  __REG__ Register to be written | ||||||
|  |   * @param  __VALUE__ Value to be written in the register | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | #define LL_ICACHE_WriteReg(__REG__, __VALUE__) WRITE_REG(ICACHE->__REG__, (__VALUE__)) | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Read a value in ICACHE register | ||||||
|  |   * @param  __REG__ Register to be read | ||||||
|  |   * @retval Register value | ||||||
|  |   */ | ||||||
|  | #define LL_ICACHE_ReadReg(__REG__) READ_REG(ICACHE->__REG__) | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Exported functions --------------------------------------------------------*/ | ||||||
|  | /** @defgroup ICACHE_LL_Exported_Functions ICACHE Exported Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EF_Configuration Configuration | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable the ICACHE. | ||||||
|  |   * @rmtoll CR           EN            LL_ICACHE_Enable | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_Enable(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(ICACHE->CR, ICACHE_CR_EN); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the ICACHE. | ||||||
|  |   * @rmtoll CR           EN            LL_ICACHE_Disable | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_Disable(void) | ||||||
|  | { | ||||||
|  |   CLEAR_BIT(ICACHE->CR, ICACHE_CR_EN); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Return if ICACHE is enabled or not. | ||||||
|  |   * @rmtoll CR           EN            LL_ICACHE_IsEnabled | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_IsEnabled(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(ICACHE->CR, ICACHE_CR_EN) == (ICACHE_CR_EN)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Select the ICACHE operating mode. | ||||||
|  |   * @rmtoll CR           WAYSEL        LL_ICACHE_SetMode | ||||||
|  |   * @param  Mode This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_1WAY | ||||||
|  |   *         @arg @ref LL_ICACHE_2WAYS | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_SetMode(uint32_t Mode) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(ICACHE->CR, ICACHE_CR_WAYSEL, Mode); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the selected ICACHE operating mode. | ||||||
|  |   * @rmtoll CR           WAYSEL        LL_ICACHE_GetMode | ||||||
|  |   * @retval Returned value can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_1WAY | ||||||
|  |   *         @arg @ref LL_ICACHE_2WAYS | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_GetMode(void) | ||||||
|  | { | ||||||
|  |   return (READ_BIT(ICACHE->CR, ICACHE_CR_WAYSEL)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Invalidate the ICACHE. | ||||||
|  |   * @note   Until the BSYEND flag is set, the cache is bypassed. | ||||||
|  |   * @rmtoll CR           CACHEINV      LL_ICACHE_Invalidate | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_Invalidate(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(ICACHE->CR, ICACHE_CR_CACHEINV); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EF_Monitors Monitors | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable the hit/miss monitor(s). | ||||||
|  |   * @rmtoll CR           HITMEN        LL_ICACHE_EnableMonitors | ||||||
|  |   * @rmtoll CR           MISSMEN       LL_ICACHE_EnableMonitors | ||||||
|  |   * @param  Monitors This parameter can be one or a combination of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_HIT | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_MISS | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_ALL | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_EnableMonitors(uint32_t Monitors) | ||||||
|  | { | ||||||
|  |   SET_BIT(ICACHE->CR, Monitors); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the hit/miss monitor(s). | ||||||
|  |   * @rmtoll CR           HITMEN        LL_ICACHE_DisableMonitors | ||||||
|  |   * @rmtoll CR           MISSMEN       LL_ICACHE_DisableMonitors | ||||||
|  |   * @param  Monitors This parameter can be one or a combination of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_HIT | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_MISS | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_ALL | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_DisableMonitors(uint32_t Monitors) | ||||||
|  | { | ||||||
|  |   CLEAR_BIT(ICACHE->CR, Monitors); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if the monitor(s) is(are) enabled or disabled. | ||||||
|  |   * @rmtoll CR           HITMEN        LL_ICACHE_IsEnabledMonitors | ||||||
|  |   * @rmtoll CR           MISSMEN       LL_ICACHE_IsEnabledMonitors | ||||||
|  |   * @param  Monitors This parameter can be one or a combination of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_HIT | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_MISS | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_ALL | ||||||
|  |   * @retval State of parameter value (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_IsEnabledMonitors(uint32_t Monitors) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(ICACHE->CR, Monitors) == (Monitors)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Reset the hit/miss monitor(s). | ||||||
|  |   * @rmtoll CR           HITMRST       LL_ICACHE_ResetMonitors | ||||||
|  |   * @rmtoll CR           MISSMRST      LL_ICACHE_ResetMonitors | ||||||
|  |   * @param  Monitors This parameter can be one or a combination of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_HIT | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_MISS | ||||||
|  |   *         @arg @ref LL_ICACHE_MONITOR_ALL | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_ResetMonitors(uint32_t Monitors) | ||||||
|  | { | ||||||
|  |   /* Reset */ | ||||||
|  |   SET_BIT(ICACHE->CR, (Monitors << 2U)); | ||||||
|  |   /* Release reset */ | ||||||
|  |   CLEAR_BIT(ICACHE->CR, (Monitors << 2U)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the Hit monitor. | ||||||
|  |   * @note   Upon reaching the 32-bit maximum value, hit monitor does not wrap. | ||||||
|  |   * @rmtoll HMONR        HITMON        LL_ICACHE_GetHitMonitor | ||||||
|  |   * @retval Value between Min_Data=0 and Max_Data=0xFFFFFFFF | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_GetHitMonitor(void) | ||||||
|  | { | ||||||
|  |   return (ICACHE->HMONR); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the Miss monitor. | ||||||
|  |   * @note   Upon reaching the 16-bit maximum value, miss monitor does not wrap. | ||||||
|  |   * @rmtoll MMONR        MISSMON       LL_ICACHE_GetMissMonitor | ||||||
|  |   * @retval Value between Min_Data=0 and Max_Data=0xFFFF | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_GetMissMonitor(void) | ||||||
|  | { | ||||||
|  |   return (ICACHE->MMONR); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EF_IT_Management IT_Management | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable BSYEND interrupt. | ||||||
|  |   * @rmtoll IER          BSYENDIE      LL_ICACHE_EnableIT_BSYEND | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_EnableIT_BSYEND(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(ICACHE->IER, ICACHE_IER_BSYENDIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable BSYEND interrupt. | ||||||
|  |   * @rmtoll IER          BSYENDIE      LL_ICACHE_DisableIT_BSYEND | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_DisableIT_BSYEND(void) | ||||||
|  | { | ||||||
|  |   CLEAR_BIT(ICACHE->IER, ICACHE_IER_BSYENDIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if the BSYEND Interrupt is enabled or disabled. | ||||||
|  |   * @rmtoll IER          BSYENDIE      LL_ICACHE_IsEnabledIT_BSYEND | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_IsEnabledIT_BSYEND(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(ICACHE->IER, ICACHE_IER_BSYENDIE) == (ICACHE_IER_BSYENDIE)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable ERR interrupt. | ||||||
|  |   * @rmtoll IER          ERRIE         LL_ICACHE_EnableIT_ERR | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_EnableIT_ERR(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(ICACHE->IER, ICACHE_IER_ERRIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable ERR interrupt. | ||||||
|  |   * @rmtoll IER          ERRIE        LL_ICACHE_DisableIT_ERR | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_DisableIT_ERR(void) | ||||||
|  | { | ||||||
|  |   CLEAR_BIT(ICACHE->IER, ICACHE_IER_ERRIE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check if the ERR Interrupt is enabled or disabled. | ||||||
|  |   * @rmtoll IER          ERRIE         LL_ICACHE_IsEnabledIT_ERR | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_IsEnabledIT_ERR(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(ICACHE->IER, ICACHE_IER_ERRIE) == (ICACHE_IER_ERRIE)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_LL_EF_FLAG_Management FLAG_Management | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Indicate the status of an ongoing operation flag. | ||||||
|  |   * @rmtoll SR           BUSYF         LL_ICACHE_IsActiveFlag_BUSY | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_IsActiveFlag_BUSY(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(ICACHE->SR, ICACHE_SR_BUSYF) == (ICACHE_SR_BUSYF)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Indicate the status of an operation end flag. | ||||||
|  |   * @rmtoll SR           BSYEND       LL_ICACHE_IsActiveFlag_BSYEND | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_IsActiveFlag_BSYEND(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(ICACHE->SR, ICACHE_SR_BSYENDF) == (ICACHE_SR_BSYENDF)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Indicate the status of an error flag. | ||||||
|  |   * @rmtoll SR           ERRF          LL_ICACHE_IsActiveFlag_ERR | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_IsActiveFlag_ERR(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(ICACHE->SR, ICACHE_SR_ERRF) == (ICACHE_SR_ERRF)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear busy end of operation flag. | ||||||
|  |   * @rmtoll FCR          CBSYENDF      LL_ICACHE_ClearFlag_BSYEND | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_ClearFlag_BSYEND(void) | ||||||
|  | { | ||||||
|  |   WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear error flag. | ||||||
|  |   * @rmtoll FCR          ERRF          LL_ICACHE_ClearFlag_ERR | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_ClearFlag_ERR(void) | ||||||
|  | { | ||||||
|  |   WRITE_REG(ICACHE->FCR, ICACHE_FCR_CERRF); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(ICACHE_CRRx_REN) | ||||||
|  | /** @defgroup ICACHE_LL_EF_REGION_Management REGION_Management | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable the remapped memory region. | ||||||
|  |   * @note   The region must have been already configured. | ||||||
|  |   * @rmtoll CRRx         REN           LL_ICACHE_EnableRegion | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_EnableRegion(uint32_t Region) | ||||||
|  | { | ||||||
|  |   SET_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |           ICACHE_CRRx_REN); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the remapped memory region. | ||||||
|  |   * @rmtoll CRRx         REN           LL_ICACHE_DisableRegion | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_DisableRegion(uint32_t Region) | ||||||
|  | { | ||||||
|  |   CLEAR_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |             ICACHE_CRRx_REN); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Return if remapped memory region is enabled or not. | ||||||
|  |   * @rmtoll CRRx         REN           LL_ICACHE_IsEnabledRegion | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @retval State of bit (1 or 0). | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_IsEnabledRegion(uint32_t Region) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |                     ICACHE_CRRx_REN) == (ICACHE_CRRx_REN)) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Select the memory remapped region base address. | ||||||
|  |   * @note   The useful bits depends on RSIZE as described in the Reference Manual. | ||||||
|  |   * @rmtoll CRRx         BASEADDR      LL_ICACHE_SetRegionBaseAddress | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @param  Address  Alias address in the Code region | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_SetRegionBaseAddress(uint32_t Region, uint32_t Address) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |              ICACHE_CRRx_BASEADDR, ((Address & 0x1FFFFFFFU) >> 21U)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the memory remapped region base address. | ||||||
|  |   * @note   The base address is the alias in the Code region. | ||||||
|  |   * @note   The useful bits depends on RSIZE as described in the Reference Manual. | ||||||
|  |   * @rmtoll CRRx         BASEADDR      LL_ICACHE_GetRegionBaseAddress | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @retval Address  Alias address in the Code region | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_GetRegionBaseAddress(uint32_t Region) | ||||||
|  | { | ||||||
|  |   return (READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |                    ICACHE_CRRx_BASEADDR) << 21U); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Select the memory remapped region address. | ||||||
|  |   * @note   The useful bits depends on RSIZE as described in the Reference Manual. | ||||||
|  |   * @rmtoll CRRx         REMAPADDR     LL_ICACHE_SetRegionRemapAddress | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @param  Address  Memory address to remap | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_SetRegionRemapAddress(uint32_t Region, uint32_t Address) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |              ICACHE_CRRx_REMAPADDR, ((Address >> 21U) << ICACHE_CRRx_REMAPADDR_Pos)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the memory remapped region address. | ||||||
|  |   * @note   The useful bits depends on RSIZE as described in the Reference Manual. | ||||||
|  |   * @rmtoll CRRx         REMAPADDR     LL_ICACHE_GetRegionRemapAddress | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @retval Address  Remapped memory address | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_GetRegionRemapAddress(uint32_t Region) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |                     ICACHE_CRRx_REMAPADDR) >> ICACHE_CRRx_REMAPADDR_Pos) << 21U); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Select the memory remapped region size. | ||||||
|  |   * @rmtoll CRRx         RSIZE         LL_ICACHE_SetRegionSize | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @param  Size This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_2MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_4MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_8MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_16MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_32MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_64MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_128MB | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_SetRegionSize(uint32_t Region, uint32_t Size) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |              ICACHE_CRRx_RSIZE, (Size << ICACHE_CRRx_RSIZE_Pos)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the selected the memory remapped region size. | ||||||
|  |   * @rmtoll CRRx         RSIZE         LL_ICACHE_GetRegionSize | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @retval Returned value can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_2MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_4MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_8MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_16MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_32MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_64MB | ||||||
|  |   *         @arg @ref LL_ICACHE_REGIONSIZE_128MB | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_GetRegionSize(uint32_t Region) | ||||||
|  | { | ||||||
|  |   return (READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |                    ICACHE_CRRx_RSIZE) >> ICACHE_CRRx_RSIZE_Pos); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Select the memory remapped region output burst type. | ||||||
|  |   * @rmtoll CRRx         HBURST        LL_ICACHE_SetRegionOutputBurstType | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @param  Type This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_OUTPUT_BURST_WRAP | ||||||
|  |   *         @arg @ref LL_ICACHE_OUTPUT_BURST_INCR | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_SetRegionOutputBurstType(uint32_t Region, uint32_t Type) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |              ICACHE_CRRx_HBURST, Type); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the selected the memory remapped region output burst type. | ||||||
|  |   * @rmtoll CRRx         HBURST        LL_ICACHE_GetRegionOutputBurstType | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @retval Returned value can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_OUTPUT_BURST_WRAP | ||||||
|  |   *         @arg @ref LL_ICACHE_OUTPUT_BURST_INCR | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_GetRegionOutputBurstType(uint32_t Region) | ||||||
|  | { | ||||||
|  |   return (READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |                    ICACHE_CRRx_HBURST)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Select the memory remapped region cache master port. | ||||||
|  |   * @rmtoll CRRx         MSTSEL        LL_ICACHE_SetRegionMasterPort | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @param  Port This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_MASTER1_PORT | ||||||
|  |   *         @arg @ref LL_ICACHE_MASTER2_PORT | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE void LL_ICACHE_SetRegionMasterPort(uint32_t Region, uint32_t Port) | ||||||
|  | { | ||||||
|  |   MODIFY_REG(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |              ICACHE_CRRx_MSTSEL, Port); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the selected the memory remapped region cache master port. | ||||||
|  |   * @rmtoll CRRx         MSTSEL        LL_ICACHE_GetRegionMasterPort | ||||||
|  |   * @param  Region This parameter can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_0 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_1 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_2 | ||||||
|  |   *         @arg @ref LL_ICACHE_REGION_3 | ||||||
|  |   * @retval Returned value can be one of the following values: | ||||||
|  |   *         @arg @ref LL_ICACHE_MASTER1_PORT | ||||||
|  |   *         @arg @ref LL_ICACHE_MASTER2_PORT | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_ICACHE_GetRegionMasterPort(uint32_t Region) | ||||||
|  | { | ||||||
|  |   return (READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \ | ||||||
|  |                    ICACHE_CRRx_MSTSEL)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(USE_FULL_LL_DRIVER) | ||||||
|  | /** @defgroup ICACHE_LL_EF_REGION_Init Region Initialization functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | void LL_ICACHE_ConfigRegion(uint32_t Region, const LL_ICACHE_RegionTypeDef *const pICACHE_RegionStruct); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /* USE_FULL_LL_DRIVER */ | ||||||
|  |  | ||||||
|  | #endif /*  ICACHE_CRRx_REN */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #endif /* ICACHE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* STM32H5xx_LL_ICACHE_H */ | ||||||
							
								
								
									
										2077
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_pwr.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2077
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_pwr.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										6463
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_rcc.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6463
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_rcc.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1814
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_system.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1814
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_system.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										365
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_utils.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										365
									
								
								Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_utils.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,365 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_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) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Define to prevent recursive inclusion -------------------------------------*/ | ||||||
|  | #ifndef __STM32H5xx_LL_UTILS_H | ||||||
|  | #define __STM32H5xx_LL_UTILS_H | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_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 must be a number between Min_Data = 1 and Max_Data = 63 | ||||||
|  |  | ||||||
|  |                         This feature can be modified afterwards using unitary function | ||||||
|  |                         @ref LL_RCC_PLL1_SetM(). */ | ||||||
|  |  | ||||||
|  |   uint32_t PLLN;   /*!< Multiplication factor for PLL VCO output clock. | ||||||
|  |                         This parameter must be a number between Min_Data = 4 and Max_Data = 512 | ||||||
|  |  | ||||||
|  |                         This feature can be modified afterwards using unitary function | ||||||
|  |                         @ref LL_RCC_PLL1_SetN(). */ | ||||||
|  |  | ||||||
|  |   uint32_t PLLP;   /*!< Division for the main system clock. | ||||||
|  |                         This parameter must be a number between Min_Data = 2 and Max_Data = 128 | ||||||
|  |                           odd division factors are not allowed | ||||||
|  |  | ||||||
|  |                         This feature can be modified afterwards using unitary function | ||||||
|  |                         @ref LL_RCC_PLL1_SetP(). */ | ||||||
|  |  | ||||||
|  |   uint32_t FRACN;  /*!< Fractional part of the multiplication factor for PLL VCO. | ||||||
|  |                         This parameter can be a value between 0 and 8191 | ||||||
|  |  | ||||||
|  |                         This feature can be modified afterwards using unitary function | ||||||
|  |                         @ref LL_RCC_PLL1_SetFRACN(). */ | ||||||
|  |  | ||||||
|  |   uint32_t VCO_Input;  /*!< PLL clock Input range. | ||||||
|  |                         This parameter can be a value of @ref RCC_LL_EC_PLLINPUTRANGE | ||||||
|  |  | ||||||
|  |                         This feature can be modified afterwards using unitary function | ||||||
|  |                         @ref LL_RCC_PLL1_SetVCOInputRange(). */ | ||||||
|  |  | ||||||
|  |   uint32_t VCO_Output;  /*!< PLL clock Output range. | ||||||
|  |                         This parameter can be a value of @ref RCC_LL_EC_PLLOUTPUTRANGE | ||||||
|  |  | ||||||
|  |                       This feature can be modified afterwards using unitary function | ||||||
|  |                       @ref LL_RCC_PLL1_SetVCOOutputRange(). */ | ||||||
|  |  | ||||||
|  | } LL_UTILS_PLLInitTypeDef; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  UTILS System, AHB and APB buses clock configuration structure definition | ||||||
|  |   */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |   uint32_t SYSCLKDivider;         /*!< The System clock (SYSCLK) divider. This clock is derived from the System clock. | ||||||
|  |                                        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(). */ | ||||||
|  |  | ||||||
|  |   uint32_t APB3CLKDivider;        /*!< The APB3 clock (PCLK3) divider. This clock is derived from the AHB clock (HCLK). | ||||||
|  |                                        This parameter can be a value of @ref RCC_LL_EC_APB3_DIV | ||||||
|  |  | ||||||
|  |                                        This feature can be modified afterwards using unitary function | ||||||
|  |                                        @ref LL_RCC_SetAPB3Prescaler(). */ | ||||||
|  |  | ||||||
|  | } 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 Analog is enabled             */ | ||||||
|  | #define LL_UTILS_HSEBYPASS_DIGITAL_ON   0x00000002U       /*!< HSE Bypass Digital is enabled            */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup UTILS_EC_PACKAGETYPE PACKAGE TYPE | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_LQFP64                  0x00000000U /*!< LQFP64 package type                                 */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_VFQFPN68                0x00000001U /*!< VFQFPN68 package type                               */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_LQFP100                 0x00000002U /*!< LQFP100 package type                                */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_UFBGA176                0x00000003U /*!< UFBGA176+25 package type                            */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_LQFP144                 0x00000004U /*!< LQFP144 package type                                */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_LQFP48                  0x00000005U /*!< LQFP48 package type                                 */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_UFBGA169                0x00000006U /*!< UFBGA169 package type                               */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_LQFP176                 0x00000007U /*!< LQFP176 package type                                */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_UFQFPN32                0x00000009U /*!< UFQFPN32 package type                               */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_LQFP100_SMPS            0x0000000AU /*!< LQFP100 with internal SMPS package type             */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_UFBGA176_SMPS           0x0000000BU /*!< UFBGA176+25 with internal SMPS package type         */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_LQFP144_SMPS            0x0000000CU /*!< LQFP144 with internal SMPS package type             */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_LQFP176_SMPS            0x0000000DU /*!< LQFP176 with internal SMPS package type             */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_UFBGA169_SMPS           0x0000000EU /*!< UFBGA169 with internal SMPS package type            */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_WLCSP25                 0x0000000FU /*!< WLCSP25 package type                                */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_UFQFPN48                0x00000010U /*!< UFQFPN48 package type                               */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_WLCSP39                 0x00000011U /*!< WLCSP39 package type                                */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_UFBGA100                0x00000014U /*!< UFBGA100 package type                               */ | ||||||
|  | #define LL_UTILS_PACKAGETYPE_UFBGA144                0x00000015U /*!< UFBGA144 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]: X and Y coordinates on the wafer expressed in BCD format | ||||||
|  |   */ | ||||||
|  | __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]: Wafer number (UID[39:32]) & LOT_NUM[23:0] (UID[63:40]) | ||||||
|  |   */ | ||||||
|  | __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]: Lot number (ASCII encoded) - LOT_NUM[55:24] | ||||||
|  |   */ | ||||||
|  | __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)) & 0xFFFFU); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get Package type | ||||||
|  |   * @retval Returned value can be one of the following values: | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_LQFP64 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_VFQFPN68 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_LQFP100 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_UFBGA176 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_LQFP144 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_LQFP48 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_UFBGA169 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_LQFP176 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_UFQFPN32 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_LQFP100_SMPS | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_UFBGA176_SMPS | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_LQFP144_SMPS | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_LQFP176_SMPS | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_UFBGA169_SMPS | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_WLCSP25 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_UFQFPN48 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_WLCSP39 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_UFBGA100 | ||||||
|  |   *         @arg @ref LL_UTILS_PACKAGETYPE_UFBGA144 | ||||||
|  |   * @note   Refer to product datasheet for availability of package on a specific device | ||||||
|  |   */ | ||||||
|  | __STATIC_INLINE uint32_t LL_GetPackageType(void) | ||||||
|  | { | ||||||
|  |   return (uint32_t)(READ_REG(*((uint16_t *)PACKAGE_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_Init1msTick_HCLK_Div8(uint32_t HCLKFrequency); | ||||||
|  | void        LL_Init1msTick_LSE(void); | ||||||
|  | void        LL_Init1msTick_LSI(void); | ||||||
|  | void        LL_mDelay(uint32_t Delay); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup UTILS_EF_SYSTEM SYSTEM | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | void        LL_SetSystemCoreClock(uint32_t HCLKFrequency); | ||||||
|  | ErrorStatus LL_PLL_ConfigSystemClock_CSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, | ||||||
|  |                                          LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); | ||||||
|  | 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); | ||||||
|  | ErrorStatus LL_SetFlashLatency(uint32_t HCLK_Frequency); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* __STM32H5xx_LL_UTILS_H */ | ||||||
|  |  | ||||||
							
								
								
									
										27
									
								
								Drivers/STM32H5xx_HAL_Driver/LICENSE.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								Drivers/STM32H5xx_HAL_Driver/LICENSE.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | |||||||
|  | Copyright 2021 STMicroelectronics. | ||||||
|  | All rights reserved. | ||||||
|  |  | ||||||
|  | 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 the copyright holder 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. | ||||||
							
								
								
									
										6
									
								
								Drivers/STM32H5xx_HAL_Driver/LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Drivers/STM32H5xx_HAL_Driver/LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | This software component is provided to you as part of a software package and | ||||||
|  | applicable license terms are in the  Package_license file. If you received this | ||||||
|  | software component outside of a package or without applicable license terms, | ||||||
|  | the terms of the BSD-3-Clause license shall apply.  | ||||||
|  | You may obtain a copy of the BSD-3-Clause at: | ||||||
|  | https://opensource.org/licenses/BSD-3-Clause | ||||||
							
								
								
									
										1329
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1329
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										872
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_cortex.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										872
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_cortex.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,872 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_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 Configuration functions | ||||||
|  |   *           + Peripheral Control functions | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   @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-M33 exceptions are managed by CMSIS functions. | ||||||
|  |  | ||||||
|  |     (#) Configure the NVIC Priority Grouping using HAL_NVIC_SetPriorityGrouping() function. | ||||||
|  |     (#) Configure the priority of the selected IRQ Channels using HAL_NVIC_SetPriority(). | ||||||
|  |     (#) Enable the selected IRQ Channels using HAL_NVIC_EnableIRQ(). | ||||||
|  |  | ||||||
|  |      -@- When the NVIC_PRIORITYGROUP_0 is selected, IRQ pre-emption 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 pre-emption 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 stm32h5xx_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 | ||||||
|  |  | ||||||
|  |     [..] | ||||||
|  |     *** How to configure MPU regions using CORTEX HAL driver *** | ||||||
|  |     ============================================================ | ||||||
|  |     [..] | ||||||
|  |     This section provides functions allowing to configure the Memory Protection Unit (MPU). | ||||||
|  |  | ||||||
|  |     (#) Disable the MPU using HAL_MPU_Disable(). | ||||||
|  |     (#) Configure the necessary MPU memory attributes using HAL_MPU_ConfigMemoryAttributes(). | ||||||
|  |     (#) Configure the necessary MPU regions using HAL_MPU_ConfigRegion() ennsuring that the MPU region configuration link to | ||||||
|  |         the right MPU attributes number. | ||||||
|  |     (#) Enable the MPU using HAL_MPU_Enable() function. | ||||||
|  |  | ||||||
|  |      -@- The memory management fault exception is enabled in HAL_MPU_Enable() function and the system will enter the memory | ||||||
|  |          management fault handler MemManage_Handler() when an illegal memory access is performed. | ||||||
|  |      -@- If the MPU has previously been programmed, disable the unused regions to prevent any previous region configuration | ||||||
|  |          from affecting the new MPU configuration. | ||||||
|  |      -@- MPU APIs ending with '_NS' allow to control the non-secure Memory Protection Unit (MPU_NS) from the secure context | ||||||
|  |  | ||||||
|  |   @endverbatim | ||||||
|  |   ****************************************************************************** | ||||||
|  |  | ||||||
|  |   The table below gives the allowed values of the pre-emption priority and subpriority according | ||||||
|  |   to the Priority Grouping configuration performed by HAL_NVIC_SetPriorityGrouping() function. | ||||||
|  |  | ||||||
|  | ======================================================================================================================== | ||||||
|  |   NVIC_PriorityGroup  | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority |       Description | ||||||
|  | ======================================================================================================================== | ||||||
|  |  NVIC_PRIORITYGROUP_0 |                0                  |            0-15            | 0 bit for pre-emption priority | ||||||
|  |                       |                                   |                            | 4 bits for subpriority | ||||||
|  | ------------------------------------------------------------------------------------------------------------------------ | ||||||
|  |  NVIC_PRIORITYGROUP_1 |                0-1                |            0-7             | 1 bit for pre-emption priority | ||||||
|  |                       |                                   |                            | 3 bits for subpriority | ||||||
|  | ------------------------------------------------------------------------------------------------------------------------ | ||||||
|  |  NVIC_PRIORITYGROUP_2 |                0-3                |            0-3             | 2 bits for pre-emption priority | ||||||
|  |                       |                                   |                            | 2 bits for subpriority | ||||||
|  | ------------------------------------------------------------------------------------------------------------------------ | ||||||
|  |  NVIC_PRIORITYGROUP_3 |                0-7                |            0-1             | 3 bits for pre-emption priority | ||||||
|  |                       |                                   |                            | 1 bit for subpriority | ||||||
|  | ------------------------------------------------------------------------------------------------------------------------ | ||||||
|  |  NVIC_PRIORITYGROUP_4 |                0-15               |            0               | 4 bits for pre-emption priority | ||||||
|  |                       |                                   |                            | 0 bit for subpriority | ||||||
|  | ======================================================================================================================== | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup CORTEX | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_CORTEX_MODULE_ENABLED | ||||||
|  |  | ||||||
|  | /* Private types -------------------------------------------------------------*/ | ||||||
|  | /* Private variables ---------------------------------------------------------*/ | ||||||
|  | /* Private constants ---------------------------------------------------------*/ | ||||||
|  | /* Private macros ------------------------------------------------------------*/ | ||||||
|  | /* Private functions ---------------------------------------------------------*/ | ||||||
|  | /** @defgroup CORTEX_Private_Functions CORTEX Private Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | static void MPU_ConfigRegion(MPU_Type *MPUx, const MPU_Region_InitTypeDef *const pMPU_RegionInit); | ||||||
|  | static void MPU_ConfigMemoryAttributes(MPU_Type *MPUx, const MPU_Attributes_InitTypeDef *const pMPU_AttributesInit); | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | /* Exported functions --------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @addtogroup CORTEX_Exported_Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** @addtogroup CORTEX_Exported_Functions_Group1 | ||||||
|  |   *  @brief    NVIC functions | ||||||
|  |   * | ||||||
|  | @verbatim | ||||||
|  |   ============================================================================== | ||||||
|  |                           ##### NVIC functions ##### | ||||||
|  |   ============================================================================== | ||||||
|  |     [..] | ||||||
|  |       This section provides the CORTEX HAL driver functions for NVIC functionalities | ||||||
|  |  | ||||||
|  | @endverbatim | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Set the priority grouping field (pre-emption 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 bit  for pre-emption priority, | ||||||
|  |   *                                    4 bits for subpriority | ||||||
|  |   *         @arg NVIC_PRIORITYGROUP_1: 1 bit  for pre-emption priority, | ||||||
|  |   *                                    3 bits for subpriority | ||||||
|  |   *         @arg NVIC_PRIORITYGROUP_2: 2 bits for pre-emption priority, | ||||||
|  |   *                                    2 bits for subpriority | ||||||
|  |   *         @arg NVIC_PRIORITYGROUP_3: 3 bits for pre-emption priority, | ||||||
|  |   *                                    1 bit  for subpriority | ||||||
|  |   *         @arg NVIC_PRIORITYGROUP_4: 4 bits for pre-emption priority, | ||||||
|  |   *                                    0 bit  for subpriority | ||||||
|  |   * @note   When the NVIC_PRIORITYGROUP_0 is selected, IRQ pre-emption 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  Set 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 (stm32h5xxxx.h)) | ||||||
|  |   * @param  PreemptPriority: The pre-emption 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; | ||||||
|  |  | ||||||
|  |   /* 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  Enable 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 (stm32h5xxxx.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  Disable 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 (stm32h5xxxx.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  Initiate a system reset request to reset the MCU. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_NVIC_SystemReset(void) | ||||||
|  | { | ||||||
|  |   /* System Reset */ | ||||||
|  |   NVIC_SystemReset(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get 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  Get 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 (stm32h5xxxx.h)) | ||||||
|  |   * @param   PriorityGroup: the priority grouping bits length. | ||||||
|  |   *         This parameter can be one of the following values: | ||||||
|  |   *           @arg NVIC_PRIORITYGROUP_0: 0 bit for pre-emption priority, | ||||||
|  |   *                                      4 bits for subpriority | ||||||
|  |   *           @arg NVIC_PRIORITYGROUP_1: 1 bit for pre-emption priority, | ||||||
|  |   *                                      3 bits for subpriority | ||||||
|  |   *           @arg NVIC_PRIORITYGROUP_2: 2 bits for pre-emption priority, | ||||||
|  |   *                                      2 bits for subpriority | ||||||
|  |   *           @arg NVIC_PRIORITYGROUP_3: 3 bits for pre-emption priority, | ||||||
|  |   *                                      1 bit for subpriority | ||||||
|  |   *           @arg NVIC_PRIORITYGROUP_4: 4 bits for pre-emption priority, | ||||||
|  |   *                                      0 bit 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 *const pPreemptPriority, | ||||||
|  |                           uint32_t *const 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  Set 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 (stm32h5xxxx.h)) | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn) | ||||||
|  | { | ||||||
|  |   /* Set interrupt pending */ | ||||||
|  |   NVIC_SetPendingIRQ(IRQn); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get Pending Interrupt (read the pending register in the NVIC | ||||||
|  |   *         and return 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 (stm32h5xxxx.h)) | ||||||
|  |   * @retval status: - 0  Interrupt status is not pending. | ||||||
|  |   *                 - 1  Interrupt status is pending. | ||||||
|  |   */ | ||||||
|  | uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn) | ||||||
|  | { | ||||||
|  |   /* Return 1 if pending else 0 */ | ||||||
|  |   return NVIC_GetPendingIRQ(IRQn); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear 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 (stm32h5xxxx.h)) | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn) | ||||||
|  | { | ||||||
|  |   /* Clear pending interrupt */ | ||||||
|  |   NVIC_ClearPendingIRQ(IRQn); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Get active interrupt (read the active register in NVIC and return 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 (stm32h5xxxx.h)) | ||||||
|  |   * @retval status: - 0  Interrupt status is not pending. | ||||||
|  |   *                 - 1  Interrupt status is pending. | ||||||
|  |   */ | ||||||
|  | uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn) | ||||||
|  | { | ||||||
|  |   /* Return 1 if active else 0 */ | ||||||
|  |   return NVIC_GetActive(IRQn); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** @addtogroup CORTEX_Exported_Functions_Group2 | ||||||
|  |   *  @brief   SYSTICK functions | ||||||
|  |   * | ||||||
|  | @verbatim | ||||||
|  |   ============================================================================== | ||||||
|  |                           ##### SYSTICK functions ##### | ||||||
|  |   ============================================================================== | ||||||
|  |     [..] | ||||||
|  |       This section provides the CORTEX HAL driver functions for SYSTICK functionalities | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @endverbatim | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Initialize the System Timer with interrupt enabled and start the System Tick Timer (SysTick): | ||||||
|  |   *         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) | ||||||
|  | { | ||||||
|  |   if ((TicksNumb - 1UL) > SysTick_LOAD_RELOAD_Msk) | ||||||
|  |   { | ||||||
|  |     /* Reload value impossible */ | ||||||
|  |     return (1UL); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Set reload register */ | ||||||
|  |   WRITE_REG(SysTick->LOAD, (uint32_t)(TicksNumb - 1UL)); | ||||||
|  |  | ||||||
|  |   /* Load the SysTick Counter Value */ | ||||||
|  |   WRITE_REG(SysTick->VAL, 0UL); | ||||||
|  |  | ||||||
|  |   /* Enable SysTick IRQ and SysTick Timer */ | ||||||
|  |   SET_BIT(SysTick->CTRL, (SysTick_CTRL_TICKINT_Msk | SysTick_CTRL_ENABLE_Msk)); | ||||||
|  |  | ||||||
|  |   /* Function successful */ | ||||||
|  |   return (0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Configure the SysTick clock source. | ||||||
|  |   * @param  CLKSource: specifies the SysTick clock source. | ||||||
|  |   *          This parameter can be one of the following values: | ||||||
|  |   *             @arg SYSTICK_CLKSOURCE_LSI: LSI clock selected as SysTick clock source. | ||||||
|  |   *             @arg SYSTICK_CLKSOURCE_LSE: LSE clock selected as SysTick clock source. | ||||||
|  |   *             @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source. | ||||||
|  |   *             @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource) | ||||||
|  | { | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_SYSTICK_CLK_SOURCE(CLKSource)); | ||||||
|  |   switch (CLKSource) | ||||||
|  |   { | ||||||
|  |     /* Select HCLK as Systick clock source */ | ||||||
|  |     case SYSTICK_CLKSOURCE_HCLK: | ||||||
|  |       SET_BIT(SysTick->CTRL, SYSTICK_CLKSOURCE_HCLK); | ||||||
|  |       break; | ||||||
|  |     /* Select HCLK_DIV8 as Systick clock source */ | ||||||
|  |     case SYSTICK_CLKSOURCE_HCLK_DIV8: | ||||||
|  |       CLEAR_BIT(SysTick->CTRL, SYSTICK_CLKSOURCE_HCLK); | ||||||
|  |       MODIFY_REG(RCC->CCIPR4, RCC_CCIPR4_SYSTICKSEL, (0x00000000U)); | ||||||
|  |       break; | ||||||
|  |     /* Select LSI as Systick clock source */ | ||||||
|  |     case SYSTICK_CLKSOURCE_LSI: | ||||||
|  |       CLEAR_BIT(SysTick->CTRL, SYSTICK_CLKSOURCE_HCLK); | ||||||
|  |       MODIFY_REG(RCC->CCIPR4, RCC_CCIPR4_SYSTICKSEL, RCC_CCIPR4_SYSTICKSEL_0); | ||||||
|  |       break; | ||||||
|  |     /* Select LSE as Systick clock source */ | ||||||
|  |     case SYSTICK_CLKSOURCE_LSE: | ||||||
|  |       CLEAR_BIT(SysTick->CTRL, SYSTICK_CLKSOURCE_HCLK); | ||||||
|  |       MODIFY_REG(RCC->CCIPR4, RCC_CCIPR4_SYSTICKSEL, RCC_CCIPR4_SYSTICKSEL_1); | ||||||
|  |       break; | ||||||
|  |     default: | ||||||
|  |       /* Nothing to do */ | ||||||
|  |       break; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the SysTick clock source configuration. | ||||||
|  |   * @retval  SysTick clock source that can be one of the following values: | ||||||
|  |   *             @arg SYSTICK_CLKSOURCE_LSI: LSI clock selected as SysTick clock source. | ||||||
|  |   *             @arg SYSTICK_CLKSOURCE_LSE: LSE clock selected as SysTick clock source. | ||||||
|  |   *             @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source. | ||||||
|  |   *             @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source. | ||||||
|  |   */ | ||||||
|  | uint32_t HAL_SYSTICK_GetCLKSourceConfig(void) | ||||||
|  | { | ||||||
|  |   uint32_t systick_source; | ||||||
|  |   uint32_t systick_rcc_source; | ||||||
|  |  | ||||||
|  |   /* Read SysTick->CTRL register for internal or external clock source */ | ||||||
|  |   if (READ_BIT(SysTick->CTRL, SysTick_CTRL_CLKSOURCE_Msk) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Internal clock source */ | ||||||
|  |     systick_source = SYSTICK_CLKSOURCE_HCLK; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* External clock source, check the selected one in RCC */ | ||||||
|  |     systick_rcc_source = READ_BIT(RCC->CCIPR4, RCC_CCIPR4_SYSTICKSEL); | ||||||
|  |  | ||||||
|  |     switch (systick_rcc_source) | ||||||
|  |     { | ||||||
|  |       case (0x00000000U): | ||||||
|  |         systick_source = SYSTICK_CLKSOURCE_HCLK_DIV8; | ||||||
|  |         break; | ||||||
|  |  | ||||||
|  |       case (RCC_CCIPR4_SYSTICKSEL_0): | ||||||
|  |         systick_source = SYSTICK_CLKSOURCE_LSI; | ||||||
|  |         break; | ||||||
|  |  | ||||||
|  |       case (RCC_CCIPR4_SYSTICKSEL_1): | ||||||
|  |         systick_source = SYSTICK_CLKSOURCE_LSE; | ||||||
|  |         break; | ||||||
|  |  | ||||||
|  |       default: | ||||||
|  |         systick_source = SYSTICK_CLKSOURCE_HCLK_DIV8; | ||||||
|  |         break; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   return systick_source; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Handle 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 | ||||||
|  |    */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup CORTEX_Exported_Functions_Group3 | ||||||
|  |   *  @brief   MPU functions | ||||||
|  |   * | ||||||
|  | @verbatim | ||||||
|  |   ============================================================================== | ||||||
|  |                          ##### MPU functions ##### | ||||||
|  |   ============================================================================== | ||||||
|  |     [..] | ||||||
|  |       This section provides the CORTEX HAL driver functions for MPU functionalities | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @endverbatim | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @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) | ||||||
|  | { | ||||||
|  |   __DMB(); /* Data Memory Barrier operation to force any outstanding writes to memory before enabling the MPU */ | ||||||
|  |  | ||||||
|  |   /* Enable the MPU */ | ||||||
|  |   MPU->CTRL   = MPU_Control | MPU_CTRL_ENABLE_Msk; | ||||||
|  |  | ||||||
|  |   /* Enable fault exceptions */ | ||||||
|  |   SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; | ||||||
|  |  | ||||||
|  |   /* Follow ARM recommendation with */ | ||||||
|  |   /* Data Synchronization and Instruction Synchronization Barriers to ensure MPU configuration */ | ||||||
|  |   __DSB(); /* Ensure that the subsequent instruction is executed only after the write to memory */ | ||||||
|  |   __ISB(); /* Flush and refill pipeline with updated MPU configuration settings */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /** | ||||||
|  |   * @brief  Enable the non-secure 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_NS(uint32_t MPU_Control) | ||||||
|  | { | ||||||
|  |   __DMB(); /* Data Memory Barrier operation to force any outstanding writes to memory before enabling the MPU */ | ||||||
|  |  | ||||||
|  |   /* Enable the MPU */ | ||||||
|  |   MPU_NS->CTRL   = MPU_Control | MPU_CTRL_ENABLE_Msk; | ||||||
|  |  | ||||||
|  |   /* Enable fault exceptions */ | ||||||
|  |   SCB_NS->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; | ||||||
|  |  | ||||||
|  |   /* Follow ARM recommendation with */ | ||||||
|  |   /* Data Synchronization and Instruction Synchronization Barriers to ensure MPU configuration */ | ||||||
|  |   __DSB(); /* Ensure that the subsequent instruction is executed only after the write to memory */ | ||||||
|  |   __ISB(); /* Flush and refill pipeline with updated MPU configuration settings */ | ||||||
|  | } | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the MPU. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_MPU_Disable(void) | ||||||
|  | { | ||||||
|  |   __DMB(); /* Force any outstanding transfers to complete before disabling MPU */ | ||||||
|  |  | ||||||
|  |   /* Disable fault exceptions */ | ||||||
|  |   SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; | ||||||
|  |  | ||||||
|  |   /* Disable the MPU */ | ||||||
|  |   MPU->CTRL  &= ~MPU_CTRL_ENABLE_Msk; | ||||||
|  |  | ||||||
|  |   /* Follow ARM recommendation with */ | ||||||
|  |   /* Data Synchronization and Instruction Synchronization Barriers to ensure MPU configuration */ | ||||||
|  |   __DSB(); /* Ensure that the subsequent instruction is executed only after the write to memory */ | ||||||
|  |   __ISB(); /* Flush and refill pipeline with updated MPU configuration settings */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the non-secure MPU. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_MPU_Disable_NS(void) | ||||||
|  | { | ||||||
|  |   __DMB(); /* Force any outstanding transfers to complete before disabling MPU */ | ||||||
|  |  | ||||||
|  |   /* Disable fault exceptions */ | ||||||
|  |   SCB_NS->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; | ||||||
|  |  | ||||||
|  |   /* Disable the MPU */ | ||||||
|  |   MPU_NS->CTRL  &= ~MPU_CTRL_ENABLE_Msk; | ||||||
|  |  | ||||||
|  |   /* Follow ARM recommendation with */ | ||||||
|  |   /* Data Synchronization and Instruction Synchronization Barriers to ensure MPU configuration */ | ||||||
|  |   __DSB(); /* Ensure that the subsequent instruction is executed only after the write to memory */ | ||||||
|  |   __ISB(); /* Flush and refill pipeline with updated MPU configuration settings */ | ||||||
|  | } | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable the MPU Region. | ||||||
|  |   * @param  RegionNumber Specifies the index of the region to enable. | ||||||
|  |   *         this parameter can be a value of @ref CORTEX_MPU_Region_Number | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_MPU_EnableRegion(uint32_t RegionNumber) | ||||||
|  | { | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_MPU_REGION_NUMBER(RegionNumber)); | ||||||
|  |  | ||||||
|  |   /* Set the Region number */ | ||||||
|  |   MPU->RNR = RegionNumber; | ||||||
|  |  | ||||||
|  |   /* Enable the Region */ | ||||||
|  |   SET_BIT(MPU->RLAR, MPU_RLAR_EN_Msk); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /** | ||||||
|  |   * @brief  Enable the MPU_NS Region. | ||||||
|  |   * @param  RegionNumber Specifies the index of the region to enable. | ||||||
|  |   *         this parameter can be a value of @ref CORTEX_MPU_Region_Number | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_MPU_EnableRegion_NS(uint32_t RegionNumber) | ||||||
|  | { | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_MPU_REGION_NUMBER_NS(RegionNumber)); | ||||||
|  |  | ||||||
|  |   /* Set the Region number */ | ||||||
|  |   MPU_NS->RNR = RegionNumber; | ||||||
|  |  | ||||||
|  |   /* Enable the Region */ | ||||||
|  |   SET_BIT(MPU_NS->RLAR, MPU_RLAR_EN_Msk); | ||||||
|  | } | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the MPU Region. | ||||||
|  |   * @param  RegionNumber Specifies the index of the region to disable. | ||||||
|  |   *         this parameter can be a value of @ref CORTEX_MPU_Region_Number | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_MPU_DisableRegion(uint32_t RegionNumber) | ||||||
|  | { | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_MPU_REGION_NUMBER(RegionNumber)); | ||||||
|  |  | ||||||
|  |   /* Set the Region number */ | ||||||
|  |   MPU->RNR = RegionNumber; | ||||||
|  |  | ||||||
|  |   /* Disable the Region */ | ||||||
|  |   CLEAR_BIT(MPU->RLAR, MPU_RLAR_EN_Msk); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the MPU_NS Region. | ||||||
|  |   * @param  RegionNumber Specifies the index of the region to disable. | ||||||
|  |   *         this parameter can be a value of @ref CORTEX_MPU_Region_Number | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_MPU_DisableRegion_NS(uint32_t RegionNumber) | ||||||
|  | { | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_MPU_REGION_NUMBER_NS(RegionNumber)); | ||||||
|  |  | ||||||
|  |   /* Set the Region number */ | ||||||
|  |   MPU_NS->RNR = RegionNumber; | ||||||
|  |  | ||||||
|  |   /* Disable the Region */ | ||||||
|  |   CLEAR_BIT(MPU_NS->RLAR, MPU_RLAR_EN_Msk); | ||||||
|  | } | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Initialize and configure the Region and the memory to be protected. | ||||||
|  |   * @param  pMPU_RegionInit: Pointer to a MPU_Region_InitTypeDef structure that contains | ||||||
|  |   *                the initialization and configuration information. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_MPU_ConfigRegion(const MPU_Region_InitTypeDef *const pMPU_RegionInit) | ||||||
|  | { | ||||||
|  |   MPU_ConfigRegion(MPU, pMPU_RegionInit); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /** | ||||||
|  |   * @brief  Initialize and configure the Region and the memory to be protected for non-secure MPU. | ||||||
|  |   * @param  pMPU_RegionInit: Pointer to a MPU_Region_InitTypeDef structure that contains | ||||||
|  |   *                the initialization and configuration information. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_MPU_ConfigRegion_NS(const MPU_Region_InitTypeDef *const pMPU_RegionInit) | ||||||
|  | { | ||||||
|  |   MPU_ConfigRegion(MPU_NS, pMPU_RegionInit); | ||||||
|  | } | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Initialize and configure the memory attributes. | ||||||
|  |   * @param  pMPU_AttributesInit: Pointer to a MPU_Attributes_InitTypeDef structure that contains | ||||||
|  |   *                the initialization and configuration information. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_MPU_ConfigMemoryAttributes(const MPU_Attributes_InitTypeDef *const pMPU_AttributesInit) | ||||||
|  | { | ||||||
|  |   MPU_ConfigMemoryAttributes(MPU, pMPU_AttributesInit); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /** | ||||||
|  |   * @brief  Initialize and configure the memory attributes for non-secure MPU. | ||||||
|  |   * @param  pMPU_AttributesInit: Pointer to a MPU_Attributes_InitTypeDef structure that contains | ||||||
|  |   *                the initialization and configuration information. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_MPU_ConfigMemoryAttributes_NS(const MPU_Attributes_InitTypeDef *const pMPU_AttributesInit) | ||||||
|  | { | ||||||
|  |   MPU_ConfigMemoryAttributes(MPU_NS, pMPU_AttributesInit); | ||||||
|  | } | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup CORTEX_Private_Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /** | ||||||
|  |   * @brief  Initialize and configure the Region and the memory to be protected for MPU. | ||||||
|  |   * @param  MPUx: Pointer to MPU_Type structure | ||||||
|  |   *          This parameter can be one of the following values: | ||||||
|  |   *            @arg MPU | ||||||
|  |   *            @arg MPU_NS | ||||||
|  |   * @param  pMPU_RegionInit: Pointer to a MPU_Region_InitTypeDef structure that contains | ||||||
|  |   *                the initialization and configuration information. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | static void MPU_ConfigRegion(MPU_Type *MPUx, const MPU_Region_InitTypeDef *const pMPU_RegionInit) | ||||||
|  | { | ||||||
|  |   /* Check the parameters */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |   assert_param(IS_MPU_INSTANCE(MPUx)); | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |   assert_param(IS_MPU_REGION_NUMBER(pMPU_RegionInit->Number)); | ||||||
|  |   assert_param(IS_MPU_REGION_ENABLE(pMPU_RegionInit->Enable)); | ||||||
|  |   assert_param(IS_MPU_INSTRUCTION_ACCESS(pMPU_RegionInit->DisableExec)); | ||||||
|  |   assert_param(IS_MPU_REGION_PERMISSION_ATTRIBUTE(pMPU_RegionInit->AccessPermission)); | ||||||
|  |   assert_param(IS_MPU_ACCESS_SHAREABLE(pMPU_RegionInit->IsShareable)); | ||||||
|  |  | ||||||
|  |   /* Follow ARM recommendation with Data Memory Barrier prior to MPU configuration */ | ||||||
|  |   __DMB(); | ||||||
|  |  | ||||||
|  |   /* Set the Region number */ | ||||||
|  |   MPUx->RNR = pMPU_RegionInit->Number; | ||||||
|  |  | ||||||
|  |   /* Disable the Region */ | ||||||
|  |   CLEAR_BIT(MPUx->RLAR, MPU_RLAR_EN_Msk); | ||||||
|  |  | ||||||
|  |   MPUx->RBAR = (((uint32_t)pMPU_RegionInit->BaseAddress               & 0xFFFFFFE0UL)  | | ||||||
|  |                 ((uint32_t)pMPU_RegionInit->IsShareable           << MPU_RBAR_SH_Pos)  | | ||||||
|  |                 ((uint32_t)pMPU_RegionInit->AccessPermission      << MPU_RBAR_AP_Pos)  | | ||||||
|  |                 ((uint32_t)pMPU_RegionInit->DisableExec           << MPU_RBAR_XN_Pos)); | ||||||
|  |  | ||||||
|  |   MPUx->RLAR = (((uint32_t)pMPU_RegionInit->LimitAddress                    & 0xFFFFFFE0UL) | | ||||||
|  |                 ((uint32_t)pMPU_RegionInit->AttributesIndex       << MPU_RLAR_AttrIndx_Pos) | | ||||||
|  |                 ((uint32_t)pMPU_RegionInit->Enable                << MPU_RLAR_EN_Pos)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Initialize and configure the memory attributes for MPU. | ||||||
|  |   * @param  MPUx: Pointer to MPU_Type structure | ||||||
|  |   *          This parameter can be one of the following values: | ||||||
|  |   *            @arg MPU | ||||||
|  |   *            @arg MPU_NS | ||||||
|  |   * @param  pMPU_AttributesInit: Pointer to a MPU_Attributes_InitTypeDef structure that contains | ||||||
|  |   *                the initialization and configuration information. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | static void MPU_ConfigMemoryAttributes(MPU_Type *MPUx, const MPU_Attributes_InitTypeDef *const pMPU_AttributesInit) | ||||||
|  | { | ||||||
|  |   __IO uint32_t *p_mair; | ||||||
|  |   uint32_t      attr_values; | ||||||
|  |   uint32_t      attr_number; | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |   assert_param(IS_MPU_INSTANCE(MPUx)); | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |   assert_param(IS_MPU_ATTRIBUTES_NUMBER(pMPU_AttributesInit->Number)); | ||||||
|  |   /* No need to check Attributes value as all 0x0..0xFF possible */ | ||||||
|  |  | ||||||
|  |   /* Follow ARM recommendation with Data Memory Barrier prior to MPUx configuration */ | ||||||
|  |   __DMB(); | ||||||
|  |  | ||||||
|  |   if (pMPU_AttributesInit->Number < MPU_ATTRIBUTES_NUMBER4) | ||||||
|  |   { | ||||||
|  |     /* Program MPU_MAIR0 */ | ||||||
|  |     p_mair = &(MPUx->MAIR0); | ||||||
|  |     attr_number = pMPU_AttributesInit->Number; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* Program MPU_MAIR1 */ | ||||||
|  |     p_mair = &(MPUx->MAIR1); | ||||||
|  |     attr_number = (uint32_t)pMPU_AttributesInit->Number - 4U; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   attr_values = *(p_mair); | ||||||
|  |   attr_values &=  ~(0xFFUL << (attr_number * 8U)); | ||||||
|  |   *(p_mair) = attr_values | ((uint32_t)pMPU_AttributesInit->Attributes << (attr_number * 8U)); | ||||||
|  | } | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #endif /* HAL_CORTEX_MODULE_ENABLED */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
							
								
								
									
										1722
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_dma.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1722
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_dma.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										4762
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_dma_ex.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4762
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_dma_ex.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										874
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_exti.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										874
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_exti.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,874 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_exti.c | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   EXTI HAL module driver. | ||||||
|  |   *          This file provides firmware functions to manage the following | ||||||
|  |   *          functionalities of the General Purpose Input/Output (EXTI) peripheral: | ||||||
|  |   *           + Initialization and de-initialization functions | ||||||
|  |   *           + IO operation functions | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   @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 diffenrents | ||||||
|  |         interrupt 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 | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @addtogroup EXTI | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_EXTI_MODULE_ENABLED | ||||||
|  |  | ||||||
|  | /* Private typedef -----------------------------------------------------------*/ | ||||||
|  | /* Private defines ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup EXTI_Private_Constants EXTI Private Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define EXTI_MODE_OFFSET                    0x04U   /* 0x10: byte offset between: IMR1/EMR1 and IMR2/EMR2 registers */ | ||||||
|  | #define EXTI_CONFIG_OFFSET                  0x08U   /* 0x20: byte offset between Rising1/Falling1 and Rising2/Falling2  | ||||||
|  |                                                              configuration registers */ | ||||||
|  | #define EXTI_PRIVCFGR_OFFSET                0x08U   /* 0x20: byte offset between PRIVCFGR1 and PRIVCFGR2 registers */ | ||||||
|  | #define EXTI_SECCFGR_OFFSET                 0x08U   /* 0x20: byte offset between SECCFGR1 and SECCFGR2 registers */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* 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) | ||||||
|  | { | ||||||
|  |   __IO uint32_t *regaddr; | ||||||
|  |   uint32_t regval; | ||||||
|  |   uint32_t linepos; | ||||||
|  |   uint32_t maskline; | ||||||
|  |   uint32_t offset; | ||||||
|  |  | ||||||
|  |   /* Check null pointer */ | ||||||
|  |   if ((hexti == NULL) || (pExtiConfig == NULL)) | ||||||
|  |   { | ||||||
|  |     return HAL_ERROR; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Check the 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 register offset and line mask */ | ||||||
|  |   offset = ((pExtiConfig->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT); | ||||||
|  |   linepos = (pExtiConfig->Line & EXTI_PIN_MASK); | ||||||
|  |   maskline = (1UL << linepos); | ||||||
|  |  | ||||||
|  |   /* Configure triggers for configurable lines */ | ||||||
|  |   if ((pExtiConfig->Line & EXTI_CONFIG) != 0U) | ||||||
|  |   { | ||||||
|  |     assert_param(IS_EXTI_TRIGGER(pExtiConfig->Trigger)); | ||||||
|  |  | ||||||
|  |     /* Configure rising trigger */ | ||||||
|  |     regaddr = (__IO uint32_t *)(&EXTI->RTSR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |     regval = *regaddr; | ||||||
|  |  | ||||||
|  |     /* Mask or set line */ | ||||||
|  |     if ((pExtiConfig->Trigger & EXTI_TRIGGER_RISING) != 0U) | ||||||
|  |     { | ||||||
|  |       regval |= maskline; | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |       regval &= ~maskline; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /* Store rising trigger mode */ | ||||||
|  |     *regaddr = regval; | ||||||
|  |  | ||||||
|  |     /* Configure falling trigger */ | ||||||
|  |     regaddr = (__IO uint32_t *)(&EXTI->FTSR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |     regval = *regaddr; | ||||||
|  |  | ||||||
|  |     /* Mask or set line */ | ||||||
|  |     if ((pExtiConfig->Trigger & EXTI_TRIGGER_FALLING) != 0U) | ||||||
|  |     { | ||||||
|  |       regval |= maskline; | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |       regval &= ~maskline; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /* Store falling trigger mode */ | ||||||
|  |     *regaddr = regval; | ||||||
|  |  | ||||||
|  |     /* 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 = EXTI->EXTICR[(linepos >> 2U) & 0x03UL]; | ||||||
|  |       regval &= ~(EXTI_EXTICR1_EXTI0 << (EXTI_EXTICR1_EXTI1_Pos * (linepos & 0x03U))); | ||||||
|  |       regval |= (pExtiConfig->GPIOSel << (EXTI_EXTICR1_EXTI1_Pos * (linepos & 0x03U))); | ||||||
|  |       EXTI->EXTICR[(linepos >> 2U) & 0x03UL] = regval; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Configure interrupt mode : read current mode */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->IMR1 + (EXTI_MODE_OFFSET * offset)); | ||||||
|  |   regval = *regaddr; | ||||||
|  |  | ||||||
|  |   /* Mask or set line */ | ||||||
|  |   if ((pExtiConfig->Mode & EXTI_MODE_INTERRUPT) != 0U) | ||||||
|  |   { | ||||||
|  |     regval |= maskline; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     regval &= ~maskline; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Store interrupt mode */ | ||||||
|  |   *regaddr = regval; | ||||||
|  |  | ||||||
|  |   /* Configure event mode : read current mode */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->EMR1 + (EXTI_MODE_OFFSET * offset)); | ||||||
|  |   regval = *regaddr; | ||||||
|  |  | ||||||
|  |   /* Mask or set line */ | ||||||
|  |   if ((pExtiConfig->Mode & EXTI_MODE_EVENT) != 0U) | ||||||
|  |   { | ||||||
|  |     regval |= maskline; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     regval &= ~maskline; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Store event mode */ | ||||||
|  |   *regaddr = regval; | ||||||
|  |  | ||||||
|  |   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) | ||||||
|  | { | ||||||
|  |   const __IO uint32_t *regaddr; | ||||||
|  |   uint32_t regval; | ||||||
|  |   uint32_t linepos; | ||||||
|  |   uint32_t maskline; | ||||||
|  |   uint32_t offset; | ||||||
|  |  | ||||||
|  |   /* 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 configiguration structure */ | ||||||
|  |   pExtiConfig->Line = hexti->Line; | ||||||
|  |  | ||||||
|  |   /* compute line register offset and line mask */ | ||||||
|  |   offset = ((pExtiConfig->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT); | ||||||
|  |   linepos = (pExtiConfig->Line & EXTI_PIN_MASK); | ||||||
|  |   maskline = (1UL << linepos); | ||||||
|  |  | ||||||
|  |   /* 1] Get core mode : interrupt */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->IMR1 + (EXTI_MODE_OFFSET * offset)); | ||||||
|  |   regval = *regaddr; | ||||||
|  |  | ||||||
|  |   /* Check if selected line is enable */ | ||||||
|  |   if ((regval & maskline) != 0U) | ||||||
|  |   { | ||||||
|  |     pExtiConfig->Mode = EXTI_MODE_INTERRUPT; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     pExtiConfig->Mode = EXTI_MODE_NONE; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Get event mode */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->EMR1 + (EXTI_MODE_OFFSET * offset)); | ||||||
|  |   regval = *regaddr; | ||||||
|  |  | ||||||
|  |   /* Check if selected line is enable */ | ||||||
|  |   if ((regval & maskline) != 0U) | ||||||
|  |   { | ||||||
|  |     pExtiConfig->Mode |= EXTI_MODE_EVENT; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* 2] Get trigger for configurable lines : rising */ | ||||||
|  |   if ((pExtiConfig->Line & EXTI_CONFIG) != 0U) | ||||||
|  |   { | ||||||
|  |     regaddr = (__IO uint32_t *)(&EXTI->RTSR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |     regval = *regaddr; | ||||||
|  |  | ||||||
|  |     /* Get default Trigger and GPIOSel configuration */ | ||||||
|  |     pExtiConfig->Trigger = EXTI_TRIGGER_NONE; | ||||||
|  |     pExtiConfig->GPIOSel = 0x00u; | ||||||
|  |  | ||||||
|  |     /* Check if configuration of selected line is enable */ | ||||||
|  |     if ((regval & maskline) != 0U) | ||||||
|  |     { | ||||||
|  |       pExtiConfig->Trigger = EXTI_TRIGGER_RISING; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /* Get falling configuration */ | ||||||
|  |     regaddr = (__IO uint32_t *)(&EXTI->FTSR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |     regval = *regaddr; | ||||||
|  |  | ||||||
|  |     /* Check if configuration of selected line is enable */ | ||||||
|  |     if ((regval & maskline) != 0U) | ||||||
|  |     { | ||||||
|  |       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 = EXTI->EXTICR[(linepos >> 2U) & 0x03UL]; | ||||||
|  |       pExtiConfig->GPIOSel = (regval >> (EXTI_EXTICR1_EXTI1_Pos * (linepos & 0x03u))) & EXTI_EXTICR1_EXTI0; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Clear whole configuration of a dedicated Exti line. | ||||||
|  |   * @param  hexti Exti handle. | ||||||
|  |   * @retval HAL Status. | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_EXTI_ClearConfigLine(const EXTI_HandleTypeDef *hexti) | ||||||
|  | { | ||||||
|  |   __IO uint32_t *regaddr; | ||||||
|  |   uint32_t regval; | ||||||
|  |   uint32_t linepos; | ||||||
|  |   uint32_t maskline; | ||||||
|  |   uint32_t offset; | ||||||
|  |  | ||||||
|  |   /* Check null pointer */ | ||||||
|  |   if (hexti == NULL) | ||||||
|  |   { | ||||||
|  |     return HAL_ERROR; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Check the parameter */ | ||||||
|  |   assert_param(IS_EXTI_LINE(hexti->Line)); | ||||||
|  |  | ||||||
|  |   /* compute line register offset and line mask */ | ||||||
|  |   offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT); | ||||||
|  |   linepos = (hexti->Line & EXTI_PIN_MASK); | ||||||
|  |   maskline = (1UL << linepos); | ||||||
|  |  | ||||||
|  |   /* 1] Clear interrupt mode */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->IMR1 + (EXTI_MODE_OFFSET * offset)); | ||||||
|  |   regval = (*regaddr & ~maskline); | ||||||
|  |   *regaddr = regval; | ||||||
|  |  | ||||||
|  |   /* 2] Clear event mode */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->EMR1 + (EXTI_MODE_OFFSET * offset)); | ||||||
|  |   regval = (*regaddr & ~maskline); | ||||||
|  |   *regaddr = regval; | ||||||
|  |  | ||||||
|  |   /* 3] Clear triggers in case of configurable lines */ | ||||||
|  |   if ((hexti->Line & EXTI_CONFIG) != 0U) | ||||||
|  |   { | ||||||
|  |     regaddr = (__IO uint32_t *)(&EXTI->RTSR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |     regval = (*regaddr & ~maskline); | ||||||
|  |     *regaddr = regval; | ||||||
|  |  | ||||||
|  |     regaddr = (__IO uint32_t *)(&EXTI->FTSR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |     regval = (*regaddr & ~maskline); | ||||||
|  |     *regaddr = regval; | ||||||
|  |  | ||||||
|  |     /* Get Gpio port selection for gpio lines */ | ||||||
|  |     if ((hexti->Line & EXTI_GPIO) == EXTI_GPIO) | ||||||
|  |     { | ||||||
|  |       assert_param(IS_EXTI_GPIO_PIN(linepos)); | ||||||
|  |  | ||||||
|  |       regval = EXTI->EXTICR[(linepos >> 2U) & 0x03UL]; | ||||||
|  |       regval &= ~(EXTI_EXTICR1_EXTI0 << (EXTI_EXTICR1_EXTI1_Pos * (linepos & 0x03U))); | ||||||
|  |       EXTI->EXTICR[(linepos >> 2U) & 0x03UL] = regval; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Register callback for a dedicaated 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->RisingCallback = pPendingCbfn; | ||||||
|  |       hexti->FallingCallback = pPendingCbfn; | ||||||
|  |       break; | ||||||
|  |  | ||||||
|  |     case  HAL_EXTI_RISING_CB_ID: | ||||||
|  |       hexti->RisingCallback = pPendingCbfn; | ||||||
|  |       break; | ||||||
|  |  | ||||||
|  |     case  HAL_EXTI_FALLING_CB_ID: | ||||||
|  |       hexti->FallingCallback = 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(const EXTI_HandleTypeDef *hexti) | ||||||
|  | { | ||||||
|  |   __IO uint32_t *regaddr; | ||||||
|  |   uint32_t regval; | ||||||
|  |   uint32_t maskline; | ||||||
|  |   uint32_t offset; | ||||||
|  |  | ||||||
|  |   /* Compute line register offset and line mask */ | ||||||
|  |   offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT); | ||||||
|  |   maskline = (1UL << (hexti->Line & EXTI_PIN_MASK)); | ||||||
|  |  | ||||||
|  |   /* Get rising edge pending bit  */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->RPR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |   regval = (*regaddr & maskline); | ||||||
|  |  | ||||||
|  |   if (regval != 0U) | ||||||
|  |   { | ||||||
|  |     /* Clear pending bit */ | ||||||
|  |     *regaddr = maskline; | ||||||
|  |  | ||||||
|  |     /* Call rising callback */ | ||||||
|  |     if (hexti->RisingCallback != NULL) | ||||||
|  |     { | ||||||
|  |       hexti->RisingCallback(); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Get falling edge pending bit  */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->FPR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |   regval = (*regaddr & maskline); | ||||||
|  |  | ||||||
|  |   if (regval != 0U) | ||||||
|  |   { | ||||||
|  |     /* Clear pending bit */ | ||||||
|  |     *regaddr = maskline; | ||||||
|  |  | ||||||
|  |     /* Call rising callback */ | ||||||
|  |     if (hexti->FallingCallback != NULL) | ||||||
|  |     { | ||||||
|  |       hexti->FallingCallback(); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @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 | ||||||
|  |   *           @arg @ref EXTI_TRIGGER_FALLING | ||||||
|  |   * @retval 1 if interrupt is pending else 0. | ||||||
|  |   */ | ||||||
|  | uint32_t HAL_EXTI_GetPending(const EXTI_HandleTypeDef *hexti, uint32_t Edge) | ||||||
|  | { | ||||||
|  |   const __IO uint32_t *regaddr; | ||||||
|  |   uint32_t regval; | ||||||
|  |   uint32_t linepos; | ||||||
|  |   uint32_t maskline; | ||||||
|  |   uint32_t offset; | ||||||
|  |  | ||||||
|  |   /* Check the 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 register offset and line mask */ | ||||||
|  |   offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT); | ||||||
|  |   linepos = (hexti->Line & EXTI_PIN_MASK); | ||||||
|  |   maskline = (1UL << linepos); | ||||||
|  |  | ||||||
|  |   if (Edge != EXTI_TRIGGER_RISING) | ||||||
|  |   { | ||||||
|  |     /* Get falling edge pending bit */ | ||||||
|  |     regaddr = (__IO uint32_t *)(&EXTI->FPR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* Get rising edge pending bit */ | ||||||
|  |     regaddr = (__IO uint32_t *)(&EXTI->RPR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* return 1 if bit is set else 0 */ | ||||||
|  |   regval = ((*regaddr & 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 | ||||||
|  |   *           @arg @ref EXTI_TRIGGER_FALLING | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | void HAL_EXTI_ClearPending(const EXTI_HandleTypeDef *hexti, uint32_t Edge) | ||||||
|  | { | ||||||
|  |   __IO uint32_t *regaddr; | ||||||
|  |   uint32_t maskline; | ||||||
|  |   uint32_t offset; | ||||||
|  |  | ||||||
|  |   /* Check the 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 register offset and line mask */ | ||||||
|  |   offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT); | ||||||
|  |   maskline = (1UL << (hexti->Line & EXTI_PIN_MASK)); | ||||||
|  |  | ||||||
|  |   if (Edge != EXTI_TRIGGER_RISING) | ||||||
|  |   { | ||||||
|  |     /* Get falling edge pending register address */ | ||||||
|  |     regaddr = (__IO uint32_t *)(&EXTI->FPR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* Get falling edge pending register address */ | ||||||
|  |     regaddr = (__IO uint32_t *)(&EXTI->RPR1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Clear Pending bit */ | ||||||
|  |   *regaddr =  maskline; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Generate a software interrupt for a dedicated line. | ||||||
|  |   * @param  hexti Exti handle. | ||||||
|  |   * @retval None. | ||||||
|  |   */ | ||||||
|  | void HAL_EXTI_GenerateSWI(const EXTI_HandleTypeDef *hexti) | ||||||
|  | { | ||||||
|  |   __IO uint32_t *regaddr; | ||||||
|  |   uint32_t maskline; | ||||||
|  |   uint32_t offset; | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_EXTI_LINE(hexti->Line)); | ||||||
|  |   assert_param(IS_EXTI_CONFIG_LINE(hexti->Line)); | ||||||
|  |  | ||||||
|  |   /* compute line register offset and line mask */ | ||||||
|  |   offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT); | ||||||
|  |   maskline = (1UL << (hexti->Line & EXTI_PIN_MASK)); | ||||||
|  |  | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->SWIER1 + (EXTI_CONFIG_OFFSET * offset)); | ||||||
|  |   *regaddr = maskline; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup EXTI_Exported_Functions_Group3 EXTI line attributes management functions | ||||||
|  |   *  @brief EXTI attributes management functions. | ||||||
|  |   * | ||||||
|  | @verbatim | ||||||
|  |  =============================================================================== | ||||||
|  |                        ##### EXTI attributes functions ##### | ||||||
|  |  =============================================================================== | ||||||
|  |  | ||||||
|  | @endverbatim | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Configure the EXTI line attribute(s). | ||||||
|  |   * @note   Available attributes are to secure EXTI line and set EXT line as privileged. | ||||||
|  |   *         Default state is not secure and unprivileged access allowed. | ||||||
|  |   * @note   Secure and non-secure attributes can only be set from the secure | ||||||
|  |   *         state when the system implements the security (TZEN=1). | ||||||
|  |   * @note   Security and privilege attributes can be set independently. | ||||||
|  |   * @param  ExtiLine Exti line number. | ||||||
|  |   *         This parameter can be from 0 to @ref EXTI_LINE_NB. | ||||||
|  |   * @param  LineAttributes can be one or a combination of the following values: | ||||||
|  |   *            @arg @ref EXTI_LINE_PRIV         Privileged-only access | ||||||
|  |   *            @arg @ref EXTI_LINE_NPRIV        Privileged/Non-privileged access | ||||||
|  |   *            @arg @ref EXTI_LINE_SEC          Secure-only access | ||||||
|  |   *            @arg @ref EXTI_LINE_NSEC         Secure/Non-secure access | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_EXTI_ConfigLineAttributes(uint32_t ExtiLine, uint32_t LineAttributes) | ||||||
|  | { | ||||||
|  |   __IO uint32_t *regaddr; | ||||||
|  |   uint32_t regval; | ||||||
|  |   uint32_t linepos; | ||||||
|  |   uint32_t maskline; | ||||||
|  |   uint32_t offset; | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_EXTI_LINE(ExtiLine)); | ||||||
|  |   assert_param(IS_EXTI_LINE_ATTRIBUTES(LineAttributes)); | ||||||
|  |  | ||||||
|  |   /* compute line register offset and line mask */ | ||||||
|  |   offset = ((ExtiLine & EXTI_REG_MASK) >> EXTI_REG_SHIFT); | ||||||
|  |   linepos = (ExtiLine & EXTI_PIN_MASK); | ||||||
|  |   maskline = (1UL << linepos); | ||||||
|  |  | ||||||
|  |   /* Configure privilege or non-privilege attributes */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->PRIVCFGR1 + (EXTI_PRIVCFGR_OFFSET * offset)); | ||||||
|  |   regval = *regaddr; | ||||||
|  |  | ||||||
|  |   /* Mask or set line */ | ||||||
|  |   if ((LineAttributes & EXTI_LINE_PRIV) == EXTI_LINE_PRIV) | ||||||
|  |   { | ||||||
|  |     regval |= maskline; | ||||||
|  |   } | ||||||
|  |   else if ((LineAttributes & EXTI_LINE_NPRIV) == EXTI_LINE_NPRIV) | ||||||
|  |   { | ||||||
|  |     regval &= ~maskline; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* do nothing */ | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Store privilege or non-privilege attribute */ | ||||||
|  |   *regaddr = regval; | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |  | ||||||
|  |   /* Configure secure or non-secure attributes */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->SECCFGR1 + (EXTI_SECCFGR_OFFSET * offset)); | ||||||
|  |   regval = *regaddr; | ||||||
|  |  | ||||||
|  |   /* Mask or set line */ | ||||||
|  |   if ((LineAttributes & EXTI_LINE_SEC) == EXTI_LINE_SEC) | ||||||
|  |   { | ||||||
|  |     regval |= maskline; | ||||||
|  |   } | ||||||
|  |   else if ((LineAttributes & EXTI_LINE_NSEC) == EXTI_LINE_NSEC) | ||||||
|  |   { | ||||||
|  |     regval &= ~maskline; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* do nothing */ | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Store secure or non-secure attribute */ | ||||||
|  |   *regaddr = regval; | ||||||
|  |  | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the EXTI line attribute(s). | ||||||
|  |   * @note   Secure and non-secure attributes are only available from secure state | ||||||
|  |   *         when the system implements the security (TZEN=1) | ||||||
|  |   * @param  ExtiLine Exti line number. | ||||||
|  |   *         This parameter can be from 0 to @ref EXTI_LINE_NB. | ||||||
|  |   * @param  pLineAttributes: pointer to return line attributes. | ||||||
|  |   * @retval HAL Status. | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_EXTI_GetConfigLineAttributes(uint32_t ExtiLine, uint32_t *pLineAttributes) | ||||||
|  | { | ||||||
|  |   const __IO uint32_t *regaddr; | ||||||
|  |   uint32_t linepos; | ||||||
|  |   uint32_t maskline; | ||||||
|  |   uint32_t offset; | ||||||
|  |   uint32_t attributes; | ||||||
|  |  | ||||||
|  |   /* Check null pointer */ | ||||||
|  |   if (pLineAttributes == NULL) | ||||||
|  |   { | ||||||
|  |     return HAL_ERROR; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_EXTI_LINE(ExtiLine)); | ||||||
|  |  | ||||||
|  |   /* Compute line register offset and line mask */ | ||||||
|  |   offset = ((ExtiLine & EXTI_REG_MASK) >> EXTI_REG_SHIFT); | ||||||
|  |   linepos = (ExtiLine & EXTI_PIN_MASK); | ||||||
|  |   maskline = (1UL << linepos); | ||||||
|  |  | ||||||
|  |   /* Get privilege or non-privilege attribute */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->PRIVCFGR1 + (EXTI_PRIVCFGR_OFFSET * offset)); | ||||||
|  |  | ||||||
|  |   if ((*regaddr & maskline) != 0U) | ||||||
|  |   { | ||||||
|  |     attributes = EXTI_LINE_PRIV; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     attributes = EXTI_LINE_NPRIV; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |  | ||||||
|  |   /* Get secure or non-secure attribute */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->SECCFGR1 + (EXTI_SECCFGR_OFFSET * offset)); | ||||||
|  |  | ||||||
|  |   if ((*regaddr & maskline) != 0U) | ||||||
|  |   { | ||||||
|  |     attributes |= EXTI_LINE_SEC; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     attributes |= EXTI_LINE_NSEC; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  |   /* return value */ | ||||||
|  |   *pLineAttributes = attributes; | ||||||
|  |  | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  | #if defined (EXTI_LOCKR_LOCK) | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  | /** | ||||||
|  |   * @brief  Lock the global EXTI security and privilege configuration. | ||||||
|  |   * @retval HAL Status. | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_EXTI_LockConfigAttributes(void) | ||||||
|  | { | ||||||
|  |   EXTI->LOCKR = EXTI_ATTRIBUTES_LOCKED; | ||||||
|  |  | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the global EXTI security and privilege lock configuration. | ||||||
|  |   * @param  pLockState : Pointer to returned security and privilege configuration | ||||||
|  |   * @retval HAL Status. | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_EXTI_GetLockConfigAttributes(uint32_t *const pLockState) | ||||||
|  | { | ||||||
|  |   uint32_t attributes; | ||||||
|  |   const __IO uint32_t *regaddr; | ||||||
|  |  | ||||||
|  |   /* Check null pointer */ | ||||||
|  |   if (pLockState == NULL) | ||||||
|  |   { | ||||||
|  |     return HAL_ERROR; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Get security and privilege configuration */ | ||||||
|  |   regaddr = (__IO uint32_t *)(&EXTI->LOCKR); | ||||||
|  |  | ||||||
|  |   if ((*regaddr & EXTI_LOCKR_LOCK) != 0U) | ||||||
|  |   { | ||||||
|  |     attributes = EXTI_ATTRIBUTES_LOCKED; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     attributes = EXTI_ATTRIBUTES_UNLOCKED; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* return value */ | ||||||
|  |   *pLockState = attributes; | ||||||
|  |  | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  | #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */ | ||||||
|  | #endif /* defined (EXTI_LOCKR_LOCK) */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #endif /* HAL_EXTI_MODULE_ENABLED */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
							
								
								
									
										964
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_flash.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										964
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_flash.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,964 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_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 | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |  @verbatim | ||||||
|  |   ============================================================================== | ||||||
|  |                         ##### FLASH peripheral features ##### | ||||||
|  |   ============================================================================== | ||||||
|  |  | ||||||
|  |   [..] The Flash memory interface manages CPU AHB C-Bus accesses to the Flash memory. | ||||||
|  |        It implements the erase and program Flash memory operations and the read | ||||||
|  |        and write protection mechanisms. | ||||||
|  |  | ||||||
|  |   [..] The FLASH main features are: | ||||||
|  |       (+) Flash memory read operations | ||||||
|  |       (+) Flash memory program/erase operations | ||||||
|  |       (+) Read / write protections | ||||||
|  |       (+) Option bytes programming | ||||||
|  |       (+) TrustZone aware | ||||||
|  |       (+) Watermark-based area protection | ||||||
|  |       (+) Block-based sector protection | ||||||
|  |       (+) Error code correction (ECC) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |                         ##### How to use this driver ##### | ||||||
|  |  ============================================================================== | ||||||
|  |     [..] | ||||||
|  |       This driver provides functions and macros to configure and program the FLASH | ||||||
|  |       memory of all STM32H5xx devices. | ||||||
|  |  | ||||||
|  |       (#) FLASH Memory IO Programming functions: | ||||||
|  |            (++) Lock and Unlock the FLASH interface using HAL_FLASH_Unlock() and | ||||||
|  |                 HAL_FLASH_Lock() functions | ||||||
|  |            (++) Flash memory programming by 128 bits (user area, OBKeys) and 16 bits (OTP and Flash high-cycle | ||||||
|  |                 data area) | ||||||
|  |            (++) 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() | ||||||
|  |            (++) Callback functions are called when the flash operations are finished : | ||||||
|  |                 HAL_FLASH_EndOfOperationCallback() when everything is ok, otherwise | ||||||
|  |                 HAL_FLASH_OperationErrorCallback() | ||||||
|  |            (++) Get error flag status by calling HAL_FLASH_GetError() | ||||||
|  |  | ||||||
|  |       (#) Option bytes management functions : | ||||||
|  |            (++) Lock and Unlock the option bytes using HAL_FLASH_OB_Unlock() and | ||||||
|  |                 HAL_FLASH_OB_Lock() functions | ||||||
|  |            (++) Launch the reload of the option bytes using HAL_FLASH_OB_Launch() function. | ||||||
|  |                 In this case, a reset is generated | ||||||
|  |     [..] | ||||||
|  |       In addition to these functions, this driver includes a set of macros allowing | ||||||
|  |       to handle the following operations: | ||||||
|  |        (+) Set the latency | ||||||
|  |        (+) Enable/Disable the FLASH interrupts | ||||||
|  |        (+) Monitor the FLASH flags status | ||||||
|  |      [..] | ||||||
|  |     (@) The contents of the Flash memory are not guaranteed if a device reset occurs during | ||||||
|  |         a Flash memory operation. | ||||||
|  |  | ||||||
|  |  @endverbatim | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup FLASH FLASH | ||||||
|  |   * @brief FLASH HAL module driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_FLASH_MODULE_ENABLED | ||||||
|  |  | ||||||
|  | /* Private typedef -----------------------------------------------------------*/ | ||||||
|  | /* Private define ------------------------------------------------------------*/ | ||||||
|  | /* Private macro -------------------------------------------------------------*/ | ||||||
|  | /* Private variables ---------------------------------------------------------*/ | ||||||
|  | /** @defgroup FLASH_Private_Variables FLASH Private Variables | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /** | ||||||
|  |   * @brief  Variable used for Program/Erase sectors under interruption | ||||||
|  |   */ | ||||||
|  | FLASH_ProcessTypeDef pFlash = {.Lock = HAL_UNLOCKED, \ | ||||||
|  |                                .ErrorCode = HAL_FLASH_ERROR_NONE, \ | ||||||
|  |                                .ProcedureOnGoing = 0U, \ | ||||||
|  |                                .Address = 0U, \ | ||||||
|  |                                .Bank = FLASH_BANK_1, \ | ||||||
|  |                                .Sector = 0U, \ | ||||||
|  |                                .NbSectorsToErase = 0U | ||||||
|  |                               }; | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | /* Private function prototypes -----------------------------------------------*/ | ||||||
|  | /** @defgroup FLASH_Private_Functions FLASH Private Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | static void          FLASH_Program_QuadWord(uint32_t FlashAddress, uint32_t DataAddress); | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | static void          FLASH_Program_QuadWord_OBK(uint32_t FlashAddress, uint32_t DataAddress); | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | static void          FLASH_Program_HalfWord(uint32_t FlashAddress, uint32_t DataAddress); | ||||||
|  | #if defined(FLASH_EDATAR_EDATA_EN) | ||||||
|  | static void          FLASH_Program_Word(uint32_t FlashAddress, uint32_t DataAddress); | ||||||
|  | #endif /* FLASH_EDATAR_EDATA_EN */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | /* 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 a quad-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  FlashAddress specifies the address to be programmed. | ||||||
|  |   *         This parameter shall be aligned to the Flash word (128-bit) | ||||||
|  |   * @param  DataAddress specifies the address of data to be programmed | ||||||
|  |   *         This parameter shall be 32-bit aligned | ||||||
|  |   * @retval HAL_StatusTypeDef HAL Status | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t FlashAddress, uint32_t DataAddress) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status; | ||||||
|  |   __IO uint32_t *reg_cr; | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  |   __IO uint32_t *reg_obkcfgr; | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_FLASH_TYPEPROGRAM(TypeProgram)); | ||||||
|  |  | ||||||
|  |   /* Reset error code */ | ||||||
|  |   pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; | ||||||
|  |  | ||||||
|  |   /* Wait for last operation to be completed */ | ||||||
|  |   status = FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE); | ||||||
|  |  | ||||||
|  |   if (status == HAL_OK) | ||||||
|  |   { | ||||||
|  |     /* Set current operation type */ | ||||||
|  |     pFlash.ProcedureOnGoing = TypeProgram; | ||||||
|  |  | ||||||
|  |     /* Access to SECCR or NSCR depends on operation type */ | ||||||
|  | #if defined (FLASH_OPTSR2_TZEN) | ||||||
|  |     reg_cr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECCR) : &(FLASH_NS->NSCR); | ||||||
|  | #else | ||||||
|  |     reg_cr = &(FLASH_NS->NSCR); | ||||||
|  | #endif /* FLASH_OPTSR2_TZEN */ | ||||||
|  |  | ||||||
|  |     if ((TypeProgram & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEPROGRAM_QUADWORD) | ||||||
|  |     { | ||||||
|  |       /* Check the parameters */ | ||||||
|  |       assert_param(IS_FLASH_USER_MEM_ADDRESS(FlashAddress)); | ||||||
|  |  | ||||||
|  |       /* Program a quad-word (128-bit) at a specified address */ | ||||||
|  |       FLASH_Program_QuadWord(FlashAddress, DataAddress); | ||||||
|  |     } | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  |     else if ((TypeProgram == FLASH_TYPEPROGRAM_QUADWORD_OBK) || (TypeProgram == FLASH_TYPEPROGRAM_QUADWORD_OBK_ALT)) | ||||||
|  |     { | ||||||
|  |       /* Check the parameters */ | ||||||
|  |       assert_param(IS_FLASH_OBK_ADDRESS(FlashAddress)); | ||||||
|  |  | ||||||
|  |       /* Program a quad-word (128-bit) of OBK at a specified address */ | ||||||
|  |       FLASH_Program_QuadWord_OBK(FlashAddress, DataAddress); | ||||||
|  |     } | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | #if defined (FLASH_EDATAR_EDATA_EN) | ||||||
|  |     else if ((TypeProgram & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEPROGRAM_HALFWORD_EDATA) | ||||||
|  |     { | ||||||
|  |       /* Check the parameters */ | ||||||
|  |       assert_param(IS_FLASH_EDATA_ADDRESS(FlashAddress)); | ||||||
|  |  | ||||||
|  |       /* Program a Flash high-cycle data half-word at a specified address */ | ||||||
|  |       FLASH_Program_HalfWord(FlashAddress, DataAddress); | ||||||
|  |     } | ||||||
|  |     else if ((TypeProgram & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEPROGRAM_WORD_EDATA) | ||||||
|  |     { | ||||||
|  |       /* Check the parameters */ | ||||||
|  |       assert_param(IS_FLASH_EDATA_ADDRESS(FlashAddress)); | ||||||
|  |  | ||||||
|  |       /* Program a Flash high-cycle data half-word at a specified address */ | ||||||
|  |       FLASH_Program_Word(FlashAddress, DataAddress); | ||||||
|  |     } | ||||||
|  | #endif /* FLASH_EDATAR_EDATA_EN */ | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |       /* Check the parameters */ | ||||||
|  |       assert_param(IS_FLASH_OTP_ADDRESS(FlashAddress)); | ||||||
|  |  | ||||||
|  |       /* Program an OTP half-word at a specified address */ | ||||||
|  |       FLASH_Program_HalfWord(FlashAddress, DataAddress); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /* Wait for last operation to be completed */ | ||||||
|  |     status = FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE); | ||||||
|  |  | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  |     /* If the program operation is completed, disable the PG */ | ||||||
|  |     CLEAR_BIT((*reg_cr), (TypeProgram & ~(FLASH_NON_SECURE_MASK | FLASH_OBK | FLASH_OTP | FLASH_OBKCFGR_ALT_SECT))); | ||||||
|  |  | ||||||
|  |     /* Clear alternate sector bit */ | ||||||
|  |     if (TypeProgram == FLASH_TYPEPROGRAM_QUADWORD_OBK_ALT) | ||||||
|  |     { | ||||||
|  |       reg_obkcfgr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECOBKCFGR) : &(FLASH_NS->NSOBKCFGR); | ||||||
|  |       CLEAR_BIT((*reg_obkcfgr), FLASH_OBKCFGR_ALT_SECT); | ||||||
|  |     } | ||||||
|  | #else | ||||||
|  |     /* If the program operation is completed, disable the PG */ | ||||||
|  |     CLEAR_BIT((*reg_cr), (TypeProgram & ~(FLASH_NON_SECURE_MASK |  FLASH_OTP))); | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  |   } | ||||||
|  |   /* return status */ | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Program a quad-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  FlashAddress specifies the address to be programmed. | ||||||
|  |   *         This parameter shall be aligned to the Flash word (128-bit) | ||||||
|  |   * @param  DataAddress specifies the address of data to be programmed | ||||||
|  |   *         This parameter shall be 32-bit aligned | ||||||
|  |   * @retval HAL Status | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t FlashAddress, uint32_t DataAddress) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status; | ||||||
|  |   __IO uint32_t *reg_cr; | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_FLASH_TYPEPROGRAM(TypeProgram)); | ||||||
|  |  | ||||||
|  |   /* Reset error code */ | ||||||
|  |   pFlash.ErrorCode = HAL_FLASH_ERROR_NONE; | ||||||
|  |  | ||||||
|  |   /* Wait for last operation to be completed */ | ||||||
|  |   status = FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE); | ||||||
|  |  | ||||||
|  |   if (status != HAL_OK) | ||||||
|  |   { | ||||||
|  |     /* Process Unlocked */ | ||||||
|  |     __HAL_UNLOCK(&pFlash); | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* Set internal variables used by the IRQ handler */ | ||||||
|  |     pFlash.ProcedureOnGoing = TypeProgram; | ||||||
|  |     pFlash.Address = FlashAddress; | ||||||
|  |  | ||||||
|  |     /* Access to SECCR or NSCR depends on operation type */ | ||||||
|  | #if defined (FLASH_OPTSR2_TZEN) | ||||||
|  |     reg_cr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECCR) : &(FLASH_NS->NSCR); | ||||||
|  | #else | ||||||
|  |     reg_cr = &(FLASH_NS->NSCR); | ||||||
|  | #endif /* FLASH_OPTSR2_TZEN */ | ||||||
|  |  | ||||||
|  |     /* Enable End of Operation and Error interrupts */ | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  |     (*reg_cr) |= (FLASH_IT_EOP     | FLASH_IT_WRPERR | FLASH_IT_PGSERR | \ | ||||||
|  |                   FLASH_IT_STRBERR | FLASH_IT_INCERR | FLASH_IT_OBKERR | \ | ||||||
|  |                   FLASH_IT_OBKWERR); | ||||||
|  | #else | ||||||
|  |     (*reg_cr) |= (FLASH_IT_EOP     | FLASH_IT_WRPERR | FLASH_IT_PGSERR | \ | ||||||
|  |                   FLASH_IT_STRBERR | FLASH_IT_INCERR); | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  |  | ||||||
|  |     if ((TypeProgram & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEPROGRAM_QUADWORD) | ||||||
|  |     { | ||||||
|  |       /* Check the parameters */ | ||||||
|  |       assert_param(IS_FLASH_USER_MEM_ADDRESS(FlashAddress)); | ||||||
|  |  | ||||||
|  |       /* Program a quad-word (128-bit) at a specified address */ | ||||||
|  |       FLASH_Program_QuadWord(FlashAddress, DataAddress); | ||||||
|  |     } | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  |     else if (((TypeProgram & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEPROGRAM_QUADWORD_OBK) || \ | ||||||
|  |              ((TypeProgram & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEPROGRAM_QUADWORD_OBK_ALT)) | ||||||
|  |     { | ||||||
|  |       /* Check the parameters */ | ||||||
|  |       assert_param(IS_FLASH_OBK_ADDRESS(FlashAddress)); | ||||||
|  |  | ||||||
|  |       /* Program a quad-word (128-bit) of OBK at a specified address */ | ||||||
|  |       FLASH_Program_QuadWord_OBK(FlashAddress, DataAddress); | ||||||
|  |     } | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  | #if defined (FLASH_EDATAR_EDATA_EN) | ||||||
|  |     else if ((TypeProgram & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEPROGRAM_HALFWORD_EDATA) | ||||||
|  |     { | ||||||
|  |       /* Check the parameters */ | ||||||
|  |       assert_param(IS_FLASH_EDATA_ADDRESS(FlashAddress)); | ||||||
|  |  | ||||||
|  |       /* Program a Flash high-cycle data half-word at a specified address */ | ||||||
|  |       FLASH_Program_HalfWord(FlashAddress, DataAddress); | ||||||
|  |     } | ||||||
|  |      else if ((TypeProgram & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEPROGRAM_WORD_EDATA) | ||||||
|  |     { | ||||||
|  |       /* Check the parameters */ | ||||||
|  |       assert_param(IS_FLASH_EDATA_ADDRESS(FlashAddress)); | ||||||
|  |  | ||||||
|  |       /* Program a Flash high-cycle data word at a specified address */ | ||||||
|  |       FLASH_Program_Word(FlashAddress, DataAddress); | ||||||
|  |     } | ||||||
|  | #endif /* FLASH_EDATAR_EDATA_EN */ | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |       /* Check the parameters */ | ||||||
|  |       assert_param(IS_FLASH_OTP_ADDRESS(FlashAddress)); | ||||||
|  |  | ||||||
|  |       /* Program an OTP word at a specified address */ | ||||||
|  |       FLASH_Program_HalfWord(FlashAddress, DataAddress); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* return status */ | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief This function handles FLASH interrupt request. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_FLASH_IRQHandler(void) | ||||||
|  | { | ||||||
|  |   uint32_t param = 0U; | ||||||
|  |   uint32_t errorflag; | ||||||
|  |   __IO uint32_t *reg_cr; | ||||||
|  |   __IO uint32_t *reg_ccr; | ||||||
|  |   const __IO uint32_t *reg_sr; | ||||||
|  |   const __IO uint32_t *reg_ecccorr; | ||||||
|  |  | ||||||
|  |   /* Access to CR, CCR and SR registers depends on operation type */ | ||||||
|  | #if defined (FLASH_OPTSR2_TZEN) | ||||||
|  |   reg_cr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECCR) : &(FLASH_NS->NSCR); | ||||||
|  |   reg_ccr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECCCR) : &(FLASH_NS->NSCCR); | ||||||
|  |   reg_sr  = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECSR) : &(FLASH_NS->NSSR); | ||||||
|  | #else | ||||||
|  |   reg_cr = &(FLASH_NS->NSCR); | ||||||
|  |   reg_ccr = &(FLASH_NS->NSCCR); | ||||||
|  |   reg_sr = &(FLASH_NS->NSSR); | ||||||
|  | #endif /* FLASH_OPTSR2_TZEN */ | ||||||
|  |   reg_ecccorr = &(FLASH->ECCCORR); | ||||||
|  |  | ||||||
|  |   /* Save Flash errors */ | ||||||
|  |   errorflag = (*reg_sr) & FLASH_FLAG_SR_ERRORS; | ||||||
|  |   /* Add option byte error flag, if any */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |   errorflag |= (FLASH->NSSR & FLASH_FLAG_OPTCHANGEERR); | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  |   /* Set parameter of the callback */ | ||||||
|  |   if ((pFlash.ProcedureOnGoing & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEERASE_SECTORS) | ||||||
|  |   { | ||||||
|  |     param = pFlash.Sector; | ||||||
|  |   } | ||||||
|  |   else if ((pFlash.ProcedureOnGoing & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEERASE_MASSERASE) | ||||||
|  |   { | ||||||
|  |     param = pFlash.Bank; | ||||||
|  |   } | ||||||
|  |   else if ((pFlash.ProcedureOnGoing & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEPROGRAM_QUADWORD) | ||||||
|  |   { | ||||||
|  |     param = pFlash.Address; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* Empty statement (to be compliant MISRA 15.7) */ | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Clear operation bit on the on-going procedure */ | ||||||
|  |   CLEAR_BIT((*reg_cr), (pFlash.ProcedureOnGoing & ~(FLASH_NON_SECURE_MASK))); | ||||||
|  |  | ||||||
|  |   /* Check FLASH operation error flags */ | ||||||
|  |   if (errorflag != 0U) | ||||||
|  |   { | ||||||
|  |     /* Save the error code */ | ||||||
|  |     pFlash.ErrorCode |= errorflag; | ||||||
|  |  | ||||||
|  |     /* Clear error programming flags */ | ||||||
|  |     (*reg_ccr) = errorflag & FLASH_FLAG_SR_ERRORS; | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |     if ((errorflag & FLASH_FLAG_OPTCHANGEERR) != 0U) | ||||||
|  |     { | ||||||
|  |       FLASH->NSCCR = FLASH_FLAG_OPTCHANGEERR; | ||||||
|  |     } | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  |     /* Stop the procedure ongoing */ | ||||||
|  |     pFlash.ProcedureOnGoing = 0U; | ||||||
|  |  | ||||||
|  |     /* FLASH error interrupt user callback */ | ||||||
|  |     HAL_FLASH_OperationErrorCallback(param); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Check FLASH End of Operation flag */ | ||||||
|  |   if (((*reg_sr) & FLASH_FLAG_EOP) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Clear FLASH End of Operation pending bit */ | ||||||
|  |     (*reg_ccr) = FLASH_FLAG_EOP; | ||||||
|  |  | ||||||
|  |     if ((pFlash.ProcedureOnGoing & (~FLASH_NON_SECURE_MASK)) == FLASH_TYPEERASE_SECTORS) | ||||||
|  |     { | ||||||
|  |       /* Nb of sector to erased can be decreased */ | ||||||
|  |       pFlash.NbSectorsToErase--; | ||||||
|  |  | ||||||
|  |       /* Check if there are still sectors to erase */ | ||||||
|  |       if (pFlash.NbSectorsToErase != 0U) | ||||||
|  |       { | ||||||
|  |         /* Increment sector number */ | ||||||
|  |         pFlash.Sector++; | ||||||
|  |         FLASH_Erase_Sector(pFlash.Sector, pFlash.Bank); | ||||||
|  |       } | ||||||
|  |       else | ||||||
|  |       { | ||||||
|  |         /* No more sectors to erase */ | ||||||
|  |         /* Reset sector parameter and stop erase sectors procedure */ | ||||||
|  |         param = 0xFFFFFFFFU; | ||||||
|  |         pFlash.ProcedureOnGoing = 0U; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |       /* Clear the procedure ongoing */ | ||||||
|  |       pFlash.ProcedureOnGoing = 0U; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /* FLASH EOP interrupt user callback */ | ||||||
|  |     HAL_FLASH_EndOfOperationCallback(param); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Check FLASH ECC correction flag */ | ||||||
|  |   if ((*reg_ecccorr & FLASH_ECCR_ECCC) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Call User callback */ | ||||||
|  |     HAL_FLASHEx_EccCorrectionCallback(); | ||||||
|  |  | ||||||
|  |     /* Clear ECC correction flag in order to allow new ECC error record */ | ||||||
|  |     FLASH->ECCCORR |= FLASH_ECCR_ECCC; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   if (pFlash.ProcedureOnGoing == 0U) | ||||||
|  |   { | ||||||
|  |     /* Disable Flash Operation and Error source interrupt */ | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  |     (*reg_cr) &= ~(FLASH_IT_EOP     | FLASH_IT_WRPERR | FLASH_IT_PGSERR | \ | ||||||
|  |                    FLASH_IT_STRBERR | FLASH_IT_INCERR | FLASH_IT_OBKERR | \ | ||||||
|  |                    FLASH_IT_OBKWERR | FLASH_IT_OPTCHANGEERR); | ||||||
|  | #else | ||||||
|  |     (*reg_cr) &= ~(FLASH_IT_EOP     | FLASH_IT_WRPERR | FLASH_IT_PGSERR | \ | ||||||
|  |                    FLASH_IT_STRBERR | FLASH_IT_INCERR | FLASH_IT_OPTCHANGEERR); | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @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 0xFFFFFFFF, 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 registers access | ||||||
|  |   * @retval HAL Status | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_FLASH_Unlock(void) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status = HAL_OK; | ||||||
|  |  | ||||||
|  |   if (READ_BIT(FLASH->NSCR, FLASH_CR_LOCK) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Authorize the FLASH Control Register access */ | ||||||
|  |     WRITE_REG(FLASH->NSKEYR, FLASH_KEY1); | ||||||
|  |     WRITE_REG(FLASH->NSKEYR, FLASH_KEY2); | ||||||
|  |  | ||||||
|  |     /* Verify Flash CR is unlocked */ | ||||||
|  |     if (READ_BIT(FLASH->NSCR, FLASH_CR_LOCK) != 0U) | ||||||
|  |     { | ||||||
|  |       status = HAL_ERROR; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |   if (status == HAL_OK) | ||||||
|  |   { | ||||||
|  |     if (READ_BIT(FLASH->SECCR, FLASH_CR_LOCK) != 0U) | ||||||
|  |     { | ||||||
|  |       /* Authorize the FLASH Control Register access */ | ||||||
|  |       WRITE_REG(FLASH->SECKEYR, FLASH_KEY1); | ||||||
|  |       WRITE_REG(FLASH->SECKEYR, FLASH_KEY2); | ||||||
|  |  | ||||||
|  |       /* verify Flash CR is unlocked */ | ||||||
|  |       if (READ_BIT(FLASH->SECCR, FLASH_CR_LOCK) != 0U) | ||||||
|  |       { | ||||||
|  |         status = HAL_ERROR; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Locks the FLASH control registers access | ||||||
|  |   * @retval HAL Status | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_FLASH_Lock(void) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status = HAL_OK; | ||||||
|  |  | ||||||
|  |   /* Set the LOCK Bit to lock the FLASH Control Register access */ | ||||||
|  |   SET_BIT(FLASH->NSCR, FLASH_CR_LOCK); | ||||||
|  |  | ||||||
|  |   /* Verify Flash is locked */ | ||||||
|  |   if (READ_BIT(FLASH->NSCR, FLASH_CR_LOCK) == 0U) | ||||||
|  |   { | ||||||
|  |     status = HAL_ERROR; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |   if (status == HAL_OK) | ||||||
|  |   { | ||||||
|  |     /* Set the LOCK Bit to lock the FLASH Control Register access */ | ||||||
|  |     SET_BIT(FLASH->SECCR, FLASH_CR_LOCK); | ||||||
|  |  | ||||||
|  |     /* verify Flash is locked */ | ||||||
|  |     if (READ_BIT(FLASH->SECCR, FLASH_CR_LOCK) == 0U) | ||||||
|  |     { | ||||||
|  |       status = HAL_ERROR; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Unlock the FLASH Option Control Registers access. | ||||||
|  |   * @retval HAL Status | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void) | ||||||
|  | { | ||||||
|  |   if (READ_BIT(FLASH->OPTCR, FLASH_OPTCR_OPTLOCK) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Authorizes the Option Byte registers programming */ | ||||||
|  |     WRITE_REG(FLASH->OPTKEYR, FLASH_OPT_KEY1); | ||||||
|  |     WRITE_REG(FLASH->OPTKEYR, FLASH_OPT_KEY2); | ||||||
|  |  | ||||||
|  |     /* Verify that the Option Bytes are unlocked */ | ||||||
|  |     if (READ_BIT(FLASH->OPTCR, FLASH_OPTCR_OPTLOCK) != 0U) | ||||||
|  |     { | ||||||
|  |       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 */ | ||||||
|  |   SET_BIT(FLASH->OPTCR, FLASH_OPTCR_OPTLOCK); | ||||||
|  |  | ||||||
|  |   /* Verify that the Option Bytes are locked */ | ||||||
|  |   if (READ_BIT(FLASH->OPTCR, FLASH_OPTCR_OPTLOCK) != 0U) | ||||||
|  |   { | ||||||
|  |     return HAL_OK; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return HAL_ERROR; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Launch the option bytes loading. | ||||||
|  |   * @retval HAL Status | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_FLASH_OB_Launch(void) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status; | ||||||
|  |  | ||||||
|  |   /* Set OPTSTRT Bit */ | ||||||
|  |   SET_BIT(FLASH->OPTCR, FLASH_OPTCR_OPTSTART); | ||||||
|  |  | ||||||
|  |   /* Wait for OB change operation to be completed */ | ||||||
|  |   status = FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE); | ||||||
|  |  | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @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 HAL_FLASH_ERRORCode The returned value can be: | ||||||
|  |   *            @arg HAL_FLASH_ERROR_NONE  : No error set | ||||||
|  |   *            @arg HAL_FLASH_ERROR_WRP   : Write Protection Error | ||||||
|  |   *            @arg HAL_FLASH_ERROR_PGS   : Program Sequence Error | ||||||
|  |   *            @arg HAL_FLASH_ERROR_STRB  : Strobe Error | ||||||
|  |   *            @arg HAL_FLASH_ERROR_INC   : Inconsistency Error | ||||||
|  |   *            @arg HAL_FLASH_ERROR_OBK   : OBK Error | ||||||
|  |   *            @arg HAL_FLASH_ERROR_OBKW  : OBK Write Error | ||||||
|  |   *            @arg HAL_FLASH_ERROR_OB_CHANGE : Option Byte Change Error | ||||||
|  |   *            @arg HAL_FLASH_ERROR_ECCC  : ECC Single Correction Error | ||||||
|  |   *            @arg HAL_FLASH_ERROR_ECCD  : ECC Double Detection Error | ||||||
|  |   */ | ||||||
|  | uint32_t HAL_FLASH_GetError(void) | ||||||
|  | { | ||||||
|  |   return pFlash.ErrorCode; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private functions ---------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @addtogroup FLASH_Private_Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Wait for a FLASH operation to complete. | ||||||
|  |   * @param  Timeout maximum flash operation timeout | ||||||
|  |   * @retval HAL_StatusTypeDef HAL Status | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout) | ||||||
|  | { | ||||||
|  |   /* Wait for the FLASH operation to complete by polling on BUSY, WBNE and DBNE flags to be reset. | ||||||
|  |      Even if the FLASH operation fails, the BUSY, WBNE and DBNE flags will be reset and an error | ||||||
|  |      flag will be set */ | ||||||
|  |  | ||||||
|  |   uint32_t errorflag; | ||||||
|  |   const __IO uint32_t *reg_sr; | ||||||
|  |   __IO uint32_t *reg_ccr; | ||||||
|  |  | ||||||
|  |   uint32_t tickstart = HAL_GetTick(); | ||||||
|  |  | ||||||
|  |   /* Access to SR register depends on operation type */ | ||||||
|  | #if defined (FLASH_OPTSR2_TZEN) | ||||||
|  |   reg_sr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECSR) : &(FLASH_NS->NSSR); | ||||||
|  | #else | ||||||
|  |   reg_sr = &(FLASH_NS->NSSR); | ||||||
|  | #endif /* FLASH_OPTSR2_TZEN */ | ||||||
|  |  | ||||||
|  |   /* Wait on BSY, WBNE and DBNE flags to be reset */ | ||||||
|  |   while (((*reg_sr) & (FLASH_FLAG_BSY | FLASH_FLAG_WBNE | FLASH_FLAG_DBNE)) != 0U) | ||||||
|  |   { | ||||||
|  |     if (Timeout != HAL_MAX_DELAY) | ||||||
|  |     { | ||||||
|  |       if (((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U)) | ||||||
|  |       { | ||||||
|  |         return HAL_TIMEOUT; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Access to CCR register depends on operation type */ | ||||||
|  | #if defined (FLASH_OPTSR2_TZEN) | ||||||
|  |   reg_ccr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECCCR) : &(FLASH_NS->NSCCR); | ||||||
|  | #else | ||||||
|  |   reg_ccr = &(FLASH_NS->NSCCR); | ||||||
|  | #endif /* FLASH_OPTSR2_TZEN */ | ||||||
|  |  | ||||||
|  |   /* Check FLASH operation error flags */ | ||||||
|  |   errorflag = ((*reg_sr) & FLASH_FLAG_SR_ERRORS); | ||||||
|  |   /* Add option byte error flag, if any */ | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |   errorflag |= (FLASH->NSSR & FLASH_FLAG_OPTCHANGEERR); | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  |   /* In case of error reported in Flash SR or OPTSR registers */ | ||||||
|  |   if (errorflag != 0U) | ||||||
|  |   { | ||||||
|  |     /*Save the error code*/ | ||||||
|  |     pFlash.ErrorCode |= errorflag; | ||||||
|  |  | ||||||
|  |     /* Clear error flags */ | ||||||
|  |     (*reg_ccr) = errorflag & FLASH_FLAG_SR_ERRORS; | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |     if ((errorflag & FLASH_FLAG_OPTCHANGEERR) != 0U) | ||||||
|  |     { | ||||||
|  |       FLASH->NSCCR = FLASH_FLAG_OPTCHANGEERR; | ||||||
|  |     } | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  |     return HAL_ERROR; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Check FLASH End of Operation flag  */ | ||||||
|  |   if (((*reg_sr) & FLASH_FLAG_EOP) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Clear FLASH End of Operation pending bit */ | ||||||
|  |     (*reg_ccr) = FLASH_FLAG_EOP; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* If there is no error flag set */ | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Program a quad-word (128-bit) at a specified address. | ||||||
|  |   * @param  FlashAddress specifies the address to be programmed. | ||||||
|  |   * @param  DataAddress specifies the address of data to be programmed. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | static void FLASH_Program_QuadWord(uint32_t FlashAddress, uint32_t DataAddress) | ||||||
|  | { | ||||||
|  |   uint8_t index = 4; | ||||||
|  |   uint32_t *dest_addr = (uint32_t *)FlashAddress; | ||||||
|  |   uint32_t *src_addr  = (uint32_t *)DataAddress; | ||||||
|  |   uint32_t primask_bit; | ||||||
|  |   __IO uint32_t *reg_cr; | ||||||
|  |  | ||||||
|  |   /* Access to SECCR or NSCR registers depends on operation type */ | ||||||
|  | #if defined (FLASH_OPTSR2_TZEN) | ||||||
|  |   reg_cr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECCR) : &(FLASH_NS->NSCR); | ||||||
|  | #else | ||||||
|  |   reg_cr = &(FLASH_NS->NSCR); | ||||||
|  | #endif /* FLASH_OPTSR2_TZEN */ | ||||||
|  |  | ||||||
|  |   /* Set PG bit */ | ||||||
|  |   SET_BIT((*reg_cr), FLASH_CR_PG); | ||||||
|  |  | ||||||
|  |   /* Enter critical section: Disable interrupts to avoid any interruption during the loop */ | ||||||
|  |   primask_bit = __get_PRIMASK(); | ||||||
|  |   __disable_irq(); | ||||||
|  |  | ||||||
|  |   /* Program the quad-word */ | ||||||
|  |   do | ||||||
|  |   { | ||||||
|  |     *dest_addr = *src_addr; | ||||||
|  |     dest_addr++; | ||||||
|  |     src_addr++; | ||||||
|  |     index--; | ||||||
|  |   } while (index != 0U); | ||||||
|  |  | ||||||
|  |   /* Exit critical section: restore previous priority mask */ | ||||||
|  |   __set_PRIMASK(primask_bit); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #if defined (FLASH_SR_OBKERR) | ||||||
|  | /** | ||||||
|  |   * @brief  Program a quad-word (128-bit) of OBK at a specified address. | ||||||
|  |   * @param  FlashAddress specifies the address to be programmed. | ||||||
|  |   * @param  DataAddress specifies the address of data to be programmed. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | static void FLASH_Program_QuadWord_OBK(uint32_t FlashAddress, uint32_t DataAddress) | ||||||
|  | { | ||||||
|  |   uint8_t index = 4; | ||||||
|  |   uint32_t *dest_addr = (uint32_t *)FlashAddress; | ||||||
|  |   uint32_t *src_addr  = (uint32_t *)DataAddress; | ||||||
|  |   uint32_t primask_bit; | ||||||
|  |   __IO uint32_t *reg_cr; | ||||||
|  |   __IO uint32_t *reg_obkcfgr; | ||||||
|  |  | ||||||
|  |   /* Access to SECCR or NSCR registers depends on operation type */ | ||||||
|  |   reg_cr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECCR) : &(FLASH_NS->NSCR); | ||||||
|  |   reg_obkcfgr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECOBKCFGR) : &(FLASH_NS->NSOBKCFGR); | ||||||
|  |  | ||||||
|  |   /* Set PG bit */ | ||||||
|  |   SET_BIT((*reg_cr), FLASH_CR_PG); | ||||||
|  |  | ||||||
|  |   /* Set ALT_SECT bit */ | ||||||
|  |   SET_BIT((*reg_obkcfgr), pFlash.ProcedureOnGoing & FLASH_OBKCFGR_ALT_SECT); | ||||||
|  |  | ||||||
|  |   /* Enter critical section: Disable interrupts to avoid any interruption during the loop */ | ||||||
|  |   primask_bit = __get_PRIMASK(); | ||||||
|  |   __disable_irq(); | ||||||
|  |  | ||||||
|  |   /* Program the quad-word */ | ||||||
|  |   do | ||||||
|  |   { | ||||||
|  |     *dest_addr = *src_addr; | ||||||
|  |     dest_addr++; | ||||||
|  |     src_addr++; | ||||||
|  |     index--; | ||||||
|  |   } while (index != 0U); | ||||||
|  |  | ||||||
|  |   /* Exit critical section: restore previous priority mask */ | ||||||
|  |   __set_PRIMASK(primask_bit); | ||||||
|  | } | ||||||
|  | #endif /* FLASH_SR_OBKERR */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Program a half-word (16-bit) at a specified address. | ||||||
|  |   * @param  FlashAddress specifies the address to be programmed. | ||||||
|  |   * @param  DataAddress specifies the address of data to be programmed. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | static void FLASH_Program_HalfWord(uint32_t FlashAddress, uint32_t DataAddress) | ||||||
|  | { | ||||||
|  |   __IO uint32_t *reg_cr; | ||||||
|  |  | ||||||
|  |   /* Access to SECCR or NSCR registers depends on operation type */ | ||||||
|  | #if defined (FLASH_OPTSR2_TZEN) | ||||||
|  |   reg_cr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECCR) : &(FLASH_NS->NSCR); | ||||||
|  | #else | ||||||
|  |   reg_cr = &(FLASH_NS->NSCR); | ||||||
|  | #endif /* FLASH_OPTSR2_TZEN */ | ||||||
|  |  | ||||||
|  |   /* Set HalfWord_PG bit */ | ||||||
|  |   SET_BIT((*reg_cr), FLASH_CR_PG); | ||||||
|  |  | ||||||
|  |   /* Program a halfword word (16 bits) */ | ||||||
|  |   *(__IO uint16_t *)FlashAddress = *(__IO uint16_t *)DataAddress; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #if defined(FLASH_EDATAR_EDATA_EN) | ||||||
|  | /** | ||||||
|  |   * @brief  Program a word (32-bit) at a specified address. | ||||||
|  |   * @param  FlashAddress specifies the address to be programmed. | ||||||
|  |   * @param  DataAddress specifies the address of data to be programmed. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | static void FLASH_Program_Word(uint32_t FlashAddress, uint32_t DataAddress) | ||||||
|  | { | ||||||
|  |   __IO uint32_t *reg_cr; | ||||||
|  |  | ||||||
|  |   /* Access to SECCR or NSCR registers depends on operation type */ | ||||||
|  | #if defined (FLASH_OPTSR2_TZEN) | ||||||
|  |   reg_cr = IS_FLASH_SECURE_OPERATION() ? &(FLASH->SECCR) : &(FLASH_NS->NSCR); | ||||||
|  | #else | ||||||
|  |   reg_cr = &(FLASH_NS->NSCR); | ||||||
|  | #endif /* FLASH_OPTSR2_TZEN */ | ||||||
|  |  | ||||||
|  |   /* Set PG bit */ | ||||||
|  |   SET_BIT((*reg_cr), FLASH_CR_PG); | ||||||
|  |  | ||||||
|  |     *(__IO uint32_t *)FlashAddress = *(__IO uint32_t *)DataAddress; | ||||||
|  | } | ||||||
|  | #endif /* FLASH_EDATAR_EDATA_EN */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #endif /* HAL_FLASH_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
							
								
								
									
										2047
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_flash_ex.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2047
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_flash_ex.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										754
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_gpio.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										754
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_gpio.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,754 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_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 | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   @verbatim | ||||||
|  |   ============================================================================== | ||||||
|  |                     ##### GPIO Peripheral features ##### | ||||||
|  |   ============================================================================== | ||||||
|  |   [..] | ||||||
|  |     (+) Each port bit of the general-purpose I/O (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. | ||||||
|  |  | ||||||
|  |     (+) The microcontroller IO pins are connected to onboard peripherals/modules through a | ||||||
|  |         multiplexer that allows only one peripheral alternate function (AF) connected | ||||||
|  |        to an IO pin at a time. In this way, there can be no conflict between peripherals | ||||||
|  |        sharing the same IO pin. | ||||||
|  |  | ||||||
|  |     (+) 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 39 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 set the level of several pins and reset level of several other pins in | ||||||
|  |         same cycle, use HAL_GPIO_WriteMultipleStatePin(). | ||||||
|  |  | ||||||
|  |    (#) 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 | ||||||
|  |   ****************************************************************************** | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup GPIO GPIO | ||||||
|  |   * @brief GPIO HAL module driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #ifdef HAL_GPIO_MODULE_ENABLED | ||||||
|  |  | ||||||
|  | /* Private typedef -----------------------------------------------------------*/ | ||||||
|  | /* Private defines -----------------------------------------------------------*/ | ||||||
|  | /** @defgroup GPIO_Private_Defines GPIO Private Defines | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #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 macros ------------------------------------------------------------*/ | ||||||
|  | /* Private variables ---------------------------------------------------------*/ | ||||||
|  | /** @defgroup GPIO_Private_Macros GPIO Private Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private function prototypes -----------------------------------------------*/ | ||||||
|  | /* Exported functions --------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup GPIO_Exported_Functions GPIO Exported Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup GPIO_Exported_Functions_Group1 Initialization/de-initialization functions | ||||||
|  |   *  @brief    Initialization and Configuration functions | ||||||
|  |   * | ||||||
|  | @verbatim | ||||||
|  |  =============================================================================== | ||||||
|  |               ##### Initialization and de-initialization functions ##### | ||||||
|  |  =============================================================================== | ||||||
|  |  | ||||||
|  | @endverbatim | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Initialize the GPIOx peripheral according to the specified parameters in the pGPIO_Init. | ||||||
|  |   * @note   If GPIOx peripheral pin is used in EXTI_MODE and the pin is secure in case | ||||||
|  |   *         the system implements the security (TZEN=1), it is up to the secure application to | ||||||
|  |   *         insure that the corresponding EXTI line is set secure. | ||||||
|  |   * @param  GPIOx: where x can be (A..I) for stm32h56xxx and stm32h57xxx family lines and | ||||||
|  |   *         (A..D or H) for stm32h503xx family line to select the GPIO peripheral for STM32H5 family | ||||||
|  |   * @param  pGPIO_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, const GPIO_InitTypeDef *pGPIO_Init) | ||||||
|  | { | ||||||
|  |   uint32_t tmp; | ||||||
|  |   uint32_t iocurrent; | ||||||
|  |   uint32_t position = 0U; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); | ||||||
|  |   assert_param(IS_GPIO_PIN(pGPIO_Init->Pin)); | ||||||
|  |   assert_param(IS_GPIO_MODE(pGPIO_Init->Mode)); | ||||||
|  |   assert_param(IS_GPIO_PULL(pGPIO_Init->Pull)); | ||||||
|  |  | ||||||
|  |   /* Configure the port pins */ | ||||||
|  |   while (((pGPIO_Init->Pin) >> position) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Get current io position */ | ||||||
|  |     iocurrent = (pGPIO_Init->Pin) & (1UL << position); | ||||||
|  |  | ||||||
|  |     if (iocurrent != 0U) | ||||||
|  |     { | ||||||
|  |       /*--------------------- GPIO Mode Configuration ------------------------*/ | ||||||
|  |       /* In case of Alternate function mode selection */ | ||||||
|  |       if ((pGPIO_Init->Mode == GPIO_MODE_AF_PP) || (pGPIO_Init->Mode == GPIO_MODE_AF_OD)) | ||||||
|  |       { | ||||||
|  |         /* Check the Alternate function parameters */ | ||||||
|  |         assert_param(IS_GPIO_AF_INSTANCE(GPIOx)); | ||||||
|  |         assert_param(IS_GPIO_AF(pGPIO_Init->Alternate)); | ||||||
|  |  | ||||||
|  |         /* Configure Alternate function mapped with the current IO */ | ||||||
|  |         tmp = GPIOx->AFR[position >> 3U]; | ||||||
|  |         tmp &= ~(0x0FUL << ((position & 0x07U) * GPIO_AFRL_AFSEL1_Pos)); | ||||||
|  |         tmp |= ((pGPIO_Init->Alternate & 0x0FUL) << ((position & 0x07U) * GPIO_AFRL_AFSEL1_Pos)); | ||||||
|  |         GPIOx->AFR[position >> 3U] = tmp; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       /* Configure IO Direction mode (Input, Output, Alternate or Analog) */ | ||||||
|  |       tmp = GPIOx->MODER; | ||||||
|  |       tmp &= ~(GPIO_MODER_MODE0 << (position * GPIO_MODER_MODE1_Pos)); | ||||||
|  |       tmp |= ((pGPIO_Init->Mode & GPIO_MODE) << (position * GPIO_MODER_MODE1_Pos)); | ||||||
|  |       GPIOx->MODER = tmp; | ||||||
|  |  | ||||||
|  |       /* In case of Output or Alternate function mode selection */ | ||||||
|  |       if ((pGPIO_Init->Mode == GPIO_MODE_OUTPUT_PP) || (pGPIO_Init->Mode == GPIO_MODE_AF_PP) || | ||||||
|  |           (pGPIO_Init->Mode == GPIO_MODE_OUTPUT_OD) || (pGPIO_Init->Mode == GPIO_MODE_AF_OD)) | ||||||
|  |       { | ||||||
|  |         /* Check the Speed parameter */ | ||||||
|  |         assert_param(IS_GPIO_SPEED(pGPIO_Init->Speed)); | ||||||
|  |  | ||||||
|  |         /* Configure the IO Speed */ | ||||||
|  |         tmp = GPIOx->OSPEEDR; | ||||||
|  |         tmp &= ~(GPIO_OSPEEDR_OSPEED0 << (position * GPIO_OSPEEDR_OSPEED1_Pos)); | ||||||
|  |         tmp |= (pGPIO_Init->Speed << (position * GPIO_OSPEEDR_OSPEED1_Pos)); | ||||||
|  |         GPIOx->OSPEEDR = tmp; | ||||||
|  |  | ||||||
|  |         /* Configure the IO Output Type */ | ||||||
|  |         tmp = GPIOx->OTYPER; | ||||||
|  |         tmp &= ~(GPIO_OTYPER_OT0 << position) ; | ||||||
|  |         tmp |= (((pGPIO_Init->Mode & GPIO_OUTPUT_TYPE) >> 4U) << position); | ||||||
|  |         GPIOx->OTYPER = tmp; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       if (((pGPIO_Init->Mode & GPIO_MODE) != GPIO_MODE_ANALOG) || | ||||||
|  |           (((pGPIO_Init->Mode & GPIO_MODE) == GPIO_MODE_ANALOG) && (pGPIO_Init->Pull != GPIO_PULLUP))) | ||||||
|  |       { | ||||||
|  |         /* Check the Pull parameters */ | ||||||
|  |         assert_param(IS_GPIO_PULL(pGPIO_Init->Pull)); | ||||||
|  |  | ||||||
|  |         /* Activate the Pull-up or Pull down resistor for the current IO */ | ||||||
|  |         tmp = GPIOx->PUPDR; | ||||||
|  |         tmp &= ~(GPIO_PUPDR_PUPD0 << (position * GPIO_PUPDR_PUPD1_Pos)); | ||||||
|  |         tmp |= ((pGPIO_Init->Pull) << (position * GPIO_PUPDR_PUPD1_Pos)); | ||||||
|  |         GPIOx->PUPDR = tmp; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       /*--------------------- EXTI Mode Configuration ------------------------*/ | ||||||
|  |       /* Configure the External Interrupt or event for the current IO */ | ||||||
|  |       if ((pGPIO_Init->Mode & EXTI_MODE) == EXTI_MODE) | ||||||
|  |       { | ||||||
|  |         tmp = EXTI->EXTICR[position >> 2U]; | ||||||
|  |         tmp &= ~((0x0FUL) << ((position & 0x03U) * EXTI_EXTICR1_EXTI1_Pos)); | ||||||
|  |         tmp |= (GPIO_GET_INDEX(GPIOx) << ((position & 0x03U) * EXTI_EXTICR1_EXTI1_Pos)); | ||||||
|  |         EXTI->EXTICR[position >> 2U] = tmp; | ||||||
|  |  | ||||||
|  |         /* Clear Rising Falling edge configuration */ | ||||||
|  |         tmp = EXTI->RTSR1; | ||||||
|  |         tmp &= ~((uint32_t)iocurrent); | ||||||
|  |         if ((pGPIO_Init->Mode & RISING_EDGE) == RISING_EDGE) | ||||||
|  |         { | ||||||
|  |           tmp |= iocurrent; | ||||||
|  |         } | ||||||
|  |         EXTI->RTSR1 = tmp; | ||||||
|  |  | ||||||
|  |         tmp = EXTI->FTSR1; | ||||||
|  |         tmp &= ~((uint32_t)iocurrent); | ||||||
|  |         if ((pGPIO_Init->Mode & FALLING_EDGE) == FALLING_EDGE) | ||||||
|  |         { | ||||||
|  |           tmp |= iocurrent; | ||||||
|  |         } | ||||||
|  |         EXTI->FTSR1 = tmp; | ||||||
|  |  | ||||||
|  |         /* Clear EXTI line configuration */ | ||||||
|  |         tmp = EXTI->EMR1; | ||||||
|  |         tmp &= ~((uint32_t)iocurrent); | ||||||
|  |         if ((pGPIO_Init->Mode & GPIO_MODE_EVT) == GPIO_MODE_EVT) | ||||||
|  |         { | ||||||
|  |           tmp |= iocurrent; | ||||||
|  |         } | ||||||
|  |         EXTI->EMR1 = tmp; | ||||||
|  |  | ||||||
|  |         tmp = EXTI->IMR1; | ||||||
|  |         tmp &= ~((uint32_t)iocurrent); | ||||||
|  |         if ((pGPIO_Init->Mode & GPIO_MODE_IT) == GPIO_MODE_IT) | ||||||
|  |         { | ||||||
|  |           tmp |= iocurrent; | ||||||
|  |         } | ||||||
|  |         EXTI->IMR1 = tmp; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     position++; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  De-initialize the GPIOx peripheral registers to their default reset values. | ||||||
|  |   * @param  GPIOx: where x can be (A..I) for stm32h56xxx and stm32h57xxx family lines and | ||||||
|  |   *         (A..D or H) for stm32h503xx family line to select the GPIO peripheral for STM32H5 family | ||||||
|  |   * @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 tmp; | ||||||
|  |   uint32_t iocurrent; | ||||||
|  |   uint32_t position = 0U; | ||||||
|  |  | ||||||
|  |   /* 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 != 0U) | ||||||
|  |     { | ||||||
|  |       /*------------------------- EXTI Mode Configuration --------------------*/ | ||||||
|  |       /* Clear the External Interrupt or Event for the current IO */ | ||||||
|  |       tmp = EXTI->EXTICR[position >> 2U]; | ||||||
|  |       tmp &= ((0x0FUL) << ((position & 0x03U) * EXTI_EXTICR1_EXTI1_Pos)); | ||||||
|  |       if (tmp == (GPIO_GET_INDEX(GPIOx) << ((position & 0x03U) * EXTI_EXTICR1_EXTI1_Pos))) | ||||||
|  |       { | ||||||
|  |         /* Clear EXTI line configuration */ | ||||||
|  |         EXTI->IMR1 &= ~(iocurrent); | ||||||
|  |         EXTI->EMR1 &= ~(iocurrent); | ||||||
|  |  | ||||||
|  |         /* Clear Rising Falling edge configuration */ | ||||||
|  |         EXTI->RTSR1 &= ~(iocurrent); | ||||||
|  |         EXTI->FTSR1 &= ~(iocurrent); | ||||||
|  |  | ||||||
|  |         tmp = (0x0FUL) << ((position & 0x03U) * EXTI_EXTICR1_EXTI1_Pos); | ||||||
|  |         EXTI->EXTICR[position >> 2U] &= ~tmp; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       /*------------------------- GPIO Mode Configuration --------------------*/ | ||||||
|  |       /* Configure IO in Analog Mode */ | ||||||
|  |       GPIOx->MODER |= (GPIO_MODER_MODE0 << (position * GPIO_MODER_MODE1_Pos)); | ||||||
|  |  | ||||||
|  |       /* Configure the default Alternate Function in current IO */ | ||||||
|  |       GPIOx->AFR[position >> 3U] &= ~(0x0FUL << ((position & 0x07U) * GPIO_AFRL_AFSEL1_Pos)); | ||||||
|  |  | ||||||
|  |       /* Configure the default value for IO Speed */ | ||||||
|  |       GPIOx->OSPEEDR &= ~(GPIO_OSPEEDR_OSPEED0 << (position * GPIO_OSPEEDR_OSPEED1_Pos)); | ||||||
|  |  | ||||||
|  |       /* Configure the default value IO Output Type */ | ||||||
|  |       GPIOx->OTYPER  &= ~(GPIO_OTYPER_OT0 << position); | ||||||
|  |  | ||||||
|  |       /* Deactivate the Pull-up and Pull-down resistor for the current IO */ | ||||||
|  |       GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPD0 << (position * GPIO_PUPDR_PUPD1_Pos)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     position++; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup GPIO_Exported_Functions_Group2 IO operation functions | ||||||
|  |   *  @brief GPIO Read, Write, Toggle, Lock and EXTI management functions. | ||||||
|  |   * | ||||||
|  | @verbatim | ||||||
|  |  =============================================================================== | ||||||
|  |                        ##### IO operation functions ##### | ||||||
|  |  =============================================================================== | ||||||
|  |  | ||||||
|  | @endverbatim | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Read the specified input port pin. | ||||||
|  |   * @param  GPIOx: where x can be (A..I) for stm32h56xxx and stm32h57xxx family lines and | ||||||
|  |   *         (A..D or H) for stm32h503xx family line to select the GPIO peripheral for STM32H5 family | ||||||
|  |   * @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(const 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) != 0U) | ||||||
|  |   { | ||||||
|  |     bitstatus = GPIO_PIN_SET; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     bitstatus = GPIO_PIN_RESET; | ||||||
|  |   } | ||||||
|  |   return bitstatus; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Set or clear the selected data port bit. | ||||||
|  |   * | ||||||
|  |   * @note   This function uses GPIOx_BSRR and GPIOx_BRR registers 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..I) for stm32h56xxx and stm32h57xxx family lines and | ||||||
|  |   *         (A..D or H) for stm32h503xx family line to select the GPIO peripheral for STM32H5 family | ||||||
|  |   * @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 = (uint32_t)GPIO_Pin; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     GPIOx->BRR = (uint32_t)GPIO_Pin; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Set and clear several pins of a dedicated port in same cycle. | ||||||
|  |   * @note   This function uses GPIOx_BSRR and GPIOx_BRR registers to allow atomic read/modify | ||||||
|  |   *         accesses. | ||||||
|  |   * @param  GPIOx: where x can be (A..I) for stm32h56xxx and stm32h57xxx family lines and | ||||||
|  |   *         (A..D or H) for stm32h503xx family line to select the GPIO peripheral for STM32H5 family | ||||||
|  |   * @param  PinReset specifies the port bits to be reset | ||||||
|  |   *         This parameter can be any combination of GPIO_Pin_x where x can be (0..15) or zero. | ||||||
|  |   * @param  PinSet specifies the port bits to be set | ||||||
|  |   *         This parameter can be any combination of GPIO_Pin_x where x can be (0..15) or zero. | ||||||
|  |   * @note   Both PinReset and PinSet combinations shall not get any common bit, else | ||||||
|  |   *         assert would be triggered. | ||||||
|  |   * @note   At least one of the two parameters used to set or reset shall be different from zero. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_GPIO_WriteMultipleStatePin(GPIO_TypeDef *GPIOx, uint16_t PinReset, uint16_t PinSet) | ||||||
|  | { | ||||||
|  |   uint32_t tmp; | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   /* Make sure at least one parameter is different from zero and that there is no common pin */ | ||||||
|  |   assert_param(IS_GPIO_PIN((uint32_t)PinReset | (uint32_t)PinSet)); | ||||||
|  |   assert_param(IS_GPIO_COMMON_PIN(PinReset, PinSet)); | ||||||
|  |  | ||||||
|  |   tmp = (((uint32_t)PinReset << 16) | PinSet); | ||||||
|  |   GPIOx->BSRR = tmp; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Toggle the specified GPIO pin. | ||||||
|  |   * @param  GPIOx: where x can be (A..I) to select the GPIO peripheral for STM32H5 family | ||||||
|  |   * @param  GPIO_Pin: specifies the pin 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 Output 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  Lock 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..I) for stm32h56xxx and stm32h57xxx family lines and | ||||||
|  |   *         (A..D or H) for stm32h503xx family line to select the GPIO peripheral for STM32H5 family | ||||||
|  |   * @param  GPIO_Pin: specifies the port bits 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 */ | ||||||
|  |   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 bit*/ | ||||||
|  |   tmp = GPIOx->LCKR; | ||||||
|  |  | ||||||
|  |   /* read again in order to confirm lock is active */ | ||||||
|  |   if ((GPIOx->LCKR & GPIO_LCKR_LCKK) != GPIO_LCKR_LCKK) | ||||||
|  |   { | ||||||
|  |     return HAL_ERROR; | ||||||
|  |   } | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable speed optimization for several pin of dedicated port. | ||||||
|  |   * @note   Not all I/Os support the HSLV mode. Refer to the I/O structure in the corresponding | ||||||
|  |   *         datasheet for the list of I/Os supporting this feature. Other I/Os HSLV configuration must | ||||||
|  |   *         be kept at reset value. | ||||||
|  |   * @note   It must be used only if the I/O supply voltage is below 2.7 V. | ||||||
|  |   * @param  GPIOx: where x can be (A..I) for stm32h56xxx and stm32h57xxx family lines and | ||||||
|  |   *         (A..D or H) for stm32h503xx family line to select the GPIO peripheral for STM32H5 family | ||||||
|  |   * @param  GPIO_Pin: specifies the port bit to be written. | ||||||
|  |   *         This parameter can be any combination of GPIO_Pin_x where x can be (0..15). | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_GPIO_EnableHighSPeedLowVoltage(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) | ||||||
|  | { | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_GPIO_PIN(GPIO_Pin)); | ||||||
|  |   assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); | ||||||
|  |  | ||||||
|  |   /* Set HSLVR gpio pin */ | ||||||
|  |   SET_BIT(GPIOx->HSLVR, GPIO_Pin); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable speed optimization for several pin of dedicated port. | ||||||
|  |   * @note   Not all I/Os support the HSLV mode. Refer to the I/O structure in the corresponding | ||||||
|  |   *         datasheet for the list of I/Os supporting this feature. Other I/Os HSLV configuration must | ||||||
|  |   *         be kept at reset value. | ||||||
|  |   * @note   It must be used only if the I/O supply voltage is below 2.7 V. | ||||||
|  |   * @param  GPIOx: where x can be (A..I) for stm32h56xxx and stm32h57xxx family lines and | ||||||
|  |   *         (A..D or H) for stm32h503xx family line to select the GPIO peripheral for STM32H5 family | ||||||
|  |   * @param  GPIO_Pin: specifies the port bit to be written. | ||||||
|  |   *         This parameter can be any combination of GPIO_Pin_x where x can be (0..15). | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_GPIO_DisableHighSPeedLowVoltage(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) | ||||||
|  | { | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_GPIO_PIN(GPIO_Pin)); | ||||||
|  |   assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); | ||||||
|  |  | ||||||
|  |   /* Clear HSLVR gpio pin */ | ||||||
|  |   CLEAR_BIT(GPIOx->HSLVR, GPIO_Pin); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Handle EXTI interrupt request. | ||||||
|  |   * @param  GPIO_Pin: Specifies the port pin connected to corresponding EXTI line. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin) | ||||||
|  | { | ||||||
|  |   /* EXTI line interrupt detected */ | ||||||
|  |   if (__HAL_GPIO_EXTI_GET_RISING_IT(GPIO_Pin) != 0U) | ||||||
|  |   { | ||||||
|  |     __HAL_GPIO_EXTI_CLEAR_RISING_IT(GPIO_Pin); | ||||||
|  |     HAL_GPIO_EXTI_Rising_Callback(GPIO_Pin); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   if (__HAL_GPIO_EXTI_GET_FALLING_IT(GPIO_Pin) != 0U) | ||||||
|  |   { | ||||||
|  |     __HAL_GPIO_EXTI_CLEAR_FALLING_IT(GPIO_Pin); | ||||||
|  |     HAL_GPIO_EXTI_Falling_Callback(GPIO_Pin); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  EXTI line rising detection callback. | ||||||
|  |   * @param  GPIO_Pin: Specifies the port pin connected to corresponding EXTI line. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __weak void HAL_GPIO_EXTI_Rising_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_Rising_Callback could be implemented in the user file | ||||||
|  |    */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  EXTI line falling detection callback. | ||||||
|  |   * @param  GPIO_Pin: Specifies the port pin connected to corresponding EXTI line. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | __weak void HAL_GPIO_EXTI_Falling_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_Falling_Callback could be implemented in the user file | ||||||
|  |    */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||||
|  |  | ||||||
|  | /** @defgroup GPIO_Exported_Functions_Group3 IO attributes management functions | ||||||
|  |   *  @brief GPIO attributes management functions. | ||||||
|  |   * | ||||||
|  | @verbatim | ||||||
|  |  =============================================================================== | ||||||
|  |                        ##### IO attributes functions ##### | ||||||
|  |  =============================================================================== | ||||||
|  |  | ||||||
|  | @endverbatim | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Configure the GPIO pins attributes. | ||||||
|  |   * @note   Available attributes are to secure GPIO pin(s), so this function is | ||||||
|  |   *         only available in secure | ||||||
|  |   * @param  GPIOx: where x can be (A..I) for stm32h56xxx and stm32h57xxx family lines and | ||||||
|  |   *         (A..D or H) for stm32h503xx family line to select the GPIO peripheral for STM32H5 family | ||||||
|  |   * @param  GPIO_Pin: specifies the pin(s) to configure the secure attribute | ||||||
|  |   * @param  PinAttributes: specifies the pin(s) to be set in secure mode, other being set non secured. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_GPIO_ConfigPinAttributes(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t PinAttributes) | ||||||
|  | { | ||||||
|  |   uint32_t tmp; | ||||||
|  |   uint32_t iocurrent; | ||||||
|  |   uint32_t position = 0U; | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); | ||||||
|  |   assert_param(IS_GPIO_PIN(GPIO_Pin)); | ||||||
|  |   assert_param(IS_GPIO_PIN_ATTRIBUTES(PinAttributes)); | ||||||
|  |  | ||||||
|  |   tmp = GPIOx->SECCFGR; | ||||||
|  |  | ||||||
|  |   /* Configure the port pins */ | ||||||
|  |   while ((GPIO_Pin >> position) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Get current io position */ | ||||||
|  |     iocurrent = GPIO_Pin & (1UL << position); | ||||||
|  |  | ||||||
|  |     if (iocurrent != 0U) | ||||||
|  |     { | ||||||
|  |       /* Configure the IO secure attribute */ | ||||||
|  |       tmp &= ~(GPIO_SECCFGR_SEC0 << position); | ||||||
|  |       tmp |= (PinAttributes << position); | ||||||
|  |     } | ||||||
|  |     position++; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Set secure attributes */ | ||||||
|  |   GPIOx->SECCFGR = tmp; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the GPIO pins attributes. | ||||||
|  |   * @note   Available attributes are to secure GPIO pin(s), so this function is | ||||||
|  |   *         only available in secure | ||||||
|  |   * @param  GPIOx: where x can be (A..I) for stm32h56xxx and stm32h57xxx family lines and | ||||||
|  |   *         (A..D or H) for stm32h503xx family line to select the GPIO peripheral for STM32H5 family | ||||||
|  |   * @param  GPIO_Pin: specifies the single pin to get the secure attribute from | ||||||
|  |   * @param  pPinAttributes: pointer to return the pin attributes. | ||||||
|  |   * @retval HAL Status. | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_GPIO_GetConfigPinAttributes(const GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, | ||||||
|  |                                                   uint32_t *pPinAttributes) | ||||||
|  | { | ||||||
|  |   uint32_t iocurrent; | ||||||
|  |   uint32_t position = 0U; | ||||||
|  |  | ||||||
|  |   /* Check null pointer */ | ||||||
|  |   if (pPinAttributes == NULL) | ||||||
|  |   { | ||||||
|  |     return HAL_ERROR; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); | ||||||
|  |   assert_param(IS_GPIO_SINGLE_PIN(GPIO_Pin)); | ||||||
|  |  | ||||||
|  |   /* Get secure attribute of the port pin */ | ||||||
|  |   while ((GPIO_Pin >> position) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Get current io position */ | ||||||
|  |     iocurrent = GPIO_Pin & (1UL << position); | ||||||
|  |  | ||||||
|  |     if (iocurrent != 0U) | ||||||
|  |     { | ||||||
|  |       /* Get the IO secure attribute */ | ||||||
|  |       if ((GPIOx->SECCFGR & (GPIO_SECCFGR_SEC0 << position)) != 0U) | ||||||
|  |       { | ||||||
|  |         *pPinAttributes = GPIO_PIN_SEC; | ||||||
|  |       } | ||||||
|  |       else | ||||||
|  |       { | ||||||
|  |         *pPinAttributes = GPIO_PIN_NSEC; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       break; | ||||||
|  |     } | ||||||
|  |     position++; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #endif /* __ARM_FEATURE_CMSE */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #endif /* HAL_GPIO_MODULE_ENABLED */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
							
								
								
									
										657
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_icache.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										657
									
								
								Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_icache.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,657 @@ | |||||||
|  | /** | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @file    stm32h5xx_hal_icache.c | ||||||
|  |   * @author  MCD Application Team | ||||||
|  |   * @brief   ICACHE HAL module driver. | ||||||
|  |   *          This file provides firmware functions to manage the following | ||||||
|  |   *          functionalities of the Instruction Cache (ICACHE). | ||||||
|  |   *           + Initialization and Configuration | ||||||
|  |   *           + Invalidate functions | ||||||
|  |   *           + Monitoring management | ||||||
|  |   *           + Memory address remap management | ||||||
|  |   ****************************************************************************** | ||||||
|  |   * @attention | ||||||
|  |   * | ||||||
|  |   * Copyright (c) 2023 STMicroelectronics. | ||||||
|  |   * All rights reserved. | ||||||
|  |   * | ||||||
|  |   * This software is licensed under terms that can be found in the LICENSE file | ||||||
|  |   * in the root directory of this software component. | ||||||
|  |   * If no LICENSE file comes with this software, it is provided AS-IS. | ||||||
|  |   * | ||||||
|  |   ****************************************************************************** | ||||||
|  |   @verbatim | ||||||
|  |   ============================================================================== | ||||||
|  |                         ##### ICACHE main features ##### | ||||||
|  |   ============================================================================== | ||||||
|  |   [..] | ||||||
|  |     The Instruction Cache (ICACHE) is introduced on C-AHB code bus of | ||||||
|  |     Cortex-M33 processor to improve performance when fetching instruction | ||||||
|  |     and data from both internal and external memories. It allows close to | ||||||
|  |     zero wait states performance. | ||||||
|  |  | ||||||
|  |     (+) The ICACHE provides two performance counters (Hit and Miss), | ||||||
|  |         cache invalidate maintenance operation, error management and TrustZone | ||||||
|  |         security support. | ||||||
|  |  | ||||||
|  |     (+) The ICACHE provides additionally the possibility to remap input address | ||||||
|  |         falling into up to four memory regions (used to remap aliased code in | ||||||
|  |         external memories to the internal Code region, for execution) | ||||||
|  |  | ||||||
|  |   =============================================================================== | ||||||
|  |                         ##### How to use this driver ##### | ||||||
|  |   =============================================================================== | ||||||
|  |   [..] | ||||||
|  |      The ICACHE HAL driver can be used as follows: | ||||||
|  |  | ||||||
|  |     (#) Optionally configure the Instruction Cache mode with | ||||||
|  |         HAL_ICACHE_ConfigAssociativityMode() if the default configuration | ||||||
|  |         does not suit the application requirements. | ||||||
|  |  | ||||||
|  |     (#) Enable and disable the Instruction Cache with respectively | ||||||
|  |         HAL_ICACHE_Enable() and HAL_ICACHE_Disable(). | ||||||
|  |         Use HAL_ICACHE_IsEnabled() to get the Instruction Cache status. | ||||||
|  |         To ensure a deterministic cache behavior after power on, system reset or after | ||||||
|  |         a call to @ref HAL_ICACHE_Disable(), the application must call | ||||||
|  |         @ref HAL_ICACHE_WaitForInvalidateComplete(). Indeed on power on, system reset | ||||||
|  |         or cache disable, an automatic cache invalidation procedure is launched and the | ||||||
|  |         cache is bypassed until the operation completes. | ||||||
|  |  | ||||||
|  |     (#) Initiate the cache maintenance invalidation procedure with either | ||||||
|  |         HAL_ICACHE_Invalidate() (blocking mode) or HAL_ICACHE_Invalidate_IT() | ||||||
|  |         (interrupt mode). When interrupt mode is used, the callback function | ||||||
|  |         HAL_ICACHE_InvalidateCompleteCallback() is called when the invalidate | ||||||
|  |         procedure is complete. The function HAL_ICACHE_WaitForInvalidateComplete() | ||||||
|  |         may be called to wait for the end of the invalidate procedure automatically | ||||||
|  |         initiated when disabling the Instruction Cache with HAL_ICACHE_Disable(). | ||||||
|  |         The cache operation is bypassed during the invalidation procedure. | ||||||
|  |  | ||||||
|  |     (#) Use the performance monitoring counters for Hit and Miss with the following | ||||||
|  |         functions: HAL_ICACHE_Monitor_Start(), HAL_ICACHE_Monitor_Stop(), | ||||||
|  |         HAL_ICACHE_Monitor_Reset(), HAL_ICACHE_Monitor_GetHitValue() and | ||||||
|  |         HAL_ICACHE_Monitor_GetMissValue() | ||||||
|  |  | ||||||
|  |     (#) Enable and disable up to four regions to remap input address from external | ||||||
|  |         memories to the internal Code region for execution with | ||||||
|  |         HAL_ICACHE_EnableRemapRegion() and HAL_ICACHE_DisableRemapRegion() | ||||||
|  |  | ||||||
|  |   @endverbatim | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Includes ------------------------------------------------------------------*/ | ||||||
|  | #include "stm32h5xx_hal.h" | ||||||
|  |  | ||||||
|  | /** @addtogroup STM32H5xx_HAL_Driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE ICACHE | ||||||
|  |   * @brief HAL ICACHE module driver | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #if defined(ICACHE) && defined (HAL_ICACHE_MODULE_ENABLED) | ||||||
|  |  | ||||||
|  | /* Private typedef -----------------------------------------------------------*/ | ||||||
|  | /* Private constants ---------------------------------------------------------*/ | ||||||
|  | /** @addtogroup ICACHE_Private_Constants ICACHE Private Constants | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  | #define ICACHE_INVALIDATE_TIMEOUT_VALUE        1U   /* 1ms */ | ||||||
|  | #define ICACHE_DISABLE_TIMEOUT_VALUE           1U   /* 1ms */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private macros ------------------------------------------------------------*/ | ||||||
|  | /** @defgroup ICACHE_Private_Macros ICACHE Private Macros | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #define IS_ICACHE_ASSOCIATIVITY_MODE(__MODE__) (((__MODE__) == ICACHE_1WAY) || \ | ||||||
|  |                                                 ((__MODE__) == ICACHE_2WAYS)) | ||||||
|  |  | ||||||
|  | #define IS_ICACHE_MONITOR_TYPE(__TYPE__)    (((__TYPE__) == ICACHE_MONITOR_HIT_MISS) || \ | ||||||
|  |                                              ((__TYPE__) == ICACHE_MONITOR_HIT)      || \ | ||||||
|  |                                              ((__TYPE__) == ICACHE_MONITOR_MISS)) | ||||||
|  |  | ||||||
|  | #if defined(ICACHE_CRRx_REN) | ||||||
|  | #define IS_ICACHE_REGION_NUMBER(__NUMBER__) ((__NUMBER__) < 4U) | ||||||
|  |  | ||||||
|  | #define IS_ICACHE_REGION_SIZE(__SIZE__)     (((__SIZE__) == ICACHE_REGIONSIZE_2MB)   || \ | ||||||
|  |                                              ((__SIZE__) == ICACHE_REGIONSIZE_4MB)   || \ | ||||||
|  |                                              ((__SIZE__) == ICACHE_REGIONSIZE_8MB)   || \ | ||||||
|  |                                              ((__SIZE__) == ICACHE_REGIONSIZE_16MB)  || \ | ||||||
|  |                                              ((__SIZE__) == ICACHE_REGIONSIZE_32MB)  || \ | ||||||
|  |                                              ((__SIZE__) == ICACHE_REGIONSIZE_64MB)  || \ | ||||||
|  |                                              ((__SIZE__) == ICACHE_REGIONSIZE_128MB)) | ||||||
|  |  | ||||||
|  | #define IS_ICACHE_REGION_TRAFFIC_ROUTE(__TRAFFICROUTE__)  (((__TRAFFICROUTE__) == ICACHE_MASTER1_PORT) || \ | ||||||
|  |                                                            ((__TRAFFICROUTE__) == ICACHE_MASTER2_PORT)) | ||||||
|  |  | ||||||
|  | #define IS_ICACHE_REGION_OUTPUT_BURST_TYPE(__OUTPUTBURSTTYPE_) (((__OUTPUTBURSTTYPE_) == ICACHE_OUTPUT_BURST_WRAP) || \ | ||||||
|  |                                                                 ((__OUTPUTBURSTTYPE_) == ICACHE_OUTPUT_BURST_INCR)) | ||||||
|  |  | ||||||
|  | #endif /*  ICACHE_CRRx_REN */ | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /* Private variables ---------------------------------------------------------*/ | ||||||
|  | /* Private function prototypes -----------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /* Exported functions --------------------------------------------------------*/ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_Exported_Functions ICACHE Exported Functions | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_Exported_Functions_Group1 Initialization and control functions | ||||||
|  |   * @brief    Initialization and control functions | ||||||
|  |   * | ||||||
|  |   @verbatim | ||||||
|  |   ============================================================================== | ||||||
|  |             ##### Initialization and control functions ##### | ||||||
|  |   ============================================================================== | ||||||
|  |   [..] | ||||||
|  |     This section provides functions allowing to initialize and control the | ||||||
|  |     Instruction Cache (mode, invalidate procedure, performance counters). | ||||||
|  |   @endverbatim | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Configure the Instruction Cache cache associativity mode selection. | ||||||
|  |   * @param  AssociativityMode  Associativity mode selection | ||||||
|  |   *         This parameter can be one of the following values: | ||||||
|  |   *            @arg ICACHE_1WAY   1-way cache (direct mapped cache) | ||||||
|  |   *            @arg ICACHE_2WAYS  2-ways set associative cache (default) | ||||||
|  |   * @retval HAL status (HAL_OK/HAL_ERROR) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_ConfigAssociativityMode(uint32_t AssociativityMode) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status = HAL_OK; | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_ICACHE_ASSOCIATIVITY_MODE(AssociativityMode)); | ||||||
|  |  | ||||||
|  |   /* Check cache is not enabled */ | ||||||
|  |   if (READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U) | ||||||
|  |   { | ||||||
|  |     status = HAL_ERROR; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     MODIFY_REG(ICACHE->CR, ICACHE_CR_WAYSEL, AssociativityMode); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  DeInitialize the Instruction Cache. | ||||||
|  |   * @retval HAL status (HAL_OK) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_DeInit(void) | ||||||
|  | { | ||||||
|  |   /* Reset interrupt enable value */ | ||||||
|  |   WRITE_REG(ICACHE->IER, 0U); | ||||||
|  |  | ||||||
|  |   /* Clear any pending flags */ | ||||||
|  |   WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF | ICACHE_FCR_CERRF); | ||||||
|  |  | ||||||
|  |   /* Disable cache then set default associative mode value */ | ||||||
|  |   CLEAR_BIT(ICACHE->CR, ICACHE_CR_EN); | ||||||
|  |   WRITE_REG(ICACHE->CR, ICACHE_CR_WAYSEL); | ||||||
|  |  | ||||||
|  |   /* Stop monitor and reset monitor values */ | ||||||
|  |   CLEAR_BIT(ICACHE->CR, ICACHE_MONITOR_HIT_MISS); | ||||||
|  |   SET_BIT(ICACHE->CR, (ICACHE_MONITOR_HIT_MISS << 2U)); | ||||||
|  |   CLEAR_BIT(ICACHE->CR, (ICACHE_MONITOR_HIT_MISS << 2U)); | ||||||
|  |  | ||||||
|  | #if defined(ICACHE_CRRx_REN) | ||||||
|  |   /* Reset regions configuration values */ | ||||||
|  |   WRITE_REG(ICACHE->CRR0, ICACHE_REGIONSIZE_2MB << ICACHE_CRRx_RSIZE_Pos); | ||||||
|  |   WRITE_REG(ICACHE->CRR1, ICACHE_REGIONSIZE_2MB << ICACHE_CRRx_RSIZE_Pos); | ||||||
|  |   WRITE_REG(ICACHE->CRR2, ICACHE_REGIONSIZE_2MB << ICACHE_CRRx_RSIZE_Pos); | ||||||
|  |   WRITE_REG(ICACHE->CRR3, ICACHE_REGIONSIZE_2MB << ICACHE_CRRx_RSIZE_Pos); | ||||||
|  | #endif /*  ICACHE_CRRx_REN */ | ||||||
|  |  | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Enable the Instruction Cache. | ||||||
|  |   * @note   This function always returns HAL_OK even if there is any ongoing | ||||||
|  |   *         cache operation. The Instruction Cache is bypassed until the | ||||||
|  |   *         cache operation completes. | ||||||
|  |   * @retval HAL status (HAL_OK) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Enable(void) | ||||||
|  | { | ||||||
|  |   SET_BIT(ICACHE->CR, ICACHE_CR_EN); | ||||||
|  |  | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the Instruction Cache. | ||||||
|  |   * @note   This function waits for the cache being disabled but | ||||||
|  |   *         not for the end of the automatic cache invalidation procedure. | ||||||
|  |   * @retval HAL status (HAL_OK/HAL_TIMEOUT) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Disable(void) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status = HAL_OK; | ||||||
|  |   uint32_t tickstart; | ||||||
|  |  | ||||||
|  |   /* Make sure BSYENDF is reset before to disable the instruction cache */ | ||||||
|  |   /* as it automatically starts a cache invalidation procedure */ | ||||||
|  |   WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF); | ||||||
|  |  | ||||||
|  |   CLEAR_BIT(ICACHE->CR, ICACHE_CR_EN); | ||||||
|  |  | ||||||
|  |   /* Get tick */ | ||||||
|  |   tickstart = HAL_GetTick(); | ||||||
|  |  | ||||||
|  |   /* Wait for instruction cache being disabled */ | ||||||
|  |   while (READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U) | ||||||
|  |   { | ||||||
|  |     if ((HAL_GetTick() - tickstart) > ICACHE_DISABLE_TIMEOUT_VALUE) | ||||||
|  |     { | ||||||
|  |       /* New check to avoid false timeout detection in case of preemption */ | ||||||
|  |       if (READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U) | ||||||
|  |       { | ||||||
|  |         status = HAL_TIMEOUT; | ||||||
|  |         break; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Check whether the Instruction Cache is enabled or not. | ||||||
|  |   * @retval Status (0: disabled, 1: enabled) | ||||||
|  |   */ | ||||||
|  | uint32_t HAL_ICACHE_IsEnabled(void) | ||||||
|  | { | ||||||
|  |   return ((READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U) ? 1UL : 0UL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Invalidate the Instruction Cache. | ||||||
|  |   * @note   This function waits for the end of cache invalidation procedure | ||||||
|  |   *         and clears the associated BSYENDF flag. | ||||||
|  |   * @retval HAL status (HAL_OK/HAL_ERROR/HAL_TIMEOUT) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Invalidate(void) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status; | ||||||
|  |  | ||||||
|  |   /* Check if no ongoing operation */ | ||||||
|  |   if (READ_BIT(ICACHE->SR, ICACHE_SR_BUSYF) == 0U) | ||||||
|  |   { | ||||||
|  |     /* Launch cache invalidation */ | ||||||
|  |     SET_BIT(ICACHE->CR, ICACHE_CR_CACHEINV); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   status = HAL_ICACHE_WaitForInvalidateComplete(); | ||||||
|  |  | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Invalidate the Instruction Cache with interrupt. | ||||||
|  |   * @note   This function launches cache invalidation and returns. | ||||||
|  |   *         User application shall resort to interrupt generation to check | ||||||
|  |   *         the end of the cache invalidation with the BSYENDF flag and the | ||||||
|  |   *         HAL_ICACHE_InvalidateCompleteCallback() callback. | ||||||
|  |   * @retval HAL status (HAL_OK/HAL_ERROR) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Invalidate_IT(void) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status = HAL_OK; | ||||||
|  |  | ||||||
|  |   /* Check no ongoing operation */ | ||||||
|  |   if (READ_BIT(ICACHE->SR, ICACHE_SR_BUSYF) != 0U) | ||||||
|  |   { | ||||||
|  |     status = HAL_ERROR; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* Make sure BSYENDF is reset before to start cache invalidation */ | ||||||
|  |     WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF); | ||||||
|  |  | ||||||
|  |     /* Enable end of cache invalidation interrupt */ | ||||||
|  |     SET_BIT(ICACHE->IER, ICACHE_IER_BSYENDIE); | ||||||
|  |  | ||||||
|  |     /* Launch cache invalidation */ | ||||||
|  |     SET_BIT(ICACHE->CR, ICACHE_CR_CACHEINV); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Wait for the end of the Instruction Cache invalidate procedure. | ||||||
|  |   * @note This function checks and clears the BSYENDF flag when set. | ||||||
|  |   * @retval HAL status (HAL_OK/HAL_TIMEOUT) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_WaitForInvalidateComplete(void) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status = HAL_OK; | ||||||
|  |   uint32_t tickstart; | ||||||
|  |  | ||||||
|  |   /* Check if ongoing invalidation operation */ | ||||||
|  |   if (READ_BIT(ICACHE->SR, ICACHE_SR_BUSYF) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Get tick */ | ||||||
|  |     tickstart = HAL_GetTick(); | ||||||
|  |  | ||||||
|  |     /* Wait for end of cache invalidation */ | ||||||
|  |     while (READ_BIT(ICACHE->SR, ICACHE_SR_BSYENDF) == 0U) | ||||||
|  |     { | ||||||
|  |       if ((HAL_GetTick() - tickstart) > ICACHE_INVALIDATE_TIMEOUT_VALUE) | ||||||
|  |       { | ||||||
|  |         /* New check to avoid false timeout detection in case of preemption */ | ||||||
|  |         if (READ_BIT(ICACHE->SR, ICACHE_SR_BSYENDF) == 0U) | ||||||
|  |         { | ||||||
|  |           status = HAL_TIMEOUT; | ||||||
|  |           break; | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Clear BSYENDF */ | ||||||
|  |   WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF); | ||||||
|  |  | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Start the Instruction Cache performance monitoring. | ||||||
|  |   * @param  MonitorType  Monitoring type | ||||||
|  |   *         This parameter can be one of the following values: | ||||||
|  |   *            @arg ICACHE_MONITOR_HIT_MISS   Hit & Miss monitoring | ||||||
|  |   *            @arg ICACHE_MONITOR_HIT        Hit monitoring | ||||||
|  |   *            @arg ICACHE_MONITOR_MISS       Miss monitoring | ||||||
|  |   * @retval HAL status (HAL_OK) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Monitor_Start(uint32_t MonitorType) | ||||||
|  | { | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_ICACHE_MONITOR_TYPE(MonitorType)); | ||||||
|  |  | ||||||
|  |   SET_BIT(ICACHE->CR, MonitorType); | ||||||
|  |  | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Stop the Instruction Cache performance monitoring. | ||||||
|  |   * @note   Stopping the monitoring does not reset the values. | ||||||
|  |   * @param  MonitorType  Monitoring type | ||||||
|  |   *         This parameter can be one of the following values: | ||||||
|  |   *            @arg ICACHE_MONITOR_HIT_MISS   Hit & Miss monitoring | ||||||
|  |   *            @arg ICACHE_MONITOR_HIT        Hit monitoring | ||||||
|  |   *            @arg ICACHE_MONITOR_MISS       Miss monitoring | ||||||
|  |   * @retval HAL status (HAL_OK) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Monitor_Stop(uint32_t MonitorType) | ||||||
|  | { | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_ICACHE_MONITOR_TYPE(MonitorType)); | ||||||
|  |  | ||||||
|  |   CLEAR_BIT(ICACHE->CR, MonitorType); | ||||||
|  |  | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Reset the Instruction Cache performance monitoring values. | ||||||
|  |   * @param  MonitorType  Monitoring type | ||||||
|  |   *         This parameter can be one of the following values: | ||||||
|  |   *            @arg ICACHE_MONITOR_HIT_MISS   Hit & Miss monitoring | ||||||
|  |   *            @arg ICACHE_MONITOR_HIT        Hit monitoring | ||||||
|  |   *            @arg ICACHE_MONITOR_MISS       Miss monitoring | ||||||
|  |   * @retval HAL status (HAL_OK) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef HAL_ICACHE_Monitor_Reset(uint32_t MonitorType) | ||||||
|  | { | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_ICACHE_MONITOR_TYPE(MonitorType)); | ||||||
|  |  | ||||||
|  |   /* Force/Release reset */ | ||||||
|  |   SET_BIT(ICACHE->CR, (MonitorType << 2U)); | ||||||
|  |   CLEAR_BIT(ICACHE->CR, (MonitorType << 2U)); | ||||||
|  |  | ||||||
|  |   return HAL_OK; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the Instruction Cache performance Hit monitoring value. | ||||||
|  |   * @note   Upon reaching the 32-bit maximum value, monitor does not wrap. | ||||||
|  |   * @retval Hit monitoring value | ||||||
|  |   */ | ||||||
|  | uint32_t HAL_ICACHE_Monitor_GetHitValue(void) | ||||||
|  | { | ||||||
|  |   return (ICACHE->HMONR); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Get the Instruction Cache performance Miss monitoring value. | ||||||
|  |   * @note   Upon reaching the 32-bit maximum value, monitor does not wrap. | ||||||
|  |   * @retval Miss monitoring value | ||||||
|  |   */ | ||||||
|  | uint32_t HAL_ICACHE_Monitor_GetMissValue(void) | ||||||
|  | { | ||||||
|  |   return (ICACHE->MMONR); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** @defgroup ICACHE_Exported_Functions_Group2 IRQ and callback functions | ||||||
|  |   * @brief    IRQ and callback functions | ||||||
|  |   * | ||||||
|  |   @verbatim | ||||||
|  |   ============================================================================== | ||||||
|  |             ##### IRQ and callback functions ##### | ||||||
|  |   ============================================================================== | ||||||
|  |   [..] | ||||||
|  |     This section provides functions allowing to handle ICACHE global interrupt | ||||||
|  |     and the associated callback functions. | ||||||
|  |   @endverbatim | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Handle the Instruction Cache interrupt request. | ||||||
|  |   * @note This function should be called under the ICACHE_IRQHandler(). | ||||||
|  |   * @note This function respectively disables the interrupt and clears the | ||||||
|  |   *       flag of any pending flag before calling the associated user callback. | ||||||
|  |   * @retval None | ||||||
|  |   */ | ||||||
|  | void HAL_ICACHE_IRQHandler(void) | ||||||
|  | { | ||||||
|  |   /* Get current interrupt flags and interrupt sources value */ | ||||||
|  |   uint32_t itflags   = READ_REG(ICACHE->SR); | ||||||
|  |   uint32_t itsources = READ_REG(ICACHE->IER); | ||||||
|  |  | ||||||
|  |   /* Check Instruction cache Error interrupt flag */ | ||||||
|  |   if (((itflags & itsources) & ICACHE_FLAG_ERROR) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Disable error interrupt */ | ||||||
|  |     CLEAR_BIT(ICACHE->IER, ICACHE_IER_ERRIE); | ||||||
|  |  | ||||||
|  |     /* Clear ERR pending flag */ | ||||||
|  |     WRITE_REG(ICACHE->FCR, ICACHE_FCR_CERRF); | ||||||
|  |  | ||||||
|  |     /* Instruction cache error interrupt user callback */ | ||||||
|  |     HAL_ICACHE_ErrorCallback(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /* Check Instruction cache BusyEnd interrupt flag */ | ||||||
|  |   if (((itflags & itsources) & ICACHE_FLAG_BUSYEND) != 0U) | ||||||
|  |   { | ||||||
|  |     /* Disable end of cache invalidation interrupt */ | ||||||
|  |     CLEAR_BIT(ICACHE->IER, ICACHE_IER_BSYENDIE); | ||||||
|  |  | ||||||
|  |     /* Clear BSYENDF pending flag */ | ||||||
|  |     WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF); | ||||||
|  |  | ||||||
|  |     /* Instruction cache busyend interrupt user callback */ | ||||||
|  |     HAL_ICACHE_InvalidateCompleteCallback(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Cache invalidation complete callback. | ||||||
|  |   */ | ||||||
|  | __weak void HAL_ICACHE_InvalidateCompleteCallback(void) | ||||||
|  | { | ||||||
|  |   /* NOTE : This function should not be modified, when the callback is needed, | ||||||
|  |             the HAL_ICACHE_InvalidateCompleteCallback() should be implemented in the user file | ||||||
|  |    */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Error callback. | ||||||
|  |   */ | ||||||
|  | __weak void HAL_ICACHE_ErrorCallback(void) | ||||||
|  | { | ||||||
|  |   /* NOTE : This function should not be modified, when the callback is needed, | ||||||
|  |             the HAL_ICACHE_ErrorCallback() should be implemented in the user file | ||||||
|  |    */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #if defined(ICACHE_CRRx_REN) | ||||||
|  | /** @defgroup ICACHE_Exported_Functions_Group3 Memory remapped regions functions | ||||||
|  |   * @brief    Memory remapped regions functions | ||||||
|  |   * | ||||||
|  |   @verbatim | ||||||
|  |   ============================================================================== | ||||||
|  |             ##### Memory remapped regions functions ##### | ||||||
|  |   ============================================================================== | ||||||
|  |   [..] | ||||||
|  |     This section provides functions allowing to manage the remapping of | ||||||
|  |     external memories to internal Code for execution. | ||||||
|  |   @endverbatim | ||||||
|  |   * @{ | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Configure and enable a region for memory remapping. | ||||||
|  |   * @note   The Instruction Cache and the region must be disabled. | ||||||
|  |   * @param  Region   Region number | ||||||
|  |                      This parameter can be a value of @arg @ref ICACHE_Region | ||||||
|  |   * @param  pRegionConfig  Pointer to structure of ICACHE region configuration parameters | ||||||
|  |   * @retval HAL status (HAL_OK/HAL_ERROR) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef  HAL_ICACHE_EnableRemapRegion(uint32_t Region, const ICACHE_RegionConfigTypeDef *const pRegionConfig) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status = HAL_OK; | ||||||
|  |   __IO uint32_t *p_reg; | ||||||
|  |   uint32_t value; | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_ICACHE_REGION_NUMBER(Region)); | ||||||
|  |   assert_param(IS_ICACHE_REGION_SIZE(pRegionConfig->Size)); | ||||||
|  |   assert_param(IS_ICACHE_REGION_TRAFFIC_ROUTE(pRegionConfig->TrafficRoute)); | ||||||
|  |   assert_param(IS_ICACHE_REGION_OUTPUT_BURST_TYPE(pRegionConfig->OutputBurstType)); | ||||||
|  |  | ||||||
|  |   /* Check cache is not enabled */ | ||||||
|  |   if (READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U) | ||||||
|  |   { | ||||||
|  |     status = HAL_ERROR; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* Get region control register address */ | ||||||
|  |     p_reg = &(ICACHE->CRR0) + (1U * Region); | ||||||
|  |  | ||||||
|  |     /* Check region is not already enabled */ | ||||||
|  |     if ((*p_reg & ICACHE_CRRx_REN) != 0U) | ||||||
|  |     { | ||||||
|  |       status = HAL_ERROR; | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |       /* Region 2MB:   BaseAddress size 8 bits, RemapAddress size 11 bits */ | ||||||
|  |       /* Region 4MB:   BaseAddress size 7 bits, RemapAddress size 10 bits */ | ||||||
|  |       /* Region 8MB:   BaseAddress size 6 bits, RemapAddress size 9 bits  */ | ||||||
|  |       /* Region 16MB:  BaseAddress size 5 bits, RemapAddress size 8 bits  */ | ||||||
|  |       /* Region 32MB:  BaseAddress size 4 bits, RemapAddress size 7 bits  */ | ||||||
|  |       /* Region 64MB:  BaseAddress size 3 bits, RemapAddress size 6 bits  */ | ||||||
|  |       /* Region 128MB: BaseAddress size 2 bits, RemapAddress size 5 bits  */ | ||||||
|  |       value  = ((pRegionConfig->BaseAddress & 0x1FFFFFFFU) >> 21U) & \ | ||||||
|  |                (0xFFU & ~(pRegionConfig->Size - 1U)); | ||||||
|  |       value |= ((pRegionConfig->RemapAddress >> 5U) & \ | ||||||
|  |                 ((uint32_t)(0x7FFU & ~(pRegionConfig->Size - 1U)) << ICACHE_CRRx_REMAPADDR_Pos)); | ||||||
|  |       value |= (pRegionConfig->Size << ICACHE_CRRx_RSIZE_Pos) | pRegionConfig->TrafficRoute | \ | ||||||
|  |                pRegionConfig->OutputBurstType; | ||||||
|  |       *p_reg = (value | ICACHE_CRRx_REN); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief  Disable the memory remapping for a predefined region. | ||||||
|  |   * @param  Region   Region number | ||||||
|  |                      This parameter can be a value of @arg @ref ICACHE_Region | ||||||
|  |   * @retval HAL status (HAL_OK/HAL_ERROR) | ||||||
|  |   */ | ||||||
|  | HAL_StatusTypeDef  HAL_ICACHE_DisableRemapRegion(uint32_t Region) | ||||||
|  | { | ||||||
|  |   HAL_StatusTypeDef status = HAL_OK; | ||||||
|  |   __IO uint32_t *p_reg; | ||||||
|  |  | ||||||
|  |   /* Check the parameters */ | ||||||
|  |   assert_param(IS_ICACHE_REGION_NUMBER(Region)); | ||||||
|  |  | ||||||
|  |   /* Check cache is not enabled */ | ||||||
|  |   if (READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U) | ||||||
|  |   { | ||||||
|  |     status = HAL_ERROR; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     /* Get region control register address */ | ||||||
|  |     p_reg = &(ICACHE->CRR0) + (1U * Region); | ||||||
|  |  | ||||||
|  |     *p_reg &= ~ICACHE_CRRx_REN; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return status; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  | #endif /*  ICACHE_CRRx_REN */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | #endif /* ICACHE && HAL_ICACHE_MODULE_ENABLED */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @} | ||||||
|  |   */ | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user