close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_fs.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.
- Timestamp:
-
May 8, 2009, 1:59:21 AM (15 years ago)
- Author:
-
jazz
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v4
|
v5
|
|
8 | 8 | static int outportb(unsigned int port, unsigned int val, int size) |
9 | 9 | { |
10 | | static int iopldone = 0; |
| 10 | static int iopldone = 0; |
11 | 11 | |
12 | 12 | #ifdef DEBUG |
13 | | printf("outportb(0x%04x)<=0x%02x\n", port, val); |
| 13 | printf("outportb(0x%04x)<=0x%02x\n", port, val); |
14 | 14 | #endif |
15 | 15 | |
16 | | if (port > 1024) { |
17 | | if (!iopldone && iopl(3)) { |
18 | | fprintf(stderr, "iopl(): %s\n", strerror(errno)); |
19 | | return 1; |
20 | | } |
21 | | iopldone++; |
22 | | } else if (ioperm(port,size,1)) { |
23 | | fprintf(stderr, "ioperm(%x): %s\n", port, strerror(errno)); |
24 | | return 1; |
| 16 | if (port > 1024) { |
| 17 | if (!iopldone && iopl(3)) { |
| 18 | fprintf(stderr, "iopl(): %s\n", strerror(errno)); |
| 19 | return 1; |
25 | 20 | } |
| 21 | iopldone++; |
| 22 | } else if (ioperm(port,size,1)) { |
| 23 | fprintf(stderr, "ioperm(%x): %s\n", port, strerror(errno)); |
| 24 | return 1; |
| 25 | } |
26 | 26 | |
27 | | if (size == 4) |
28 | | outl(val, port); |
29 | | else if (size == 2) |
30 | | outw(val&0xffff, port); |
31 | | else |
32 | | outb(val&0xff, port); |
33 | | return 0; |
| 27 | if (size == 4) |
| 28 | outl(val, port); |
| 29 | else if (size == 2) |
| 30 | outw(val&0xffff, port); |
| 31 | else |
| 32 | outb(val&0xff, port); |
| 33 | return 0; |
34 | 34 | } |
35 | 35 | |
36 | 36 | static int inportb(unsigned int port, int size) |
37 | 37 | { |
38 | | static int iopldone = 0; |
| 38 | static int iopldone = 0; |
39 | 39 | |
40 | 40 | #ifdef DEBUG |
41 | | printf("inportb(0x%04x)\n", port); |
| 41 | printf("inportb(0x%04x)\n", port); |
42 | 42 | #endif |
43 | 43 | |
44 | | if (port > 1024) { |
45 | | if (!iopldone && iopl(3)) { |
46 | | fprintf(stderr, "iopl(): %s\n", strerror(errno)); |
47 | | return 1; |
48 | | } |
49 | | iopldone++; |
50 | | } else if (ioperm(port,size,1)) { |
51 | | fprintf(stderr, "ioperm(%x): %s\n", port, strerror(errno)); |
52 | | return 1; |
| 44 | if (port > 1024) { |
| 45 | if (!iopldone && iopl(3)) { |
| 46 | fprintf(stderr, "iopl(): %s\n", strerror(errno)); |
| 47 | return 1; |
53 | 48 | } |
| 49 | iopldone++; |
| 50 | } else if (ioperm(port,size,1)) { |
| 51 | fprintf(stderr, "ioperm(%x): %s\n", port, strerror(errno)); |
| 52 | return 1; |
| 53 | } |
54 | 54 | |
55 | | if (size == 4) |
56 | | return inl(port); |
57 | | else if (size == 2) |
58 | | return inw(port) & 0xffff; |
59 | | else |
60 | | return inb(port) & 0xff; |
| 55 | if (size == 4) |
| 56 | return inl(port); |
| 57 | else if (size == 2) |
| 58 | return inw(port) & 0xffff; |
| 59 | else |
| 60 | return inb(port) & 0xff; |
61 | 61 | } |
62 | 62 | }}} |