Introduction
serdisp_connect.h offers functions for opening and closing output devices using a descriptor ('sdcd').
Features
Output devices
- parallel port
- serial port (I2C, RS232)
- USB-to-serial adaptors (I2C-devices only)
- USB-modules
- other output devices like SDL, framebuffer
Supported access methods
Nota Bene: ioctl vs. direct-io is only valid for displays connected to parallel or serial ports.
- ioctl-calls: output devices are accessed using devices
- direct I/O: output devices are accessed using port addresses (direct I/O is only supported with linux and i386/x86_64 architectures)
The default output-method uses 'ioctl'-calls using device names (eg: /dev/parport0
).
serdisplib also supports using direct-IO (using port-addresses and inline-assembler).
Pros and contras
- ioctl:
+
not restricted to root-only (users qualified for eg. /dev/parport0
may control a display connected to it)
+
universal (usable with more unix-derivats)
-
slower than direct I/O
- direct I/O:
+
faster (at least in theory)
-
root-only
-
i386-compliant architectures only
Tested compilers
- gcc 2.96
- gcc 3.x
- gcc 4.0 (tested using Fedora Core 4)
- gcc 4.5 - 4.7.2
- clang 2.9 - 3.2
Operating systems (tested)
- Linux (x86_32, x86_64, arm; direct I/O only with x86 architectures)
- Solaris 10 (only x86 tested. devices:
ecpp
and cua
)
- FreeBSD (only x86 and parport tested)
Operating systems (untested)
- Linux / non-x86
- FreeBSD/ non-86
- OpenBSD
void SDCONN_close |
( |
serdisp_CONN_t * |
sdcd | ) |
|
- Parameters
-
sdcd | serdisp connect descriptor |
serdisp_CONN_t* SDCONN_import_PP |
( |
int |
directIO, |
|
|
int |
hport |
|
) |
| |
import an existing already opened parport device / port and create a sdcd struct out of it
- Parameters
-
directIO | 1: yes -> outp-calls, 0: no -> ioctl-calls |
hport | if directIO: port (eg: 0x378), else: descriptor for parport dev |
- Return values
-
!NULL | serdisp connect descriptor |
NULL | operation was unsuccessful |
- Deprecated:
- has not been used so far, unsafe
- Attention
- USE WITH CARE!!! all permissions and stuff like that must be ok before!! no checking for validity in here
serdisp_CONN_t* SDCONN_open |
( |
const char |
sdcdev[] | ) |
|
- Parameters
-
sdcdev | device name or port-number of device to open |
Format: [conntype:]device
- conntype (connection type) is case insensitive
- no connection type is needed for known devices (list below)
List of known devices:
device conntype remark
---------------- -------- ----------------------------------------
/dev/parportX PAR or PARPORT (alias name)
/dev/ppiX PAR bsd
/dev/ecppX PAR solaris
0x378 PAR first parallel port, linux, direct IO
0x278 PAR second parallel port, linux, direct IO
/dev/ttySX SERRAW
/dev/ttyUSBX SERRAW
/dev/cuaX SERRAW
0x3f8 SERRAW first serial port, linux, direct IO
0x2f8 SERRAW second serial port, linux, direct IO
Examples:
sdcdev remark
----------------------- -----------------------------------------------
"/dev/parport0" parallel port, ioctl, linux
"0x378" parallel port, direct IO, linux 86 only
"/dev/ecpp0" parallel port, ioctl, solaris
"/dev/ttyS0" serial port, ioctl, should be os-indepentend (POSIX)
"0x3f8" serial port, direct IO, linux x86 only
"serraw:/dev/ttyS0" serial device, ioctl
"SERRAW:/dev/ttyS0" the same as above because connection type is case-insensitive
"SERPORT:/dev/ttyS0" the same because SERPORT and SERRAW are synonyms
"serraw:0x3f8" serial device, direct IO
"par:/dev/parport0" linux, ioctl
- Return values
-
!NULL | serdisp connect descriptor |
NULL | operation was unsuccessful |
- Attention
- direct IO is only supported with linux (for now - maybe someone may try if this is also valid with freebsd).