Class SleepController
Defined in File sim_sleep.h
Inheritance Relationships
Base Types
public Peripheral(Class Peripheral)public SignalHook(Class SignalHook)
Class Documentation
-
class SleepController : public Peripheral, public SignalHook
Generic sleep mode controller.
It listens for the sleep instruction notification from the CPU and, using the register configuration, determines which sleep mode the MCU should enter. It then sends a CTL request to the device to enter sleep.
It is also connected to the interrupt controller to listen to any interrupt raise, and determines if the interrupt is able to wake the MCU up. If so, it sends a CTL request to the device to exit sleep.
This controller also manages the “pseudo-sleep” mode, which is treated as any other sleep mode, and which can be exited by any interrupt.
All the configuration is done at construction by mean of a AVR_SleepConfig object.
Public Functions
-
explicit SleepController(const SleepConfig &config)
-
virtual bool init(Device &device) override
Virtual method called when the device is initialised. This is where the peripheral can allocate its I/O registers, interrupts or connect signals.
- Returns:
boolean indicates the success of all allocations.
-
virtual bool ctlreq(ctlreq_id_t req, ctlreq_data_t *data) override
Virtual method called for a CTL request. The method must return true if the request has been processed.
-
virtual void raised(const signal_data_t &sigdata, int hooktag) override
Pure virtual callback called during signal raises.
- Parameters:
sigdata – Data structure passed on when raising a signal
hooktag – integer passed on when connecting a hook to a signal. For hooks connected to several signals, it provides a mean to identify the caller.
-
explicit SleepController(const SleepConfig &config)