Changes between Version 4 and Version 5 of jazz/09-05-08
- Timestamp:
- May 8, 2009, 1:59:21 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
jazz/09-05-08
v4 v5 8 8 static int outportb(unsigned int port, unsigned int val, int size) 9 9 { 10 10 static int iopldone = 0; 11 11 12 12 #ifdef DEBUG 13 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 28 29 30 31 32 33 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 38 static int iopldone = 0; 39 39 40 40 #ifdef DEBUG 41 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 56 57 58 59 60 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 }}}