Last change
on this file since 23 was 22, checked in by ogrimm, 16 years ago |
First commit of drsdaq program
|
File size:
1.6 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 | if (argc!=2) {
|
---|
20 | fprintf(stderr, "usage: %s path\n", argv[0]);
|
---|
21 | return 1;
|
---|
22 | }
|
---|
23 |
|
---|
24 | if ((p=open(argv[1], O_RDWR, 0))<0) return 1;
|
---|
25 |
|
---|
26 | while (1) {
|
---|
27 | struct sis1100_ctrl_reg reg;
|
---|
28 | int ioreg;
|
---|
29 |
|
---|
30 | ioreg=(count&0x7f) | ((~count&0x7f)<<16);
|
---|
31 |
|
---|
32 | reg.offset=0x80;
|
---|
33 | reg.val=ioreg;
|
---|
34 | if (ioctl(p, SIS3100_CONTROL_WRITE, ®)<0) {
|
---|
35 | perror("SIS3100_CONTROL_WRITE");
|
---|
36 | return -1;
|
---|
37 | }
|
---|
38 | if (reg.error) printf("write ioreg error=%x\n", reg.error);
|
---|
39 |
|
---|
40 | if (ioctl(p, SIS3100_CONTROL_READ, ®)<0) {
|
---|
41 | perror("SIS3100_CONTROL_READ");
|
---|
42 | return -1;
|
---|
43 | }
|
---|
44 | if (reg.error) printf("read ioreg error=%x\n", reg.error);
|
---|
45 |
|
---|
46 | ioreg=reg.val;
|
---|
47 | printf("count=%x ioreg=0x%08x\n", count, ioreg);
|
---|
48 |
|
---|
49 | sleep(1);
|
---|
50 | count++;
|
---|
51 | }
|
---|
52 |
|
---|
53 | close(p);
|
---|
54 | return 0;
|
---|
55 | }
|
---|
56 | /****************************************************************************/
|
---|
57 | /****************************************************************************/
|
---|
Note:
See
TracBrowser
for help on using the repository browser.