Commit f3c9d898 authored by Aurelio Colosimo's avatar Aurelio Colosimo

spec: spec_set_tstamp fixed

implemented a new function pps_gen_set, which makes use of
PPSG_CR_CNT_SET in CR register for UTC timestamp setting
parent f47eec7f
......@@ -36,6 +36,18 @@ void pps_gen_init()
PPSG->CR = cr;
}
void pps_gen_set(int32_t sec, int32_t nsec)
{
TRACE_DEV("ADJ: sec %d nsec %d\n", sec, nsec);
PPSG->ADJ_UTCLO = sec;
PPSG->ADJ_UTCHI = 0;
PPSG->ADJ_NSEC = nsec;
PPSG->CR = PPSG_CR_CNT_EN | PPSG_CR_PWIDTH_W(PPS_PULSE_WIDTH) |
PPSG_CR_CNT_SET;
}
void pps_gen_adjust_nsec(int32_t how_much)
{
TRACE_DEV("ADJ: nsec %d nanoseconds\n", how_much);
......
......@@ -92,9 +92,7 @@ int32_t spec_set_tstamp(TimeInternal *t)
{
TimeInternal tp_orig;
pps_gen_get_time( &tp_orig.seconds, &tp_orig.nanoseconds );
pps_gen_adjust_utc(t->seconds);
pps_gen_adjust_nsec(t->nanoseconds);
pps_gen_set(t->seconds, t->nanoseconds);
return 0; /* SPEC uses a sort of monotonic tstamp for timers */
}
......
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