MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pps_event

Function pps_event

freebsd/kern/kern_tc.c:1726–1853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1724}
1725
1726void
1727pps_event(struct pps_state *pps, int event)
1728{
1729 struct bintime bt;
1730 struct timespec ts, *tsp, *osp;
1731 u_int tcount, *pcount;
1732 int foff;
1733 pps_seq_t *pseq;
1734#ifdef FFCLOCK
1735 struct timespec *tsp_ffc;
1736 pps_seq_t *pseq_ffc;
1737 ffcounter *ffcount;
1738#endif
1739#ifdef PPS_SYNC
1740 int fhard;
1741#endif
1742
1743 KASSERT(pps != NULL, ("NULL pps pointer in pps_event"));
1744 /* Nothing to do if not currently set to capture this event type. */
1745 if ((event & pps->ppsparam.mode) == 0)
1746 return;
1747 /* If the timecounter was wound up underneath us, bail out. */
1748 if (pps->capgen == 0 || pps->capgen !=
1749 atomic_load_acq_int(&pps->capth->th_generation))
1750 return;
1751
1752 /* Things would be easier with arrays. */
1753 if (event == PPS_CAPTUREASSERT) {
1754 tsp = &pps->ppsinfo.assert_timestamp;
1755 osp = &pps->ppsparam.assert_offset;
1756 foff = pps->ppsparam.mode & PPS_OFFSETASSERT;
1757#ifdef PPS_SYNC
1758 fhard = pps->kcmode & PPS_CAPTUREASSERT;
1759#endif
1760 pcount = &pps->ppscount[0];
1761 pseq = &pps->ppsinfo.assert_sequence;
1762#ifdef FFCLOCK
1763 ffcount = &pps->ppsinfo_ffc.assert_ffcount;
1764 tsp_ffc = &pps->ppsinfo_ffc.assert_timestamp;
1765 pseq_ffc = &pps->ppsinfo_ffc.assert_sequence;
1766#endif
1767 } else {
1768 tsp = &pps->ppsinfo.clear_timestamp;
1769 osp = &pps->ppsparam.clear_offset;
1770 foff = pps->ppsparam.mode & PPS_OFFSETCLEAR;
1771#ifdef PPS_SYNC
1772 fhard = pps->kcmode & PPS_CAPTURECLEAR;
1773#endif
1774 pcount = &pps->ppscount[1];
1775 pseq = &pps->ppsinfo.clear_sequence;
1776#ifdef FFCLOCK
1777 ffcount = &pps->ppsinfo_ffc.clear_ffcount;
1778 tsp_ffc = &pps->ppsinfo_ffc.clear_timestamp;
1779 pseq_ffc = &pps->ppsinfo_ffc.clear_sequence;
1780#endif
1781 }
1782
1783 /*

Callers 2

elan_poll_ppsFunction · 0.85
dmtpps_pollFunction · 0.85

Calls 7

bintime_addxFunction · 0.85
bintime2timespecFunction · 0.85
ffclock_convert_deltaFunction · 0.85
bintime_addFunction · 0.85
hardppsFunction · 0.85
wakeupFunction · 0.70
atomic_thread_fence_acqFunction · 0.50

Tested by

no test coverage detected