| 1724 | } |
| 1725 | |
| 1726 | void |
| 1727 | pps_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 | /* |
no test coverage detected