Commit aae3fe04 authored by li hongming's avatar li hongming

Merge remote-tracking branch 'origin/hm-wrsfl' into hm-wrsfl-lowjitter

Support aligning the PPS out to PPS input when WRSFL works as GM.
parents d4d8d2c8 429c2ef5
......@@ -57,7 +57,7 @@
#define ALIGN_STATE_WAIT_CLKIN 9
#define ALIGN_STATE_WAIT_PLOCK 10
#define SPLL_STATS_VER 3
#define SPLL_STATS_VER 4
/* info reported through .stat section */
/* due to endiannes problem strings has to be 4 bytes alligned */
......@@ -78,6 +78,8 @@ struct spll_stats {
char build_date[16];
char build_time[16];
char build_by[32];
int ext_pps_latency_ps; // added by hm
};
extern struct spll_stats stats;
......
......@@ -20,7 +20,7 @@
#define EXT_PERIOD_NS 100
#define EXT_FREQ_HZ 10000000
#define EXT_PPS_LATENCY_PS 63000 // fixme: make configurable
//#define EXT_PPS_LATENCY_PS 63000 // fixme: make configurable
void external_init(volatile struct spll_external_state *s, int ext_ref,
......@@ -180,7 +180,7 @@ int external_align_fsm(volatile struct spll_external_state *s)
s->align_shift += s->align_step;
mpll_set_phase_shift(s->main, s->align_shift);
} else if (v == s->align_target) {
s->align_shift += EXT_PPS_LATENCY_PS;
s->align_shift += stats.ext_pps_latency_ps;
mpll_set_phase_shift(s->main, s->align_shift);
s->align_state = ALIGN_STATE_COMPENSATE_DELAY;
}
......
......@@ -19,13 +19,13 @@ struct spll_external_state {
struct spll_helper_state *helper;
struct spll_main_state *main;
int enabled;
int enabled;
int align_state;
int align_timer;
int align_target;
int align_step;
int align_shift;
int align_target;
int align_step;
int align_shift;
};
void external_init(volatile struct spll_external_state *s, int ext_ref,
......
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