NAR-7070 User’s Manual
54
printf("Read_port:(0x%04x)=>0x%04x\n",
port,
val);
#endif
} else {
val=inb(port);
#ifdef DEBUG
printf("Read_port:(0x%04x)=>0x%02x\n",
port,
val);
#endif
}
return(val);
}
static int write_port(unsigned int port, unsigned int val, int size)
{
static int iopldone = 0;
#ifdef DEBUG
printf("Write_Port(0x%04x)<=0x%x\n", port, val);
#endif
if (port > 1024) {
if (!iopldone && iopl(3)) {
fprintf(stderr, "iopl(): %s\n", strerror(errno));
return 1;
}
i+;
} else if (ioperm(port,size,1)) {
fprintf(stderr,
"ioperm(%x):
%s\n", port, strerror(errno));
return
1;
}
if (size == 4)
outl(val,
port);
else if (size == 2)
outw(val&0xffff,
port);
else