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
47
Issues
47
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
f89fba91
Commit
f89fba91
authored
Jul 09, 2012
by
Aurelio Colosimo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
diagnostic messages cleanup and fix
parent
c2320d6a
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
65 additions
and
24 deletions
+65
-24
minic.c
arch-spec/dev/minic.c
+9
-0
pps_gen.c
arch-spec/dev/pps_gen.c
+1
-3
diag-yes.c
diag/diag-yes.c
+2
-2
fsm.c
fsm.c
+10
-3
ieee1588_types.h
include/ppsi/ieee1588_types.h
+2
-0
ppsi.h
include/ppsi/ppsi.h
+1
-1
arith.c
proto-standard/arith.c
+3
-1
msg.c
proto-standard/msg.c
+14
-2
servo.c
proto-standard/servo.c
+23
-12
No files found.
arch-spec/dev/minic.c
View file @
f89fba91
...
...
@@ -227,6 +227,12 @@ int minic_rx_frame(uint8_t *hdr, uint8_t *payload, uint32_t buf_size, struct hw_
hwts
->
nsec
=
counter_r
*
8
;
hwts
->
valid
=
(
dhdr
&
RXOOB_TS_INCORRECT
)
?
0
:
1
;
if
(
!
hwts
->
valid
)
{
int
k
;
PP_VPRINTF
(
"Warning: rx timestamp invalid - dhdr: "
);
for
(
k
=
0
;
k
<
2
;
k
++
)
PP_VPRINTF
(
"%02x "
,
((
char
*
)
&
dhdr
)[
k
]);
PP_VPRINTF
(
"
\n
"
);
}
}
n_recvd
=
(
buf_size
<
payload_size
?
buf_size
:
payload_size
);
...
...
@@ -321,6 +327,9 @@ int minic_tx_frame(uint8_t *hdr, uint8_t *payload, uint32_t size, struct hw_time
hwts
->
ahead
=
0
;
hwts
->
nsec
=
counter_r
*
8
;
if
(
!
ts_valid
)
{
PP_PRINTF
(
"Warning: tx timestamp invalid
\n
"
);
}
// TRACE_DEV("minic_tx_frame [%d bytes] TS: %d.%d valid %d\n", size, hwts->utc, hwts->nsec, hwts->valid);
minic
.
tx_count
++
;
...
...
arch-spec/dev/pps_gen.c
View file @
f89fba91
...
...
@@ -38,7 +38,6 @@ void pps_gen_init()
void
pps_gen_set
(
int32_t
sec
,
int32_t
nsec
)
{
TRACE_DEV
(
"ADJ: sec %d nsec %d
\n
"
,
sec
,
nsec
);
PPSG
->
ADJ_UTCLO
=
sec
;
PPSG
->
ADJ_UTCHI
=
0
;
...
...
@@ -46,11 +45,11 @@ void pps_gen_set(int32_t sec, int32_t nsec)
PPSG
->
CR
=
PPSG_CR_CNT_EN
|
PPSG_CR_PWIDTH_W
(
PPS_PULSE_WIDTH
)
|
PPSG_CR_CNT_SET
;
PP_PRINTF
(
"UTC set %d.%d
\n
"
,
sec
,
nsec
);
}
void
pps_gen_adjust_nsec
(
int32_t
how_much
)
{
TRACE_DEV
(
"ADJ: nsec %d nanoseconds
\n
"
,
how_much
);
#if 1
PPSG
->
ADJ_UTCLO
=
0
;
PPSG
->
ADJ_UTCHI
=
0
;
...
...
@@ -66,7 +65,6 @@ void pps_gen_adjust_utc(int32_t how_much)
{
#if 1
TRACE_DEV
(
"ADJ: utc %d seconds
\n
"
,
how_much
);
PPSG
->
ADJ_UTCLO
=
how_much
;
PPSG
->
ADJ_UTCHI
=
0
;
PPSG
->
ADJ_NSEC
=
0
;
...
...
diag/diag-yes.c
View file @
f89fba91
...
...
@@ -12,12 +12,12 @@ void pp_diag_fsm(struct pp_instance *ppi, char *name, int sequence, int plen)
{
if
(
sequence
==
STATE_ENTER
)
{
/* enter with or without a packet len */
pp_printf
(
"fsm for %p: ENTER %3i (%s), packet len %i
\n
"
,
pp_
timed_
printf
(
"fsm for %p: ENTER %3i (%s), packet len %i
\n
"
,
ppi
,
ppi
->
state
,
name
,
plen
);
return
;
}
/* leave has one \n more, so different states are separate */
pp_printf
(
"fsm for %p: LEAVE %3i (%s) (next: %3i in %i ms)
\n\n
"
,
pp_
timed_
printf
(
"fsm for %p: LEAVE %3i (%s) (next: %3i in %i ms)
\n\n
"
,
ppi
,
ppi
->
state
,
name
,
ppi
->
next_state
,
ppi
->
next_delay
);
}
...
...
fsm.c
View file @
f89fba91
...
...
@@ -17,7 +17,12 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
{
struct
pp_state_table_item
*
ip
;
int
state
,
err
;
#ifdef PPSI_MASTER__
if
((
plen
>
0
))
pp_printf
(
"RECV %02d %d.%d %s
\n
"
,
plen
,
ppi
->
last_rcv_time
.
seconds
,
ppi
->
last_rcv_time
.
nanoseconds
,
pp_msg_names
[
packet
[
0
]
&
0x0f
]);
#endif
if
(
packet
)
msg_unpack_header
(
ppi
,
packet
);
...
...
@@ -30,13 +35,15 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
/* found: handle this state */
ppi
->
next_state
=
state
;
ppi
->
next_delay
=
0
;
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_ENTER
,
plen
);
if
((
pp_diag_verbosity
)
||
(
ppi
->
is_new_state
))
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_ENTER
,
plen
);
err
=
ip
->
f1
(
ppi
,
packet
,
plen
);
if
(
!
err
&&
ip
->
f2
)
err
=
ip
->
f2
(
ppi
,
packet
,
plen
);
if
(
err
)
pp_diag_error
(
ppi
,
err
);
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_LEAVE
,
0
/* unused */
);
if
(
pp_diag_verbosity
)
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_LEAVE
,
0
/* unused */
);
ppi
->
is_new_state
=
0
;
...
...
include/ppsi/ieee1588_types.h
View file @
f89fba91
...
...
@@ -272,6 +272,8 @@ enum pp_std_messages {
PPM_MANAGEMENT
,
};
extern
const
char
const
*
pp_msg_names
[];
/* Enumeration Domain Number (table 2, page 41) */
enum
ENDomainNumber
{
DFLT_DOMAIN_NUMBER
=
0
,
...
...
include/ppsi/ppsi.h
View file @
f89fba91
...
...
@@ -341,7 +341,7 @@ extern void div2_TimeInternal(TimeInternal *r);
/* Get and Set system timestamp */
extern
void
pp_get_tstamp
(
TimeInternal
*
t
);
extern
int32_t
pp_set_tstamp
(
TimeInternal
*
t
);
extern
const
char
*
pp_get_tstamp_str
();
/* Virtualization of Linux adjtimex (or BSD adjtime) system clock time
* adjustment. Boolean: returns 1 in case of success and 0 if failure */
...
...
proto-standard/arith.c
View file @
f89fba91
...
...
@@ -108,5 +108,7 @@ void set_TimeInternal(TimeInternal *t, Integer32 s, Integer32 ns)
void
display_TimeInternal
(
const
char
*
label
,
TimeInternal
*
t
)
{
PP_VPRINTF
(
"%s: %d.%d
\n
"
,
label
,
t
->
seconds
,
t
->
nanoseconds
);
PP_VPRINTF
(
"%s: %s%d.%09d
\n
"
,
label
,
(
t
->
seconds
<
0
||
(
t
->
seconds
==
0
&&
t
->
nanoseconds
<
0
))
?
"-"
:
" "
,
abs
(
t
->
seconds
),
abs
(
t
->
nanoseconds
));
}
proto-standard/msg.c
View file @
f89fba91
...
...
@@ -571,7 +571,7 @@ void msg_unpack_pdelay_resp_followup(void *buf,
PP_VPRINTF
(
"
\n
"
);
}
static
const
char
const
*
pp_msg_names
[]
=
{
const
char
const
*
pp_msg_names
[]
=
{
"sync"
,
"delay_req"
,
"pdelay_req"
,
...
...
@@ -585,6 +585,7 @@ static const char const * pp_msg_names[] = {
"management"
};
#ifdef PPSI_SLAVE
#define MSG_SEND_AND_RET(x,y,z)\
if (pp_send_packet(ppi, ppi->buf_out, PP_## x ##_LENGTH,\
&ppi->last_snt_time, PP_NP_##y , z) < PP_## x ##_LENGTH) {\
...
...
@@ -592,9 +593,20 @@ static const char const * pp_msg_names[] = {
pp_msg_names[PPM_##x], PPM_##x);\
return -1;\
}\
PP_VPRINTF("%s(%d) Message sent\n", pp_msg_names[PPM_##x], PPM_##x);\
ppi->sent_seq_id[PPM_## x]++;\
return 0;
#else
#define MSG_SEND_AND_RET(x,y,z)\
if (pp_send_packet(ppi, ppi->buf_out, PP_## x ##_LENGTH,\
&ppi->last_snt_time, PP_NP_##y , z) < PP_## x ##_LENGTH) {\
PP_PRINTF("%s(%d) Message can't be sent -> FAULTY state!\n",\
pp_msg_names[PPM_##x], PPM_##x);\
return -1;\
}\
ppi->sent_seq_id[PPM_## x]++;\
//PP_PRINTF("SENT %02d %d.%d %s \n", PP_## x ##_LENGTH, ppi->last_snt_time.seconds, ppi->last_snt_time.nanoseconds,pp_msg_names[PPM_##x]);\
return 0;
#endif
/* Pack and send on general multicast ip adress an Announce message */
int
msg_issue_announce
(
struct
pp_instance
*
ppi
)
...
...
proto-standard/servo.c
View file @
f89fba91
...
...
@@ -33,13 +33,13 @@ void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field)
if
(
OPTS
(
ppi
)
->
max_dly
)
{
/* If max_delay is 0 then it's OFF */
if
(
s_to_m_dly
.
seconds
)
{
PP_
PRINTF
(
"updateD
elay aborted, delay greater than 1"
" second
.
"
);
PP_
VPRINTF
(
"pp_update_d
elay aborted, delay greater than 1"
" second
\n
"
);
return
;
}
if
(
s_to_m_dly
.
nanoseconds
>
OPTS
(
ppi
)
->
max_dly
)
{
PP_
PRINTF
(
"updateD
elay aborted, delay %d greater than "
PP_
VPRINTF
(
"pp_update_d
elay aborted, delay %d greater than "
"administratively set maximum %d
\n
"
,
s_to_m_dly
.
nanoseconds
,
OPTS
(
ppi
)
->
max_dly
);
...
...
@@ -254,13 +254,13 @@ void pp_update_clock(struct pp_instance *ppi)
if
(
OPTS
(
ppi
)
->
max_rst
)
{
/* If max_rst is 0 then it's OFF */
if
(
DSCUR
(
ppi
)
->
offsetFromMaster
.
seconds
)
{
PP_PRINTF
(
"pp_update_clock aborted, offset greater "
"than 1 second
.
"
);
"than 1 second
\n
"
);
goto
display
;
}
if
(
DSCUR
(
ppi
)
->
offsetFromMaster
.
nanoseconds
>
OPTS
(
ppi
)
->
max_rst
)
{
PP_
PRINTF
(
"updateC
lock aborted, offset %d greater than "
PP_
VPRINTF
(
"pp_update_c
lock aborted, offset %d greater than "
"administratively set maximum %d
\n
"
,
DSCUR
(
ppi
)
->
offsetFromMaster
.
nanoseconds
,
OPTS
(
ppi
)
->
max_rst
);
...
...
@@ -285,6 +285,7 @@ void pp_update_clock(struct pp_instance *ppi)
}
}
}
else
{
static
int
dc
=
0
;
/* the PI controller */
/* no negative or zero attenuation */
...
...
@@ -310,6 +311,16 @@ void pp_update_clock(struct pp_instance *ppi)
/* apply controller output as a clock tick rate adjustment */
if
(
!
OPTS
(
ppi
)
->
no_adjust
)
pp_adj_freq
(
-
adj
);
dc
++
;
if
(
dc
%
8
==
0
)
{
/* Prints statistics every 8s */
PP_PRINTF
(
"ofst %d, raw ofst %d, mean-dly %d, adj %d
\n
"
,
DSCUR
(
ppi
)
->
offsetFromMaster
.
nanoseconds
,
SRV
(
ppi
)
->
m_to_s_dly
.
nanoseconds
,
DSCUR
(
ppi
)
->
meanPathDelay
.
nanoseconds
,
adj
);
}
}
display:
...
...
@@ -319,26 +330,26 @@ display:
*/
PP_PRINTF
(
"
\n
--Offset Correction--
\n
"
);
PP_PRINTF
(
"Raw offset from master: %10ds %11dns
\n
"
,
PP_
V
PRINTF
(
"
\n
--Offset Correction--
\n
"
);
PP_
V
PRINTF
(
"Raw offset from master: %10ds %11dns
\n
"
,
SRV
(
ppi
)
->
m_to_s_dly
.
seconds
,
SRV
(
ppi
)
->
m_to_s_dly
.
nanoseconds
);
PP_PRINTF
(
"
\n
--Offset and Delay filtered--
\n
"
);
PP_
V
PRINTF
(
"
\n
--Offset and Delay filtered--
\n
"
);
if
(
!
OPTS
(
ppi
)
->
e2e_mode
)
{
PP_PRINTF
(
"one-way delay averaged (P2P): %10ds %11dns
\n
"
,
PP_
V
PRINTF
(
"one-way delay averaged (P2P): %10ds %11dns
\n
"
,
DSPOR
(
ppi
)
->
peerMeanPathDelay
.
seconds
,
DSPOR
(
ppi
)
->
peerMeanPathDelay
.
nanoseconds
);
}
else
{
PP_PRINTF
(
"one-way delay averaged (E2E): %10ds %11dns
\n
"
,
PP_
V
PRINTF
(
"one-way delay averaged (E2E): %10ds %11dns
\n
"
,
DSCUR
(
ppi
)
->
meanPathDelay
.
seconds
,
DSCUR
(
ppi
)
->
meanPathDelay
.
nanoseconds
);
}
PP_PRINTF
(
"offset from master: %10ds %11dns
\n
"
,
PP_
V
PRINTF
(
"offset from master: %10ds %11dns
\n
"
,
DSCUR
(
ppi
)
->
offsetFromMaster
.
seconds
,
DSCUR
(
ppi
)
->
offsetFromMaster
.
nanoseconds
);
PP_PRINTF
(
"observed drift: %10d
\n
"
,
SRV
(
ppi
)
->
obs_drift
);
PP_
V
PRINTF
(
"observed drift: %10d
\n
"
,
SRV
(
ppi
)
->
obs_drift
);
}
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