The initialization in PMU firmware takes place in a normal context. Interrupts are disabled to avoid unintended interruptions and prevent usage of the system resources before they are properly initialized. After initialization completes, interrupts are enabled and the required tasks are scheduled to be executed. The system enters in to a sleep state. The system wakes up only when an event occurs or the scheduled tasks are triggered and the corresponding handlers are executed. The following figure shows the state transitions for PMU firmware.
Figure 1. State Transitions for PMU firmware in Main Loop
PMU firmware execution flow consists of the following three phases:
- Initialization phase
- This phase consists of PMU firmware starting up, performing self-tests and validations, initializing the hardware, creating and initializing modules. Interrupts are disabled during this phase and are enabled at the end.
- Post initialization
- In this phase, PMU firmware enters service mode, wherein it enters into sleep and waits for an interrupt.
- Waking up
- PMU firmware enters the interrupt context and services the interrupt. After completing this task, it goes back to sleep.
The following figure shows the execution flow for PMU firmware.
Figure 2. Execution Context View for PMU firmware