I have a custom dual ported ram device that I am trying to access to no
avail. This device is hung on an ISA bus slot off of a PC104 based
motherboard. The device requires that the address it responds too be loaded
through an IO register. This all seems like pretty simple stuff. Here is
the code.
rc = ThreadCtl(_NTO_TCTL_IO, 0);
if (rc < 0)
printf("\n error %d\n", errno);
rc = mmap_device_io(8, adr);
if (rc < 0)
printf("\n error %d\n", errno);
out8(0x186, 7); // disable interupts
out8(0x187, (0x80 | (0xd0 >> 1))); // Set address of dual ported ram
// this may look
funky but it is correct for the board
shmaddr = 0; // System assigned address
shmaddr = (char *) mmap_device_memory(shmaddr, 512,
PROT_NOCACHE | PROT_READ | PROT_WRITE,
MAP_TYPE, 0xd0000);
printf("\n error %d\n", errno);
shmaddr[0] = ‘a’;
shmaddr[1] = ‘b’;
shmaddr[2] = ‘c’;
tst[0] = shmaddr[0];
tst[1] = shmaddr[1];
tst[2] = shmaddr[2];
printf("\ntest %d, %d, %d, %d\n", shmaddr[510], tst[0], tst[1], tst[2]);
Here is the problem. The result of all calls is success. The result of the
tst[x] assignments are always -1.
I have tried to add a fixed memory area to the startup-bios code (add_mem
function). I can see the memory reported during boot from print_meminfo().
I have verified that the IO port writes work by hardware debugging the
board. What seems to happen is that the 0xd0000 address never actually gets
written or read. The SMEMW signal never triggers on the isa bus.
A few questions have come up as a result of all this.
- Why didn’t the write to the allocated address result in a memory protect
before I modified the startup code. - Why doesn’t the write memory protect ever? regardless of the address
utilized between 0xa0000 and 0xfffff. Or even specifying nonsense addresses
beyond the physical address space of the installed memory in the pc104. - Why doesn’t the map_device_memory fail?
- Do I need to set up a HWI structure for this device to get it to
function? - What am I doing wrong here?
Any help would be appreciated.