Skip to content

Commit

Permalink
Merge pull request #158 from DUNE-DAQ/mroda/daphne_v5
Browse files Browse the repository at this point in the history
Mroda/daphne v5
  • Loading branch information
mroda88 authored Dec 10, 2024
2 parents 311cfe8 + ddcf318 commit f0b7e1d
Show file tree
Hide file tree
Showing 11 changed files with 663 additions and 56 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.12)
project(appmodel VERSION 2.0.0)
project(appmodel VERSION 2.1.0)

find_package(daq-cmake REQUIRED)

Expand All @@ -16,11 +16,11 @@ find_package(fmt REQUIRED)

find_package(Boost COMPONENTS unit_test_framework program_options REQUIRED)

daq_oks_codegen(application.schema.xml fdmodules.schema.xml trigger.schema.xml wiec.schema.xml
daq_oks_codegen(application.schema.xml fdmodules.schema.xml trigger.schema.xml wiec.schema.xml PDS.schema.xml
NAMESPACE dunedaq::appmodel DEP_PKGS confmodel)

daq_add_library(ReadoutApplication.cpp SmartDaqApplication.cpp
DFApplication.cpp DFOApplication.cpp TPWriterApplication.cpp FakeDataApplication.cpp FakeHSIApplication.cpp DTSHSIApplication.cpp TriggerApplication.cpp MLTApplication.cpp HSIEventToTCApplication.cpp WIECApplication.cpp
DFApplication.cpp DFOApplication.cpp TPWriterApplication.cpp FakeDataApplication.cpp FakeHSIApplication.cpp DTSHSIApplication.cpp TriggerApplication.cpp MLTApplication.cpp HSIEventToTCApplication.cpp WIECApplication.cpp DaphneApplication.cpp
LINK_LIBRARIES conffwk::conffwk fmt::fmt
logging::logging confmodel::confmodel oks::oks ers::ers)

Expand Down
12 changes: 12 additions & 0 deletions include/appmodel/appmodelIssues.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#ifndef APPDALISSUES_HPP
#define APPDALISSUES_HPP

Expand All @@ -8,6 +9,17 @@ namespace dunedaq {
ERS_DECLARE_ISSUE(appmodel, BadStreamConf,
"Failed to cast stream parameters " << id << " to " << stype,
((std::string)id) ((std::string)stype))

ERS_DECLARE_ISSUE(appmodel,
MissingIP,
"Daphne configuration has no IP " << ip,
((std::string)ip))

ERS_DECLARE_ISSUE(appmodel,
MissingDaphne,
"Daphne " << id << " has active channels but its turned off",
((size_t)id))

}


Expand Down
4 changes: 3 additions & 1 deletion pybindsrc/dal_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "appmodel/HSIEventToTCApplication.hpp"
#include "appmodel/MLTApplication.hpp"
#include "appmodel/WIECApplication.hpp"
#include "appmodel/DaphneApplication.hpp"

#include <sstream>

Expand Down Expand Up @@ -83,7 +84,8 @@ register_dal_methods(py::module& m)
m.def("hsieventtotc_application_generate", &application_generate_template<HSIEventToTCApplication>, "Generate DaqModules required by HSIEventToTCApplication");
m.def("mlt_application_generate", &application_generate_template<MLTApplication>, "Generate DaqModules required by MLTApplication");
m.def("wiec_application_generate", &application_generate_template<WIECApplication>, "Generate DaqModules required by WIECApplication");

m.def("daphne_application_generate", &application_generate_template<DaphneApplication>, "Generate DaqModules required by DaphneApplication");

m.def("smart_daq_application_construct_commandline_parameters", &smart_daq_application_construct_commandline_parameters, "Get a version of the command line agruments parsed");
}

Expand Down
1 change: 1 addition & 0 deletions python/appmodel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'HSIEventToTCApplication': hsieventtotc_application_generate,
'MLTApplication': mlt_application_generate,
'WIECApplication': wiec_application_generate,
'DaphneApplication': daphne_application_generate,

}

Expand Down
215 changes: 215 additions & 0 deletions schema/appmodel/PDS.schema.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
<?xml version="1.0" encoding="ASCII"?>

