pps.c (399144d94309ba43c0fc7e2d9d42aec895c4726e) | pps.c (f1d19042b082d95f07a0027e596ba2405aa8a9a5) |
---|---|
1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * | 1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * |
9 * $Id: pps.c,v 1.10 1998/08/03 19:14:31 msmith Exp $ | 9 * $Id: pps.c,v 1.11 1998/08/24 16:31:27 phk Exp $ |
10 * 11 * This driver implements a draft-mogul-pps-api-02.txt PPS source. 12 * 13 * The input pin is pin#10 14 * The echo output pin is pin#14 15 * 16 */ 17 --- 130 unchanged lines hidden (view full) --- 148 return(0); 149} 150 151static void 152ppsintr(int unit) 153{ 154 struct pps_data *sc = softc[unit]; 155 struct timespec tc; | 10 * 11 * This driver implements a draft-mogul-pps-api-02.txt PPS source. 12 * 13 * The input pin is pin#10 14 * The echo output pin is pin#14 15 * 16 */ 17 --- 130 unchanged lines hidden (view full) --- 148 return(0); 149} 150 151static void 152ppsintr(int unit) 153{ 154 struct pps_data *sc = softc[unit]; 155 struct timespec tc; |
156 struct timeval tv; | |
157 158 nanotime(&tc); 159 if (!(ppb_rstr(&sc->pps_dev) & nACK)) 160 return; 161 if (sc->ppsparam.mode & PPS_ECHOASSERT) 162 ppb_wctr(&sc->pps_dev, IRQENABLE | AUTOFEED); 163 if (sc->ppsparam.mode & PPS_OFFSETASSERT) { 164 timespecadd(&tc, &sc->ppsparam.assert_offset); 165 if (tc.tv_nsec < 0) { 166 tc.tv_sec--; 167 tc.tv_nsec += 1000000000; 168 } 169 } 170 sc->ppsinfo.assert_timestamp = tc; 171 sc->ppsinfo.assert_sequence++; 172#ifdef PPS_SYNC 173 if (sc->ppsparam.mode & PPS_HARDPPSONASSERT) { | 156 157 nanotime(&tc); 158 if (!(ppb_rstr(&sc->pps_dev) & nACK)) 159 return; 160 if (sc->ppsparam.mode & PPS_ECHOASSERT) 161 ppb_wctr(&sc->pps_dev, IRQENABLE | AUTOFEED); 162 if (sc->ppsparam.mode & PPS_OFFSETASSERT) { 163 timespecadd(&tc, &sc->ppsparam.assert_offset); 164 if (tc.tv_nsec < 0) { 165 tc.tv_sec--; 166 tc.tv_nsec += 1000000000; 167 } 168 } 169 sc->ppsinfo.assert_timestamp = tc; 170 sc->ppsinfo.assert_sequence++; 171#ifdef PPS_SYNC 172 if (sc->ppsparam.mode & PPS_HARDPPSONASSERT) { |
173 struct timeval tv; 174 |
|
174 tv.tv_sec = tc.tv_sec; 175 tv.tv_usec = tc.tv_nsec / 1000; 176 hardpps(&tv, tv.tv_usec); 177 } 178#endif /* PPS_SYNC */ 179 if (sc->ppsparam.mode & PPS_ECHOASSERT) 180 ppb_wctr(&sc->pps_dev, IRQENABLE); 181} --- 24 unchanged lines hidden --- | 175 tv.tv_sec = tc.tv_sec; 176 tv.tv_usec = tc.tv_nsec / 1000; 177 hardpps(&tv, tv.tv_usec); 178 } 179#endif /* PPS_SYNC */ 180 if (sc->ppsparam.mode & PPS_ECHOASSERT) 181 ppb_wctr(&sc->pps_dev, IRQENABLE); 182} --- 24 unchanged lines hidden --- |