]>
Commit | Line | Data |
---|---|---|
7af9c849 | 1 | #include <stdio.h> |
2 | #include <sys/io.h> | |
3 | #include <errno.h> | |
4 | #include <stdlib.h> | |
5 | #include <unistd.h> | |
6 | ||
7 | #define BASE 0xe800 | |
8 | ||
9 | #define die(x) \ | |
10 | { \ | |
11 | char buf[BUFSIZ]; \ | |
12 | snprintf(buf, sizeof(buf), \ | |
13 | "%s: %d: %s: %s", \ | |
14 | __FILE__, (int) __LINE__, __FUNCTION__, x); \ | |
15 | perror(buf); \ | |
16 | exit(EXIT_FAILURE); \ | |
17 | } | |
18 | ||
19 | int | |
20 | main(void) | |
21 | { | |
22 | int ret; | |
23 | unsigned int word; | |
24 | ||
25 | ret = ioperm(BASE,8,1); | |
26 | if (ret < 0) { | |
27 | die("ioperm"); | |
28 | } | |
29 | word = inl(BASE); | |
30 | printf("0x%08x\n", 0x0 | word); | |
31 | ||
32 | #if 0 | |
33 | outl(0x00, BASE); | |
34 | outl(0xFFFFFFFF, BASE); | |
35 | ||
36 | word = inl(BASE); | |
37 | printf("0x%08x\n", 0x0 | word); | |
38 | #endif | |
39 | ||
40 | ret = ioperm(BASE,8,0); | |
41 | if (ret < 0) { | |
42 | die("ioperm"); | |
43 | } | |
44 | ||
45 | return(EXIT_SUCCESS); | |
46 | } |