Commit 4541f38e authored by Dimitris Lampridis's avatar Dimitris Lampridis

[doc] wip

parent 87509f75
......@@ -260,16 +260,18 @@ latex_elements = {
'fontpkg': r'''
\setmainfont{Bitstream Charter}
\setsansfont{Lato}
\setmonofont{FreeMono}
\setmonofont[Scale=0.92]{FreeMono}
''',
# Additional stuff for the LaTeX preamble.
#
# 'preamble' : '',
'preamble' : '\setcounter{tocdepth}{3}',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
'sphinxsetup': 'VerbatimColor={rgb}{.97,.98,.97}',
}
# Grouping the document tree into LaTeX files. List of tuples
......
......@@ -18,5 +18,3 @@ White Rabbit Trigger Distribution documentation
usage_index
ref_nodes
devel
.. todolist::
......@@ -9,7 +9,23 @@ Reference Nodes
SPEC150T-based FMC-ADC
======================
.. figure:: graphics/wrtd_ref_design_spec_adc.png
:name: fig-ref_spec_adc
:align: center
:alt: alternate text
:figclass: align-center
SPEC150T-based FMC-ADC reference WRTD Node
.. _svec_ref_tdc_fd:
SVEC-based TDC+FDELAY
=====================
.. figure:: graphics/wrtd_ref_design_svec_list.png
:name: fig-ref_svec_list
:align: center
:alt: alternate text
:figclass: align-center
SVEC-based TDC+FDELAY reference WRTD Node
......@@ -68,7 +68,8 @@ Functions
status = wrtd_get_attr_bool(wrtd, WRTD_GLOBAL_REP_CAP_ID,
WRTD_ATTR_EVENT_LOG_EMPTY);
if (status != WRTD_SUCCESS) {
/* query the necessary buffer size for the error message */
/* query the necessary buffer size for
the error message */
buf_size = wrtd_get_error(wrtd, NULL, 0, NULL);
/* allocate the buffer */
err_msg = calloc(sizeof(char), buf_size);
......@@ -215,7 +216,8 @@ Functions
/* check if the event log is empty (global attribute) */
status = wrtd_get_attr_bool(wrtd, WRTD_GLOBAL_REP_CAP_ID,
WRTD_ATTR_EVENT_LOG_EMPTY, &log_empty);
WRTD_ATTR_EVENT_LOG_EMPTY,
&log_empty);
/* add a rule with name "rule1" */
status = wrtd_add_rule(wrtd, "rule1");
......@@ -332,6 +334,48 @@ Configuration of an Alarm happens by setting the relevant :ref:`Attributes <attr
.. doxygenfunction:: wrtd_remove_alarm
.. doxygenfunction:: wrtd_remove_all_alarms
.. doxygenfunction:: wrtd_get_alarm_name
.. code-block:: c
:caption: Adding, removing and indexing :ref:`Alarms <alarm>`.
#include <libwrtd.h>
int main(void) {
int i, count;
char rep_cap_id[16];
wrtd_dev *wrtd;
status = wrtd_init("MT01", false, NULL, &wrtd);
/* disable and then remove any declared alarms */
status = wrtd_disable_all_alarms(wrtd);
status = wrtd_remove_all_alarms(wrtd);
/* Add three alarms */
status = wrtd_add_alarm("alarm1");
status = wrtd_add_alarm("alarm2");
status = wrtd_add_alarm("alarm3");
/* Remove the 2nd alarm */
status = wrtd_remove_alarm("alarm2");
/* Get number of defined alarms */
status = wrtd_get_attr_int32(wrtd, WRTD_GLOBAL_REP_CAP_ID,
WRTD_ATTR_ALARM_COUNT, &count);
/* Iterate through alarms and print their names.
This should output:
1: alarm1
2: alarm3
*/
for (i = 0; i < count; i++) {
status = wrtd_get_alarm_name(wrtd, i, 16, rep_cap_id);
printf ("%d: %s\n", i, rep_cap_id);
}
wrtd_close(wrtd);
return 0;
}
.. _api_rule:
......@@ -349,13 +393,128 @@ Configuration of a Rule happens by setting the relevant :ref:`Attributes <attrib
.. doxygenfunction:: wrtd_remove_all_rules
.. doxygenfunction:: wrtd_get_rule_name
.. doxygenfunction:: wrtd_reset_rule_stats
.. code-block:: c
:caption: Adding, removing and indexing :ref:`Rules <rule>`.
#include <libwrtd.h>
int main(void) {
int i, count;
char rep_cap_id[16];
wrtd_dev *wrtd;
status = wrtd_init("MT01", false, NULL, &wrtd);
/* disable and then remove any declared rules */
status = wrtd_disable_all_rules(wrtd);
status = wrtd_remove_all_rules(wrtd);
/* Add three rules */
status = wrtd_add_rule("rule1");
status = wrtd_add_rule("rule2");
status = wrtd_add_rule("rule3");
/* Remove the 2nd rule */
status = wrtd_remove_rule("rule2");
/* Get number of defined rules */
status = wrtd_get_attr_int32(wrtd, WRTD_GLOBAL_REP_CAP_ID,
WRTD_ATTR_RULE_COUNT, &count);
/* Iterate through rules and print their names.
This should output:
1: rule1
2: rule3
*/
for (i = 0; i < count; i++) {
status = wrtd_get_rule_name(wrtd, i, 16, rep_cap_id);
printf ("%d: %s\n", i, rep_cap_id);
}
wrtd_close(wrtd);
return 0;
}
.. code-block:: c
:caption: Basic :ref:`rule` configuration.
#include <libwrtd.h>
int main(void) {
wrtd_dev *wrtd;
status = wrtd_init("MT01", false, NULL, &wrtd);
/* Add a rule */
status = wrtd_add_rule("rule1");
/* Set rule to listen for events coming on local channel
input 1 and generate a message on the network with
event ID "NET0", after adding 500ns to the event timestamp. */
status = wrtd_set_attr_string(wrtd, "rule1",
WRTD_ATTR_RULE_SOURCE, "LC-I1");
status = wrtd_set_attr_string(wrtd, "rule1",
WRTD_ATTR_RULE_DESTINATION, "NET0");
wrtd_tstamp ts = {.seconds = 0, .ns = 500, .frac = 0};
status = wrtd_set_attr_tstamp(wrtd, "rule1",
WRTD_ATTR_RULE_DELAY, &ts);
/* Enable rule */
status = wrtd_set_attr_bool(wrtd, "rule1",
WRTD_ATTR_RULE_ENABLED, True);
wrtd_close(wrtd);
return 0;
}
.. _api_app:
Applications API
----------------
Similar to :ref:`Rules <rule>` and :ref:`Alarms <alarm>`, :ref:`Applications <application>` are also
:ref:`Repeated Capabilities <rep_cap>`. However, they are read-only and, as such, do not possess any
functions to add or remove them. The only provided functionality is that of indexing.
Information retrieval regarding a particular :ref:`application` is performed by by getting the
relevant :ref:`Attributes <attribute>` via the :ref:`api_attr`.
.. doxygenfunction:: wrtd_get_fw_name
.. code-block:: c
:caption: Indexing :ref:`Applications <application>` and version retrieval.
#include <libwrtd.h>
int main(void) {
int i, count, major, minor;
char rep_cap_id[16];
wrtd_dev *wrtd;
status = wrtd_init("MT01", false, NULL, &wrtd);
/* Get number of defined applications */
status = wrtd_get_attr_int32(wrtd, WRTD_GLOBAL_REP_CAP_ID,
WRTD_ATTR_FW_COUNT, &count);
/* Iterate through applications and print their
names and versions. */
for (i = 0; i < count; i++) {
status = wrtd_get_fw_name(wrtd, i, 16, rep_cap_id);
status = wrtd_get_attr_int32(wrtd, rep_cap_id,
WRTD_ATTR_FW_MAJOR_VERSION,
&major);
status = wrtd_get_attr_int32(wrtd, rep_cap_id,
WRTD_ATTR_FW_MINOR_VERSION,
&minor);
printf ("%d: %s, v%d.%d\n", i, rep_cap_id, major, minor);
}
wrtd_close(wrtd);
return 0;
}
.. _IVI: http://ivifoundation.org
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment