IO-mapped devices


Introduction

I/O devices are accessed from C++ applications by system calls of the type sysInByte()/sysInWord() (see full list below). . The name of the functions are quite self-explanatory: They read or write a byte or word to or from a given address. These functions are essentially identical to the well-known _inp()/_outp()-system calls used in other systems.

Example prototypes


Example prototypes are:

unsigned char sysInByte(int port)
Reads and returns 1 byte the address 'port'
void sysOutByte(int port, char data)
Outputs the byte 'data' to the address 'port'

Additional I/O functions

The below list is the full API for access to I/O-mapped devices. For most of the functions, the name and the analogy with the above mentioned functions should explain return values and parameters:

sysInWord( )
sysOutWord( )
sysInLong( )
sysOutLong( )
sysInWordString( )
sysOutWordString( )
sysInLongString( )
sysOutLongString( )

A full specification can be found in the online document "VxWorks 6.3 Architecture Supplement", available from the integrated help system (Menu Help > Help Contents > Wind River Documentation > Guides > Operating System > VxWorks Architecture Supplement, 6.3. > Intel Architecture > Interface Variations > Architecture-Specific Routines).

Test has shown an incompatibility issue between the use of <vxworks.h>/<sysLib.h> and <iostream>. Use of <iostream> functions like cout/cin results in errors and is therefore discouraged. Use printf()/scanf() instead.

Note that these calls must be used from a module running in kernel space, which is guaranteed with the Downloadadble Kernel Modules used for C++ applications. Note also that the above calls are specific to the pentium BSP