Commit 286bc226 authored by Alessandro Rubini's avatar Alessandro Rubini

userspace: new ppsi with cleaned-up wr-servo

This commit also fixes the tools that access ppsi's shmem.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent c5d4d246
ppsi @ 78277307
Subproject commit ea68c737c6049f6fbe75827f3be236956c2207bc
Subproject commit 782773077690f2b2d53af0395e3b94e8fcc89a9d
......@@ -10,7 +10,7 @@ int hal_nports_local;
/* PPSI */
struct wrs_shm_head *ppsi_head;
static struct pp_globals *ppg;
struct wr_servo_state_t *ppsi_servo;
struct wr_servo_state *ppsi_servo;
/* RTUd */
struct wrs_shm_head *rtud_head;
......
......@@ -15,7 +15,7 @@ extern int hal_nports_local;
/* PPSI */
extern struct wrs_shm_head *ppsi_head;
extern struct wr_servo_state_t *ppsi_servo;
extern struct wr_servo_state *ppsi_servo;
/* RTUd */
struct wrs_shm_head *rtud_head;
......
......@@ -30,8 +30,8 @@ static struct hal_port_state hal_ports_local_copy[HAL_MAX_PORTS];
static int hal_nports_local;
static struct wrs_shm_head *ppsi_head;
static struct pp_globals *ppg;
static struct wr_servo_state_t *ppsi_servo;
static struct wr_servo_state_t ppsi_servo_local; /* local copy of
static struct wr_servo_state *ppsi_servo;
static struct wr_servo_state ppsi_servo_local; /* local copy of
servo status */
static pid_t ptp_ch_pid; /* pid of ppsi connected via minipc */
static struct hal_temp_sensors *temp_sensors;
......@@ -309,7 +309,7 @@ void show_servo(void)
if(mode == SHOW_GUI) {
term_cprintf(C_BLUE, "Synchronization status:\n");
if (!ppsi_servo_local.valid) {
if (!(ppsi_servo_local.flags & WR_FLAG_VALID)) {
term_cprintf(C_RED, "Master mode or sync info not valid\n");
return;
}
......@@ -378,7 +378,7 @@ void show_servo(void)
}
else if(mode == SHOW_STATS) {
printf("SERVO ");
printf("sv:%d ", ppsi_servo_local.valid ? 1 : 0);
printf("sv:%d ", ppsi_servo_local.flags & WR_FLAG_VALID ? 1 : 0);
printf("ss:'%s' ", ppsi_servo_local.servo_state_name);
printf("mu:%llu ", ppsi_servo_local.picos_mu);
printf("dms:%llu ", ppsi_servo_local.delta_ms);
......
......@@ -479,33 +479,30 @@ struct dump_info dstp_info [] = {
};
#undef DUMP_STRUCT
#define DUMP_STRUCT struct wr_servo_state_t /* Horrible typedef */
#define DUMP_STRUCT struct wr_servo_state
struct dump_info servo_state_info [] = {
DUMP_FIELD_SIZE(char, if_name, 16),
DUMP_FIELD(unsigned_long, flags),
DUMP_FIELD(int, state),
DUMP_FIELD_SIZE(char, servo_state_name, 32),
DUMP_FIELD(int, next_state),
DUMP_FIELD(TimeInternal, mu), /* half of the RTT */
DUMP_FIELD(Integer64, picos_mu),
DUMP_FIELD(Integer32, delta_tx_m),
DUMP_FIELD(Integer32, delta_rx_m),
DUMP_FIELD(Integer32, delta_tx_s),
DUMP_FIELD(Integer32, delta_rx_s),
DUMP_FIELD(Integer32, cur_setpoint),
DUMP_FIELD(Integer32, delta_ms),
DUMP_FIELD(Integer32, delta_ms_prev),
DUMP_FIELD(Integer32, fiber_fix_alpha),
DUMP_FIELD(Integer32, clock_period_ps),
DUMP_FIELD(TimeInternal, t1),
DUMP_FIELD(TimeInternal, t2),
DUMP_FIELD(TimeInternal, t3),
DUMP_FIELD(TimeInternal, t4),
DUMP_FIELD(UInteger64, last_tics),
DUMP_FIELD(Integer32, fiber_fix_alpha),
DUMP_FIELD(Integer32, clock_period_ps),
DUMP_FIELD(Integer32, delta_ms_prev),
DUMP_FIELD(int, missed_iters),
DUMP_FIELD(int, valid),
DUMP_FIELD(TimeInternal, mu), /* half of the RTT */
DUMP_FIELD(Integer64, picos_mu),
DUMP_FIELD(Integer32, cur_setpoint),
DUMP_FIELD(Integer32, delta_ms),
DUMP_FIELD(UInteger32, update_count),
DUMP_FIELD(int, tracking_enabled),
DUMP_FIELD_SIZE(char, servo_state_name, 32),
DUMP_FIELD(Integer64, skew),
DUMP_FIELD(Integer64, offset),
};
......@@ -584,7 +581,7 @@ int dump_ppsi_mem(struct wrs_shm_head *head)
DSCurrent *dsc;
DSParent *dsp;
DSTimeProperties *dstp;
struct wr_servo_state_t *global_ext_data;
struct wr_servo_state *global_ext_data;
int i;
if (head->version != WRS_PPSI_SHMEM_VERSION) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment