Last change
on this file since 23 was 22, checked in by ogrimm, 16 years ago |
First commit of drsdaq program
|
File size:
1.1 KB
|
Line | |
---|
1 | #define _GNU_SOURCE
|
---|
2 | #include <stdio.h>
|
---|
3 | #include <errno.h>
|
---|
4 | #include <string.h>
|
---|
5 | #include <sys/types.h>
|
---|
6 | #include <unistd.h>
|
---|
7 | #include <fcntl.h>
|
---|
8 | #include <sys/mman.h>
|
---|
9 | #include <sys/ioctl.h>
|
---|
10 |
|
---|
11 | #include "dev/pci/sis1100_var.h"
|
---|
12 |
|
---|
13 | int mod_base=0xe00000;
|
---|
14 | int p;
|
---|
15 |
|
---|
16 | /****************************************************************************/
|
---|
17 | static void printerror(struct sis1100_vme_req* req, int _errno, int write)
|
---|
18 | {
|
---|
19 | if (write)
|
---|
20 | printf("vme write 0x%08x to 0x%08x", req->data, req->addr);
|
---|
21 | else
|
---|
22 | printf("vme read 0x%08x", req->addr);
|
---|
23 |
|
---|
24 | printf(": %s", strerror(_errno));
|
---|
25 | if (_errno==EIO) printf("; protocoll error 0x%x", req->error);
|
---|
26 | printf("\n");
|
---|
27 | }
|
---|
28 | /****************************************************************************/
|
---|
29 | int main(int argc, char* argv[])
|
---|
30 | {
|
---|
31 | struct sis1100_vme_req req;
|
---|
32 |
|
---|
33 | if (argc<2)
|
---|
34 | {
|
---|
35 | fprintf(stderr, "usage: %s path\n", argv[0]);
|
---|
36 | return 1;
|
---|
37 | }
|
---|
38 | if ((p=open(argv[1], O_RDWR, 0))<0) return 1;
|
---|
39 |
|
---|
40 | req.size=4;
|
---|
41 | req.am=0x39;
|
---|
42 | req.addr=mod_base+0x2020;
|
---|
43 | if (ioctl(p, SIS3100_VME_READ, &req)<0) {
|
---|
44 | printf("SIS3100_VME_READ(2020): %s\n", strerror(errno));
|
---|
45 | return 1;
|
---|
46 | }
|
---|
47 | printf("*0x2020=0x%08x; error=0x%x\n", req.data, req.error);
|
---|
48 |
|
---|
49 | close(p);
|
---|
50 | return 0;
|
---|
51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.