172 bool fSysTickCanPreempt =
false;
183 for (
volatile unsigned i = 0; i < 32000 / 12; ++i)
192 if (McciArm_getPRIMASK() == 0)
195 uint32_t
const ipsr = McciArm_getIPSR();
199 fSysTickCanPreempt =
true;
207 if (systickpri < intpri)
208 fSysTickCanPreempt =
true;
215 if (fSysTickCanPreempt)
220 fSysTickCanPreempt =
false;
225 if (fSysTickCanPreempt)
256 unsigned timeToReboot;
258 McciArm_disableInterrupts();
261 timeToReboot = 60 * 1000;
272 for (; timeToReboot > 0; --timeToReboot)
279 McciArm_DataSynchBarrier();
291 McciArm_DataSynchBarrier();
305 rOdr ^= UINT32_C(1) << 2;
static uint32_t McciArm_putRegOr(uint32_t reg, uint32_t orVal)
or 32-bit values to a cm0plus register
static uint32_t McciArm_getReg(uint32_t reg)
read a 32-bit value from a cm0plus register
static uint32_t McciArm_putReg(uint32_t reg, uint32_t val)
write a 32-bit value to a cm0plus register
#define MCCI_CM0PLUS_SCB_AIRCR_SYSRESETREQ
#define MCCI_CM0PLUS_SYSTICK_CSR
#define MCCI_CM0PLUS_SCB_AIRCR
#define MCCI_CM0PLUS_SYSTICK_CSR_ENABLE
enable counter
static bool McciArmIPSR_queryThreadMode(uint32_t ipsr)
test IPSR to see if Cortex-M0+ is in thread mode.
#define MCCI_CM0PLUS_SCB_AIRCR_VECTKEY_VALUE
Value to write to unlock regster.
#define MCCI_CM0PLUS_SYSTICK_CSR_TICKINT
enable tick exception
static int32_t McciArmNvic_getPriority(int32_t irq)
return priority of speciified IRQ
static uint32_t McciArm_putRegMasked(uint32_t reg, uint32_t maskVal, uint32_t modVal)
store to cm0plus register under mask
#define MCCI_CM0PLUS_SYSTICK_CSR_COUNTFLAG
timer has counted to zero
#define MCCI_CM0PLUS_SCB_AIRCR_VECTKEY
Vector key.
static uint32_t McciArm_getSysTickPriority(void)
return priority of SysTick exception.
static int32_t McciArmIPSR_toIRQ(uint32_t ipsr)
convert IPSR value to IRQ number, if in handler.
@ McciBootloaderError_BootloaderNotValid
bootloader image isn't valid
#define MCCI_BOOTLOADER_FIELD_SET_VALUE(fmask, val)
McciBootloaderPlatform_DelayMsFn_t McciBootloaderBoard_Catena1sj_delayMs
McciBootloaderPlatform_SystemInitFn_t McciBootloaderBoard_Catena1sj_systemInit
McciBootloaderPlatform_AnnunciatorIndicateStateFn_t McciBootloaderBoard_Catena1sj_annunciatorIndicateState
void McciBootloaderBoard_Catena1sj_annunciatorHandleSysTick(void)
MCCI_BOOTLOADER_BEGIN_DECLS void McciBootloader_Stm32L0_systemInit(void)
#define MCCI_BOOTLOADER_NORETURN_SFX
uint32_t McciBootloader_Milliseconds_t
Time (in milliseconds)
uint32_t McciBootloaderError_t
error codes for the bootloader
#define MCCI_BOOTLOADER_NORETURN_PFX
#define MCCI_STM32L0_GPIO_BSRR
#define MCCI_STM32L0_REG_RCC_IOPENR_IOPBEN
#define MCCI_STM32L0_REG_GPIOB
Section 9.4.12: GPIO register map (1K)
#define MCCI_STM32L0_GPIO_ODR
#define MCCI_STM32L0_GPIO_MODER
#define MCCI_STM32L0_REG_RCC_IOPENR
GPIO clock enable.
#define MCCI_STM32L0_GPIO_BRR
#define MCCI_STM32L0_REG_RCC_IOPENR_IOPAEN
#define MCCI_STM32L0_GPIO_MODE_OUT
#define MCCI_STM32L0_GPIO_MODE_P(p)
compute the mask for the mode bits for port bits 0..15
void McciBootloader_LED_annunciatorInit(void)
McciBootloader_Milliseconds_t McciBootloaderBoard_Catena1sj_getMilliseconds(void)
void McciBootloaderBoard_Catena1sj_setLed(void)
static MCCI_BOOTLOADER_NORETURN_PFX void fastBlinkForever(void)
void McciBootloaderBoard_Catena1sj_handleSysTick(void)
static void delayTick(void)
void McciBootloaderBoard_Catena1sj_clearLed(void)
void McciBootloaderBoard_Catena1sj_fail(McciBootloaderError_t errorCode)