SatCat5
satcat5::test::MockOffload Class Reference

Detailed Description

Simulate the router2::Offload port's ConfigBus interface.

Definition at line 15 of file sim_router2_offload.h.

#include <sim_router2_offload.h>

Inheritance diagram for satcat5::test::MockOffload:
[legend]
Collaboration diagram for satcat5::test::MockOffload:
[legend]

Classes

class  Port
 

Public Member Functions

 MockOffload (unsigned devaddr)
 Create the mock interface and set ConfigBus device address.
 
void add_port (satcat5::io::Writeable *dst, satcat5::io::Readable *src)
 Link the next hardware port to a destination and source.
 
void port_shdn (u32 mask_shdn)
 Update the reported port-status flags.
 
void clear_all (u32 val=0)
 Clear all registers for all devices.
 
void clear_dev (unsigned devaddr, u32 val=0)
 Clear all registers for the specified device-ID.
 
void irq_event ()
 Make event-handler accessible (normally private)
 
satcat5::cfg::IoStatus read (unsigned regaddr, u32 &val) override
 Basic single-register read operation.
 
satcat5::cfg::IoStatus write (unsigned regaddr, u32 val) override
 Basic single-register write operation.
 
void * get_device_mmap (unsigned dev) const
 Get a raw pointer to the designated device-address.
 
volatile u32 * get_register_mmap (unsigned addr) const
 Get a raw pointer to the designated combined-address.
 
virtual satcat5::cfg::IoStatus read_array (unsigned regaddr, unsigned count, u32 *result)
 Bulk-read with auto-increment (regaddr, regaddr+1, ...) Bulk read/write operations are more efficient when controlling ConfigBus peripherals over a network interface.
 
virtual satcat5::cfg::IoStatus read_repeat (unsigned regaddr, unsigned count, u32 *result)
 Bulk-read the same register N times.
 
virtual satcat5::cfg::IoStatus write_array (unsigned regaddr, unsigned count, const u32 *data)
 Bulk-write with auto-increment (regaddr, regaddr+1, ...)
 
virtual satcat5::cfg::IoStatus write_repeat (unsigned regaddr, unsigned count, const u32 *data)
 Bulk-write the same register N times.
 
unsigned get_regaddr (unsigned dev, unsigned reg) const
 Convert device + register to combined address.
 
void register_irq (satcat5::cfg::Interrupt *obj)
 Add an interrupt handler. More...
 
void unregister_irq (satcat5::cfg::Interrupt *obj)
 Remove an interrupt handler.
 
unsigned count_irq () const
 Count attached interrupt handlers.
 
satcat5::cfg::Register get_register (unsigned dev, unsigned reg=0)
 Create register-map object for the given device address. More...
 
void irq_poll ()
 Poll all registered ConfigBus interrupt handlers. More...
 

Public Attributes

const char *const m_label
 Human-readable label, for debugging.
 
const int m_irq_idx
 IRQ index for this interrupt handler.
 

Protected Attributes

u32 m_regs [satcat5::cfg::MAX_TOTAL_REGS]
 Simulated register-map for up to 256 devices.
 
volatile u32 * m_base_ptr
 
satcat5::util::List< satcat5::cfg::Interruptm_irq_list
 
u32 m_max_irqtime
 Statistics tracking for time consumed by this interrupt.
 

Private Member Functions

void poll_always () override
 Child class MUST override this method. More...
 
bool copy_to_hwbuf (unsigned idx, satcat5::io::Readable *src)
 
void poll_register ()
 Register this pollable object, called by the constructor.
 
void poll_unregister ()
 Unregister this pollable object, called by the destructor.
 

Static Private Member Functions

static unsigned count_always ()
 Count active objects of this type.
 

Private Attributes

friend Port
 
u32 *const m_dev
 
std::vector< Port * > m_ports
 
satcat5::irq::Handlerm_next
 

Member Function Documentation

◆ get_register()

Register ConfigBus::get_register ( unsigned  dev,
unsigned  reg = 0 
)
inherited

Create register-map object for the given device address.

(Or for a specific register, if the register address is specified.)

Definition at line 101 of file cfgbus_core.cc.

◆ irq_poll()

void ConfigBus::irq_poll ( )
inherited

Poll all registered ConfigBus interrupt handlers.

Issue callbacks to any that may have triggered. (This method should not usually be called directly.)

Definition at line 111 of file cfgbus_core.cc.

◆ poll_always()

void MockOffload::poll_always ( )
overrideprivatevirtual

Child class MUST override this method.

(This method should rarely be called directly.)

Implements satcat5::poll::Always.

Definition at line 50 of file sim_router2_offload.cc.

◆ register_irq()

void ConfigBus::register_irq ( satcat5::cfg::Interrupt obj)
inherited

Add an interrupt handler.

Each ConfigBus interface has a single interrupt signal, which is the logical OR of interrupts from all attached peripherals. When any peripheral raises its interrupt signal, call irq_poll().

Definition at line 80 of file cfgbus_core.cc.


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