<!-- oks-schema version 2.2 -->


<!DOCTYPE oks-schema [
<!ELEMENT oks-schema (info, (include)?, (comments)?, (class)+)>
<!ELEMENT info EMPTY>
<!ATTLIST info
name CDATA #IMPLIED
type CDATA #IMPLIED
num-of-items CDATA #REQUIRED
oks-format CDATA #FIXED "schema"
oks-version CDATA #REQUIRED
created-by CDATA #IMPLIED
created-on CDATA #IMPLIED
creation-time CDATA #IMPLIED
last-modified-by CDATA #IMPLIED
last-modified-on CDATA #IMPLIED
last-modification-time CDATA #IMPLIED
>
<!ELEMENT include (file)+>
<!ELEMENT file EMPTY>
<!ATTLIST file
path CDATA #REQUIRED
>
<!ELEMENT comments (comment)+>
<!ELEMENT comment EMPTY>
<!ATTLIST comment
creation-time CDATA #REQUIRED
created-by CDATA #REQUIRED
created-on CDATA #REQUIRED
author CDATA #REQUIRED
text CDATA #REQUIRED
>
<!ELEMENT class (superclass | attribute | relationship | method)*>
<!ATTLIST class
name CDATA #REQUIRED
description CDATA ""
is-abstract (yes|no) "no"
>
<!ELEMENT superclass EMPTY>
<!ATTLIST superclass name CDATA #REQUIRED>
<!ELEMENT attribute EMPTY>
<!ATTLIST attribute
name CDATA #REQUIRED
description CDATA ""
type (bool|s8|u8|s16|u16|s32|u32|s64|u64|float|double|date|time|string|uid|enum|class) #REQUIRED
range CDATA ""
format (dec|hex|oct) "dec"
is-multi-value (yes|no) "no"
init-value CDATA ""
is-not-null (yes|no) "no"
ordered (yes|no) "no"
>
<!ELEMENT relationship EMPTY>
<!ATTLIST relationship
name CDATA #REQUIRED
description CDATA ""
class-type CDATA #REQUIRED
low-cc (zero|one) #REQUIRED
high-cc (one|many) #REQUIRED
is-composite (yes|no) #REQUIRED
is-exclusive (yes|no) #REQUIRED
is-dependent (yes|no) #REQUIRED
ordered (yes|no) "no"
>
<!ELEMENT method (method-implementation*)>
<!ATTLIST method
name CDATA #REQUIRED
description CDATA ""
>
<!ELEMENT method-implementation EMPTY>
<!ATTLIST method-implementation
language CDATA #REQUIRED
prototype CDATA #REQUIRED
body CDATA ""
>
]>

<oks-schema>

<info name="" type="" num-of-items="9" oks-format="schema" oks-version="862f2957270" created-by="mroda" created-on="theta.ph.liv.ac.uk" creation-time="20241011T123346" last-modified-by="maroda" last-modified-on="np04-srv-015.cern.ch" last-modification-time="20241126T165916"/>

<include>
<file path="schema/confmodel/dunedaq.schema.xml"/>
<file path="schema/appmodel/application.schema.xml"/>
</include>


<class name="DaphneApplication">
<superclass name="SmartDaqApplication"/>
<superclass name="ResourceSetAND"/>
<relationship name="configuration" class-type="DaphneConf" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<method name="generate_modules" description="Generate DaqModule dal objects for streams of the application on the fly">
<method-implementation language="c++" prototype="std::vector&lt;const dunedaq::confmodel::DaqModule*&gt; generate_modules(conffwk::Configuration*, const std::string&amp;, const confmodel::Session*) const override" body=""/>
</method>
</class>

