---
name: "hal_parport"
section: "3hal"
platform: "linux"
package: "linuxcnc-uspace-dev"
version: "1:2.9.4-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/hal_parport/3hal"
---

# hal\_parport(3hal)

portable access to PC-style parallel ports

## NAME

hal\_parport - portable access to PC-style parallel ports

## SYNTAX

\#include "hal\_parport.h"

int **hal\_parport\_get**(int *comp\_id*, hal\_parport\_t \**port*, unsigned short *base*, unsigned short *base\_hi*, unsigned int *modes*)

void **hal\_parport\_release**(hal\_parport\_t \**port*)

## ARGUMENTS

- *comp\_id*

  A HAL component identifier returned by an earlier call to **hal\_init**.

- *port*

  A pointer to a hal\_parport\_t structure

- *base*

  The base address of the port (if port \>= 16) or the linux port number of the port (if port \< 16)

- *base\_hi*

  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

- *modes*

  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.

## DESCRIPTION

**hal\_parport\_get** allocates a parallel port for exclusive use of the named HAL component.  The port must be released with **hal\_parport\_release** before the component exits with **hal\_exit**.

## HIGH ADDRESS PROBING

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.

## PARPORT STRUCTURE

```
typedef struct
{
    unsigned short base;
    unsigned short base_hi;
    .... // and further unspecified fields
} hal_parport_t;
```

## RETURN VALUE

**hal\_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 **hal\_parport\_release**.

**hal\_parport\_release** does not return a value.  It always succeeds.

## NOTES

In new code, prefer use of rtapi\_parport to hal\_parport.
