Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wrpc-sw
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
hdl-core-lib
wr-cores
wrpc-sw
Commits
62f595a5
Commit
62f595a5
authored
12 years ago
by
Aurelio Colosimo
Committed by
Alessandro Rubini
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
monitor output implementation for ppsi module
Signed-off-by:
Aurelio Colosimo
<
aurelio@aureliocolosimo.it
>
parent
f5e21870
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+1
-0
1 addition, 0 deletions
Makefile
monitor/monitor_ppsi.c
+193
-2
193 additions, 2 deletions
monitor/monitor_ppsi.c
with
194 additions
and
2 deletions
Makefile
+
1
−
0
View file @
62f595a5
...
@@ -70,6 +70,7 @@ cflags-$(CONFIG_PPSI) += \
...
@@ -70,6 +70,7 @@ cflags-$(CONFIG_PPSI) += \
-include
include/ppsi-wrappers.h
\
-include
include/ppsi-wrappers.h
\
-Iinclude
\
-Iinclude
\
-I
$(
PPSI
)
/include
\
-I
$(
PPSI
)
/include
\
-I
$(
PPSI
)
/arch-spec
\
-I
$(
PPSI
)
/arch-spec/include
\
-I
$(
PPSI
)
/arch-spec/include
\
-I
$(
PPSI
)
/proto-ext-whiterabbit
\
-I
$(
PPSI
)
/proto-ext-whiterabbit
\
-Iboards
/spec
-Iboards
/spec
...
...
This diff is collapsed.
Click to expand it.
monitor/monitor_ppsi.c
+
193
−
2
View file @
62f595a5
...
@@ -8,14 +8,205 @@
...
@@ -8,14 +8,205 @@
*/
*/
#include
<inttypes.h>
#include
<inttypes.h>
#include
<wrc.h>
#include
<ppsi/ppsi.h>
#include
<spec.h>
#include
<wr-api.h>
#include
<minic.h>
#include
<softpll_ng.h>
#include
<syscon.h>
#include
<pps_gen.h>
#include
<onewire.h>
#include
<util.h>
#define UI_REFRESH_PERIOD TICS_PER_SECOND
/* 1 sec */
struct
ptpdexp_sync_state_t
;
extern
ptpdexp_sync_state_t
cur_servo_state
;
extern
int
wrc_man_phase
;
void
wrc_mon_gui
(
void
)
void
wrc_mon_gui
(
void
)
{
{
/* FIXME stub: everything to be done, see monitor.c */
static
uint32_t
last
=
0
;
hexp_port_state_t
ps
;
int
tx
,
rx
;
int
aux_stat
;
uint64_t
sec
;
uint32_t
nsec
;
if
(
timer_get_tics
()
-
last
<
UI_REFRESH_PERIOD
)
return
;
last
=
timer_get_tics
();
term_clear
();
pp_printf
(
"WR PTP Core Sync Monitor v 1.0"
);
pp_printf
(
"Esc = exit"
);
shw_pps_gen_get_time
(
&
sec
,
&
nsec
);
pp_printf
(
"
\n\n
TAI Time: "
);
pp_printf
(
"%s"
,
format_time
(
sec
));
/*show_ports */
halexp_get_port_state
(
&
ps
,
NULL
);
pp_printf
(
"
\n\n
Link status:"
);
pp_printf
(
"%s: "
,
"wru1"
);
if
(
ps
.
up
)
pp_printf
(
"Link up "
);
else
pp_printf
(
"Link down "
);
if
(
ps
.
up
)
{
minic_get_stats
(
&
tx
,
&
rx
);
pp_printf
(
"(RX: %d, TX: %d), mode: "
,
rx
,
tx
);
/* FIXME: define HEXP_PORT_MODE_WR_MASTER/SLAVE somewhere
switch (ps.mode) {
case HEXP_PORT_MODE_WR_MASTER:
pp_printf("WR Master ");
break;
case HEXP_PORT_MODE_WR_SLAVE:
pp_printf("WR Slave ");
break;
}
*/
if
(
ps
.
is_locked
)
pp_printf
(
"Locked "
);
else
pp_printf
(
"NoLock "
);
if
(
ps
.
rx_calibrated
&&
ps
.
tx_calibrated
)
pp_printf
(
"Calibrated "
);
else
pp_printf
(
"Uncalibrated "
);
/* show_servo */
pp_printf
(
"
\n\n
Synchronization status:
\n\n
"
);
if
(
!
cur_servo_state
.
valid
)
{
pp_printf
(
"Master mode or sync info not valid
\n\n
"
);
return
;
}
pp_printf
(
"Servo state: "
);
pp_printf
(
"%s
\n
"
,
cur_servo_state
.
slave_servo_state
);
pp_printf
(
"Phase tracking: "
);
if
(
cur_servo_state
.
tracking_enabled
)
pp_printf
(
"ON
\n
"
);
else
pp_printf
(
"OFF
\n
"
);
pp_printf
(
"Synchronization source: "
);
pp_printf
(
"%s
\n
"
,
cur_servo_state
.
sync_source
);
pp_printf
(
"Aux clock status: "
);
aux_stat
=
spll_get_aux_status
(
0
);
if
(
aux_stat
&
SPLL_AUX_ENABLED
)
pp_printf
(
"enabled"
);
if
(
aux_stat
&
SPLL_AUX_LOCKED
)
pp_printf
(
", locked"
);
pp_printf
(
"
\n
"
);
pp_printf
(
"
\n
Timing parameters:
\n\n
"
);
pp_printf
(
"Round-trip time (mu): "
);
pp_printf
(
"%d ps
\n
"
,
(
int32_t
)
(
cur_servo_state
.
mu
));
pp_printf
(
"Master-slave delay: "
);
pp_printf
(
"%d ps
\n
"
,
(
int32_t
)
(
cur_servo_state
.
delay_ms
));
pp_printf
(
"Master PHY delays: "
);
pp_printf
(
"TX: %d ps, RX: %d ps
\n
"
,
(
int32_t
)
cur_servo_state
.
delta_tx_m
,
(
int32_t
)
cur_servo_state
.
delta_rx_m
);
pp_printf
(
"Slave PHY delays: "
);
pp_printf
(
"TX: %d ps, RX: %d ps
\n
"
,
(
int32_t
)
cur_servo_state
.
delta_tx_s
,
(
int32_t
)
cur_servo_state
.
delta_rx_s
);
pp_printf
(
"Total link asymmetry: "
);
pp_printf
(
"%d ps
\n
"
,
(
int32_t
)
(
cur_servo_state
.
total_asymmetry
));
pp_printf
(
"Cable rtt delay: "
);
pp_printf
(
"%d ps
\n
"
,
(
int32_t
)
(
cur_servo_state
.
mu
)
-
(
int32_t
)
cur_servo_state
.
delta_tx_m
-
(
int32_t
)
cur_servo_state
.
delta_rx_m
-
(
int32_t
)
cur_servo_state
.
delta_tx_s
-
(
int32_t
)
cur_servo_state
.
delta_rx_s
);
pp_printf
(
"Clock offset: "
);
pp_printf
(
"%d ps
\n
"
,
(
int32_t
)
(
cur_servo_state
.
cur_offset
));
pp_printf
(
"Phase setpoint: "
);
pp_printf
(
"%d ps
\n
"
,
(
int32_t
)
(
cur_servo_state
.
cur_setpoint
));
pp_printf
(
"Skew: "
);
pp_printf
(
"%d ps
\n
"
,
(
int32_t
)
(
cur_servo_state
.
cur_skew
));
pp_printf
(
"Manual phase adjustment: "
);
pp_printf
(
"%d ps
\n
"
,
(
int32_t
)
(
wrc_man_phase
));
pp_printf
(
"Update counter: "
);
pp_printf
(
"%d
\n
"
,
(
int32_t
)
(
cur_servo_state
.
update_count
));
}
pp_printf
(
"--"
);
return
;
}
}
int
wrc_log_stats
(
uint8_t
onetime
)
int
wrc_log_stats
(
uint8_t
onetime
)
{
{
/* FIXME stub: everything to be done, see monitor.c */
static
uint32_t
last
=
0
;
hexp_port_state_t
ps
;
int
tx
,
rx
;
int
aux_stat
;
uint64_t
sec
;
uint32_t
nsec
;
int16_t
brd_temp
=
0
;
int16_t
brd_temp_frac
=
0
;
if
(
!
onetime
&&
timer_get_tics
()
-
last
<
UI_REFRESH_PERIOD
)
return
0
;
last
=
timer_get_tics
();
shw_pps_gen_get_time
(
&
sec
,
&
nsec
);
halexp_get_port_state
(
&
ps
,
NULL
);
minic_get_stats
(
&
tx
,
&
rx
);
pp_printf
(
"lnk:%d rx:%d tx:%d "
,
ps
.
up
,
rx
,
tx
);
pp_printf
(
"lock:%d "
,
ps
.
is_locked
?
1
:
0
);
pp_printf
(
"sv:%d "
,
cur_servo_state
.
valid
?
1
:
0
);
pp_printf
(
"ss:'%s' "
,
cur_servo_state
.
slave_servo_state
);
aux_stat
=
spll_get_aux_status
(
0
);
pp_printf
(
"aux:%x "
,
aux_stat
);
pp_printf
(
"sec:%d nsec:%d "
,
(
uint32_t
)
sec
,
nsec
);
/* fixme: clock is not always 125 MHz */
pp_printf
(
"mu:%d "
,
(
int32_t
)
cur_servo_state
.
mu
);
pp_printf
(
"dms:%d "
,
(
int32_t
)
cur_servo_state
.
delay_ms
);
pp_printf
(
"dtxm:%d drxm:%d "
,
(
int32_t
)
cur_servo_state
.
delta_tx_m
,
(
int32_t
)
cur_servo_state
.
delta_rx_m
);
pp_printf
(
"dtxs:%d drxs:%d "
,
(
int32_t
)
cur_servo_state
.
delta_tx_s
,
(
int32_t
)
cur_servo_state
.
delta_rx_s
);
pp_printf
(
"asym:%d "
,
(
int32_t
)
(
cur_servo_state
.
total_asymmetry
));
pp_printf
(
"crtt:%d "
,
(
int32_t
)
(
cur_servo_state
.
mu
)
-
(
int32_t
)
cur_servo_state
.
delta_tx_m
-
(
int32_t
)
cur_servo_state
.
delta_rx_m
-
(
int32_t
)
cur_servo_state
.
delta_tx_s
-
(
int32_t
)
cur_servo_state
.
delta_rx_s
);
pp_printf
(
"cko:%d "
,
(
int32_t
)
(
cur_servo_state
.
cur_offset
));
pp_printf
(
"setp:%d "
,
(
int32_t
)
(
cur_servo_state
.
cur_setpoint
));
pp_printf
(
"hd:%d md:%d ad:%d "
,
spll_get_dac
(
-
1
),
spll_get_dac
(
0
),
spll_get_dac
(
1
));
pp_printf
(
"ucnt:%d "
,
(
int32_t
)
cur_servo_state
.
update_count
);
own_readtemp
(
ONEWIRE_PORT
,
&
brd_temp
,
&
brd_temp_frac
);
pp_printf
(
"temp:%d.%02d C"
,
brd_temp
,
brd_temp_frac
);
pp_printf
(
"
\n
"
);
return
0
;
return
0
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment