source: drsdaq/VME/struck/sis1100/V2.02/test.orig/check_3100_mmap.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.5 KB
Line 
1/*
2 * $ZEL$
3 */
4
5#include "test_3100.h"
6
7int
8check_mmap(struct path* path)
9{
10#if SIS1100_Version < 0x20000
11 if (path->type!=sis1100_subdev_remote) return 0;
12#endif
13
14 if (!path->mapsize) return 0;
15 path->map=mmap(0, path->mapsize, PROT_READ|PROT_WRITE,
16 MAP_FILE|MAP_SHARED/*|MAP_VARIABLE*/, path->p, 0);
17
18 if (path->map==MAP_FAILED) {
19 printf("mmap(%s, 0x%x): %s\n", path->name, path->mapsize,
20 strerror(errno));
21 path->map=0;
22 } else
23 printf("%s: 0x%x Bytes mapped at %p\n", path->name, path->mapsize,
24 path->map);
25
26 switch (path->type) {
27 case sis1100_subdev_remote:
28 if (!path->map)
29 printf(" Not a real error.\n");
30 else
31 printf(" OK.\n");
32 break;
33 case sis1100_subdev_ram:
34 if (!path->map)
35 printf(" As expected.\n");
36 else {
37 printf(" But that is not possible (yet).\n");
38 return -1;
39 }
40 break;
41#if SIS1100_Version >= 0x20000
42 case sis1100_subdev_ctrl:
43 if (!path->map) {
44 printf(" But it should work.\n");
45 return -1;
46 } else
47 printf(" OK.\n");
48 break;
49#endif
50 case sis1100_subdev_dsp:
51 if (!path->map)
52 printf(" OK.\n");
53 else {
54 printf(" But that is not possible (yet).\n");
55 return -1;
56 }
57 break;
58 default:
59 printf("check_mmap: %s has unknown type %d\n",
60 path->name, path->type);
61 return -1;
62 }
63 return 0;
64}
Note: See TracBrowser for help on using the repository browser.