Commit 770cbd9a authored by Adam Wujek's avatar Adam Wujek 💬

proto-ext-whiterabbit: add pointer to valid servo instance for wr_servo_reset

This pointer is needed for wr_servo_reset function, since this function is
called without ppi context for wrpc-sw.

It is required since wr_servo_reset has to mark instance as invalid.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 4f7246d8
......@@ -124,7 +124,7 @@ struct wr_operations {
/* wr_servo interface */
int wr_servo_init(struct pp_instance *ppi);
void wr_servo_reset();
void wr_servo_reset(void);
int wr_servo_man_adjust_phase(int phase);
void wr_servo_enable_tracking(int enable);
int wr_servo_got_sync(struct pp_instance *ppi, TimeInternal *t1,
......
......@@ -28,6 +28,9 @@ ptpdexp_sync_state_t cur_servo_state; /* Exported with mini-rpc */
static int tracking_enabled = 1; /* FIXME: why? */
extern struct wrs_shm_head *ppsi_head;
static struct wr_servo_state_t *saved_servo_pointer; /* required for
* wr_servo_reset, which doesn't
* have ppi context. */
void wr_servo_enable_tracking(int enable)
{
......@@ -141,9 +144,11 @@ static TimeInternal ts_hardwarize(TimeInternal ts, int clock_period_ps)
static int got_sync = 0;
void wr_servo_reset()
void wr_servo_reset(void)
{
cur_servo_state.valid = 0;
if (saved_servo_pointer)
saved_servo_pointer->valid = 0;
}
int wr_servo_init(struct pp_instance *ppi)
......@@ -188,7 +193,8 @@ int wr_servo_init(struct pp_instance *ppi)
strcpy(s->servo_state_name, "Uninitialized");
cur_servo_state.valid = 1;
s->valid = 1;
saved_servo_pointer = s;
saved_servo_pointer->valid = 1;
cur_servo_state.update_count = 0;
s->update_count = 0;
......
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