SatCat5
cfgbus_core.h File Reference

Detailed Description

ConfigBus core definitions.

ConfigBus is a multipurpose memory-mapped interface used by many SatCat5 gateware peripherals. This file defines the software API for accessing that interface, either locally or remotely.

On bare-metal embedded systems, ConfigBus is directly memory-mapped to a volatile pointer in the local address space. This is, by far, the simplest and most direct way to access ConfigBus and provides native support for byte-at-a-time writes (e.g., for MailMap). This simplified interface is enabled by setting SATCAT5_CFGBUS_DIRECT = 1.

If the "simple" flag is not set, we instead define an object-oriented interface that overloads the array-index and assignment operators.

In many cases, code written with this in mind should be compatible with both options, e.g.: my_register[n] = writeval; readval = my_register[n]; The object-oriented interface allows hooks for unit tests or even for remote commanding of an Ethernet-enabled ConfigBus host.

Definition in file cfgbus_core.h.

#include <satcat5/interrupts.h>
#include <satcat5/list.h>
Include dependency graph for cfgbus_core.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  satcat5::cfg::WrappedRegister
 Generic wrapper for a specific ConfigBus register. More...
 
class  satcat5::cfg::WrappedRegisterPtr
 Pointer-like wrapper for one or more ConfigBus registers. More...
 
class  satcat5::cfg::ConfigBus
 Generic ConfigBus API. More...
 
class  satcat5::cfg::ConfigBusMmap
 Memory-mapped local ConfigBus. More...
 

Macros

#define SATCAT5_CFGBUS_DIRECT   0
 By default, use the general-purpose interface (see above). More...
 
#define SATCAT5_NULL_REGISTER   satcat5::cfg::WrappedRegisterPtr(0,0)
 

Typedefs

typedef satcat5::cfg::WrappedRegisterPtr satcat5::cfg::Register
 

Enumerations

enum class  satcat5::cfg::IoStatus { OK = 0 , BUSERROR , CMDERROR , TIMEOUT }
 Status codes for ConfigBus read/write operations. More...
 

Variables

const unsigned satcat5::cfg::REGADDR_ANY = 0
 Shortcut for don't-care register address.
 
constexpr auto satcat5::cfg::IOSTATUS_OK
 
constexpr auto satcat5::cfg::IOSTATUS_BUSERROR
 
constexpr auto satcat5::cfg::IOSTATUS_CMDERROR
 
constexpr auto satcat5::cfg::IOSTATUS_TIMEOUT
 
const unsigned satcat5::cfg::DEVS_PER_CFGBUS = 256
 Fixed ConfigBus gateware interface parameters.
 
const unsigned satcat5::cfg::REGS_PER_DEVICE = 1024
 Fixed ConfigBus gateware interface parameters.
 
const unsigned satcat5::cfg::MAX_DEVICES = 256
 Fixed ConfigBus gateware interface parameters.
 
const unsigned satcat5::cfg::MAX_TOTAL_REGS = REGS_PER_DEVICE * MAX_DEVICES
 Fixed ConfigBus gateware interface parameters.
 

Macro Definition Documentation

◆ SATCAT5_CFGBUS_DIRECT

#define SATCAT5_CFGBUS_DIRECT   0

By default, use the general-purpose interface (see above).

If your platform supports it, set this to 1 for better performance.

Definition at line 37 of file cfgbus_core.h.

Enumeration Type Documentation

◆ IoStatus

Status codes for ConfigBus read/write operations.

See also
satcat5::cfg::ConfigBus

Definition at line 99 of file cfgbus_core.h.

Variable Documentation

◆ IOSTATUS_BUSERROR

constexpr auto satcat5::cfg::IOSTATUS_BUSERROR
constexpr
Initial value:
=
satcat5::cfg::IoStatus::BUSERROR

Definition at line 109 of file cfgbus_core.h.

◆ IOSTATUS_CMDERROR

constexpr auto satcat5::cfg::IOSTATUS_CMDERROR
constexpr
Initial value:
=
satcat5::cfg::IoStatus::CMDERROR

Definition at line 111 of file cfgbus_core.h.

◆ IOSTATUS_OK

constexpr auto satcat5::cfg::IOSTATUS_OK
constexpr
Initial value:
=
satcat5::cfg::IoStatus::OK

Definition at line 107 of file cfgbus_core.h.

◆ IOSTATUS_TIMEOUT

constexpr auto satcat5::cfg::IOSTATUS_TIMEOUT
constexpr
Initial value:
=
satcat5::cfg::IoStatus::TIMEOUT

Definition at line 113 of file cfgbus_core.h.