Use cached value instead of RCC->CSR
This commit is contained in:
parent
e2caf8831f
commit
74f34d463d
|
@ -83,7 +83,7 @@ void systemInit(void)
|
||||||
// Turn on clocks for stuff we use
|
// Turn on clocks for stuff we use
|
||||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
|
||||||
|
|
||||||
// cache RCC->CSR value to use it in isMPUSoftreset() and others
|
// cache RCC->CSR value to use it in isMPUSoftReset() and others
|
||||||
cachedRccCsrValue = RCC->CSR;
|
cachedRccCsrValue = RCC->CSR;
|
||||||
RCC_ClearFlag();
|
RCC_ClearFlag();
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ void systemInit(void)
|
||||||
// Configure NVIC preempt/priority groups
|
// Configure NVIC preempt/priority groups
|
||||||
NVIC_PriorityGroupConfig(NVIC_PRIORITY_GROUPING);
|
NVIC_PriorityGroupConfig(NVIC_PRIORITY_GROUPING);
|
||||||
|
|
||||||
// cache RCC->CSR value to use it in isMPUSoftreset() and others
|
// cache RCC->CSR value to use it in isMPUSoftReset() and others
|
||||||
cachedRccCsrValue = RCC->CSR;
|
cachedRccCsrValue = RCC->CSR;
|
||||||
RCC_ClearFlag();
|
RCC_ClearFlag();
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ void enableGPIOPowerUsageAndNoiseReductions(void)
|
||||||
|
|
||||||
bool isMPUSoftReset(void)
|
bool isMPUSoftReset(void)
|
||||||
{
|
{
|
||||||
if (RCC->CSR & RCC_CSR_SFTRSTF)
|
if (cachedRccCsrValue & RCC_CSR_SFTRSTF)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -167,7 +167,7 @@ void systemInit(void)
|
||||||
// Configure NVIC preempt/priority groups
|
// Configure NVIC preempt/priority groups
|
||||||
NVIC_PriorityGroupConfig(NVIC_PRIORITY_GROUPING);
|
NVIC_PriorityGroupConfig(NVIC_PRIORITY_GROUPING);
|
||||||
|
|
||||||
// cache RCC->CSR value to use it in isMPUSoftreset() and others
|
// cache RCC->CSR value to use it in isMPUSoftReset() and others
|
||||||
cachedRccCsrValue = RCC->CSR;
|
cachedRccCsrValue = RCC->CSR;
|
||||||
|
|
||||||
/* Accounts for OP Bootloader, set the Vector Table base address as specified in .ld file */
|
/* Accounts for OP Bootloader, set the Vector Table base address as specified in .ld file */
|
||||||
|
|
|
@ -149,7 +149,7 @@ void enableGPIOPowerUsageAndNoiseReductions(void)
|
||||||
|
|
||||||
bool isMPUSoftReset(void)
|
bool isMPUSoftReset(void)
|
||||||
{
|
{
|
||||||
if (RCC->CSR & RCC_CSR_SFTRSTF)
|
if (cachedRccCsrValue & RCC_CSR_SFTRSTF)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -164,7 +164,7 @@ void systemInit(void)
|
||||||
// Configure NVIC preempt/priority groups
|
// Configure NVIC preempt/priority groups
|
||||||
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITY_GROUPING);
|
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITY_GROUPING);
|
||||||
|
|
||||||
// cache RCC->CSR value to use it in isMPUSoftreset() and others
|
// cache RCC->CSR value to use it in isMPUSoftReset() and others
|
||||||
cachedRccCsrValue = RCC->CSR;
|
cachedRccCsrValue = RCC->CSR;
|
||||||
|
|
||||||
/* Accounts for OP Bootloader, set the Vector Table base address as specified in .ld file */
|
/* Accounts for OP Bootloader, set the Vector Table base address as specified in .ld file */
|
||||||
|
|
Loading…
Reference in New Issue