source: drsdaq/VME/struck/sis1100/V2.02/dev/pci/sis1100_poll.c@ 23

Last change on this file since 23 was 22, checked in by ogrimm, 16 years ago
First commit of drsdaq program
File size: 2.5 KB
Line 
1/* $ZEL: sis1100_poll.c,v 1.3 2004/05/27 23:10:29 wuestner Exp $ */
2
3/*
4 * Copyright (c) 2004
5 * Peter Wuestner. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include "sis1100_sc.h"
30
31#ifdef __NetBSD__
32
33int
34sis1100_poll(dev_t dev, int events, struct proc *p)
35{
36 struct sis1100_softc* sc=SIS1100SC(dev);
37 struct sis1100_fdata* fd=SIS1100FD(dev);
38 int s;
39/*
40 pINFO(sc, "poll: events=0x%x pending=0x%x owned=0x%x", events,
41 sc->pending_irqs, fd->owned_irqs);
42*/
43 s = splbio();
44
45 if (events & (POLLIN | POLLRDNORM)) {
46 if (irq_pending(sc, fd, fd->owned_irqs)) {
47 /*pINFO(sc, "poll: successfull");*/
48 splx(s);
49 return (events & (POLLIN | POLLRDNORM));
50 }
51 selrecord(p, &sc->sel);
52 }
53 splx(s);
54 return 0;
55}
56
57#elif __linux__
58
59unsigned int
60sis1100_poll(struct file* file, struct poll_table_struct* poll_table)
61{
62 struct sis1100_softc* sc=SIS1100SC(file);
63 struct sis1100_fdata* fd=SIS1100FD(file);
64
65/*
66 * pINFO(sc, "poll: pending=0x%x poll_table=%p", sc->pending_irqs, poll_table);
67 */
68
69 poll_wait(file, &sc->remoteirq_wait, poll_table);
70
71 if (irq_pending(sc, fd, fd->owned_irqs))
72 return POLLIN|POLLRDNORM;
73 else
74 return 0;
75}
76
77#endif
Note: See TracBrowser for help on using the repository browser.