/* Calculate the first base_time in the future that satisfies this * relationship: * * future_base_time = base_time + N x cycle_time >= now, or * * now - base_time * N >= --------------- * cycle_time * * Because N is an integer, the ceiling value of the above "a / b" ratio * is in fact precisely the floor value of "(a + b - 1) / b", which is * easier to calculate only having integer division tools.
*/ staticinline s64 future_base_time(s64 base_time, s64 cycle_time, s64 now)
{
s64 a, b, n;
if (base_time >= now) return base_time;
a = now - base_time;
b = cycle_time;
n = div_s64(a + b - 1, b);
return base_time + n * cycle_time;
}
/* This is not a preprocessor macro because the "ns" argument may or may not be * s64 at caller side. This ensures it is properly type-cast before div_s64.
*/ staticinline s64 ns_to_sja1105_delta(s64 ns)
{ return div_s64(ns, 200);
}
struct sja1105_ptp_data { struct timer_list extts_timer; /* Used only on SJA1105 to reconstruct partial timestamps */ struct sk_buff_head skb_rxtstamp_queue; /* Used on SJA1110 where meta frames are generated only for * 2-step TX timestamps
*/ struct sk_buff_head skb_txtstamp_queue; struct ptp_clock_info caps; struct ptp_clock *clock; struct sja1105_ptp_cmd cmd; /* Serializes all operations on the PTP hardware clock */ struct mutex lock; bool extts_enabled;
u64 ptpsyncts;
};
int sja1105_ptp_clock_register(struct dsa_switch *ds);
/* Structures cannot be empty in C. Bah! * Keep the mutex as the only element, which is a bit more difficult to * refactor out of sja1105_main.c anyway.
*/ struct sja1105_ptp_data { struct mutex lock;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.