REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches

The Lucidac U-Block (U for Voltage) is represented by this class. More...

#include <ublock.h>

Inheritance diagram for blocks::UBlock:
Collaboration diagram for blocks::UBlock:

Public Types

using Transmission_Mode = UBlockHAL::Transmission_Mode
 
using Reference_Magnitude = UBlockHAL::Reference_Magnitude
 

Public Member Functions

 UBlock (UBlockHAL *hardware)
 
 UBlock ()
 
metadata::eui_t get_entity_eui () const override
 
void reset (entities::ResetAction action) override
 
void reset_connections ()
 
bool connect (const uint8_t input, const uint8_t output, const bool force=false)
 Connects a block input to a block output.
 
bool connect_alternative (Transmission_Mode signal_type, const uint8_t output, const bool force=false, bool use_a_side=false)
 Connects an alternative input / non block input specified by signal_mode from the a- or b-side to a block output.
 
bool disconnect (const uint8_t input, const uint8_t output)
 Disconnect an input from an output, if they are connected. Both input and output are zero-based indizes.
 
bool disconnect (const uint8_t output)
 Disconnect all inputs from an output. Fails for invalid arguments.
 
bool is_connected (const uint8_t input, const uint8_t output) const
 Check whether an chip input is connected to an chip / block output.
 
bool is_output_connected (const uint8_t output) const
 Check whether an chip / block output is connected to any chip input.
 
bool is_input_connected (const uint8_t input) const
 Check whether an chip input is connected to any output.
 
bool is_anything_connected () const
 
utils::status write_to_hardware () override
 returns true in case of success
 
utils::status config_self_from_json (JsonObjectConst cfg) override
 Deserialize a new configuration for this entity from a JsonObject.
 
- Public Member Functions inherited from blocks::FunctionBlock
 FunctionBlock (std::string entity_id)
 
std::vector< Entity * > get_child_entities () override
 
Entityget_child_entity (const std::string &child_id) override
 
- Public Member Functions inherited from entities::Entity
 Entity ()=default
 
 Entity (std::string entityId)
 
const std::string & get_entity_id () const
 
void rename_entity (const std::string entityId)
 
EntityClassifier get_entity_classifier () const
 
EntityClass get_entity_class () const
 
uint8_t get_entity_type () const
 
Version get_entity_version () const
 
uint8_t get_entity_variant () const
 
bool is_entity_class (EntityClass class_) const
 
bool is_entity_type (uint8_t type_) const
 
bool is_entity_version (Version version_) const
 
bool is_entity_variant (uint8_t variant_) const
 
Entityresolve_child_entity (std::string paths[], size_t len)
 
Entityresolve_child_entity (JsonArrayConstIterator begin, JsonArrayConstIterator end)
 
Entityresolve_child_entity (JsonArrayConst path)
 
virtual bool init ()
 returns true in case of success
 
utils::status config_from_json (JsonObjectConst cfg)
 Deserialize a new configuration for this entity and all its children from a JsonObject.
 
void config_to_json (JsonObject &cfg, bool recursive=true)
 Serialize the configuration for this entity to a JsonObject.
 
utils::status user_set_config (JsonObjectConst msg_in, JsonObject &msg_out)
 
utils::status user_get_config (JsonObjectConst msg_in, JsonObject &msg_out)
 
utils::status user_reset_config (JsonObjectConst msg_in, JsonObject &msg_out)
 
void classifier_to_json (JsonObject &out)
 Provide recursive entity information in a tree.
 

Static Public Member Functions

static UBlockfrom_entity_classifier (entities::EntityClassifier classifier, bus::addr_t block_address)
 
static constexpr std::array< uint8_t, NUM_OF_INPUTSINPUT_IDX_RANGE ()
 
static constexpr std::array< uint8_t, NUM_OF_OUTPUTSOUTPUT_IDX_RANGE ()
 

Static Public Attributes

