parport(3rtapi)
π NAME π
rtapi_parport β portable access to PC-style parallel ports. yes bestie, the actual hardware kind, not the vibes kind β¨
Oh also, hi, this page lives in the RTAPI manual as parport(3rtapi), so that's the whole energy we're on today π
β¨ SYNTAX β¨
#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)
Two functions. One grabs the port, one gives it back. That's the whole situationship π
πΈ ARGUMENTS πΈ
module_nameβ the name of the RTAPI module or HAL component that's using the parport. By convention, okay? Like, that's just how we do it around here π«Άportβ a pointer to artapi_parport_tstructure. Yes, the one from further down this page. Keep scrolling, bestie πbaseβ the base address of the port, ifport >= 16. But ifport < 16, it's the linux port number of the port instead. Two meanings, one argument, pick your fighter βοΈbase_hiβ the "high" address of the port, aka where the ECP registers live π. Set it to0if you want a probed high address, or-1to flat-out disable the high address. No in-between, no cap π«modesβ you're advising the driver what port modes you want, and the values come from<linux/parport.h>. If Linux detected a port and it does not provide the modes you asked for, a warning gets printed withrtapi_print_msgπ’. Important: this does not make the port request fail. Why? Because unfortunately, so many systems out here have perfectly working EPP parports and Linux just does not clock them as such π. So we warn and move on, periodt.
π¦ DESCRIPTION π¦
rtapi_parport_get allocates a parallel port for the exclusive use of the named HAL component. Exclusive! It's not sharing, it's not polyamorous, that port is yours now π
If it works, you access that port with I/O calls like rtapi_inb, at the address based at the base or base_hi addresses. Simple as.
But listen β the port must be released with rtapi_parport_release before the component exits with rtapi_exit. That's not a suggestion, that's the rule π
π₯ HIGH ADDRESS PROBING π₯
Okay so here's the tea on how the high address gets figured out β
- If the port is a parallel port that Linux knows about, and Linux detected a high I/O address, then that value gets used π
- Otherwise, if
base+0x400isn't registered to any device, that one gets used β¨ - Otherwise? No address is used. Nothing. Nada. It's giving empty π
And if no high address is detected at all, then port->base_hi is 0.
π PARPORT STRUCTURE π
typedef struct
{
unsigned short base;
unsigned short base_hi;
.... // and further unspecified fields
} rtapi_parport_t;
That .... is doing a lot of heavy lifting, I know. Those further fields are unspecified, so don't go poking at them like you know them π
π RETURN VALUE π
rtapi_parport_get returns a HAL status code.
- On success,
portgets filled out with all the info about the allocated port π - On failure, the contents of
portare undefined β except that it is safe (but not required) to pass thatporttortapi_parport_release. So like, the struct is a mystery box but it's a mystery box that won't bite you π«Ά
rtapi_parport_release does not return a value. It always succeeds. It literally cannot fail. Iconic behavior, honestly π
β NOTES β
In new code, prefer use of rtapi_parport to rtapi_parport. Yes, it says exactly that, bestie, and I am not about to editorialize on it β I just report the facts and let you sit with it ππ
and that's the whole page!! you understood it, you ate it, no crumbs π go forth and allocate responsibly π
this page came to you from the <b>LinuxCNC Documentation</b>, dated <b>2006-10-12</b>, filed under <b>parport(3rtapi)</b> β mwah, xoxo π
π¦ where this page comes from
- debian bookworm: linuxcnc-uspace-dev 2.9.0~pre1+git20230208.f1270d6ed7-1+deb12u2 Β· GFDL-1.1-or-later
- debian trixie: linuxcnc-uspace-dev 1:2.9.4-2+deb13u1 Β· GFDL-1.1-or-later
- ubuntu questing: linuxcnc-uspace-dev 1:2.9.4-2ubuntu2
- ubuntu resolute: linuxcnc-uspace-dev 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- ubuntu stonking: linuxcnc-uspace-dev 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- Copyright (c) 2014 Jeff Epler
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms