pps.c (47625) | pps.c (47640) |
---|---|
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.17 1999/05/06 22:03:14 peter Exp $ | 9 * $Id: pps.c,v 1.18 1999/05/30 16:51:36 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 --- 64 unchanged lines hidden (view full) --- 82 /* bmaj */ -1 83}; 84 85 86static struct ppb_device * 87ppsprobe(struct ppb_data *ppb) 88{ 89 struct pps_data *sc; | 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 --- 64 unchanged lines hidden (view full) --- 82 /* bmaj */ -1 83}; 84 85 86static struct ppb_device * 87ppsprobe(struct ppb_data *ppb) 88{ 89 struct pps_data *sc; |
90 static int once; |
|
90 | 91 |
92 if (!once++) 93 cdevsw_add(&pps_cdevsw); 94 |
|
91 sc = (struct pps_data *) malloc(sizeof(struct pps_data), 92 M_TEMP, M_NOWAIT); 93 if (!sc) { 94 printf(PPS_NAME ": cannot malloc!\n"); 95 return (0); 96 } 97 bzero(sc, sizeof(struct pps_data)); 98 --- 9 unchanged lines hidden (view full) --- 108 sc->pps.ppscap = PPS_CAPTUREASSERT | PPS_ECHOASSERT; 109 pps_init(&sc->pps); 110 return (&sc->pps_dev); 111} 112 113static int 114ppsattach(struct ppb_device *dev) 115{ | 95 sc = (struct pps_data *) malloc(sizeof(struct pps_data), 96 M_TEMP, M_NOWAIT); 97 if (!sc) { 98 printf(PPS_NAME ": cannot malloc!\n"); 99 return (0); 100 } 101 bzero(sc, sizeof(struct pps_data)); 102 --- 9 unchanged lines hidden (view full) --- 112 sc->pps.ppscap = PPS_CAPTUREASSERT | PPS_ECHOASSERT; 113 pps_init(&sc->pps); 114 return (&sc->pps_dev); 115} 116 117static int 118ppsattach(struct ppb_device *dev) 119{ |
116 dev_t devt; | |
117 118 /* 119 * Report ourselves 120 */ 121 printf(PPS_NAME "%d: <Pulse per second Timing Interface> on ppbus %d\n", 122 dev->id_unit, dev->ppb->ppb_link->adapter_unit); 123 124#ifdef DEVFS 125 devfs_add_devswf(&pps_cdevsw, 126 dev->id_unit, DV_CHR, 127 UID_ROOT, GID_WHEEL, 0600, PPS_NAME "%d", dev->id_unit); 128#endif | 120 121 /* 122 * Report ourselves 123 */ 124 printf(PPS_NAME "%d: <Pulse per second Timing Interface> on ppbus %d\n", 125 dev->id_unit, dev->ppb->ppb_link->adapter_unit); 126 127#ifdef DEVFS 128 devfs_add_devswf(&pps_cdevsw, 129 dev->id_unit, DV_CHR, 130 UID_ROOT, GID_WHEEL, 0600, PPS_NAME "%d", dev->id_unit); 131#endif |
129 devt = makedev(CDEV_MAJOR, 0); 130 cdevsw_add(&devt, &pps_cdevsw, NULL); | |
131 return (1); 132} 133 134static int 135ppsopen(dev_t dev, int flags, int fmt, struct proc *p) 136{ 137 struct pps_data *sc; 138 u_int unit = minor(dev); --- 59 unchanged lines hidden --- | 132 return (1); 133} 134 135static int 136ppsopen(dev_t dev, int flags, int fmt, struct proc *p) 137{ 138 struct pps_data *sc; 139 u_int unit = minor(dev); --- 59 unchanged lines hidden --- |