peary::hal::Board

Base class for a hardware board.

#include <peary/hal/Board.hpp>

Inherited by peary::board::carboard::Carboard

Public Functions

Name
Board() =defaultDefault constructor.
virtual ~Board() =defaultDefault destructor.
template <typename T > std::shared_ptr< T > getResource(const std::string & name)Get a resource by name.
void writeMemory(utils::memory_map mem, uintptr_t value)Write a value to a memory-mapped register.
void writeMemory(utils::memory_map mem, size_t offset, uintptr_t value)Write a value to a memory-mapped register with an offset.
uintptr_t readMemory(utils::memory_map mem)Read a value from a memory-mapped register.
uintptr_t readMemory(utils::memory_map mem, size_t offset)Read a value from a memory-mapped register with an offset.

Protected Functions

Name
template <typename T ,typename… Args> void register_resource(const std::string & name, Args &&… args)Register a resource with the board.

Protected Attributes

Name
utils::string_hash_map< std::shared_ptr< Resource > > _resources

Public Functions Documentation

function Board

  Board() =default
  

Default constructor.

function ~Board

  virtual ~Board() =default
  

Default destructor.

function getResource

  template <typename T >
inline std::shared_ptr< T > getResource(
    const std::string & name
)
  

Get a resource by name.

Parameters:

  • name Name of the resource to be retrieved

Template Parameters:

  • T Type of the resource to be retrieved

Return: Shared pointer to the requested resource

function writeMemory

  inline void writeMemory(
    utils::memory_map mem,
    uintptr_t value
)
  

Write a value to a memory-mapped register.

Parameters:

  • mem Memory map where the register is located
  • value Value to be written to the register

function writeMemory

  inline void writeMemory(
    utils::memory_map mem,
    size_t offset,
    uintptr_t value
)
  

Write a value to a memory-mapped register with an offset.

Parameters:

  • mem Memory map where the register is located
  • offset Offset from the base address of the memory map
  • value Value to be written to the register

function readMemory

  inline uintptr_t readMemory(
    utils::memory_map mem
)
  

Read a value from a memory-mapped register.

Parameters:

  • mem Memory map where the register is located

Return: Value read from the register

function readMemory

  inline uintptr_t readMemory(
    utils::memory_map mem,
    size_t offset
)
  

Read a value from a memory-mapped register with an offset.

Parameters:

  • mem Memory map where the register is located
  • offset Offset from the base address of the memory map

Return: Value read from the register

Protected Functions Documentation

function register_resource

  template <typename T ,
typename... Args>
inline void register_resource(
    const std::string & name,
    Args &&... args
)
  

Register a resource with the board.

Parameters:

  • name Name of the resource
  • args Arguments to be passed to the resource constructor

Protected Attributes Documentation

variable _resources

  utils::string_hash_map< std::shared_ptr< Resource > > _resources;
  

Updated on 2025-11-14 at 11:31:23 +0100