Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Trigger Distribution
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Trigger Distribution
Commits
5c5aee45
Commit
5c5aee45
authored
Sep 17, 2022
by
Dimitris Lampridis
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'proposed_master' into feature/pytest
parents
72812507
c75a73cd
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
129 additions
and
64 deletions
+129
-64
conf.py
doc/conf.py
+1
-1
devel.rst
doc/devel.rst
+2
-2
installation.rst
doc/installation.rst
+2
-0
ref_svec_adc_x2.rst
doc/ref_svec_adc_x2.rst
+1
-1
ref_svec_tdc_fd.rst
doc/ref_svec_tdc_fd.rst
+3
-3
ref_svec_tdc_x2.rst
doc/ref_svec_tdc_x2.rst
+1
-1
requirements.txt
doc/requirements.txt
+6
-6
usage_clib.rst
doc/usage_clib.rst
+41
-2
usage_pywrap.rst
doc/usage_pywrap.rst
+1
-1
usage_tools.rst
doc/usage_tools.rst
+1
-3
wrtd_ref_svec_tdc_fd.vhd
hdl/top/wrtd_ref_svec_tdc_fd/wrtd_ref_svec_tdc_fd.vhd
+3
-2
.gitignore
software/lib/.gitignore
+1
-0
libwrtd-reconfigure.c
software/lib/libwrtd-reconfigure.c
+3
-11
libwrtd.c
software/lib/libwrtd.c
+59
-30
libwrtd.h
software/lib/libwrtd.h
+4
-1
No files found.
doc/conf.py
View file @
5c5aee45
...
...
@@ -75,7 +75,7 @@ release = u'1.0'
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language
=
None
#
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
...
...
doc/devel.rst
View file @
5c5aee45
...
...
@@ -232,7 +232,7 @@ functions. These include:
+ :cpp:func:`wr_link_up`
+ :cpp:func:`wr_time_ready`
+ :cpp:func:`wr_enable_lock`
+ :cpp:func:`wr_
time
_locked`
+ :cpp:func:`wr_
aux
_locked`
+ :cpp:func:`wr_sync_timeout`
* :ref:`fw_api_event_in`
...
...
@@ -264,7 +264,7 @@ done.
.. doxygenfunction:: wr_link_up
.. doxygenfunction:: wr_time_ready
.. doxygenfunction:: wr_enable_lock
.. doxygenfunction:: wr_
time
_locked
.. doxygenfunction:: wr_
aux
_locked
.. doxygenfunction:: wr_sync_timeout
Event I/O
...
...
doc/installation.rst
View file @
5c5aee45
...
...
@@ -14,6 +14,8 @@ Installation
procedures have been finalised and tested, the contents of the wiki page will be merged
here.
.. _permissions:
Permissions
===========
...
...
doc/ref_svec_adc_x2.rst
View file @
5c5aee45
...
...
@@ -4,7 +4,7 @@
.. _svec_ref_adc_x2:
SVEC-based ADC x 2
=================
=================
=
This is a WRTD :ref:`node` based on the `Simple VME FMC Carrier (SVEC)
<https://www.ohwr.org/project/svec/wikis/home>`_ and the `FMC ADC 100M 14b 4cha (FMC-ADC)
...
...
doc/ref_svec_tdc_fd.rst
View file @
5c5aee45
...
...
@@ -25,7 +25,7 @@ SVEC-based TDC+FD
+----------------------------------------+------------+------------+
| Average input to Message latency | 20μs | N.A. |
+----------------------------------------+------------+------------+
| Average Message to output latency | N.A. |
4
0μs |
| Average Message to output latency | N.A. |
2
0μs |
+----------------------------------------+------------+------------+
| Can receive Messages over WR | NO | YES |
+----------------------------------------+------------+------------+
...
...
@@ -34,8 +34,8 @@ SVEC-based TDC+FD
This is a WRTD :ref:`node` based on the `Simple VME FMC Carrier (SVEC)
<https://www.ohwr.org/project/svec/wikis/home>`_, the `FMC Time to Digital Converter (FMC-TDC)
<https://www.ohwr.org/project/fmc-tdc
-1ns-5cha-hw/wikis/home>`_ and the `FMC Fine Delay generator
(FMC-FD)
<https://www.ohwr.org/project/fmc-delay-1ns-8cha/wikis/home>`_.
<https://www.ohwr.org/project/fmc-tdc
/wikis/home>`_ and the `FMC Fine Delay generator (FMC-FD)
<https://www.ohwr.org/project/fmc-delay-1ns-8cha/wikis/home>`_.
.. important:: The FMC-TDC should always be attached to "FMC Slot 1" of the SVEC, and the FMC-FD
should always be attached to "FMC Slot 2". It is not necessary though to have both
...
...
doc/ref_svec_tdc_x2.rst
View file @
5c5aee45
...
...
@@ -8,7 +8,7 @@ SVEC-based TDC x 2
This is a WRTD :ref:`node` based on the `Simple VME FMC Carrier (SVEC)
<https://www.ohwr.org/project/svec/wikis/home>`_ and the `FMC Time to Digital Converter (FMC-TDC)
<https://www.ohwr.org/project/fmc-tdc
-1ns-5cha-hw
/wikis/home>`_.
<https://www.ohwr.org/project/fmc-tdc/wikis/home>`_.
The basic principle of this :ref:`node` is simple: it takes in
external pulses on its FMC-TDC inputs, timestamps them using WR time
...
...
doc/requirements.txt
View file @
5c5aee45
docutils==0.1
4
Sphinx==
1.8.5
sphinx_rtd_theme
breathe==4.
11
.0
recommonmark==0.
5.0
decorator==
4.4.0
docutils==0.1
7.1
Sphinx==
5.1.1
sphinx_rtd_theme
==1.0.0
breathe==4.
34
.0
recommonmark==0.
7.1
decorator==
5.1.1
doc/usage_clib.rst
View file @
5c5aee45
...
...
@@ -92,6 +92,40 @@ Functions
examples. However, in a real application, users should always check the status code of every call
to a WRTD function, like in :numref:`lst-get_error`.
.. hint::
If you want to be sure that the buffer that you pass to :cpp:func:`wrtd_get_error`
is large enough, without having to resort to querying like in :numref:`lst-get_error`, you can
always allocate a buffer of :c:macro:`WRTD_ERR_MSG_BUF_SIZE`. WRTD guarantees that all error
messages shall not exceed this size.
.. doxygendefine:: WRTD_ERR_MSG_BUF_SIZE
.. code-block:: c
:caption: Retrieving the error message with a pre-defined buffer size
#include <libwrtd.h>
int main(void) {
wrtd_dev *wrtd;
wrtd_status status;
char err_msg[WRTD_ERR_MSG_BUF_SIZE];
status = wrtd_init(1, false, NULL, &wrtd);
status = wrtd_get_attr_bool(wrtd, WRTD_GLOBAL_REP_CAP_ID,
WRTD_ATTR_EVENT_LOG_EMPTY);
if (status != WRTD_SUCCESS) {
/* retrieve the error code and message */
wrtd_get_error(wrtd, &err_code, WRTD_ERR_MSG_BUF_SIZE, err_msg)
printf("ERROR: %d, %s\n", err_code, err_msg);
return status;
}
wrtd_close(wrtd);
return 0;
}
.. _api_init:
Initialisation API
...
...
@@ -257,7 +291,7 @@ Functions
/* get the delay configured for "rule1" */
status = wrtd_get_attr_tstamp(wrtd, "rule1",
WRTD_ATTR_RULE_DELAY, &ts
"
);
WRTD_ATTR_RULE_DELAY, &ts);
wrtd_close(wrtd);
}
...
...
@@ -295,6 +329,7 @@ The Event Logging API provides functions for accessing the :ref:`event_log`.
int main(void) {
wrtd_dev *wrtd;
wrtd_status status;
char *log_msg;
int buf_size;
...
...
@@ -332,6 +367,7 @@ The Event Logging API provides functions for accessing the :ref:`event_log`.
int main(void) {
wrtd_dev *wrtd;
wrtd_status status;
char log_msg[WRTD_LOG_ENTRY_SIZE];
status = wrtd_init(1, false, NULL, &wrtd);
...
...
@@ -368,6 +404,7 @@ Configuration of an Alarm happens by setting the relevant :ref:`Attributes <attr
int i, count;
char rep_cap_id[16];
wrtd_dev *wrtd;
wrtd_status status;
status = wrtd_init(1, false, NULL, &wrtd);
...
...
@@ -427,6 +464,7 @@ Configuration of a Rule happens by setting the relevant :ref:`Attributes <attrib
int i, count;
char rep_cap_id[16];
wrtd_dev *wrtd;
wrtd_status status;
status = wrtd_init(1, false, NULL, &wrtd);
...
...
@@ -487,7 +525,7 @@ Configuration of a Rule happens by setting the relevant :ref:`Attributes <attrib
/* Enable rule */
status = wrtd_set_attr_bool(wrtd, "rule1",
WRTD_ATTR_RULE_ENABLED,
T
rue);
WRTD_ATTR_RULE_ENABLED,
t
rue);
wrtd_close(wrtd);
...
...
@@ -516,6 +554,7 @@ relevant :ref:`Attributes <attribute>` via the :ref:`api_attr`.
int i, count, major, minor;
char rep_cap_id[16];
wrtd_dev *wrtd;
wrtd_status status;
status = wrtd_init(1, false, NULL, &wrtd);
...
...
doc/usage_pywrap.rst
View file @
5c5aee45
...
...
@@ -42,7 +42,7 @@ In order to retrieve the ID of the :ref:`node`, the :py:class:`PyWrtd` class pro
methods
:
py
:
meth
:`
PyWrtd
.
PyWrtd
.
get_node_count
`
and
:
py
:
meth
:`
PyWrtd
.
PyWrtd
.
get_node_id
`
that
can
be
used
before
you
instantiate
the
:
py
:
class
:`
PyWrtd
`
object
.
If
the
ID
is
wrong
or
if
the
user
does
not
have
the
correct
:
ref
:`
permissions
<
permissions
>
`
to
If
the
ID
is
wrong
or
if
the
user
does
not
have
the
correct
:
ref
:`
permissions
`
to
access
it
,
WRTD
will
return
:
cpp
:
enumerator
:`
WRTD_ERROR_RESOURCE_UNKNOWN
`.
..
code
-
block
::
python
...
...
doc/usage_tools.rst
View file @
5c5aee45
...
...
@@ -6,13 +6,11 @@
Tools
=====
.. module:: PyWrtd
WRTD provides a comand-line, Python based tool (:ref:`wrtd_tool`) for accessing a :ref:`node`.
.. hint::
Please make sure that you run the tool wih the proper :ref:`permissions
<permissions>
`.
Please make sure that you run the tool wih the proper :ref:`permissions`.
For details on how to install the tool (and their dependencies), please refer to
:numref:`installation`.
...
...
hdl/top/wrtd_ref_svec_tdc_fd/wrtd_ref_svec_tdc_fd.vhd
View file @
5c5aee45
...
...
@@ -467,7 +467,7 @@ begin -- architecture arch
generic
map
(
g_VENDOR_ID
=>
x"0000_10DC"
,
g_DEVICE_ID
=>
c_WRTD_NODE_ID
,
g_VERSION
=>
x"0100_000
0
"
,
g_VERSION
=>
x"0100_000
1
"
,
g_CAPABILITIES
=>
x"0000_0000"
,
g_COMMIT_ID
=>
(
others
=>
'0'
))
port
map
(
...
...
@@ -702,6 +702,7 @@ begin -- architecture arch
rst_sys_n_i
=>
rst_sys_62m5_n
,
rst_n_a_i
=>
rst_sys_62m5_n
,
fmc_id_i
=>
'0'
,
fmc_present_n_i
=>
fmc0_prsnt_m2c_n_i
,
pll_sclk_o
=>
fmc0_tdc_pll_sclk_o
,
pll_sdi_o
=>
fmc0_tdc_pll_sdi_o
,
pll_cs_o
=>
fmc0_tdc_pll_cs_n_o
,
...
...
@@ -841,7 +842,7 @@ begin -- architecture arch
i2c_scl_i
=>
'0'
,
i2c_sda_oen_o
=>
open
,
i2c_sda_i
=>
'0'
,
fmc_present_n_i
=>
'0'
,
fmc_present_n_i
=>
fmc1_prsnt_m2c_n_i
,
wb_adr_i
=>
fmc1_mux_wb_out
.
adr
,
wb_dat_i
=>
fmc1_mux_wb_out
.
dat
,
wb_dat_o
=>
fmc1_mux_wb_in
.
dat
,
...
...
software/lib/.gitignore
View file @
5c5aee45
*.d
*.a
*.so.*
software/lib/libwrtd-reconfigure.c
View file @
5c5aee45
...
...
@@ -148,17 +148,9 @@ static enum wrtd_status wrtd_find_channel(struct wrtd_dev *wrtd,
struct
device_map
*
d
=
&
map
->
devs
[
i
];
for
(
j
=
0
;
j
<
d
->
nbr_chs
;
j
++
)
{
memset
(
&
dev_id
.
c
,
0
,
WRTD_ID_LEN
);
dev_id
.
c
[
0
]
=
'L'
;
dev_id
.
c
[
1
]
=
'C'
;
dev_id
.
c
[
2
]
=
'-'
;
if
(
d
->
chs_dir
==
WRTD_CH_DIR_IN
)
{
dev_id
.
c
[
3
]
=
'I'
;
dev_id
.
c
[
4
]
=
'1'
+
d
->
chs_idx
+
j
;
}
else
{
dev_id
.
c
[
3
]
=
'O'
;
dev_id
.
c
[
4
]
=
'1'
+
d
->
chs_idx
+
j
;
}
snprintf
(
&
dev_id
.
c
[
0
],
WRTD_ID_LEN
,
"LC-%c%d"
,
(
d
->
chs_dir
==
WRTD_CH_DIR_IN
)
?
'I'
:
'O'
,
1
+
d
->
chs_idx
+
j
);
if
(
d
->
chs_dir
==
dir
&&
wrtd_id_eq
(
&
dev_id
,
id
))
{
*
res_dev
=
i
;
...
...
software/lib/libwrtd.c
View file @
5c5aee45
...
...
@@ -257,8 +257,8 @@ wrtd_status wrtd_get_error(wrtd_dev *wrtd,
if
(
wrtd
==
NULL
)
return
WRTD_ERROR_NOT_INITIALIZED
;
char
error_message
[
256
];
memset
(
error_message
,
0
,
256
);
char
error_message
[
WRTD_ERR_MSG_BUF_SIZE
];
memset
(
error_message
,
0
,
WRTD_ERR_MSG_BUF_SIZE
);
status
=
wrtd_error_message
(
wrtd
,
wrtd
->
err
,
error_message
);
WRTD_RETURN_IF_ERROR
(
status
);
...
...
@@ -312,7 +312,8 @@ wrtd_status wrtd_get_error(wrtd_dev *wrtd,
* @param[in] wrtd Device token. Can be NULL to allow calling this function
* even when initialisation has failed.
* @param[in] err_code #wrtd_status error code to convert.
* @param[out] err_message Buffer of at least 256 bytes to store the resulting string.
* @param[out] err_message Buffer of at least #WRTD_ERR_MSG_BUF_SIZE bytes
* to store the resulting string.
* @return #wrtd_status
*/
wrtd_status
wrtd_error_message
(
wrtd_dev
*
wrtd
,
...
...
@@ -332,71 +333,92 @@ wrtd_status wrtd_error_message(wrtd_dev *wrtd,
switch
(
err_code
){
case
WRTD_SUCCESS
:
snprintf
(
err_message
,
256
,
"WRTD_SUCCESS"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_SUCCESS"
);
break
;
case
WRTD_ERROR_INVALID_ATTRIBUTE
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_INVALID_ATTRIBUTE"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_INVALID_ATTRIBUTE"
);
break
;
case
WRTD_ERROR_ATTR_NOT_WRITEABLE
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_ATTR_NOT_WRITEABLE"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_ATTR_NOT_WRITEABLE"
);
break
;
case
WRTD_ERROR_ATTR_NOT_READABLE
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_ATTR_NOT_READABLE"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_ATTR_NOT_READABLE"
);
break
;
case
WRTD_ERROR_INVALID_VALUE
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_INVALID_VALUE"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_INVALID_VALUE"
);
break
;
case
WRTD_ERROR_NOT_INITIALIZED
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_NOT_INITIALIZED"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_NOT_INITIALIZED"
);
break
;
case
WRTD_ERROR_UNKNOWN_CHANNEL_NAME
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_UNKNOWN_CHANNEL_NAME"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_UNKNOWN_CHANNEL_NAME"
);
break
;
case
WRTD_ERROR_OUT_OF_MEMORY
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_OUT_OF_MEMORY"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_OUT_OF_MEMORY"
);
break
;
case
WRTD_ERROR_NULL_POINTER
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_NULL_POINTER"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_NULL_POINTER"
);
break
;
case
WRTD_ERROR_UNEXPECTED_RESPONSE
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_UNEXPECTED_RESPONSE"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_UNEXPECTED_RESPONSE"
);
break
;
case
WRTD_ERROR_RESOURCE_UNKNOWN
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_RESOURCE_UNKNOWN"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_RESOURCE_UNKNOWN"
);
break
;
case
WRTD_ERROR_BADLY_FORMED_SELECTOR
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_BADLY_FORMED_SELECTOR"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_BADLY_FORMED_SELECTOR"
);
break
;
case
WRTD_ERROR_ALARM_EXISTS
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_ALARM_EXISTS"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_ALARM_EXISTS"
);
break
;
case
WRTD_ERROR_ALARM_DOES_NOT_EXIST
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_ALARM_DOES_NOT_EXIST"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_ALARM_DOES_NOT_EXIST"
);
break
;
case
WRTD_ERROR_VERSION_MISMATCH
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_VERSION_MISMATCH"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_VERSION_MISMATCH"
);
break
;
case
WRTD_ERROR_INTERNAL
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_INTERNAL"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_INTERNAL"
);
break
;
case
WRTD_ERROR_UNKNOWN_LOG_TYPE
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_UNKNOWN_LOG_TYPE"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_UNKNOWN_LOG_TYPE"
);
break
;
case
WRTD_ERROR_RESOURCE_ACTIVE
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_RESOURCE_ACTIVE"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_RESOURCE_ACTIVE"
);
break
;
case
WRTD_ERROR_ATTR_GLOBAL
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_ATTR_GLOBAL"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_ATTR_GLOBAL"
);
break
;
case
WRTD_ERROR_OUT_OF_RESOURCES
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_OUT_OF_RESOURCES"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_OUT_OF_RESOURCES"
);
break
;
case
WRTD_ERROR_RULE_EXISTS
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_RULE_EXISTS"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_RULE_EXISTS"
);
break
;
case
WRTD_ERROR_RULE_DOES_NOT_EXIST
:
snprintf
(
err_message
,
256
,
"WRTD_ERROR_RULE_DOES_NOT_EXIST"
);
snprintf
(
err_message
,
WRTD_ERR_MSG_BUF_SIZE
,
"WRTD_ERROR_RULE_DOES_NOT_EXIST"
);
break
;
default:
...
...
@@ -834,7 +856,7 @@ wrtd_status wrtd_get_attr_string(wrtd_dev *wrtd,
}
/**
* Set an attribute of type `timestamp`.
* Set an attribute of type `timestamp`
(#wrtd_tstamp)
.
*
* Modelled after the IVI-C SetAttribute family of functions.
*
...
...
@@ -842,13 +864,15 @@ wrtd_status wrtd_get_attr_string(wrtd_dev *wrtd,
* @param[in] rep_cap_id ID (string) of concerned repeated capability.
* If it is a global attribute, use #WRTD_GLOBAL_REP_CAP_ID
* @param[in] id ID (#wrtd_attr) of concerned attribute.
* @param[in] value Value to write to the attribute.
* @param[in] value Value (#wrtd_tstamp) to write to the attribute.
* If the `ns` part is greater or equal to 1e9, the `seconds` part will be
* automatically increased and the `ns` part will be reduced accordingly.
* @return #wrtd_status
*/
wrtd_status
wrtd_set_attr_tstamp
(
wrtd_dev
*
wrtd
,
const
char
*
rep_cap_id
,
wrtd_attr
id
,
const
wrtd_tstamp
*
value
)
wrtd_tstamp
*
value
)
{
wrtd_status
status
;
...
...
@@ -865,6 +889,11 @@ wrtd_status wrtd_set_attr_tstamp(wrtd_dev *wrtd,
"parameter value"
,
__func__
);
}
while
(
value
->
ns
>=
1e9
)
{
value
->
seconds
++
;
value
->
ns
-=
1e9
;
}
switch
(
id
)
{
case
WRTD_ATTR_ALARM_TIME
:
return
wrtd_attr_set_alarm_time
...
...
@@ -902,7 +931,7 @@ wrtd_status wrtd_set_attr_tstamp(wrtd_dev *wrtd,
}
/**
* Get an attribute of type `timestamp`.
* Get an attribute of type `timestamp`
(#wrtd_tstamp)
.
*
* Modelled after the IVI-C GetAttribute family of functions.
*
...
...
@@ -910,7 +939,7 @@ wrtd_status wrtd_set_attr_tstamp(wrtd_dev *wrtd,
* @param[in] rep_cap_id ID (string) of concerned repeated capability.
* If it is a global attribute, use #WRTD_GLOBAL_REP_CAP_ID
* @param[in] id ID (#wrtd_attr) of concerned attribute.
* @param[out] value Retrieved attribute value.
* @param[out] value Retrieved attribute value
(#wrtd_tstamp)
.
* @return #wrtd_status
*/
wrtd_status
wrtd_get_attr_tstamp
(
wrtd_dev
*
wrtd
,
...
...
software/lib/libwrtd.h
View file @
5c5aee45
...
...
@@ -236,6 +236,9 @@ typedef enum wrtd_attr {
/** Size (in characters, including null termination) of an event log enty. */
#define WRTD_LOG_ENTRY_SIZE 120
/** Size (in characters, including null termination) of minimum error message bugger. */
#define WRTD_ERR_MSG_BUF_SIZE 256
/* ------------------------------------------------------------------- */
/* Function prototypes for the official WRTD API. Documented in wrtd.c */
/* ------------------------------------------------------------------- */
...
...
@@ -302,7 +305,7 @@ wrtd_status wrtd_get_attr_string(wrtd_dev *wrtd,
wrtd_status
wrtd_set_attr_tstamp
(
wrtd_dev
*
wrtd
,
const
char
*
rep_cap_id
,
wrtd_attr
id
,
const
wrtd_tstamp
*
value
);
wrtd_tstamp
*
value
);
wrtd_status
wrtd_get_attr_tstamp
(
wrtd_dev
*
wrtd
,
const
char
*
rep_cap_id
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment