Class ArchAVR_NVM

Nested Relationships

Nested Types

Inheritance Relationships

Base Types

Class Documentation

class ArchAVR_NVM : public Peripheral, public InterruptHandler

Implementation of a NVM controller for AVR series.

Limitations:

  • The Configuration Change Protection for SPM registers has no effect

CTLREQs supported:

  • AVR_CTLREQ_NVM_REQUEST : Used internally when the CPU writes to a data space address mapped to a NVM block. Used to redirect the write to the page buffer.

Public Functions

explicit ArchAVR_NVM(const ArchAVR_NVMConfig &config)
virtual ~ArchAVR_NVM()
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 void reset() override

Virtual method called when the device is reset. Note that resetting I/O registers is only necessary here if their reset value is not zero.

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 ioreg_write_handler(reg_addr_t addr, const ioreg_write_t &data) override

Virtual method called when the CPU is writing a I/O register allocated by this peripheral. The value has already been written.

Parameters:
  • addr – the register address in I/O space

  • value – the new register content

virtual void interrupt_ack_handler(int_vect_t vector) override

Callback method called when a vector has been ACK’ed by the CPU. (i.e. the CPU is about to jump to the corresponding vector table entry)

The default implementation does nothing.

class EE_Timer : public CycleTimer

Public Functions

inline EE_Timer(ArchAVR_NVM &ctl)
inline virtual cycle_count_t next(cycle_count_t when) override

Callback from the cycle loop.

Note

there’s no guarantee the method will be called exactly on the required ‘when’ cycle. The only guarantee is “called ‘when’ <= ‘current cycle’”, the implementations must account for this.

Note

The next ‘when’ can be in the ‘past’ (i.e. <= ‘current cycle’). In this case, the timer will be called again within the same cycle with the given next ‘when’. The only constraint is that it must be greater than the previous ‘when’. If it’s negative or zero, the timer is removed from the queue.

Parameters:

when – current ‘when’ cycle, at which the timer was scheduled

Returns:

the next ‘when’ the timer requires to be called at.

class SPM_Timer : public CycleTimer

Public Functions

inline SPM_Timer(ArchAVR_NVM &ctl)
inline virtual cycle_count_t next(cycle_count_t when) override

Callback from the cycle loop.

Note

there’s no guarantee the method will be called exactly on the required ‘when’ cycle. The only guarantee is “called ‘when’ <= ‘current cycle’”, the implementations must account for this.

Note

The next ‘when’ can be in the ‘past’ (i.e. <= ‘current cycle’). In this case, the timer will be called again within the same cycle with the given next ‘when’. The only constraint is that it must be greater than the previous ‘when’. If it’s negative or zero, the timer is removed from the queue.

Parameters:

when – current ‘when’ cycle, at which the timer was scheduled

Returns:

the next ‘when’ the timer requires to be called at.