Last change
on this file since 22 was 22, checked in by ogrimm, 16 years ago |
First commit of drsdaq program
|
File size:
1.4 KB
|
Line | |
---|
1 | #define _GNU_SOURCE
|
---|
2 | #include <stdio.h>
|
---|
3 | #include <stdlib.h>
|
---|
4 | #include <errno.h>
|
---|
5 | #include <string.h>
|
---|
6 | #include <sys/types.h>
|
---|
7 | #include <unistd.h>
|
---|
8 | #include <fcntl.h>
|
---|
9 | #include <sys/mman.h>
|
---|
10 | #include <sys/ioctl.h>
|
---|
11 | #include <signal.h>
|
---|
12 |
|
---|
13 | #include "dev/pci/sis1100_var.h"
|
---|
14 |
|
---|
15 | /****************************************************************************/
|
---|
16 | int main(int argc, char* argv[])
|
---|
17 | {
|
---|
18 | int p, count=0;
|
---|
19 | struct sis1100_irq_ctl irqctl;
|
---|
20 | struct sis1100_irq_get irqget;
|
---|
21 |
|
---|
22 | if (argc!=2)
|
---|
23 | {
|
---|
24 | fprintf(stderr, "usage: %s path\n", argv[0]);
|
---|
25 | return 1;
|
---|
26 | }
|
---|
27 |
|
---|
28 | if ((p=open(argv[1], O_RDWR, 0))<0) return 1;
|
---|
29 |
|
---|
30 | irqctl.irq_mask=0;
|
---|
31 | irqctl.signal=-1;
|
---|
32 | if (ioctl(p, SIS1100_IRQ_CTL, &irqctl)<0) {
|
---|
33 | fprintf(stderr, "ioctl(SIS1100_IRQ_CTL): %s\n", strerror(errno));
|
---|
34 | return 1;
|
---|
35 | }
|
---|
36 |
|
---|
37 | while (count++<10) {
|
---|
38 | irqget.irq_mask=0;
|
---|
39 | irqget.immediate_ack=0;
|
---|
40 | if (ioctl(p, SIS1100_IRQ_WAIT, &irqget)<0) {
|
---|
41 | fprintf(stderr, "ioctl(SIS1100_IRQ_WAIT): %s\n", strerror(errno));
|
---|
42 | return 1;
|
---|
43 | }
|
---|
44 | printf(" SIS1100_IRQ_WAIT returned; irqs=%08x, remote_status=%d\n",
|
---|
45 | irqget.irqs, irqget.remote_status);
|
---|
46 | }
|
---|
47 |
|
---|
48 | close(p);
|
---|
49 | return 0;
|
---|
50 | }
|
---|
51 | /****************************************************************************/
|
---|
52 | /****************************************************************************/
|
---|
Note:
See
TracBrowser
for help on using the repository browser.