rtapi_region(3rtapi)

✨ rtapi_region β€” bestie's guide to I/O memory regions ✨

okay so this is rtapi_region, from the RTAPI manual section (3rtapi, the library-call girlies πŸ’…). it's literally just two functions that manage I/O memory regions, and yes they're iconic.


🌸 NAME 🌸

rtapi_region β€” functions to manage I/O memory regions


πŸŽ€ SYNTAX πŸŽ€

void *rtapi_request_region(unsigned long base, unsigned long int
       size, const char *name)

void rtapi_release_region(unsigned long base, unsigned long int
       size)

two functions, one vibe. one grabs memory, one gives it back. the way that's the whole plot 😭


πŸ¦‹ ARGUMENTS πŸ¦‹

  • base β€” the base address of the I/O region. like, where it starts. the origin story ✨
  • size β€” the size of the I/O region. how much room we're taking, in bytes.
  • name β€” the name to be shown in /proc/ioports. yes bestie, your little label in the system file, your main character moment πŸ‘‘

πŸ’– DESCRIPTION πŸ’–

rtapi_request_region reserves I/O memory starting at base and going for size bytes.

that's it. that's the function. it calls dibs on a chunk of I/O memory, no cap 🫢


πŸ”₯ REALTIME CONSIDERATIONS πŸ”₯

May be called from realtime init/cleanup code only.

not me stressing this but fr fr: realtime init/cleanup code ONLY. don't be out here calling this from anywhere else, that's a vibe check you will fail πŸ’€

⭐ RETURN VALUE ⭐

  • rtapi_request_region returns NULL if the allocation fails, and a non-NULL value otherwise. so if you get NULL, it didn't work, periodt πŸ™ˆ
  • rtapi_release_region has no return value. nothing. silence. she gives nothing back and that's on purpose 🧚

and that's the whole page, bestie πŸ’œ go reserve some memory responsibly.

this was LinuxCNC Documentation, dated 2006-10-12 β€” vintage but still slaying, mwah πŸŽ€βœ¨