TS-7250-V3 PC104 MMAP

From Technologic Systems Manuals
Revision as of 14:13, 26 March 2020 by Mark (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

On some previous PC104 implementations the PC104 bus was able to be directly memory mapped. While it is not possible on this hardware to access the bus the same way, we do have a compatibility layer that is able to expose the PC104 bus as if it were memory mapped.

#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <assert.h>

#include "pc104.h"

volatile uint8_t *bus;

int main(int argc, char **argv)
	uint8_t i = 0;

	bus = pc104_mmap_init();
	assert(bus != NULL);
	if(bus[0x140] != 0x9b) {
		fprintf(stderr, "TS-RELAY8 not found\n");
	while(1) {
		bus[0x142] = i++;
		usleep(10 * 1000);


Accesses below 0x100000 cause IO accesses. Accesses from 0x100000 to 0x200000 cause MEM accesses. This code turns these mmap accesses into pc104_io/mem_8/16 calls.

This example must be compiled with:

gcc -marm test.c pc104.c -o test