source: drsdaq/VME/struck/sis1100/V2.02/test/reset3100.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.4 KB
Line 
1#include <stdio.h>
2#include <errno.h>
3#include <string.h>
4#include <sys/types.h>
5#include <fcntl.h>
6#include <sys/ioctl.h>
7
8#include <dev/pci/sis1100_var.h>
9
10int main(int argc, char* argv[])
11{
12 int p;
13 struct sis1100_ident ident;
14
15 if (argc<2)
16 {
17 fprintf(stderr, "usage: %s path\n", argv[0]);
18 return 1;
19 }
20
21 if ((p=open(argv[1], O_RDWR, 0))<0)
22 {
23 fprintf(stderr, "open(\"%s\"): %s\n", argv[1], strerror(errno));
24 return 1;
25 }
26
27 if (ioctl(p, SIS3100_RESET)<0) {
28 fprintf(stderr, "ioctl(SIS3100_RESET): %s\n", strerror(errno));
29 return 1;
30 }
31
32 if (ioctl(p, SIS1100_IDENT, &ident)<0) {
33 fprintf(stderr, "ioctl(SIS1100_IDENT): %s\n",strerror(errno));
34 return 1;
35 }
36
37
38 printf("local hw_type : %d\n", ident.local.hw_type);
39 printf("local hw_version: %d\n", ident.local.hw_version);
40 printf("local fw_type : %d\n", ident.local.fw_type);
41 printf("local fw_version: %d\n\n", ident.local.fw_version);
42 if (ident.remote_ok<0) {
43 printf("remote id not available\n");
44 } else {
45 printf("remote hw_type : %d\n", ident.remote.hw_type);
46 printf("remote hw_version: %d\n", ident.remote.hw_version);
47 printf("remote fw_type : %d\n", ident.remote.fw_type);
48 printf("remote fw_version: %d\n\n", ident.remote.fw_version);
49 printf("remote side is %sonline\n", ident.remote_online?"":"not ");
50 }
51
52 close(p);
53 return 0;
54}
Note: See TracBrowser for help on using the repository browser.