source: drsdaq/VME/struck/sis1100/V2.02/test/frontin_1100.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: 1.3 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/****************************************************************************/
16int main(int argc, char* argv[])
17{
18 int p;
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) {
25 fprintf(stderr, "open \"%s\"\n", argv[1]);
26 return 1;
27 }
28
29 while (1) {
30 struct sis1100_ctrl_reg reg;
31 int optreg;
32
33 reg.offset=0xF0;
34 if (ioctl(p, SIS1100_CONTROL_READ, &reg)<0) {
35 perror("SIS1100_CONTROL_READ");
36 return -1;
37 }
38 optreg=reg.val;
39 if (reg.error) printf("optreg.error=%x\n", reg.error);
40 printf("optreg=0x%08x\n", optreg);
41
42 sleep(1);
43 }
44
45 close(p);
46 return 0;
47}
48/****************************************************************************/
49/****************************************************************************/
Note: See TracBrowser for help on using the repository browser.