Commit 87aa1db9 authored by Alessandro Rubini's avatar Alessandro Rubini

syslog: avoid accessing servo state in host builds

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 367c4e79
......@@ -68,11 +68,15 @@ int syslog_poll(void)
/* for servo-state (accesses ppsi internal variables */
extern struct pp_instance *ppi;
struct wr_servo_state *s =
&((struct wr_data *)ppi->ext_data)->servo_state;
struct wr_servo_state *s;
static uint32_t prev_tics;
static int track_ok_count, prev_servo_state = -1;
if (IS_HOST_PROCESS)
s = NULL;
else
s = &((struct wr_data *)ppi->ext_data)->servo_state;
if (ip_status == IP_TRAINING)
......@@ -114,7 +118,7 @@ int syslog_poll(void)
if (!prev_tics)
prev_tics = timer_get_tics();
if (s->state == WR_TRACK_PHASE &&
if (s && s->state == WR_TRACK_PHASE &&
prev_servo_state != WR_TRACK_PHASE) {
/* we reached sync: log it */
track_ok_count++;
......@@ -138,7 +142,7 @@ int syslog_poll(void)
prev_tics / 1000, prev_tics % 1000);
goto send;
}
if (s->state != WR_TRACK_PHASE &&
if (s && s->state != WR_TRACK_PHASE &&
prev_servo_state == WR_TRACK_PHASE) {
prev_servo_state = s->state;
......
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