<class name="DaphneConf" description="Top entry for the configuraiton of a single daphne board">
<attribute name="timeout_ms" description="timeout used for the board operations" type="u16" range="1..60000" init-value="1000" is-not-null="yes"/>
<attribute name="json_file" type="string" is-not-null="yes"/>
<relationship name="default_v2_settings" description="Value to be used during scrap" class-type="DaphneV2BoardConf" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<method name="get_timeout" description="get the interval casted in ms">
<method-implementation language="C++" prototype="std::chrono::milliseconds get_timeout() const" body="BEGIN_HEADER_PROLOGUE&#xA;#include &lt;chrono&gt;&#xA;END_HEADER_PROLOGUE&#xA;&#xA;return std::chrono::milliseconds(get_timeout_ms());"/>
</method>
<method name="get_json" description="Getter to cast the configuration into a json">
<method-implementation language="C++" prototype="nlohmann::json get_json() const" body="BEGIN_HEADER_PROLOGUE&#xA;#include &lt;nlohmann/json.hpp&gt;&#xA;END_HEADER_PROLOGUE&#xA;&#xA;return nlohmann::json::parse(get_json_file());"/>
</method>
<method name="get_board_slot" description="Get the board slot from the IP">
<method-implementation language="c++" prototype="uint16_t get_board_slot(const std::string &amp; ip) const" body=""/>
</method>
</class>

<class name="DaphneV2ADC">
<attribute name="low_resolution" description="true=12bit, false=14bit" type="bool" init-value="false" is-not-null="yes"/>
<attribute name="output_offset_binary" description="true=Offset Binary, false=2s complement" type="bool" init-value="true" is-not-null="yes"/>
<attribute name="MSB_first" description="Which Significant bit comes first, true=MSB, false=LSB" type="bool" init-value="true" is-not-null="yes"/>
<method name="get_reg4" description="">
<method-implementation language="c++" prototype="uint16_t get_reg4() const" body=""/>
</method>
</class>

<class name="DaphneV2AFE">
<attribute name="afe_id" description="id in the [0,5) range" type="u8" range="0..4,100" init-value="100" is-not-null="yes"/>
<attribute name="attenuator" type="u16" range="0..4095" init-value="0" is-not-null="yes"/>
<attribute name="v_bias" description="Value for V gain of the AFE, 12 bit register.&#xA;The bias have to be under a certain value to operate in cold temperature, the maximum value depends on the brand of the SiPM, but it&apos;s always smaller than 1500 anyway " type="u16" range="0..1500" init-value="0" is-not-null="yes"/>
<relationship name="adc" class-type="DaphneV2ADC" low-cc="one" high-cc="one" is-composite="yes" is-exclusive="yes" is-dependent="yes"/>
<relationship name="pga" class-type="DaphneV2PGA" low-cc="one" high-cc="one" is-composite="yes" is-exclusive="yes" is-dependent="yes"/>
<relationship name="lna" class-type="DaphneV2LNA" low-cc="one" high-cc="one" is-composite="yes" is-exclusive="yes" is-dependent="yes"/>
</class>

<class name="DaphneV2BoardConf" description="Top entry for the configuraiton of a single daphne board">
<attribute name="bias_ctrl" description="V bias control" type="u16" range="0..4095" is-not-null="yes"/>
<attribute name="self_trigger_threshold" description="Configuration for full stream case. If it is 0, the channels will go in full stream. In that case, which channels will be set via the &quot;full_stream_channels&quot; list." type="u64" range="0..16383" init-value="0" is-not-null="yes"/>
<attribute name="full_stream_channels" description="list of channels to be used in full stream" type="u8" range="0..39" is-multi-value="yes" is-not-null="yes"/>
<relationship name="active_channels" class-type="DaphneV2Channel" low-cc="zero" high-cc="many" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="active_afes" class-type="DaphneV2AFE" low-cc="zero" high-cc="many" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="default_channel" class-type="DaphneV2Channel" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="default_afe" class-type="DaphneV2AFE" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<method name="get_channel" description="Retrieve the correct channel configuration">
<method-implementation language="c++" prototype="const DaphneV2Channel &amp; get_channel(size_t ch) const " body=""/>
</method>
<method name="get_afe" description="retrieve the correct afe configuration">
<method-implementation language="c++" prototype="const DaphneV2AFE &amp; get_afe( size_t id) const " body=""/>
</method>
<method name="is_channel_used" description="check if a channel is turned on">
<method-implementation language="c++" prototype="bool is_channel_used(size_t ch) const" body=""/>
</method>
<method name="is_afe_used" description="check if an AFE is used">
<method-implementation language="c++" prototype="bool is_afe_used(size_t ch) const" body=""/>
</method>
</class>

<class name="DaphneV2Channel">
<attribute name="gain" description="gain" type="u8" range="0..2" init-value="0" is-not-null="yes"/>
<attribute name="offset" description="Pedestal for the channel" type="u16" range="0..2700" init-value="0" is-not-null="yes"/>
<attribute name="trim" description="trim value for the channel" type="u16" range="0..4095" init-value="0" is-not-null="yes"/>
<attribute name="channel_id" type="u8" range="0..39,100" init-value="100" is-not-null="yes"/>
</class>

<class name="DaphneV2ControllerModule">
<superclass name="DaqModule"/>
<attribute name="address" description="ip address of the board" type="string" is-not-null="yes"/>
<attribute name="slot" description="slot of the board" type="u16" is-not-null="yes"/>
<relationship name="daphne_conf" class-type="DaphneConf" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="board_conf" class-type="DaphneV2BoardConf" low-cc="one" high-cc="one" is-composite="yes" is-exclusive="yes" is-dependent="yes"/>
</class>

<class name="DaphneV2LNA" description="info to generate Reg52 value">
<attribute name="clamp" description="0=auto setting, 1=1.5 Vpp, 2=1.15 Vpp, 3=0.6 Vpp" type="u8" range="0..3" init-value="0" is-not-null="yes"/>
<attribute name="integrator_disable" type="bool" init-value="true" is-not-null="yes"/>
<attribute name="gain" description="0=18 dB, 1=24 dB, 2=12 dB" type="u8" range="0..2" init-value="2" is-not-null="yes"/>
<method name="get_reg52" description="get register 51 from configuration">
<method-implementation language="c++" prototype="uint16_t get_reg52() const" body=""/>
</method>
</class>

<class name="DaphneV2PGA">
<attribute name="lpf_cut_frequency" description="cut frequency, only 4 values acceptable. 0=15MHz, 2=20MHz, 3=30MHz, 4=10MHz" type="u8" range="0,2,3,4" init-value="0" is-not-null="yes"/>
<attribute name="integrator_disable" type="bool" init-value="true" is-not-null="yes"/>
<attribute name="gain" description="rue=30 dB, false=24 dB" type="bool" init-value="false" is-not-null="yes"/>
<method name="get_reg51" description="create registry 51 from the configuration">
<method-implementation language="c++" prototype="uint16_t get_reg51() const" body=""/>
</method>
</class>

<class name="SSPLEDCalibModule" description="SSP LED Calib DAQ Module configuration">
<superclass name="DaqModule"/>
<attribute name="card_id" description="Physical card identifier (in the same host)" type="u32" init-value="0" is-not-null="yes"/>
<attribute name="board_id" description="Board ID used for configuration and metric tracking" type="u32" init-value="0" is-not-null="yes"/>
<attribute name="module_id" description="Module ID used for configuration and metric tracking" type="u32" init-value="0" is-not-null="yes"/>
<attribute name="board_ip" description="IP address of the board" type="string" init-value="127.0.0.1" is-not-null="yes"/>
<attribute name="partition_number" description="FIXME: partition number for the SSP board" type="u32" init-value="0" is-not-null="yes"/>
<attribute name="timing_address" description="Timing address of the SSP board" type="u32" init-value="32" is-not-null="yes"/>
<attribute name="number_channels" description="Decimal number of the number of channels in the card, should be either 5 or 12" type="u32" range="5,12" init-value="12" is-not-null="yes"/>
<attribute name="channel_mask" description="Decimal number for the 12-bit channel mask where 1 is on, e.g. 4095 is all channels on" type="u32" range="0..4095" init-value="4095" is-not-null="yes"/>
<attribute name="pulse_mode" type="enum" range="single,double,burst" init-value="single" is-not-null="yes"/>
<attribute name="burst_count" description="Number of LED calib pulses to send in a burst" type="u32" range="0..10000" init-value="1000" is-not-null="yes"/>
<attribute name="double_pulse_delay_ticks" description="number of ticks between first and second pulse in double pulse mode" type="u32" range="0..4095" init-value="100" is-not-null="yes"/>
<attribute name="pulse1_width_ticks" description="Width of first pulse in time ticks" type="u32" range="0..255" init-value="100" is-not-null="yes"/>
<attribute name="pulse2_width_ticks" description="width of second pulse " type="u32" range="0..255" init-value="100" is-not-null="yes"/>
<attribute name="pulse_bias_percent_270nm" description="the fraction of bias applied to 270 nm LED" type="u32" init-value="100" is-not-null="yes"/>
<attribute name="pulse_bias_percent_367nm" description="the fraction of bias applied to 367 nm LEDs" type="u32" init-value="100" is-not-null="yes"/>
<relationship name="hardware_configuration" class-type="SSPRegister" low-cc="zero" high-cc="many" is-composite="no" is-exclusive="no" is-dependent="no"/>
</class>

<class name="SSPRegister">
<attribute name="name" type="string" init-value="unknown" is-not-null="yes"/>
<attribute name="address" type="u32" format="hex" init-value="0x0" is-not-null="yes"/>
<attribute name="value" type="u32" format="hex" init-value="0x0" is-not-null="yes"/>
<attribute name="mask" type="u32" format="hex" init-value="0xffffffff" is-not-null="yes"/>
</class>

</oks-schema>
23 changes: 21 additions & 2 deletions schema/appmodel/fdmodules.schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,26 @@
<superclass name="DetDataSender"/>
</class>

<class name="FelixCardControllerModule">
<superclass name="DaqModule"/>
<attribute name="super_chunk_size" description="Number of chunks in superchunk" type="u16" init-value="12" is-not-null="yes"/>
<attribute name="emu_fanout" description="Enable emulator" type="bool" init-value="0" is-not-null="yes"/>
<relationship name="controls" class-type="DetectorToDaqConnection" low-cc="one" high-cc="many" is-composite="no" is-exclusive="no" is-dependent="no"/>
</class>

<class name="FelixDataSender">
<superclass name="DetDataSender"/>
<attribute name="protocol" type="enum" range="full,half"/>
<attribute name="link" description="Link within SLR" type="u8" range="0..5" init-value="0" is-not-null="yes"/>
<attribute name="control_host" type="string" init-value="localhost" is-not-null="yes"/>
</class>

<class name="FelixDataReceiver">
<superclass name="DetDataReceiver"/>
</class>

<class name="FelixInterface" description="Specialization of ReadoutInterface for the FLX card. ">
<superclass name="DetDataReceiver"/>
<superclass name="FelixDataReceiver"/>
<attribute name="card" description="Card ID in readout host." type="u8" range="0..1" init-value="0" is-not-null="yes"/>
<attribute name="slr" description="Super logic region of a FLX card" type="u16" init-value="0" is-not-null="yes"/>
<attribute name="dma_id" description="DMA descriptor to use" type="u8" init-value="0" is-not-null="yes"/>
Expand All @@ -152,7 +164,14 @@
<attribute name="interrupt_mode" description="Use device interrupts or polling for DMA parsing." type="bool" init-value="false" is-not-null="yes"/>
<attribute name="poll_time" description="Poll time in us. Ignored if interrupt mode is on." type="u32" init-value="5000" is-not-null="yes"/>
<attribute name="numa_id" description="CMEM_RCC NUMA region selector" type="u8" init-value="0" is-not-null="yes"/>
<attribute name="links_enabled" description="Number of elinks configured." type="u32" is-multi-value="yes" init-value="0,1,2,3,4" is-not-null="yes"/>
</class>

<class name="FelixReaderConf">
<superclass name="DataReaderConf"/>
</class>

<class name="FelixReaderModule">
<superclass name="DataReaderModule"/>
</class>

<class name="IpbusAddressTable">
Expand Down
2 changes: 1 addition & 1 deletion scripts/app_environment_cli
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ console = Console()

dal = conffwk.dal.module('x', 'schema/confmodel/dunedaq.schema.xml')

# Process a dal::Variable object, placing key/value pairs in a dictionary
# Process a appmodel::Variable object, placing key/value pairs in a dictionary
def collect_variables(variables, envDict):
for item in variables:
if item.className() == 'VariableSet':
Expand Down
Empty file modified src/DTSHSIApplication.cpp
100755 → 100644
Empty file.
Loading

0 comments on commit f0b7e1d

Please sign in to comment.