Initialize the driver

Informative

How to bring the MCU driver up. Binding rules: CHI-MCU-MUST-01, CHI-MCU-MUST-02, and CHI-MCU-MUST-03 in Mcu — Requirements; signatures in API Reference.

Bring the driver up

Mcu_Init(NULL_PTR);          /* driver: UNINIT -> INIT */

configPtr must be NULL_PTR — the configuration variant is selected at build time, not passed at runtime. Mcu_Init initialises the McuDrv and the core HW registers assigned to it (mode-relevant registers, reset management, and registers that affect multiple peripherals — but not the clock setup, which is Mcu_InitClock, nor I/O pins, which are the Port driver’s).

It also captures the reset reason: it reads the cause from the hardware, holds it internally, and clears it from the hardware. Read it afterwards with Mcu_GetResetRawValue (see Reset handling).

Note

The McuDrv has no de-init. It is a single-instance driver brought up once, very early in boot, because the rest of the system depends on the clock tree it establishes.

Order of operations

Mcu_Init(NULL_PTR);                       /* 1. driver + core HW */
uint32 cause = Mcu_GetResetRawValue();    /* 2. branch on the reset cause if needed */
Mcu_InitClock(0u);                        /* 3. clock setup (see the Clock guide) */

See also

Clock setup — bringing the clock tree up; Reset handling — the reset cause and issuing a reset.