Scroll to navigation

parport(3rtapi) RTAPI parport(3rtapi)


rtapi_parport - portable access to PC-style parallel ports


#include "rtapi_parport.h"

int rtapi_parport_get(const char *module_name, rtapi_parport_t *port, unsigned short base, unsigned short base_hi, unsigned int modes)

void rtapi_parport_release(rtapi_parport_t *port)


By convention, the name of the RTAPI module or HAL component using the parport.
A pointer to a rtapi_parport_t structure
The base address of the port (if port >= 16) or the linux port number of the port (if port < 16)
The "high" address of the port (location of the ECP registers), 0 to use a probed high address, or -1 to disable the high address
Advise the driver of the desired port modes, from <linux/parport.h>. If a linux-detected port does not provide the requested modes, a warning is printed with rtapi_print_msg. This does not make the port request fail, because unfortunately, many systems that have working EPP parports are not detected as such by Linux.


rtapi_parport_get allocates a parallel port for exclusive use of the named hal component. If successful, access the port with I/O calls such as rtapi_inb at address based at the base or base_hi addresses. The port must be released with rtapi_parport_release before the component exits with rtapi_exit.


If the port is a parallel port known to Linux, and Linux detected a high I/O address, this value is used. Otherwise, if base+0x400 is not registered to any device, it is used. Otherwise, no address is used. If no high address is detected, port->base_hi is 0.


typedef struct

unsigned short base;
unsigned short base_hi;
.... // and further unspecified fields } rtapi_parport_t;


rtapi_parport_get returns a HAL status code. On success, port is filled out with information about the allocated port. On failure, the contents of port are undefined except that it is safe (but not required) to pass this port to rtapi_parport_release.

rtapi_parport_release does not return a value. It always succeeds.


In new code, prefer use of rtapi_parport to rtapi_parport.

2006-10-12 LinuxCNC Documentation