static constexpr auto CLASS_ = entities::EntityClass::U_BLOCK
 
static constexpr uint8_t TYPE = 1
 
static constexpr uint8_t BLOCK_IDX = bus::U_BLOCK_IDX
 
static constexpr uint8_t NUM_OF_INPUTS = 16
 
static constexpr uint8_t NUM_OF_OUTPUTS = 32
 

Protected Member Functions

void change_a_side_transmission_mode (const Transmission_Mode mode)
 Changes the transmission mode of the regular ublock switches.
 
void change_b_side_transmission_mode (const Transmission_Mode mode)
 Changes the transmission mode of the alternative ublock switches.
 
void change_all_transmission_modes (const Transmission_Mode mode)
 Changes the transmission mode for all ublock switches.
 
void change_all_transmission_modes (const std::pair< Transmission_Mode, Transmission_Mode > modes)
 Changes the transmission mode for all ublock switches.
 
Reference_Magnitude get_reference_magnitude ()
 
void change_reference_magnitude (Reference_Magnitude ref)
 
void reset_reference_magnitude ()
 
std::pair< Transmission_Mode, Transmission_Modeget_all_transmission_modes () const
 
bool _is_connected (const uint8_t input, const uint8_t output) const
 Check whether an input is connected to an output, without sanity checks.
 
void _connect (const uint8_t input, const uint8_t output)
 Connects output with given input, without sanity checks or disconnection prevention.
 
void _disconnect (const uint8_t output)
 Disconnects output, without sanity checks.
 
bool _is_output_connected (const uint8_t output) const
 Check whether an output is connected to any input, without sanity checks.
 
bool _is_input_connected (const uint8_t input) const
 
void config_self_to_json (JsonObject &cfg) override
 Serialize the configuration of this entity to a JsonObject.
 
utils::status _config_outputs_from_json (const JsonVariantConst &cfg)
 
utils::status _config_constants_from_json (const JsonVariantConst &cfg)
 
- Protected Member Functions inherited from entities::Entity
utils::status config_children_from_json (JsonObjectConst &cfg)
 Deserialize a new configuration for all child entities from a JsonObject.
 
void config_children_to_json (JsonObject &cfg)
 Serialize the configuration of the child entities of this entity to a JsonObject.
 

Static Protected Member Functions

static bool _i_sanity_check (const uint8_t input)
 
static bool _o_sanity_check (const uint8_t output)
 
static bool _io_sanity_check (const uint8_t input, const uint8_t output)
 

Protected Attributes

UBlockHALhardware
 
std::array< int8_t, NUM_OF_OUTPUTSoutput_input_map
 
Reference_Magnitude ref_magnitude = Reference_Magnitude::ONE
 
Transmission_Mode a_side_mode = Transmission_Mode::ANALOG_INPUT
 
Transmission_Mode b_side_mode = Transmission_Mode::ANALOG_INPUT
 
- Protected Attributes inherited from entities::Entity
std::string entity_id
 
EntityClassifier classifier
 

Friends

class ::platform::Cluster
 
class ::blocks::MBlock
 
class ::blocks::MMulBlock
 
class ::blocks::MIntBlock
 
class ::blocks::MIntBlock_V_1_1_X
 

Detailed Description

The Lucidac U-Block (U for Voltage) is represented by this class.

This class provides an in-memory representation of the XBAR bit matrix, neat way of manipulating it and flushing it out to the hardware.

As a Lucidac can only have a single U-Block, this is kind of a singleton. Typical usage happens via the Lucidac class.

@TODO: Should ensure that there is no more then one bit per line, cf. https://lab.analogparadigm.com/lucidac/firmware/hybrid-controller/-/issues/8

Definition at line 123 of file ublock.h.

Member Typedef Documentation

◆ Reference_Magnitude

◆ Transmission_Mode

Constructor & Destructor Documentation

◆ UBlock() [1/2]

FLASHMEM blocks::UBlock::UBlock ( UBlockHAL * hardware)

