Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Mock Turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
Mock Turtle
Commits
503fd64c
Commit
503fd64c
authored
Nov 25, 2014
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comment and style
Signed-off-by:
Federico Vaga
<
federico.vaga@gmail.com
>
parent
2dd194e5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
297 additions
and
216 deletions
+297
-216
libwrtd-common.c
applications/wrtd/lib/libwrtd-common.c
+47
-41
libwrtd-input.c
applications/wrtd/lib/libwrtd-input.c
+56
-34
libwrtd-internal.h
applications/wrtd/lib/libwrtd-internal.h
+6
-3
libwrtd-output.c
applications/wrtd/lib/libwrtd-output.c
+65
-38
libwrtd.h
applications/wrtd/lib/libwrtd.h
+8
-3
libwrnc.c
lib/libwrnc.c
+109
-91
libwrnc.h
lib/libwrnc.h
+6
-6
No files found.
applications/wrtd/lib/libwrtd-common.c
View file @
503fd64c
...
...
@@ -10,32 +10,9 @@
#include <libwrnc.h>
#include <libwrtd-internal.h>
/**
* It initializes this library. It must be called before doing anything else.
* This library is based on the libwrnc, so internally, this function also
* run wrnc_init() in order to initialize the WRNC library.
*/
int
wrtd_init
()
{
int
err
;
err
=
wrnc_init
();
if
(
err
)
return
err
;
return
0
;
}
/**
* It release all the library resources. It must be called when
* you stop to use this library.
*/
void
wrtd_exit
()
{
wrnc_exit
();
}
static
const
uint32_t
application_id
[]
=
{
0x115790de
,
};
const
char
*
wrtd_errors
[]
=
{
"Received an invalid answer from white-rabbit-node-code CPU"
,
...
...
@@ -52,9 +29,10 @@ const char *wrtd_errors[] = {
/**
* It returns the error message associated to a given error code
* @param[in] err the error code
* @return an error message
* It returns a string messages corresponding to a given error code. If
* it is not a libwrtd error code, it will run strerror(3)
* @param[in] err error code
* @return a message error
*/
const
char
*
wrtd_strerror
(
int
err
)
{
...
...
@@ -65,6 +43,38 @@ const char *wrtd_strerror(int err)
}
/**
* It initializes the WRTD library. It must be called before doing
* anything else. If you are going to load/unload WRTD devices, then
* you have to un-load (wrtd_exit()) e reload (wrtd_init()) the library.
*
* This library is based on the libwrnc, so internally, this function also
* run wrnc_init() in order to initialize the WRNC library.
* @return 0 on success, otherwise -1 and errno is appropriately set
*/
int
wrtd_init
()
{
int
err
;
err
=
wrnc_init
();
if
(
err
)
return
err
;
return
0
;
}
/**
* It releases the resources allocated by wrtd_init(). It must be called when
* you stop to use this library. Then, you cannot use functions from this
* library
*/
void
wrtd_exit
()
{
wrnc_exit
();
}
/**
* Open a WRTD node device using LUN
* @param[in] device_id FMC device identificator
...
...
@@ -105,8 +115,9 @@ struct wrtd_node *wrtd_open_by_lun(int lun)
/**
* Close a LIST node device.
* @param[in] dev pointer to open node device.
* It closes a WRTD device opened with one of the following function:
* wrtd_open_by_lun(), wrtd_open_by_fmc()
* @param[in] dev device token
*/
void
wrtd_close
(
struct
wrtd_node
*
dev
)
{
...
...
@@ -119,9 +130,9 @@ void wrtd_close(struct wrtd_node *dev)
/**
* It returns the
white-rabbit node-core
token
* @param[in] dev
trig-dist device to use
* @return the
wrnc
token
* It returns the
WRNC
token
* @param[in] dev
device token
* @return the
WRNC
token
*/
struct
wrnc_dev
*
wrtd_get_wrnc_dev
(
struct
wrtd_node
*
dev
)
{
...
...
@@ -132,8 +143,8 @@ struct wrnc_dev *wrtd_get_wrnc_dev(struct wrtd_node *dev)
/**
* It load a set of real-time applications for TDC and FD
* @param[in] dev
wrtd device to use
* It load
s
a set of real-time applications for TDC and FD
* @param[in] dev
device token
* @param[in] rt_tdc path to the TDC application
* @param[in] rt_fd path to the Fine Delay application
*/
...
...
@@ -173,8 +184,3 @@ int wrtd_load_application(struct wrtd_node *dev, char *rt_tdc,
return
0
;
}
static
const
uint32_t
application_id
[]
=
{
0x115790de
,
};
applications/wrtd/lib/libwrtd-input.c
View file @
503fd64c
...
...
@@ -31,10 +31,17 @@ static inline int wrtd_in_send_and_receive_sync(struct wrtd_desc *wrtd,
/* * * * * * * * * * PROTOTYPEs IMPLEMENTATION * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* FIXME
* Most of the function's code below can be optimized by using memcpy()
* or similar operations. For the time being, I'm leaving it like this
* because data structures are shared with the real-time applications
*/
/**
* It retreives the current status of a given input channel
* @param[in] dev
pointer to open node device.
* @param[in] input index (0-based) of the
trigger input to enable
* @param[in] dev
device token
* @param[in] input index (0-based) of the
input channel
* @param[out] state the current status of a channel
* @return 0 on success, -1 on error and errno is set appropriately
*/
...
...
@@ -99,7 +106,7 @@ int wrtd_in_state_get(struct wrtd_node *dev, unsigned int input,
/**
* Hardware enable/disable a WRTD input channel.
* @param[in] dev pointer to open node device.
* @param[in] input index (0-based) of the
trigger input to enable
* @param[in] input index (0-based) of the
input channel
* @param[in] enable 1 to enable the input, 0 disables it.
* @return 0 on success, -1 on error and errno is set appropriately
*/
...
...
@@ -134,8 +141,8 @@ int wrtd_in_enable(struct wrtd_node *dev, unsigned int input, int enable)
* Assign (unassign) a trigger ID to a given WRTD input. Passing a NULL trig_id
* un-assigns the current trigger (the input will be tagging pulses and
* logging them, but they will not be sent as triggers to the WR network).
* @param[in] dev
pointer to open node device.
* @param[in] input index (0-based) of the
trigger input to assign trigger to.
* @param[in] dev
device token
* @param[in] input index (0-based) of the
input channel
* @param[in] trig_id the trigger to be sent upon reception of a pulse on the
* given input.
* @return 0 on success, -1 on error and errno is set appropriately
...
...
@@ -175,9 +182,12 @@ int wrtd_in_trigger_assign(struct wrtd_node *dev, unsigned int input,
/**
* It un-assign the trigger on an input channel. It is just an helper that
* internally use wrtd_in_trigger_unassign()
* @param[in] dev device token
* @param[in] input index (0-based) of the input channel
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_in_trigger_unassign
(
struct
wrtd_node
*
dev
,
unsigned
int
input
)
unsigned
int
input
)
{
return
wrtd_in_trigger_assign
(
dev
,
input
,
NULL
);
}
...
...
@@ -191,8 +201,8 @@ int wrtd_in_trigger_unassign(struct wrtd_node *dev,
* trigger on the first incoming pulse and will ignore the subsequent pulses
* until re-armed.
*
* @param[in] dev
pointer to open node device.
* @param[in] input (0-based)
index of the trigger input
* @param[in] dev
device token
* @param[in] input (0-based)
of the input channel
* @param[in] mode triggering mode.
* @return 0 on success, -1 on error and errno is set appropriately
*/
...
...
@@ -226,7 +236,7 @@ int wrtd_in_trigger_mode_set(struct wrtd_node *dev, unsigned int input,
/**
* Software-trigger the input at a given TAI value
* @param[in] dev
pointer to open node device.
* @param[in] dev
device token
* @param[in] trigger trigger to enumlate
* @return 0 on success, -1 on error and errno is set appropriately
*/
...
...
@@ -262,8 +272,8 @@ int wrtd_in_trigger_software(struct wrtd_node *dev,
/**
* Arm (disarm) a WRTD input for triggering. By arming the input, you are making
* it ready to accept/send triggers
* @param[in] dev
pointer to open node device.
* @param[in] input index (0-based) of
the trigger input
* @param[in] dev
device token
* @param[in] input index (0-based) of
input channel
* @param[in] armed 1 arms the input, 0 disarms the input.
* @return 0 on success, -1 on error and errno is set appropriately
*/
...
...
@@ -296,8 +306,11 @@ int wrtd_in_arm(struct wrtd_node *dev, unsigned int input, int armed)
/**
* Disarm the WRTD input. It is just an helper that internally use wrtd_in_arm()
* @param[in] dev device token
* @param[in] input index (0-based) of input channel
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_in_disarm
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
int
armed
)
int
wrtd_in_disarm
(
struct
wrtd_node
*
dev
,
unsigned
int
input
)
{
return
wrtd_in_arm
(
dev
,
input
,
0
);
}
...
...
@@ -307,8 +320,8 @@ int wrtd_in_disarm(struct wrtd_node *dev, unsigned int input, int armed)
* Set the dead time (the minimum gap between input pulses, below which
* the TDC ignores the subsequent pulses; limits maximum input pulse rate,
* 16 ns granularity)
* @param[in] dev
pointer to open node device.
* @param[in] input index (0-based) of
the trigger input to enable
* @param[in] dev
device token
* @param[in] input index (0-based) of
input channel
* @param[in] dead_time_ps dead time in pico-seconds
* @return 0 on success, -1 on error and errno is set appropriately
*/
...
...
@@ -351,11 +364,13 @@ int wrtd_in_dead_time_set(struct wrtd_node *dev, unsigned int input,
/**
* Set the offset (for compensating cable delays), in 10 ps steps.
* @param[in] dev pointer to open node device.
* @param[in] dev device token
* @param[in] input index (0-based) of input channel
* @param[in] delay_ps delay in pico-seconds
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_in_delay_set
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
uint64_t
delay_ps
)
uint64_t
delay_ps
)
{
struct
wrtd_desc
*
wrtd
=
(
struct
wrtd_desc
*
)
dev
;
struct
wr_timestamp
t
;
...
...
@@ -388,8 +403,10 @@ int wrtd_in_delay_set(struct wrtd_node *dev, unsigned int input,
/**
* @param[in] dev pointer to open node device.
* @param[in] input index (0-based) of the trigger input to enable
* Set the time offset on a given input channel
* @param[in] dev device token
* @param[in] input index (0-based) of input channel
* @param[in] offset time offset in pico seconds
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_in_timebase_offset_set
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
...
...
@@ -426,7 +443,9 @@ int wrtd_in_timebase_offset_set(struct wrtd_node *dev, unsigned int input,
/**
* @param[in] dev pointer to open node device.
* Reset all counters on a given input channel
* @param[in] dev device token
* @param[in] input index (0-based) of input channel
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_in_counters_reset
(
struct
wrtd_node
*
dev
,
unsigned
int
input
)
...
...
@@ -456,8 +475,9 @@ int wrtd_in_counters_reset(struct wrtd_node *dev, unsigned int input)
/**
* @param[in] dev pointer to open node device.
* @param[in] input index (0-based) of the trigger input to enable
* Set the log level of a given input channel
* @param[in] dev device token
* @param[in] input index (0-based) of input channel
* @param[in] log_level log level to apply to the logging messages
* @return 0 on success, -1 on error and errno is set appropriately
*/
...
...
@@ -493,11 +513,11 @@ int wrtd_in_log_level_set(struct wrtd_node *dev, unsigned int input,
* Log every trigger pulse sent out to the network. Each log message contains
* the input number, sequence ID, trigger ID, trigger counter (since arm) and
* origin timestamp.
* @param[in] dev
pointer to open node device.
* @param[out] log
* @param[in] dev
device token
* @param[out] log
log message
* @param[in] flags
* @param[in] input_mask
* @param[in] count
* @param[in] input_mask
bit mask of channel where read
* @param[in] count
number of messages to read
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_in_read_log
(
struct
wrtd_node
*
dev
,
struct
wrtd_log_entry
*
log
,
...
...
@@ -541,8 +561,8 @@ int wrtd_in_read_log(struct wrtd_node *dev, struct wrtd_log_entry *log,
/**
* Check the enable status on a trigger input.
* @param[in] dev
pointer to open node device.
* @param[in] input index (0-based) of
the trigger input to enable
* @param[in] dev
device token
* @param[in] input index (0-based) of
input channel
* @param[in] enable 1 enables the input, 0 disables it.
* @return 0 on success, -1 on error and errno is set appropriately
*/
...
...
@@ -557,13 +577,13 @@ int wrtd_in_is_enabled(struct wrtd_node *dev, unsigned int input)
* Get the dead time (the minimum gap between input pulses, below which
* the TDC ignores the subsequent pulses; limits maximum input pulse rate,
* 16 ns granularity)
* @param[in] dev
pointer to open node device
* @param[in] input index (0-based) of
the trigger input to enable
* @param[in] dev
device token
* @param[in] input index (0-based) of
input channel
* @param[out] dead_time_ps dead time in pico-seconds
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_in_dead_time_get
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
uint64_t
*
dead_time_ps
)
uint64_t
*
dead_time_ps
)
{
errno
=
EWRTD_NO_IMPLEMENTATION
;
return
-
1
;
...
...
@@ -572,11 +592,13 @@ int wrtd_in_dead_time_get(struct wrtd_node *dev, unsigned int input,
/**
* Get the offset (for compensating cable delays), in 10 ps steps.
* @param[in] dev pointer to open node device.
* @param[in] dev device token
* @param[in] input index (0-based) of input channel
* @param[out] delay_ps delay in pico-seconds
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_in_delay_get
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
uint64_t
*
delay_ps
)
uint64_t
*
delay_ps
)
{
errno
=
EWRTD_NO_IMPLEMENTATION
;
return
-
1
;
...
...
@@ -585,8 +607,8 @@ int wrtd_in_delay_get(struct wrtd_node *dev, unsigned int input,
/**
* Get/set the Sequence ID counter (counting up at every pulse)
* @param[in] dev
pointer to open node device.
* @param[in] input index (0-based) of
the trigger input to enable
* @param[in] dev
device token
* @param[in] input index (0-based) of
input channel
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_in_seq_counter_set
(
struct
wrtd_node
*
dev
,
unsigned
int
input
)
...
...
applications/wrtd/lib/libwrtd-internal.h
View file @
503fd64c
...
...
@@ -13,11 +13,14 @@
#include <libwrtd.h>
#include <libwrtd-internal.h>
/**
* Description of a White-Rabbit Trigger-Distribution device
*/
struct
wrtd_desc
{
struct
wrnc_dev
*
wrnc
;
struct
wrnc_dev
*
wrnc
;
/**< WRNC device associated */
uint32_t
app_id
;
uint32_t
n_cpu
;
uint32_t
app_id
;
/**< Application id */
uint32_t
n_cpu
;
/**< Number of CPUs */
};
/**
...
...
applications/wrtd/lib/libwrtd-output.c
View file @
503fd64c
...
...
@@ -11,7 +11,7 @@
#include <libwrtd-internal.h>
/**
* Internal helper to send and rece
vie synchronous messages to/from the FD
* Internal helper to send and rece
ive synchronous messages to/from the WRNC
*/
static
inline
int
wrtd_out_send_and_receive_sync
(
struct
wrtd_desc
*
wrtd
,
struct
wrnc_msg
*
msg
)
...
...
@@ -25,7 +25,9 @@ static inline int wrtd_out_send_and_receive_sync(struct wrtd_desc *wrtd,
}
/**
*
* It retreive a list of assigned trigger to an output channel
* @param[in] dev device token
* @param[in] output index (0-based) of output channel
*/
static
int
wrtd_out_trig_get
(
struct
wrtd_node
*
dev
,
unsigned
int
output
,
unsigned
int
bucket
,
unsigned
int
index
,
...
...
@@ -105,9 +107,9 @@ static int wrtd_out_trig_get(struct wrtd_node *dev, unsigned int output,
/**
* It retreives the current output status of a given channel
* @param[in] dev
pointer to open node device.
* @param[in] output
channel to use
* @param[out] state
the current state of a channel
* @param[in] dev
device token
* @param[in] output
index (0-based) of output channel
* @param[out] state
channel status
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_out_state_get
(
struct
wrtd_node
*
dev
,
unsigned
int
output
,
...
...
@@ -159,9 +161,9 @@ int wrtd_out_state_get(struct wrtd_node *dev, unsigned int output,
/**
* It enable
/disable
a trigger output line
* @param[in] dev
pointer to open node device.
* @param[in] output
channel to use
* It enable
s/disables
a trigger output line
* @param[in] dev
device token
* @param[in] output
index (0-based) of output channel
* @param[in] enable 1 to enable the output, 0 disables it.
* @return 0 on success, -1 on error and errno is set appropriately
*/
...
...
@@ -195,11 +197,15 @@ extern int wrtd_out_enable(struct wrtd_node *dev, unsigned int output,
/**
* @param[in] dev pointer to open node device.
* @param[in] output index (0-based) of output channel
* @param[out] handle
* @param[in] trig trigger id to assign
* @param[in] condition
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_trig_assign
(
struct
wrtd_node
*
dev
,
extern
int
wrtd_out_trig_assign
(
struct
wrtd_node
*
dev
,
int
output
,
struct
wrtd_trigger_handle
*
handle
,
int
output
,
struct
wrtd_trig_id
*
trig
,
struct
wrtd_trig_id
*
trig
,
struct
wrtd_trig_id
*
condition
)
{
struct
wrtd_desc
*
wrtd
=
(
struct
wrtd_desc
*
)
dev
;
...
...
@@ -247,7 +253,9 @@ extern int wrtd_out_trig_assign(struct wrtd_node *dev,
/**
* Un-assign a give trigger
* @param[in] dev pointer to open node device.
* @param[in] handle
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_trig_unassign
(
struct
wrtd_node
*
dev
,
...
...
@@ -275,12 +283,16 @@ extern int wrtd_out_trig_unassign(struct wrtd_node *dev,
/**
* @param[in] dev pointer to open node device.
* It retreive a given number of triggers from output device
* @param[in] dev device token
* @param[in] output index (0-based) of output channel
* @param[out] triggers list of assigned trigger
* @param[in] max_count maximum triggers to retreive
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_out_trig_get_all
(
struct
wrtd_node
*
dev
,
unsigned
int
output
,
struct
wrtd_output_trigger_state
*
triggers
,
int
max_count
)
struct
wrtd_output_trigger_state
*
triggers
,
int
max_count
)
{
int
err
,
bucket
,
count
=
0
,
index
;
...
...
@@ -309,7 +321,9 @@ int wrtd_out_trig_get_all(struct wrtd_node *dev, unsigned int output,
/**
* It returns a trigget from a given index
* @param[in] dev pointer to open node device.
* @param[in] dev device token
* @param[in] output index (0-based) of output channel
* @param[out] trigger trigger status
* @return 0 on success, -1 on error and errno is set appropriately
*/
int
wrtd_out_trig_get_by_index
(
struct
wrtd_node
*
dev
,
unsigned
int
index
,
...
...
@@ -334,7 +348,10 @@ int wrtd_out_trig_get_by_index(struct wrtd_node *dev, unsigned int index,
/**
* It sets the delay to apply for a given trigger
* @param[in] dev pointer to open node device.
* @param[in] handle trigger where act on
* @param[in] delay_ps delay in pico-seconds
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_trig_delay_set
(
struct
wrtd_node
*
dev
,
...
...
@@ -366,12 +383,12 @@ extern int wrtd_out_trig_delay_set(struct wrtd_node *dev,
}
/**
* @param[in] dev pointer to open node device.
* @param[in] output channel to use
* It set the dead time for a given output channel. so, it applies on all
* triggers assigned to the given output channel
* @param[in] dev device token
* @param[in] output index (0-based) of output channel
* @param[in] dead_time_ps dead time in pico-seconds
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_dead_time_set
(
struct
wrtd_node
*
dev
,
unsigned
int
output
,
...
...
@@ -382,16 +399,10 @@ extern int wrtd_out_dead_time_set(struct wrtd_node *dev, unsigned int output,
}
/**
* @param[in] dev pointer to open node device.
* @param[in] handle trigger where act on
* @param[in] delay_ps delay in pico-seconds
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_trig_condition_delay_set
(
struct
wrtd_node
*
dev
,
...
...
@@ -405,6 +416,8 @@ extern int wrtd_out_trig_condition_delay_set(struct wrtd_node *dev,
/**
* @param[in] dev pointer to open node device.
* @param[in] handle trigger where act on
* @param[out] state trigger status
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_trig_state_get
(
struct
wrtd_node
*
dev
,
...
...
@@ -418,6 +431,8 @@ extern int wrtd_out_trig_state_get(struct wrtd_node *dev,
/**
* @param[in] dev pointer to open node device.
* @param[in] handle trigger where act on
* @param[in] enable 1 to enable, 0 to disable
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_trig_enable
(
struct
wrtd_node
*
dev
,
...
...
@@ -429,7 +444,14 @@ extern int wrtd_out_trig_enable(struct wrtd_node *dev,
/**
* @param[in] dev pointer to open node device.
* Log every trigger pulse sent out to the network. Each log message contains
* the input number, sequence ID, trigger ID, trigger counter (since arm) and
* origin timestamp.
* @param[in] dev device token
* @param[out] log log message
* @param[in] flags
* @param[in] input_mask bit mask of channel where read
* @param[in] count number of messages to read
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_read_log
(
struct
wrtd_node
*
dev
,
struct
wrtd_log_entry
*
log
,
...
...
@@ -440,8 +462,9 @@ extern int wrtd_out_read_log(struct wrtd_node *dev, struct wrtd_log_entry *log,
}
/**
* @param[in] dev pointer to open node device.
* @param[in] output channel to use
* @param[in] dev device token
* @param[in] output index (0-based) of output channel
* @param[in] log_level log level to apply to the logging messages
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_log_level_set
(
struct
wrtd_node
*
dev
,
unsigned
int
output
,
...
...
@@ -452,8 +475,10 @@ extern int wrtd_out_log_level_set(struct wrtd_node *dev, unsigned int output,
}
/**
* @param[in] dev pointer to open node device.
* @param[in] output channel to use
* It sets the trigger mode of a given output channel
* @param[in] dev device token
* @param[in] output index (0-based) of output channel
* @param[in] mode output mode
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_trigger_mode_set
(
struct
wrtd_node
*
dev
,
...
...
@@ -465,8 +490,10 @@ extern int wrtd_out_trigger_mode_set(struct wrtd_node *dev,
/**
* @param[in] dev pointer to open node device.
* @param[in] output channel to use
* It arms (un-arms) a given output channel
* @param[in] dev device token
* @param[in] output index (0-based) of output channel
* @param[in] armed 1 to arm, 0 to un-arm
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_arm
(
struct
wrtd_node
*
dev
,
unsigned
int
ouput
,
int
armed
)
...
...
@@ -477,8 +504,8 @@ extern int wrtd_out_arm(struct wrtd_node *dev, unsigned int ouput, int armed)
/**
* @param[in] dev
pointer to open node device.
* @param[in] output
channel to use
* @param[in] dev
device token
* @param[in] output
index (0-based) of output channel
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_reset_counters_reset
(
struct
wrtd_node
*
dev
,
unsigned
int
output
)
...
...
@@ -489,8 +516,8 @@ extern int wrtd_out_reset_counters_reset(struct wrtd_node *dev, unsigned int out
/**
* @param[in] dev
pointer to open node device.
* @param[in] output
channel to use
* @param[in] dev
device token
* @param[in] output
index (0-based) of output channel
* @return 0 on success, -1 on error and errno is set appropriately
*/
extern
int
wrtd_out_check_triggered
(
struct
wrtd_node
*
dev
,
unsigned
int
output
)
...
...
applications/wrtd/lib/libwrtd.h
View file @
503fd64c
...
...
@@ -16,6 +16,11 @@ struct wrtd_node;
#define WRTD_DEFAULT_TIMEOUT 1000
/*
* FIXME Structure are not documented because tehy depends on the RT
* applications and I'm waiting for their final version
*/
/**
* White Rabbit Trigger Distribution errors
*/
...
...
@@ -117,7 +122,7 @@ extern int wrtd_in_trigger_mode_set(struct wrtd_node *dev, unsigned int input,
extern
int
wrtd_in_trigger_software
(
struct
wrtd_node
*
dev
,
struct
wrtd_trigger_entry
*
trigger
);
extern
int
wrtd_in_arm
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
int
armed
);
extern
int
wrtd_in_disarm
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
int
armed
);
extern
int
wrtd_in_disarm
(
struct
wrtd_node
*
dev
,
unsigned
int
input
);
extern
int
wrtd_in_dead_time_set
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
uint64_t
dead_time_ps
);
extern
int
wrtd_in_delay_set
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
...
...
@@ -146,9 +151,9 @@ extern int wrtd_out_state_get(struct wrtd_node *dev, unsigned int output,
struct
wrtd_output_state
*
state
);
extern
int
wrtd_out_enable
(
struct
wrtd_node
*
dev
,
unsigned
int
output
,
int
enable
);
extern
int
wrtd_out_trig_assign
(
struct
wrtd_node
*
dev
,
extern
int
wrtd_out_trig_assign
(
struct
wrtd_node
*
dev
,
int
output
,
struct
wrtd_trigger_handle
*
handle
,
int
output
,
struct
wrtd_trig_id
*
trig
,
struct
wrtd_trig_id
*
trig
,
struct
wrtd_trig_id
*
condition
);
extern
int
wrtd_out_trig_unassign
(
struct
wrtd_node
*
dev
,
struct
wrtd_trigger_handle
*
handle
);
...
...
lib/libwrnc.c
View file @
503fd64c
This diff is collapsed.
Click to expand it.
lib/libwrnc.h
View file @
503fd64c
...
...
@@ -70,16 +70,16 @@ extern char *wrnc_name_get(struct wrnc_dev *wrnc);
extern
int
wrnc_app_id_get
(
struct
wrnc_dev
*
wrnc
,
uint32_t
*
app_id
);
extern
int
wrnc_cpu_load_application_raw
(
struct
wrnc_dev
*
wrnc
,
unsigned
int
index
,
void
*
code
,
size_t
length
,
unsigned
int
offset
);
unsigned
int
index
,
void
*
code
,
size_t
length
,
unsigned
int
offset
);
extern
int
wrnc_cpu_load_application_file
(
struct
wrnc_dev
*
wrnc
,
unsigned
int
index
,
char
*
path
);
extern
int
wrnc_cpu_dump_application_raw
(
struct
wrnc_dev
*
wrnc
,
unsigned
int
index
,
void
*
code
,
size_t
length
,
unsigned
int
offset
);
unsigned
int
index
,
void
*
code
,
size_t
length
,
unsigned
int
offset
);
extern
int
wrnc_cpu_dump_application_file
(
struct
wrnc_dev
*
wrnc
,
unsigned
int
index
,
char
*
path
);
...
...
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