Lines Matching defs:pps

1506 abi_aware(struct pps_state *pps, int vers)
1509 return ((pps->kcmode & KCMODE_ABIFLAG) && pps->driver_abi >= vers);
1513 pps_fetch(struct pps_fetch_args *fapi, struct pps_state *pps)
1537 aseq = pps->ppsinfo.assert_sequence;
1538 cseq = pps->ppsinfo.clear_sequence;
1539 while (aseq == pps->ppsinfo.assert_sequence &&
1540 cseq == pps->ppsinfo.clear_sequence) {
1541 if (abi_aware(pps, 1) && pps->driver_mtx != NULL) {
1542 if (pps->flags & PPSFLAG_MTX_SPIN) {
1543 err = msleep_spin(pps, pps->driver_mtx,
1546 err = msleep(pps, pps->driver_mtx, PCATCH,
1550 err = tsleep(pps, PCATCH, "ppsfch", timo);
1564 pps->ppsinfo.current_mode = pps->ppsparam.mode;
1565 fapi->pps_info_buf = pps->ppsinfo;
1571 pps_ioctl(u_long cmd, caddr_t data, struct pps_state *pps)
1582 KASSERT(pps != NULL, ("NULL pps pointer in pps_ioctl"));
1590 if (app->mode & ~pps->ppscap)
1597 pps->ppsparam = *app;
1601 *app = pps->ppsparam;
1605 *(int*)data = pps->ppscap;
1609 return (pps_fetch(fapi, pps));
1618 pps->ppsinfo_ffc.current_mode = pps->ppsparam.mode;
1619 fapi_ffc->pps_info_buf_ffc = pps->ppsinfo_ffc;
1621 switch (pps->ppsparam.mode & PPS_TSCLK_MASK) {
1624 pps->ppsinfo.assert_timestamp;
1626 pps->ppsinfo.clear_timestamp;
1643 if (kapi->edge & ~pps->ppscap)
1645 pps->kcmode = (kapi->edge & KCMODE_EDGEMASK) |
1646 (pps->kcmode & KCMODE_ABIFLAG);
1657 pps_init(struct pps_state *pps)
1659 pps->ppscap |= PPS_TSFMT_TSPEC | PPS_CANWAIT;
1660 if (pps->ppscap & PPS_CAPTUREASSERT)
1661 pps->ppscap |= PPS_OFFSETASSERT;
1662 if (pps->ppscap & PPS_CAPTURECLEAR)
1663 pps->ppscap |= PPS_OFFSETCLEAR;
1665 pps->ppscap |= PPS_TSCLK_MASK;
1667 pps->kcmode &= ~KCMODE_ABIFLAG;
1671 pps_init_abi(struct pps_state *pps)
1674 pps_init(pps);
1675 if (pps->driver_abi > 0) {
1676 pps->kcmode |= KCMODE_ABIFLAG;
1677 pps->kernel_abi = PPS_ABI_VERSION;
1682 pps_capture(struct pps_state *pps)
1686 KASSERT(pps != NULL, ("NULL pps pointer in pps_capture"));
1688 pps->capgen = atomic_load_acq_int(&th->th_generation);
1689 pps->capth = th;
1691 pps->capffth = fftimehands;
1693 pps->capcount = th->th_counter->tc_get_timecount(th->th_counter);
1695 if (pps->capgen != th->th_generation)
1696 pps->capgen = 0;
1700 pps_event(struct pps_state *pps, int event)
1716 KASSERT(pps != NULL, ("NULL pps pointer in pps_event"));
1718 if ((event & pps->ppsparam.mode) == 0)
1721 if (pps->capgen == 0 || pps->capgen !=
1722 atomic_load_acq_int(&pps->capth->th_generation))
1727 tsp = &pps->ppsinfo.assert_timestamp;
1728 osp = &pps->ppsparam.assert_offset;
1729 foff = pps->ppsparam.mode & PPS_OFFSETASSERT;
1731 fhard = pps->kcmode & PPS_CAPTUREASSERT;
1733 pcount = &pps->ppscount[0];
1734 pseq = &pps->ppsinfo.assert_sequence;
1736 ffcount = &pps->ppsinfo_ffc.assert_ffcount;
1737 tsp_ffc = &pps->ppsinfo_ffc.assert_timestamp;
1738 pseq_ffc = &pps->ppsinfo_ffc.assert_sequence;
1741 tsp = &pps->ppsinfo.clear_timestamp;
1742 osp = &pps->ppsparam.clear_offset;
1743 foff = pps->ppsparam.mode & PPS_OFFSETCLEAR;
1745 fhard = pps->kcmode & PPS_CAPTURECLEAR;
1747 pcount = &pps->ppscount[1];
1748 pseq = &pps->ppsinfo.clear_sequence;
1750 ffcount = &pps->ppsinfo_ffc.clear_ffcount;
1751 tsp_ffc = &pps->ppsinfo_ffc.clear_timestamp;
1752 pseq_ffc = &pps->ppsinfo_ffc.clear_sequence;
1760 if (pps->ppstc != pps->capth->th_counter) {
1761 pps->ppstc = pps->capth->th_counter;
1762 *pcount = pps->capcount;
1763 pps->ppscount[2] = pps->capcount;
1768 tcount = pps->capcount - pps->capth->th_offset_count;
1769 tcount &= pps->capth->th_counter->tc_counter_mask;
1770 bt = pps->capth->th_offset;
1771 bintime_addx(&bt, pps->capth->th_scale * tcount);
1777 if (pps->capgen != pps->capth->th_generation)
1780 *pcount = pps->capcount;
1793 *ffcount = pps->capffth->tick_ffcount + tcount;
1794 bt = pps->capffth->tick_time;
1795 ffclock_convert_delta(tcount, pps->capffth->cest.period, &bt);
1796 bintime_add(&bt, &pps->capffth->tick_time);
1811 tcount = pps->capcount - pps->ppscount[2];
1812 pps->ppscount[2] = pps->capcount;
1813 tcount &= pps->capth->th_counter->tc_counter_mask;
1815 scale /= pps->capth->th_counter->tc_frequency;
1826 wakeup(pps);