Definition at line 26 of file ublock.cpp.

References CLASS_, entities::Entity::classifier, and reset_connections().

◆ UBlock() [2/2]

blocks::UBlock::UBlock ( )
inline

Definition at line 195 of file ublock.h.

Member Function Documentation

◆ _config_constants_from_json()

FLASHMEM utils::status blocks::UBlock::_config_constants_from_json ( const JsonVariantConst & cfg)
protected

Definition at line 328 of file ublock.cpp.

References utils::status::success().

◆ _config_outputs_from_json()

FLASHMEM utils::status blocks::UBlock::_config_outputs_from_json ( const JsonVariantConst & cfg)
protected

Definition at line 278 of file ublock.cpp.

References utils::status::success().

◆ _connect()

FLASHMEM void blocks::UBlock::_connect ( const uint8_t input,
const uint8_t output )
protected

Connects output with given input, without sanity checks or disconnection prevention.

Definition at line 46 of file ublock.cpp.

◆ _disconnect()

FLASHMEM void blocks::UBlock::_disconnect ( const uint8_t output)
protected

Disconnects output, without sanity checks.

Definition at line 138 of file ublock.cpp.

◆ _i_sanity_check()

FLASHMEM bool blocks::UBlock::_i_sanity_check ( const uint8_t input)
staticprotected

Definition at line 38 of file ublock.cpp.

◆ _io_sanity_check()

FLASHMEM bool blocks::UBlock::_io_sanity_check ( const uint8_t input,
const uint8_t output )
staticprotected

Definition at line 42 of file ublock.cpp.

◆ _is_connected()

FLASHMEM bool blocks::UBlock::_is_connected ( const uint8_t input,
const uint8_t output ) const
protected

Check whether an input is connected to an output, without sanity checks.

Definition at line 159 of file ublock.cpp.

◆ _is_input_connected()

FLASHMEM bool blocks::UBlock::_is_input_connected ( const uint8_t input) const
protected

Definition at line 181 of file ublock.cpp.

◆ _is_output_connected()

FLASHMEM bool blocks::UBlock::_is_output_connected ( const uint8_t output) const
protected

Check whether an output is connected to any input, without sanity checks.

Definition at line 170 of file ublock.cpp.

◆ _o_sanity_check()

FLASHMEM bool blocks::UBlock::_o_sanity_check ( const uint8_t output)
staticprotected

Definition at line 40 of file ublock.cpp.

◆ change_a_side_transmission_mode()

FLASHMEM void blocks::UBlock::change_a_side_transmission_mode ( const Transmission_Mode mode)
protected

Changes the transmission mode of the regular ublock switches.

Definition at line 201 of file ublock.cpp.

◆ change_all_transmission_modes() [1/2]

FLASHMEM void blocks::UBlock::change_all_transmission_modes ( const std::pair< Transmission_Mode, Transmission_Mode > modes)
protected

Changes the transmission mode for all ublock switches.

Definition at line 215 of file ublock.cpp.

◆ change_all_transmission_modes() [2/2]

FLASHMEM void blocks::UBlock::change_all_transmission_modes ( const Transmission_Mode mode)
protected

Changes the transmission mode for all ublock switches.

Definition at line 209 of file ublock.cpp.

◆ change_b_side_transmission_mode()

FLASHMEM void blocks::UBlock::change_b_side_transmission_mode ( const Transmission_Mode mode)
protected

Changes the transmission mode of the alternative ublock switches.

Definition at line 205 of file ublock.cpp.

Referenced by blocks::MMulBlock::calibrate().

◆ change_reference_magnitude()

FLASHMEM void blocks::UBlock::change_reference_magnitude ( Reference_Magnitude ref)
protected

Definition at line 229 of file ublock.cpp.

Referenced by blocks::MIntBlock_V_1_1_X::calibrate().

◆ config_self_from_json()

