source: drsdaq/VME/struck/sis1100/V2.02/test/frontin_3100.c@ 22

Last change on this file since 22 was 22, checked in by ogrimm, 16 years ago
First commit of drsdaq program
File size: 1.2 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) return 1;
25
26 while (1) {
27 struct sis1100_ctrl_reg reg;
28
29 int ioreg;
30 reg.offset=0x80;
31 if (ioctl(p, SIS3100_CONTROL_READ, &reg)<0) {
32 perror("SIS3100_CONTROL_READ");
33 return -1;
34 }
35 ioreg=reg.val;
36 if (reg.error) printf("ioreg.error=%x\n", reg.error);
37
38 printf("ioreg=0x%08x\n", ioreg);
39
40 sleep(1);
41 }
42
43 close(p);
44 return 0;
45}
46/****************************************************************************/
47/****************************************************************************/
Note: See TracBrowser for help on using the repository browser.