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