ArchAVR_NVM Class Reference

yasimavr: ArchAVR_NVM Class Reference
yasimavr
Loading...
Searching...
No Matches
ArchAVR_NVM Class Reference

Implementation of a NVM controller for AVR series. More...

#include <arch_avr_nvm.h>

Inheritance diagram for ArchAVR_NVM:
Peripheral InterruptHandler IORegHandler

Classes

class  EE_Timer
 
class  SPM_Timer
 

Public Member Functions

 ArchAVR_NVM (const ArchAVR_NVMConfig &config)
 
virtual ~ArchAVR_NVM ()
 
virtual bool init (Device &device) override
 
virtual void reset (int flags) override
 
virtual bool ctlreq (ctlreq_id_t req, ctlreq_data_t *data) override
 
virtual void ioreg_write_handler (reg_addr_t addr, const ioreg_write_t &data) override
 
virtual bool interrupt_ack_handler (int_vect_t vector) override
 
- Public Member Functions inherited from Peripheral
 Peripheral (ctl_id_t id)
 
virtual ~Peripheral ()
 
ctl_id_t id () const
 Unique identifier of the peripheral.
 
std::string name () const
 The name of the peripheral.
 
virtual uint8_t ioreg_read_handler (reg_addr_t addr, uint8_t value) override
 
virtual uint8_t ioreg_peek_handler (reg_addr_t addr, uint8_t value) override
 
virtual void sleep (bool on, SleepMode mode)
 
 Peripheral (const Peripheral &)=delete
 
Peripheraloperator= (const Peripheral &)=delete
 
- Public Member Functions inherited from IORegHandler
virtual ~IORegHandler ()=default
 
- Public Member Functions inherited from InterruptHandler
 InterruptHandler ()
 
virtual ~InterruptHandler ()
 
void raise_interrupt (int_vect_t vector) const
 
void cancel_interrupt (int_vect_t vector) const
 
bool interrupt_raised (int_vect_t vector) const
 
 InterruptHandler (const InterruptHandler &)=delete
 
InterruptHandleroperator= (const InterruptHandler &)=delete
 

Friends

class SPM_Timer
 
class EE_Timer
 

Additional Inherited Members

- Protected Member Functions inherited from Peripheral
Devicedevice () const
 Access to the device. It is null before init() is called.
 
Loggerlogger ()
 Logging object associated with this peripheral.
 
bool register_interrupt (int_vect_t vector, InterruptHandler &handler) const
 
Signalget_signal (ctl_id_t ctl_id) const
 
void add_ioreg (const regmask_t &rm, IORegister::BitMode bitmode=IORegister::RW)
 
void add_ioreg (const regbit_compound_t &rbc, IORegister::BitMode bitmode=IORegister::RW)
 
void add_ioreg (reg_addr_t addr, IORegister::BitMode bitmode=IORegister::RW)
 
void add_ioreg (reg_addr_t addr, bitmask_t mask, IORegister::BitMode bitmode=IORegister::RW)
 
uint8_t read_ioreg (const regbit_t &rb) const
 
uint64_t read_ioreg (const regbit_compound_t &rbc) const
 
uint8_t read_ioreg (reg_addr_t addr) const
 
uint8_t read_ioreg (reg_addr_t addr, const bitspec_t &bs) const
 
bool test_ioreg (const regbit_t &rb) const
 
bool test_ioreg (const regbit_compound_t &rbc) const
 
bool test_ioreg (reg_addr_t addr, const bitspec_t &bs) const
 
bool test_ioreg (reg_addr_t addr, bitmask_t bm=0xFF) const
 
void write_ioreg (reg_addr_t addr, bitmask_t bm, uint8_t value)
 
void write_ioreg (const regbit_t &rb, uint8_t value)
 
void write_ioreg (const regbit_compound_t &rbc, uint64_t value)
 
void write_ioreg (reg_addr_t addr, uint8_t value)
 
void write_ioreg (reg_addr_t addr, const bitspec_t &bs, uint8_t value)
 
void set_ioreg (reg_addr_t addr, bitmask_t bm=0xFF)
 
void set_ioreg (const regbit_t &rb)
 
void set_ioreg (const regbit_compound_t &rbc)
 
void set_ioreg (reg_addr_t addr, const bitspec_t &bs)
 
void clear_ioreg (reg_addr_t addr, bitmask_t bm=0xFF)
 
void clear_ioreg (const regbit_t &rb)
 
void clear_ioreg (const regbit_compound_t &rbc)
 
void clear_ioreg (reg_addr_t addr, const bitspec_t &bs)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ArchAVR_NVM()

ArchAVR_NVM::ArchAVR_NVM ( const ArchAVR_NVMConfig config)
explicit

◆ ~ArchAVR_NVM()

ArchAVR_NVM::~ArchAVR_NVM ( )
virtual

Member Function Documentation

◆ ctlreq()

bool ArchAVR_NVM::ctlreq ( ctlreq_id_t  req,
ctlreq_data_t data 
)
overridevirtual

Virtual method called for a CTL request. The method must return true if the request has been processed.

Reimplemented from Peripheral.

◆ init()

bool ArchAVR_NVM::init ( Device device)
overridevirtual

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.

Reimplemented from Peripheral.

◆ interrupt_ack_handler()

bool ArchAVR_NVM::interrupt_ack_handler ( int_vect_t  vector)
overridevirtual

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 returned boolean determines the behaviour once the CPU has jumped to the vector.

Returns
true if the interrupt should be cleared, false if it should stay raised

Implements InterruptHandler.

◆ ioreg_write_handler()

void ArchAVR_NVM::ioreg_write_handler ( reg_addr_t  addr,
const ioreg_write_t value 
)
overridevirtual

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

Parameters
addrthe register address in I/O space
valuethe new register content

Reimplemented from Peripheral.

◆ reset()

void ArchAVR_NVM::reset ( int  flags)
overridevirtual

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.

Parameters
flagsReset flags (OR'ed combination of Device::ResetFlag enumeration values)

Reimplemented from Peripheral.

Friends And Related Symbol Documentation

◆ EE_Timer

friend class EE_Timer
friend

◆ SPM_Timer

friend class SPM_Timer
friend

The documentation for this class was generated from the following files: