can't write/read to ISA-Card using ioperm, inw, outw

From: Marcus (mschneller_at_swissonline.ch)
Date: 08/28/03


Date: 28 Aug 2003 00:51:40 -0700

Dear Hardware-Experts

I have an PnP-ISA-Card installed in my PC, but do have problems
reading/writing from/to the card.

/proc/isapnp says:

Card 1 'BUR0020:BUR PCIO' PnP version 1.0
Logical device 0 'BUR0000:Unknown'
Supported registers 0x2
Device is active
Active port 0x220
Active IRQ 5
Active DMA ,0
Resources 0
Priority acceptable
Port 0x200-0xffe0, align 0x1f, size 0x20, 16-bit address decoding IRQ
3,4,5,6,7,2/9,10,11,12,14,15 High-Edge

My interpretation is that the Base Address is 0x220.

I'm using ioperm to get permission to read/write to the card as
follows (I'm root):

int initPort()
{
 if(iIOAddr == 0) //iIOAddr is 0x220
  return 1;

 return ioperm(iIOAddr, 0x20, 1);
}

Reading(writing is done as follows:

void readIOw(uint16 iOffset, uint16 *iVal) {
 if (iVal == NULL) {
  printf("readIOw: can't write to null pointer\n");
  return;
 }
 *iVal = inw(iIOAddr + iOffset);
 //usleep(1);
}

void writeIOw(uint16 iOffset, uint16 iVal) {
 outw(iVal, iIOAddr + iOffset);
 //usleep(1);
}

Well, to be short, it doesn't work. readIOw always returns 0xffff,
which shouldn't be.

The same Card works fine under Tornado/vxWorks using the same
mechanisms. Therefore the I think the addresses are correct and it
might be a Linux realated problem.

Writing to the parallel port at 0x378 works by the way fine. I've also
tried accessing the card in kernel mode, which has the same effect as
in user mode.

Any help is really welcome

Marcus



Relevant Pages