FLASHMEM utils::status blocks::UBlock::config_self_from_json ( JsonObjectConst cfg)
overridevirtual

Deserialize a new configuration for this entity from a JsonObject.

Implementations shall not traverse to children,

See also
config_children_from_json() instead.
Returns
true in case of success, else false

Implements entities::Entity.

Definition at line 257 of file ublock.cpp.

References utils::status::success().

◆ config_self_to_json()

FLASHMEM void blocks::UBlock::config_self_to_json ( JsonObject & cfg)
overrideprotectedvirtual

Serialize the configuration of this entity to a JsonObject.

Implementations shall not traverse to children,

See also
config_children_to_json() instead.

Reimplemented from entities::Entity.

Definition at line 354 of file ublock.cpp.

◆ connect()

FLASHMEM bool blocks::UBlock::connect ( const uint8_t input,
const uint8_t output,
const bool force = false )

Connects a block input to a block output.

If the current transmission mode would make the connection impossible but could be changed without consequences, the mode will be adjusted. If the specified output is already connected or the transmission mode can't be corrected, the function fails. If force is true the output will be overwritten and the transmission mode will be adjusted.

Definition at line 50 of file ublock.cpp.

◆ connect_alternative()

FLASHMEM bool blocks::UBlock::connect_alternative ( Transmission_Mode signal_type,
const uint8_t output,
const bool force = false,
bool use_a_side = false )

Connects an alternative input / non block input specified by signal_mode from the a- or b-side to a block output.

a-side inputs will be mapped one to one on the chip input if possible. Fallback chip is input 0. If the current transmission mode would make the connection impossible but could be changed without consequences, the mode will be adjusted. If the specified output is already connected or the transmission mode can't be corrected, the function fails. If force is true the output will be overwritten and the transmission mode will be adjusted.

Note

Definition at line 80 of file ublock.cpp.

◆ disconnect() [1/2]

FLASHMEM bool blocks::UBlock::disconnect ( const uint8_t input,
const uint8_t output )

Disconnect an input from an output, if they are connected. Both input and output are zero-based indizes.

Definition at line 140 of file ublock.cpp.

◆ disconnect() [2/2]

FLASHMEM bool blocks::UBlock::disconnect ( const uint8_t output)

Disconnect all inputs from an output. Fails for invalid arguments.

Definition at line 152 of file ublock.cpp.

◆ from_entity_classifier()

FLASHMEM blocks::UBlock * blocks::UBlock::from_entity_classifier ( entities::EntityClassifier classifier,
bus::addr_t block_address )
static

Definition at line 392 of file ublock.cpp.

◆ get_all_transmission_modes()

FLASHMEM std::pair< blocks::UBlock::Transmission_Mode, blocks::UBlock::Transmission_Mode > blocks::UBlock::get_all_transmission_modes ( ) const
protected

Definition at line 221 of file ublock.cpp.

◆ get_entity_eui()

FLASHMEM metadata::eui_t blocks::UBlock::get_entity_eui ( ) const
overridevirtual

Implements entities::Entity.

Definition at line 32 of file ublock.cpp.

◆ get_reference_magnitude()

FLASHMEM blocks::UBlock::Reference_Magnitude blocks::UBlock::get_reference_magnitude ( )
protected

Definition at line 225 of file ublock.cpp.

◆ INPUT_IDX_RANGE()

static constexpr std::array< uint8_t, NUM_OF_INPUTS > blocks::UBlock::INPUT_IDX_RANGE ( )
inlinestaticconstexpr

Definition at line 137 of file ublock.h.

◆ is_anything_connected()

FLASHMEM bool blocks::UBlock::is_anything_connected ( ) const

Definition at line 194 of file ublock.cpp.

◆ is_connected()

FLASHMEM bool blocks::UBlock::is_connected ( const uint8_t input,
const uint8_t output ) const

Check whether an chip input is connected to an chip / block output.

Definition at line 163 of file ublock.cpp.

◆ is_input_connected()

