I'm trying to understand how to do 16-bit transfers on the TS-7250
PC104 bus, but it doesn't seem to be happpening. Instead, I get two
cycles, apparently 8 bits each. The pair is a little faster, though.
When I run the program below, I see four cycles on each of IOR#,
MEMR#, IOW#, and MEMW#, with somewhat confusing (to me) signals on
BHE#. Here's what I see:
IOR# cycles
1 BHE#=0 A0=0
2 BHE#=0 A0=1
3 BHE#=0 A0=0
4 BHE#=0 A0=1
This is what I would expect, except for there being two cycles for the
16-bit transfer. By the way, A1 is always zero.
MEMR# cyces look about the same, except iirc faster.
IOWE# and MEMW# cycles:
1 BHE#=1 A0=0
2 BHE#=1 A0=1
3 BHE#=1 A0=0
4 BHE#=0 A0=1
This BHE# setting seems to make no sense.
What am I missing?
Here's the source code, with some comments and error checking removed:
(someone may recognize their code as my template)
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
static volatile unsigned char *pc104_io8;
static volatile unsigned short *pc104_io16;
static volatile unsigned char *pc104_mem8;
static volatile unsigned short *pc104_mem16;
/********************************************************************/
int main(int argc, char *argv[])
{
int size = getpagesize();
printf("Page Size = %d\n", size);
int fd = open("/dev/mem", O_RDWR|O_SYNC);
pc104_io8 = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
0x11E00000);
pc104_io16 = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
0x21E00000);
pc104_mem8 = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
0x11a00000);
pc104_mem16 = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
0x21a00000);
while (1) // Now once a second
{
char c;
short s;
sleep(1);
c = *pc104_io8;
c = *(pc104_io8+1);
s = *pc104_io16;
c = *pc104_mem8;
c = *(pc104_mem8+1);
s = *pc104_mem16;
*pc104_io8 = c;
*(pc104_io8+1) = c;
*pc104_io16 = s;
*pc104_mem8 = c;
*(pc104_mem8+1) = c;
*pc104_mem16 = s;
}
}