55 #define __STM32F4xx_HAL_VERSION_MAIN (0x01U)
56 #define __STM32F4xx_HAL_VERSION_SUB1 (0x08U)
57 #define __STM32F4xx_HAL_VERSION_SUB2 (0x03U)
58 #define __STM32F4xx_HAL_VERSION_RC (0x00U)
59 #define __STM32F4xx_HAL_VERSION ((__STM32F4xx_HAL_VERSION_MAIN << 24U)\
60 |(__STM32F4xx_HAL_VERSION_SUB1 << 16U)\
61 |(__STM32F4xx_HAL_VERSION_SUB2 << 8U )\
62 |(__STM32F4xx_HAL_VERSION_RC))
64 #define IDCODE_DEVID_MASK 0x00000FFFU
67 #define SYSCFG_OFFSET (SYSCFG_BASE - PERIPH_BASE)
70 #define MEMRMP_OFFSET SYSCFG_OFFSET
71 #define UFB_MODE_BIT_NUMBER SYSCFG_MEMRMP_UFB_MODE_Pos
72 #define UFB_MODE_BB (uint32_t)(PERIPH_BB_BASE + (MEMRMP_OFFSET * 32U) + (UFB_MODE_BIT_NUMBER * 4U))
76 #define CMPCR_OFFSET (SYSCFG_OFFSET + 0x20U)
77 #define CMP_PD_BIT_NUMBER SYSCFG_CMPCR_CMP_PD_Pos
78 #define CMPCR_CMP_PD_BB (uint32_t)(PERIPH_BB_BASE + (CMPCR_OFFSET * 32U) + (CMP_PD_BIT_NUMBER * 4U))
82 #define MCHDLYCR_OFFSET (SYSCFG_OFFSET + 0x30U)
83 #define BSCKSEL_BIT_NUMBER SYSCFG_MCHDLYCR_BSCKSEL_Pos
84 #define MCHDLYCR_BSCKSEL_BB (uint32_t)(PERIPH_BB_BASE + (MCHDLYCR_OFFSET * 32U) + (BSCKSEL_BIT_NUMBER * 4U))
95 uint32_t uwTickPrio = (1UL << __NVIC_PRIO_BITS);
96 HAL_TickFreqTypeDef uwTickFreq = HAL_TICK_FREQ_DEFAULT;
160 #if (INSTRUCTION_CACHE_ENABLE != 0U)
161 __HAL_FLASH_INSTRUCTION_CACHE_ENABLE();
164 #if (DATA_CACHE_ENABLE != 0U)
165 __HAL_FLASH_DATA_CACHE_ENABLE();
168 #if (PREFETCH_ENABLE != 0U)
169 __HAL_FLASH_PREFETCH_BUFFER_ENABLE();
193 __HAL_RCC_APB1_FORCE_RESET();
194 __HAL_RCC_APB1_RELEASE_RESET();
196 __HAL_RCC_APB2_FORCE_RESET();
197 __HAL_RCC_APB2_RELEASE_RESET();
199 __HAL_RCC_AHB1_FORCE_RESET();
200 __HAL_RCC_AHB1_RELEASE_RESET();
202 __HAL_RCC_AHB2_FORCE_RESET();
203 __HAL_RCC_AHB2_RELEASE_RESET();
205 __HAL_RCC_AHB3_FORCE_RESET();
206 __HAL_RCC_AHB3_RELEASE_RESET();
262 if (TickPriority < (1UL << __NVIC_PRIO_BITS))
265 uwTickPrio = TickPriority;
314 uwTick += uwTickFreq;
343 HAL_StatusTypeDef status = HAL_OK;
344 HAL_TickFreqTypeDef prevTickFreq;
346 assert_param(IS_TICKFREQ(Freq));
348 if (uwTickFreq != Freq)
351 prevTickFreq = uwTickFreq;
359 if (status != HAL_OK)
362 uwTickFreq = prevTickFreq;
393 uint32_t wait = Delay;
396 if (wait < HAL_MAX_DELAY)
398 wait += (uint32_t)(uwTickFreq);
419 SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
435 SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
444 return __STM32F4xx_HAL_VERSION;
453 return((DBGMCU->IDCODE) >> 16U);
462 return((DBGMCU->IDCODE) & IDCODE_DEVID_MASK);
471 SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
480 CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
489 SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
498 CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
507 SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
516 CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
527 *(__IO uint32_t *)CMPCR_CMP_PD_BB = (uint32_t)ENABLE;
538 *(__IO uint32_t *)CMPCR_CMP_PD_BB = (uint32_t)DISABLE;
547 return (READ_REG(*((uint32_t *)UID_BASE)));
556 return (READ_REG(*((uint32_t *)(UID_BASE + 4U))));
565 return (READ_REG(*((uint32_t *)(UID_BASE + 8U))));
568 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
569 defined(STM32F469xx) || defined(STM32F479xx)
582 *(__IO uint32_t *)UFB_MODE_BB = (uint32_t)ENABLE;
597 *(__IO uint32_t *)UFB_MODE_BB = (uint32_t)DISABLE;
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
Sets the priority of an interrupt.
uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb)
Initializes the System Timer and its interrupt, and starts the System Tick Timer. Counter is in free ...
void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
Sets the priority grouping field (preemption priority and subpriority) using the required unlock sequ...
void HAL_MspInit(void)
Initialize the MSP.
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
This function configures the source of the time base. The time source is configured to have 1ms time ...
HAL_StatusTypeDef HAL_DeInit(void)
This function de-Initializes common part of the HAL and stops the systick. This function is optional.
void HAL_MspDeInit(void)
DeInitializes the MSP.
HAL_StatusTypeDef HAL_Init(void)
This function is used to initialize the HAL Library; it must be the first instruction to be executed ...
void HAL_EnableMemorySwappingBank(void)
Enables the Internal FLASH Bank Swapping.
void HAL_EnableCompensationCell(void)
Enables the I/O Compensation Cell.
void HAL_DBGMCU_EnableDBGStandbyMode(void)
Enable the Debug Module during STANDBY mode.
void HAL_DBGMCU_DisableDBGStopMode(void)
Disable the Debug Module during STOP mode.
HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq)
Set new tick Freq.
uint32_t HAL_GetUIDw1(void)
Returns second word of the unique device identifier (UID based on 96 bits)
uint32_t HAL_GetUIDw2(void)
Returns third word of the unique device identifier (UID based on 96 bits)
void HAL_DisableCompensationCell(void)
Power-down the I/O Compensation Cell.
void HAL_DBGMCU_DisableDBGStandbyMode(void)
Disable the Debug Module during STANDBY mode.
HAL_TickFreqTypeDef HAL_GetTickFreq(void)
Return tick frequency.
void HAL_SuspendTick(void)
Suspend Tick increment.
void HAL_Delay(uint32_t Delay)
This function provides minimum delay (in milliseconds) based on variable incremented.
void HAL_IncTick(void)
This function is called to increment a global variable "uwTick" used as application time base.
void HAL_ResumeTick(void)
Resume Tick increment.
void HAL_DBGMCU_DisableDBGSleepMode(void)
Disable the Debug Module during SLEEP mode.
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
uint32_t HAL_GetTickPrio(void)
This function returns a tick priority.
void HAL_DBGMCU_EnableDBGStopMode(void)
Enable the Debug Module during STOP mode.
void HAL_DisableMemorySwappingBank(void)
Disables the Internal FLASH Bank Swapping.
uint32_t HAL_GetREVID(void)
Returns the device revision identifier.
void HAL_DBGMCU_EnableDBGSleepMode(void)
Enable the Debug Module during SLEEP mode.
uint32_t HAL_GetUIDw0(void)
Returns first word of the unique device identifier (UID based on 96 bits)
uint32_t HAL_GetHalVersion(void)
Returns the HAL revision.
uint32_t HAL_GetDEVID(void)
Returns the device identifier.
This file contains all the functions prototypes for the HAL module driver.