FLASHMEM bool blocks::UBlock::is_input_connected ( const uint8_t input) const

Check whether an chip input is connected to any output.

Definition at line 188 of file ublock.cpp.

◆ is_output_connected()

FLASHMEM bool blocks::UBlock::is_output_connected ( const uint8_t output) const

Check whether an chip / block output is connected to any chip input.

Definition at line 174 of file ublock.cpp.

◆ OUTPUT_IDX_RANGE()

static constexpr std::array< uint8_t, NUM_OF_OUTPUTS > blocks::UBlock::OUTPUT_IDX_RANGE ( )
inlinestaticconstexpr

Definition at line 141 of file ublock.h.

◆ reset()

FLASHMEM void blocks::UBlock::reset ( entities::ResetAction action)
overridevirtual

◆ reset_connections()

FLASHMEM void blocks::UBlock::reset_connections ( )

Definition at line 242 of file ublock.cpp.

Referenced by UBlock().

◆ reset_reference_magnitude()

FLASHMEM void blocks::UBlock::reset_reference_magnitude ( )
protected

Definition at line 407 of file ublock.cpp.

◆ write_to_hardware()

FLASHMEM utils::status blocks::UBlock::write_to_hardware ( )
nodiscardoverridevirtual

returns true in case of success

Reimplemented from entities::Entity.

Definition at line 233 of file ublock.cpp.

References utils::status::failure(), LOG, and utils::status::success().

Friends And Related Symbol Documentation

◆ ::blocks::MBlock

friend class ::blocks::MBlock
friend

Definition at line 247 of file ublock.h.

◆ ::blocks::MIntBlock

friend class ::blocks::MIntBlock
friend

Definition at line 249 of file ublock.h.

◆ ::blocks::MIntBlock_V_1_1_X

friend class ::blocks::MIntBlock_V_1_1_X
friend

Definition at line 250 of file ublock.h.

◆ ::blocks::MMulBlock

friend class ::blocks::MMulBlock
friend

Definition at line 248 of file ublock.h.

◆ ::platform::Cluster

friend class ::platform::Cluster
friend

Definition at line 245 of file ublock.h.

Member Data Documentation

◆ a_side_mode

Transmission_Mode blocks::UBlock::a_side_mode = Transmission_Mode::ANALOG_INPUT
protected

Definition at line 154 of file ublock.h.

◆ b_side_mode

Transmission_Mode blocks::UBlock::b_side_mode = Transmission_Mode::ANALOG_INPUT
protected

Definition at line 155 of file ublock.h.

◆ BLOCK_IDX

uint8_t blocks::UBlock::BLOCK_IDX = bus::U_BLOCK_IDX
staticconstexpr

Definition at line 132 of file ublock.h.

◆ CLASS_

auto blocks::UBlock::CLASS_ = entities::EntityClass::U_BLOCK
staticconstexpr

Definition at line 126 of file ublock.h.

Referenced by UBlock().

◆ hardware

UBlockHAL* blocks::UBlock::hardware
protected

Definition at line 150 of file ublock.h.

◆ NUM_OF_INPUTS

uint8_t blocks::UBlock::NUM_OF_INPUTS = 16
staticconstexpr

Definition at line 134 of file ublock.h.

◆ NUM_OF_OUTPUTS

uint8_t blocks::UBlock::NUM_OF_OUTPUTS = 32
staticconstexpr

Definition at line 135 of file ublock.h.

◆ output_input_map

std::array<int8_t, NUM_OF_OUTPUTS> blocks::UBlock::output_input_map
protected

Definition at line 152 of file ublock.h.

◆ ref_magnitude

Reference_Magnitude blocks::UBlock::ref_magnitude = Reference_Magnitude::ONE
protected

Definition at line 153 of file ublock.h.

◆ TYPE

uint8_t blocks::UBlock::TYPE = 1
staticconstexpr

Definition at line 127 of file ublock.h.


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