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.

Changes between Version 4 and Version 5 of jazz/09-05-08


Ignore:
Timestamp:
May 8, 2009, 1:59:21 AM (15 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • jazz/09-05-08

    v4 v5  
    88static int outportb(unsigned int port, unsigned int val, int size)
    99{
    10     static int iopldone = 0;
     10  static int iopldone = 0;
    1111
    1212#ifdef DEBUG
    13     printf("outportb(0x%04x)<=0x%02x\n", port, val);
     13  printf("outportb(0x%04x)<=0x%02x\n", port, val);
    1414#endif
    1515
    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;
    2520    }
     21    iopldone++;
     22  } else if (ioperm(port,size,1)) {
     23    fprintf(stderr, "ioperm(%x): %s\n", port, strerror(errno));
     24    return 1;
     25  }
    2626
    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;
    3434}
    3535
    3636static int inportb(unsigned int port, int size)
    3737{
    38     static int iopldone = 0;
     38  static int iopldone = 0;
    3939
    4040#ifdef DEBUG
    41     printf("inportb(0x%04x)\n", port);
     41  printf("inportb(0x%04x)\n", port);
    4242#endif
    4343
    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;
    5348    }
     49    iopldone++;
     50  } else if (ioperm(port,size,1)) {
     51    fprintf(stderr, "ioperm(%x): %s\n", port, strerror(errno));
     52    return 1;
     53  }
    5454
    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;
    6161}
    6262}}}