Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tsn-measures
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
tsn-measures
Commits
376a7d06
Commit
376a7d06
authored
Aug 20, 2021
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
motor-control: switch to CLOCK_TAI
switch all CLOCK_REALTIME references to CLOCK_TAI
parent
b70065ce
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
src/motor-control/src/master.c
src/motor-control/src/master.c
+4
-4
src/motor-control/src/send_packet.c
src/motor-control/src/send_packet.c
+1
-1
src/motor-control/src/slave.c
src/motor-control/src/slave.c
+4
-4
No files found.
src/motor-control/src/master.c
View file @
376a7d06
...
...
@@ -148,7 +148,7 @@ static void *packet_sending_thread(void *p) {
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
measures_start
);
clock_gettime
(
CLOCK_
REALTIME
,
&
next
);
clock_gettime
(
CLOCK_
TAI
,
&
next
);
if
(
thread_params
.
start_ts
)
{
if
(
thread_params
.
start_ts
<
ts_to_uint
(
next
))
{
...
...
@@ -182,7 +182,7 @@ static void *packet_sending_thread(void *p) {
nb_cycles
>=
((
unsigned
int
)
thread_params
.
max_cycles
))
break
;
clock_gettime
(
CLOCK_
REALTIME
,
&
current
);
clock_gettime
(
CLOCK_
TAI
,
&
current
);
// Sanity check
if
(
current
.
tv_sec
>
next
.
tv_sec
)
...
...
@@ -190,7 +190,7 @@ static void *packet_sending_thread(void *p) {
if
(
current
.
tv_sec
==
next
.
tv_sec
&&
current
.
tv_nsec
>
next
.
tv_nsec
)
goto
invalid_ts
;
ret
=
clock_nanosleep
(
CLOCK_
REALTIME
,
TIMER_ABSTIME
,
&
next
,
NULL
);
ret
=
clock_nanosleep
(
CLOCK_
TAI
,
TIMER_ABSTIME
,
&
next
,
NULL
);
if
(
ret
)
{
fprintf
(
stderr
,
"clock_nanosleep returned error: %d, aborting...
\n
"
,
ret
);
exit
(
EXIT_FAILURE
);
...
...
@@ -200,7 +200,7 @@ static void *packet_sending_thread(void *p) {
encode
(
tx_data
,
send_data
);
// Get timestamp before TSN task for stats
clock_gettime
(
CLOCK_
REALTIME
,
&
current
);
clock_gettime
(
CLOCK_
TAI
,
&
current
);
do_tsn_task
(
send_data
,
next_txtime
);
add_ns
(
&
next
,
thread_params
.
interval
);
...
...
src/motor-control/src/send_packet.c
View file @
376a7d06
...
...
@@ -76,7 +76,7 @@ void init_udp_send(egress_info_t *info) {
error
(
EXIT_FAILURE
,
errno
,
"setsockopt SO_BINDTODEVICE failed
\n
"
);
if
(
params
->
use_etf
)
{
info
->
sk_txtime
.
clockid
=
CLOCK_
REALTIME
;
info
->
sk_txtime
.
clockid
=
CLOCK_
TAI
;
info
->
sk_txtime
.
flags
=
SOF_TXTIME_REPORT_ERRORS
;
if
(
setsockopt
(
info
->
sock_fd
,
SOL_SOCKET
,
SO_TXTIME
,
&
info
->
sk_txtime
,
...
...
src/motor-control/src/slave.c
View file @
376a7d06
...
...
@@ -129,7 +129,7 @@ static void *emit_signal_thread(void *p) {
continue
;
}
ret
=
clock_nanosleep
(
CLOCK_
REALTIME
,
TIMER_ABSTIME
,
&
emit_signal_next
,
NULL
);
ret
=
clock_nanosleep
(
CLOCK_
TAI
,
TIMER_ABSTIME
,
&
emit_signal_next
,
NULL
);
if
(
ret
)
{
fprintf
(
stderr
,
"clock_nanosleep returned error: %d, aborting...
\n
"
,
ret
);
exit
(
EXIT_FAILURE
);
...
...
@@ -145,7 +145,7 @@ static void *emit_signal_thread(void *p) {
gpio_pulse_state
=
toggle_gpio
(
gpio_pulse_fd
,
gpio_pulse_state
);
}
clock_gettime
(
CLOCK_
REALTIME
,
&
current
);
clock_gettime
(
CLOCK_
TAI
,
&
current
);
previous_emit
=
current
;
previous_ts
=
emit_signal_next
;
...
...
@@ -177,7 +177,7 @@ static void *tsn_thread(void *p) {
if
(
tsn_task
==
XDP_TASK
)
setup_poll_fd
();
if
(
thread_params
.
start_ts
)
{
clock_gettime
(
CLOCK_
REALTIME
,
&
next
);
clock_gettime
(
CLOCK_
TAI
,
&
next
);
if
(
thread_params
.
start_ts
<
ts_to_uint
(
next
))
{
fprintf
(
stderr
,
"start timestamp is in the past, aborting...
\n
"
);
exit
(
EXIT_FAILURE
);
...
...
@@ -199,7 +199,7 @@ static void *tsn_thread(void *p) {
recv_xdp_packet
();
// Get time for statistics
clock_gettime
(
CLOCK_
REALTIME
,
&
current
);
clock_gettime
(
CLOCK_
TAI
,
&
current
);
recv_xdp_cleanup
();
interval_us
=
calcdiff_ns
(
current
,
previous
)
/
1000
;
...
...
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