Deleted Added
full compact
adlink.c (130026) adlink.c (130585)
1/*-
2 * Copyright (c) 2003 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/adlink/adlink.c 130026 2004-06-03 06:10:02Z phk $");
31__FBSDID("$FreeBSD: head/sys/dev/adlink/adlink.c 130585 2004-06-16 09:47:26Z phk $");
32
33#ifdef _KERNEL
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/malloc.h>
37#include <sys/kernel.h>
38#include <sys/module.h>
39#include <sys/kthread.h>

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

99};
100
101struct softc {
102 device_t device;
103 void *intrhand;
104 struct resource *r0, *r1, *ri;
105 bus_space_tag_t t0, t1;
106 bus_space_handle_t h0, h1;
32
33#ifdef _KERNEL
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/malloc.h>
37#include <sys/kernel.h>
38#include <sys/module.h>
39#include <sys/kthread.h>

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

99};
100
101struct softc {
102 device_t device;
103 void *intrhand;
104 struct resource *r0, *r1, *ri;
105 bus_space_tag_t t0, t1;
106 bus_space_handle_t h0, h1;
107 dev_t dev;
107 struct cdev *dev;
108 off_t mapvir;
109
110 struct proc *procp;
111
112 struct info *info;
113
114 struct wave *wave[NWAVE];
115

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

236 idx++;
237 idx %= NRING;
238 }
239 mtx_unlock(&Giant);
240 kthread_exit(0);
241}
242
243static int
108 off_t mapvir;
109
110 struct proc *procp;
111
112 struct info *info;
113
114 struct wave *wave[NWAVE];
115

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

236 idx++;
237 idx %= NRING;
238 }
239 mtx_unlock(&Giant);
240 kthread_exit(0);
241}
242
243static int
244adlink_open(dev_t dev, int oflags, int devtype, struct thread *td)
244adlink_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
245{
246 static int once;
247 struct softc *sc;
248 int i, error;
249 uint32_t u;
250
251 if (once)
252 return (0);

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

302 bus_space_write_4(sc->t0, sc->h0, 0x3c, u | 0x00000600);
303
304 /* Acquisition Enable Register: go! */
305 bus_space_write_4(sc->t1, sc->h1, 0x1c, 1);
306 return (0);
307}
308
309static int
245{
246 static int once;
247 struct softc *sc;
248 int i, error;
249 uint32_t u;
250
251 if (once)
252 return (0);

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

302 bus_space_write_4(sc->t0, sc->h0, 0x3c, u | 0x00000600);
303
304 /* Acquisition Enable Register: go! */
305 bus_space_write_4(sc->t1, sc->h1, 0x1c, 1);
306 return (0);
307}
308
309static int
310adlink_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
310adlink_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
311{
312 struct softc *sc;
313 struct wave *wp;
314 int i, error;
315
316 sc = dev->si_drv1;
317 wp = (struct wave *)data;
318 i = wp->index;

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

336 return (error);
337 bcopy(sc->wave[i], wp, sizeof(*wp));
338 return (0);
339 }
340 return (ENOIOCTL);
341}
342
343static int
311{
312 struct softc *sc;
313 struct wave *wp;
314 int i, error;
315
316 sc = dev->si_drv1;
317 wp = (struct wave *)data;
318 i = wp->index;

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

336 return (error);
337 bcopy(sc->wave[i], wp, sizeof(*wp));
338 return (0);
339 }
340 return (ENOIOCTL);
341}
342
343static int
344adlink_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot)
344adlink_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot)
345{
346 struct softc *sc;
347 struct wave *wp;
348 int i, j;
349
350 sc = dev->si_drv1;
351 if (nprot != VM_PROT_READ)
352 return (-1);

--- 142 unchanged lines hidden ---
345{
346 struct softc *sc;
347 struct wave *wp;
348 int i, j;
349
350 sc = dev->si_drv1;
351 if (nprot != VM_PROT_READ)
352 return (-1);

--- 142 unchanged lines hidden ---