Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
PPSi
Commits
65c47ec6
Commit
65c47ec6
authored
Mar 13, 2023
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
time-arith: constify
servo: reindent
parent
3e222093
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
12 deletions
+17
-12
ppsi.h
include/ppsi/ppsi.h
+3
-3
time-arith.c
lib/time-arith.c
+5
-4
wrh-servo.c
proto-ext-common/wrh-servo.c
+1
-1
wr-servo.c
proto-ext-whiterabbit/wr-servo.c
+8
-4
No files found.
include/ppsi/ppsi.h
View file @
65c47ec6
...
...
@@ -395,14 +395,14 @@ extern int msg_issue_pdelay_resp(struct pp_instance *ppi, struct pp_time *time);
/* Functions for time math */
extern
void
normalize_pp_time
(
struct
pp_time
*
t
);
extern
void
pp_time_add
(
struct
pp_time
*
t1
,
struct
pp_time
*
t2
);
extern
void
pp_time_sub
(
struct
pp_time
*
t1
,
struct
pp_time
*
t2
);
extern
void
pp_time_add
(
struct
pp_time
*
t1
,
const
struct
pp_time
*
t2
);
extern
void
pp_time_sub
(
struct
pp_time
*
t1
,
const
struct
pp_time
*
t2
);
extern
void
pp_time_div2
(
struct
pp_time
*
t
);
extern
TimeInterval
pp_time_to_interval
(
struct
pp_time
*
ts
);
extern
TimeInterval
picos_to_interval
(
int64_t
picos
);
extern
void
pp_time_add_interval
(
struct
pp_time
*
t1
,
TimeInterval
t2
);
extern
void
pp_time_sub_interval
(
struct
pp_time
*
t1
,
TimeInterval
t2
);
extern
int
pp_timeout_log_to_ms
(
Integer8
logValue
);
extern
int
pp_timeout_log_to_ms
(
Integer8
logValue
);
extern
void
fixedDelta_to_pp_time
(
struct
FixedDelta
fd
,
struct
pp_time
*
t
);
/* Function for time conversion */
...
...
lib/time-arith.c
View file @
65c47ec6
...
...
@@ -14,7 +14,7 @@
void
normalize_pp_time
(
struct
pp_time
*
t
)
{
/* no 64b division please, we'll rather loop a few times */
#define SNS_PER_S ((1000LL * 1000 * 1000) << 16)
#define SNS_PER_S ((1000LL * 1000 * 1000) << 16)
/* For whatever reason we perform a normalization on an incorrect
* timestamp, don't treat is as an negative value. */
...
...
@@ -65,7 +65,7 @@ void pp_time_sub_interval(struct pp_time *t1, TimeInterval t2)
(((a < 0) && (b < INT64_MIN - a))) \
)
void
pp_time_add
(
struct
pp_time
*
t1
,
struct
pp_time
*
t2
)
void
pp_time_add
(
struct
pp_time
*
t1
,
const
struct
pp_time
*
t2
)
{
t1
->
secs
+=
t2
->
secs
;
t1
->
scaled_nsecs
+=
t2
->
scaled_nsecs
;
...
...
@@ -77,7 +77,7 @@ void pp_time_add(struct pp_time *t1, struct pp_time *t2)
((b > 0) && (a < INT64_MIN + b)) \
)
void
pp_time_sub
(
struct
pp_time
*
t1
,
struct
pp_time
*
t2
)
void
pp_time_sub
(
struct
pp_time
*
t1
,
const
struct
pp_time
*
t2
)
{
t1
->
secs
-=
t2
->
secs
;
t1
->
scaled_nsecs
-=
t2
->
scaled_nsecs
;
...
...
@@ -113,7 +113,8 @@ int64_t pp_time_to_picos(struct pp_time *t)
return
ret
;
}
void
fixedDelta_to_pp_time
(
struct
FixedDelta
fd
,
struct
pp_time
*
t
)
{
void
fixedDelta_to_pp_time
(
struct
FixedDelta
fd
,
struct
pp_time
*
t
)
{
/* FixedDelta is expressed in ps*2^16 */
uint64_t
v
=
((
uint64_t
)
fd
.
scaledPicoseconds
.
msb
)
<<
32
|
(
uint64_t
)
fd
.
scaledPicoseconds
.
lsb
;
__div64_32
(
&
v
,
1000
);
...
...
proto-ext-common/wrh-servo.c
View file @
65c47ec6
...
...
@@ -21,7 +21,7 @@
#define SNMP_MAX_OFFSET_PS 500
#define SNMP_MAX_DELTA_RTT_PS 1000
static
const
char
*
wrh_servo_state_name
[]
=
{
static
const
char
*
const
wrh_servo_state_name
[]
=
{
[
WRH_UNINITIALIZED
]
=
"Uninitialized"
,
[
WRH_SYNC_NSEC
]
=
"SYNC_NSEC"
,
[
WRH_SYNC_TAI
]
=
"SYNC_SEC"
,
...
...
proto-ext-whiterabbit/wr-servo.c
View file @
65c47ec6
...
...
@@ -3,8 +3,11 @@
#include "../proto-standard/common-fun.h"
static
inline
void
_calculate_raw_delayMM
(
struct
pp_instance
*
ppi
,
struct
pp_time
*
ta
,
struct
pp_time
*
tb
,
struct
pp_time
*
tc
,
struct
pp_time
*
td
)
{
const
struct
pp_time
*
ta
,
const
struct
pp_time
*
tb
,
const
struct
pp_time
*
tc
,
const
struct
pp_time
*
td
)
{
wr_servo_ext_t
*
se
=
WRE_SRV
(
ppi
);
/* The calculation done will be
...
...
@@ -12,7 +15,7 @@ static inline void _calculate_raw_delayMM(struct pp_instance *ppi,
*/
struct
pp_time
*
sa
=&
se
->
rawDelayMM
,
sb
;
/* sa = td-ta) */
/* sa =
(
td-ta) */
*
sa
=*
td
;
pp_time_sub
(
sa
,
ta
);
/* sb = (tc-tb) */
...
...
@@ -63,7 +66,8 @@ int wr_servo_got_resp(struct pp_instance *ppi) {
return
wrh_servo_got_resp
(
ppi
);
}
int
wr_servo_got_presp
(
struct
pp_instance
*
ppi
)
{
int
wr_servo_got_presp
(
struct
pp_instance
*
ppi
)
{
/* Re-adjust T3,T4,T5 and T6 */
wr_servo_ext_t
*
se
=
WRE_SRV
(
ppi
);
...
...
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