Deleted Added
full compact
pps.c (184130) pps.c (185003)
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 *
10 * This driver implements a draft-mogul-pps-api-02.txt PPS source.
11 *
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 *
10 * This driver implements a draft-mogul-pps-api-02.txt PPS source.
11 *
12 * The input pin is pin#10
12 * The input pin is pin#10
13 * The echo output pin is pin#14
14 *
15 */
16
17#include <sys/cdefs.h>
13 * The echo output pin is pin#14
14 *
15 */
16
17#include <sys/cdefs.h>
18__FBSDID("$FreeBSD: head/sys/dev/ppbus/pps.c 184130 2008-10-21 18:30:10Z jhb $");
18__FBSDID("$FreeBSD: head/sys/dev/ppbus/pps.c 185003 2008-11-16 17:42:02Z jhb $");
19
20#include <sys/param.h>
21#include <sys/kernel.h>
22#include <sys/systm.h>
23#include <sys/module.h>
24#include <sys/bus.h>
25#include <sys/conf.h>
26#include <sys/timepps.h>

--- 224 unchanged lines hidden (view full) ---

251 struct pps_data *sc = arg;
252 int i, j, k, l;
253
254 if (!(sc->busy & ~1))
255 return;
256 mtx_lock_spin(&sc->mtx);
257 sc->timeout = timeout(ppshcpoll, sc, 1);
258 i = ppb_rdtr(sc->ppbus);
19
20#include <sys/param.h>
21#include <sys/kernel.h>
22#include <sys/systm.h>
23#include <sys/module.h>
24#include <sys/bus.h>
25#include <sys/conf.h>
26#include <sys/timepps.h>

--- 224 unchanged lines hidden (view full) ---

251 struct pps_data *sc = arg;
252 int i, j, k, l;
253
254 if (!(sc->busy & ~1))
255 return;
256 mtx_lock_spin(&sc->mtx);
257 sc->timeout = timeout(ppshcpoll, sc, 1);
258 i = ppb_rdtr(sc->ppbus);
259 if (i == sc->lastdata)
259 if (i == sc->lastdata)
260 return;
261 l = sc->lastdata ^ i;
262 k = 1;
263 for (j = 1; j < 9; j ++) {
264 if (l & k) {
265 pps_capture(&sc->pps[j]);
266 pps_event(&sc->pps[j],
267 i & k ? PPS_CAPTUREASSERT : PPS_CAPTURECLEAR);

--- 7 unchanged lines hidden (view full) ---

275static int
276ppsintr(void *arg)
277{
278 struct pps_data *sc = (struct pps_data *)arg;
279
280 pps_capture(&sc->pps[0]);
281 if (!(ppb_rstr(sc->ppbus) & nACK))
282 return (FILTER_STRAY);
260 return;
261 l = sc->lastdata ^ i;
262 k = 1;
263 for (j = 1; j < 9; j ++) {
264 if (l & k) {
265 pps_capture(&sc->pps[j]);
266 pps_event(&sc->pps[j],
267 i & k ? PPS_CAPTUREASSERT : PPS_CAPTURECLEAR);

--- 7 unchanged lines hidden (view full) ---

275static int
276ppsintr(void *arg)
277{
278 struct pps_data *sc = (struct pps_data *)arg;
279
280 pps_capture(&sc->pps[0]);
281 if (!(ppb_rstr(sc->ppbus) & nACK))
282 return (FILTER_STRAY);
283 if (sc->pps[0].ppsparam.mode & PPS_ECHOASSERT)
283 if (sc->pps[0].ppsparam.mode & PPS_ECHOASSERT)
284 ppb_wctr(sc->ppbus, IRQENABLE | AUTOFEED);
285 mtx_lock_spin(&sc->mtx);
286 pps_event(&sc->pps[0], PPS_CAPTUREASSERT);
287 mtx_unlock_spin(&sc->mtx);
284 ppb_wctr(sc->ppbus, IRQENABLE | AUTOFEED);
285 mtx_lock_spin(&sc->mtx);
286 pps_event(&sc->pps[0], PPS_CAPTUREASSERT);
287 mtx_unlock_spin(&sc->mtx);
288 if (sc->pps[0].ppsparam.mode & PPS_ECHOASSERT)
288 if (sc->pps[0].ppsparam.mode & PPS_ECHOASSERT)
289 ppb_wctr(sc->ppbus, IRQENABLE);
290 return (FILTER_HANDLED);
291}
292
293static int
294ppsioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td)
295{
296 struct pps_data *sc = dev->si_drv1;

--- 25 unchanged lines hidden ---
289 ppb_wctr(sc->ppbus, IRQENABLE);
290 return (FILTER_HANDLED);
291}
292
293static int
294ppsioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td)
295{
296 struct pps_data *sc = dev->si_drv1;

--- 25 unchanged lines hidden ---