5.2.1 ECDH Power Management Driver Example
When combined, the peripheral driver and power driver opportunistically put the device into the lowest power state it can be in at any point during an operation. Figure 1 shows a simplified example of how the ECDH and power driver interact when generating a public key. The device starts in active mode after booting and no peripherals are turned on yet.
- The application opens an ECDH driver instance configured with blocking return behavior by calling ECDH_open(). The driver turns on the PKA peripheral.
- The application calls ECDH_genPublicKey(). The driver sets up the PKA and appends an internal semaphore.
- The power driver puts the device into the idle power mode because the CPU is not currently busy but the PKA is active.
- The PKA triggers an interrupt that wakes up the CPU, and the power driver brings the device into active power mode. The semaphore the thread is pending on is posted, and ECDH_genPublicKey() returns.
- The application calls ECDH_close(). The ECDH driver turns off the PKA peripheral.
- The device has nothing else to do, and the power driver transitions the device into standby.
The concepts in Figure 1 also transfer to the other SimpleLink crypto drivers.