Prusa MINI Firmware overview
|
Go to the documentation of this file.
53 #ifndef __STM32F4xx_LL_CORTEX_H
54 #define __STM32F4xx_LL_CORTEX_H
61 #include "stm32f4xx.h"
87 #define LL_SYSTICK_CLKSOURCE_HCLK_DIV8 0x00000000U
88 #define LL_SYSTICK_CLKSOURCE_HCLK SysTick_CTRL_CLKSOURCE_Msk
96 #define LL_HANDLER_FAULT_USG SCB_SHCSR_USGFAULTENA_Msk
97 #define LL_HANDLER_FAULT_BUS SCB_SHCSR_BUSFAULTENA_Msk
98 #define LL_HANDLER_FAULT_MEM SCB_SHCSR_MEMFAULTENA_Msk
108 #define LL_MPU_CTRL_HFNMI_PRIVDEF_NONE 0x00000000U
109 #define LL_MPU_CTRL_HARDFAULT_NMI MPU_CTRL_HFNMIENA_Msk
110 #define LL_MPU_CTRL_PRIVILEGED_DEFAULT MPU_CTRL_PRIVDEFENA_Msk
111 #define LL_MPU_CTRL_HFNMI_PRIVDEF (MPU_CTRL_HFNMIENA_Msk | MPU_CTRL_PRIVDEFENA_Msk)
119 #define LL_MPU_REGION_NUMBER0 0x00U
120 #define LL_MPU_REGION_NUMBER1 0x01U
121 #define LL_MPU_REGION_NUMBER2 0x02U
122 #define LL_MPU_REGION_NUMBER3 0x03U
123 #define LL_MPU_REGION_NUMBER4 0x04U
124 #define LL_MPU_REGION_NUMBER5 0x05U
125 #define LL_MPU_REGION_NUMBER6 0x06U
126 #define LL_MPU_REGION_NUMBER7 0x07U
134 #define LL_MPU_REGION_SIZE_32B (0x04U << MPU_RASR_SIZE_Pos)
135 #define LL_MPU_REGION_SIZE_64B (0x05U << MPU_RASR_SIZE_Pos)
136 #define LL_MPU_REGION_SIZE_128B (0x06U << MPU_RASR_SIZE_Pos)
137 #define LL_MPU_REGION_SIZE_256B (0x07U << MPU_RASR_SIZE_Pos)
138 #define LL_MPU_REGION_SIZE_512B (0x08U << MPU_RASR_SIZE_Pos)
139 #define LL_MPU_REGION_SIZE_1KB (0x09U << MPU_RASR_SIZE_Pos)
140 #define LL_MPU_REGION_SIZE_2KB (0x0AU << MPU_RASR_SIZE_Pos)
141 #define LL_MPU_REGION_SIZE_4KB (0x0BU << MPU_RASR_SIZE_Pos)
142 #define LL_MPU_REGION_SIZE_8KB (0x0CU << MPU_RASR_SIZE_Pos)
143 #define LL_MPU_REGION_SIZE_16KB (0x0DU << MPU_RASR_SIZE_Pos)
144 #define LL_MPU_REGION_SIZE_32KB (0x0EU << MPU_RASR_SIZE_Pos)
145 #define LL_MPU_REGION_SIZE_64KB (0x0FU << MPU_RASR_SIZE_Pos)
146 #define LL_MPU_REGION_SIZE_128KB (0x10U << MPU_RASR_SIZE_Pos)
147 #define LL_MPU_REGION_SIZE_256KB (0x11U << MPU_RASR_SIZE_Pos)
148 #define LL_MPU_REGION_SIZE_512KB (0x12U << MPU_RASR_SIZE_Pos)
149 #define LL_MPU_REGION_SIZE_1MB (0x13U << MPU_RASR_SIZE_Pos)
150 #define LL_MPU_REGION_SIZE_2MB (0x14U << MPU_RASR_SIZE_Pos)
151 #define LL_MPU_REGION_SIZE_4MB (0x15U << MPU_RASR_SIZE_Pos)
152 #define LL_MPU_REGION_SIZE_8MB (0x16U << MPU_RASR_SIZE_Pos)
153 #define LL_MPU_REGION_SIZE_16MB (0x17U << MPU_RASR_SIZE_Pos)
154 #define LL_MPU_REGION_SIZE_32MB (0x18U << MPU_RASR_SIZE_Pos)
155 #define LL_MPU_REGION_SIZE_64MB (0x19U << MPU_RASR_SIZE_Pos)
156 #define LL_MPU_REGION_SIZE_128MB (0x1AU << MPU_RASR_SIZE_Pos)
157 #define LL_MPU_REGION_SIZE_256MB (0x1BU << MPU_RASR_SIZE_Pos)
158 #define LL_MPU_REGION_SIZE_512MB (0x1CU << MPU_RASR_SIZE_Pos)
159 #define LL_MPU_REGION_SIZE_1GB (0x1DU << MPU_RASR_SIZE_Pos)
160 #define LL_MPU_REGION_SIZE_2GB (0x1EU << MPU_RASR_SIZE_Pos)
161 #define LL_MPU_REGION_SIZE_4GB (0x1FU << MPU_RASR_SIZE_Pos)
169 #define LL_MPU_REGION_NO_ACCESS (0x00U << MPU_RASR_AP_Pos)
170 #define LL_MPU_REGION_PRIV_RW (0x01U << MPU_RASR_AP_Pos)
171 #define LL_MPU_REGION_PRIV_RW_URO (0x02U << MPU_RASR_AP_Pos)
172 #define LL_MPU_REGION_FULL_ACCESS (0x03U << MPU_RASR_AP_Pos)
173 #define LL_MPU_REGION_PRIV_RO (0x05U << MPU_RASR_AP_Pos)
174 #define LL_MPU_REGION_PRIV_RO_URO (0x06U << MPU_RASR_AP_Pos)
182 #define LL_MPU_TEX_LEVEL0 (0x00U << MPU_RASR_TEX_Pos)
183 #define LL_MPU_TEX_LEVEL1 (0x01U << MPU_RASR_TEX_Pos)
184 #define LL_MPU_TEX_LEVEL2 (0x02U << MPU_RASR_TEX_Pos)
185 #define LL_MPU_TEX_LEVEL4 (0x04U << MPU_RASR_TEX_Pos)
193 #define LL_MPU_INSTRUCTION_ACCESS_ENABLE 0x00U
194 #define LL_MPU_INSTRUCTION_ACCESS_DISABLE MPU_RASR_XN_Msk
202 #define LL_MPU_ACCESS_SHAREABLE MPU_RASR_S_Msk
203 #define LL_MPU_ACCESS_NOT_SHAREABLE 0x00U
211 #define LL_MPU_ACCESS_CACHEABLE MPU_RASR_C_Msk
212 #define LL_MPU_ACCESS_NOT_CACHEABLE 0x00U
220 #define LL_MPU_ACCESS_BUFFERABLE MPU_RASR_B_Msk
221 #define LL_MPU_ACCESS_NOT_BUFFERABLE 0x00U
249 return ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) == (SysTick_CTRL_COUNTFLAG_Msk));
291 SET_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk);
301 CLEAR_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk);
311 return (READ_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk) == (SysTick_CTRL_TICKINT_Msk));
330 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
341 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
354 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
365 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
377 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
389 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
412 SET_BIT(SCB->SHCSR, Fault);
427 CLEAR_BIT(SCB->SHCSR, Fault);
445 return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_IMPLEMENTER_Msk) >> SCB_CPUID_IMPLEMENTER_Pos);
455 return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_VARIANT_Msk) >> SCB_CPUID_VARIANT_Pos);
465 return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_ARCHITECTURE_Msk) >> SCB_CPUID_ARCHITECTURE_Pos);
475 return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_PARTNO_Msk) >> SCB_CPUID_PARTNO_Pos);
485 return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_REVISION_Msk) >> SCB_CPUID_REVISION_Pos);
507 __STATIC_INLINE
void LL_MPU_Enable(uint32_t Options)
510 WRITE_REG(MPU->CTRL, (MPU_CTRL_ENABLE_Msk | Options));
522 __STATIC_INLINE
void LL_MPU_Disable(
void)
527 WRITE_REG(MPU->CTRL, 0U);
535 __STATIC_INLINE uint32_t LL_MPU_IsEnabled(
void)
537 return (READ_BIT(MPU->CTRL, MPU_CTRL_ENABLE_Msk) == (MPU_CTRL_ENABLE_Msk));
554 __STATIC_INLINE
void LL_MPU_EnableRegion(uint32_t Region)
557 WRITE_REG(MPU->RNR, Region);
559 SET_BIT(MPU->RASR, MPU_RASR_ENABLE_Msk);
600 __STATIC_INLINE
void LL_MPU_ConfigRegion(uint32_t Region, uint32_t SubRegionDisable, uint32_t Address, uint32_t Attributes)
603 WRITE_REG(MPU->RNR, Region);
605 WRITE_REG(MPU->RBAR, (Address & 0xFFFFFFE0U));
607 WRITE_REG(MPU->RASR, (MPU_RASR_ENABLE_Msk | Attributes | SubRegionDisable << MPU_RASR_SRD_Pos));
625 __STATIC_INLINE
void LL_MPU_DisableRegion(uint32_t Region)
628 WRITE_REG(MPU->RNR, Region);
630 CLEAR_BIT(MPU->RASR, MPU_RASR_ENABLE_Msk);
__STATIC_INLINE void LL_LPM_DisableSleepOnExit(void)
Do not sleep when returning to Thread mode. @rmtoll SCB_SCR SLEEPONEXIT LL_LPM_DisableSleepOnExit.
Definition: stm32f4xx_ll_cortex.h:362
__STATIC_INLINE void LL_LPM_EnableSleep(void)
Processor uses sleep as its low power mode @rmtoll SCB_SCR SLEEPDEEP LL_LPM_EnableSleep.
Definition: stm32f4xx_ll_cortex.h:327
__STATIC_INLINE void LL_HANDLER_EnableFault(uint32_t Fault)
Enable a fault in System handler control register (SHCSR) @rmtoll SCB_SHCSR MEMFAULTENA LL_HANDLER_En...
Definition: stm32f4xx_ll_cortex.h:409
__STATIC_INLINE void LL_LPM_EnableDeepSleep(void)
Processor uses deep sleep as its low power mode @rmtoll SCB_SCR SLEEPDEEP LL_LPM_EnableDeepSleep.
Definition: stm32f4xx_ll_cortex.h:338
__STATIC_INLINE void LL_SYSTICK_EnableIT(void)
Enable SysTick exception request @rmtoll STK_CTRL TICKINT LL_SYSTICK_EnableIT.
Definition: stm32f4xx_ll_cortex.h:289
__STATIC_INLINE void LL_HANDLER_DisableFault(uint32_t Fault)
Disable a fault in System handler control register (SHCSR) @rmtoll SCB_SHCSR MEMFAULTENA LL_HANDLER_D...
Definition: stm32f4xx_ll_cortex.h:424
__STATIC_INLINE uint32_t LL_CPUID_GetParNo(void)
Get Part number @rmtoll SCB_CPUID PARTNO LL_CPUID_GetParNo.
Definition: stm32f4xx_ll_cortex.h:473
__STATIC_INLINE uint32_t LL_CPUID_GetConstant(void)
Get Constant number @rmtoll SCB_CPUID ARCHITECTURE LL_CPUID_GetConstant.
Definition: stm32f4xx_ll_cortex.h:463
__STATIC_INLINE uint32_t LL_SYSTICK_IsActiveCounterFlag(void)
This function checks if the Systick counter flag is active or not.
Definition: stm32f4xx_ll_cortex.h:247
__STATIC_INLINE uint32_t LL_SYSTICK_IsEnabledIT(void)
Checks if the SYSTICK interrupt is enabled or disabled. @rmtoll STK_CTRL TICKINT LL_SYSTICK_IsEnabled...
Definition: stm32f4xx_ll_cortex.h:309
__STATIC_INLINE uint32_t LL_SYSTICK_GetClkSource(void)
Get the SysTick clock source @rmtoll STK_CTRL CLKSOURCE LL_SYSTICK_GetClkSource.
Definition: stm32f4xx_ll_cortex.h:279
__STATIC_INLINE uint32_t LL_CPUID_GetRevision(void)
Get Revision number (The p value in the rnpn product revision identifier, indicates patch release) @r...
Definition: stm32f4xx_ll_cortex.h:483
__STATIC_INLINE void LL_SYSTICK_DisableIT(void)
Disable SysTick exception request @rmtoll STK_CTRL TICKINT LL_SYSTICK_DisableIT.
Definition: stm32f4xx_ll_cortex.h:299
__STATIC_INLINE uint32_t LL_CPUID_GetImplementer(void)
Get Implementer code @rmtoll SCB_CPUID IMPLEMENTER LL_CPUID_GetImplementer.
Definition: stm32f4xx_ll_cortex.h:443
__STATIC_INLINE uint32_t LL_CPUID_GetVariant(void)
Get Variant number (The r value in the rnpn product revision identifier) @rmtoll SCB_CPUID VARIANT LL...
Definition: stm32f4xx_ll_cortex.h:453
__STATIC_INLINE void LL_SYSTICK_SetClkSource(uint32_t Source)
Configures the SysTick clock source @rmtoll STK_CTRL CLKSOURCE LL_SYSTICK_SetClkSource.
Definition: stm32f4xx_ll_cortex.h:260
#define LL_SYSTICK_CLKSOURCE_HCLK
Definition: stm32f4xx_ll_cortex.h:88
__STATIC_INLINE void LL_LPM_EnableSleepOnExit(void)
Configures sleep-on-exit when returning from Handler mode to Thread mode.
Definition: stm32f4xx_ll_cortex.h:351
__STATIC_INLINE void LL_LPM_DisableEventOnPend(void)
Only enabled interrupts or events can wakeup the processor, disabled interrupts are excluded @rmtoll ...
Definition: stm32f4xx_ll_cortex.h:386
__STATIC_INLINE void LL_LPM_EnableEventOnPend(void)
Enabled events and all interrupts, including disabled interrupts, can wakeup the processor....
Definition: stm32f4xx_ll_cortex.h:374