RADIO(9)

πŸ“¦
version 11.0 Β· 2 versions
, in nixpkgs unstable

🌸 RADIO(9) 🌸

okay so this is the Kernel Developer's Manual page for radio and bestie, it's literally the glow-up guide for FM radio drivers πŸ’…


✨ NAME ✨

radio β€” the interface between low- and high-level FM radio drivers πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <dev/radio_if.h>

device_t
radio_attach_mi(const struct radio_hw_if *rhwp, void *hdlp,
    device_t dev);

πŸ’– DESCRIPTION πŸ’–

so the radio layer is the whole support system for digitally programmable FM radio tuners ✨ like, it's giving backstage crew for your tuner's main character moment.

It's split into two parts, no cap:

  • a machine independent, high-level part whose whole job is managing device files πŸ‘‘
  • the low-level hardware drivers 🧚

The high-level radio driver attaches to the low-level driver when the latter calls radio_attach_mi(). that's the meet-cute fr fr 🫢

The radio_hw_if struct holds pointers to functions that the low-level driver provides. The hdlp argument is a handle to a low-level driver's softc structure β€” it gets sent as the first argument to all the functions in radio_hw_if whenever the high-level driver calls them, every single time, no exceptions πŸ’€ And dev is the device struct for the hardware device.

The fields of radio_hw_if get described in a lil more detail right below πŸ‘‡

struct radio_hw_if {
        int     (*open)(void *, int, int, struct lwp *);
        int     (*close)(void *, int, int, struct lwp *);
        int     (*get_info)(void *, struct radio_info *);
        int     (*set_info)(void *, struct radio_info *);
        int     (*search)(void *, int);
};

🌈 the function pointers, one by one

  • (*open)(sc, flags, fmt, lwp) β€” gets called when the radio device is opened πŸšͺ Optionally, if there's genuinely no need to call a driver's function when the device file is opened, pass NULL in this field. Returns 0 on success, otherwise an error code.
  • (*close)(sc, flags, fmt, lwp) β€” gets called when the radio device is closed πŸšͺ✨ Optionally, if there's no need to call a driver's function when the device file is closed, pass NULL in this field. Returns 0 on success, otherwise an error code.
  • (*get_info)(sc, ri) β€” fills the radio_info struct πŸ’– This one is used to obtain the current state of a hardware device. It runs as a result of calling RIOCGINFO on a device file managed by the high-level driver. Returns 0 on success, otherwise an error code.
  • (*set_info)(sc, ri) β€” sets values from the radio_info struct πŸ”₯ This one is used to modify the current state of a hardware device (enable/disable various modes and parameters). It runs as a result of calling RIOCSINFO on a device file managed by the high-level driver. Returns 0 on success, otherwise an error code.
  • (*search)(sc, ri) β€” kicks off the automatic search for the radio station πŸ“»βœ¨ It runs as a result of calling RIOCSSRCH on a device file managed by the high-level driver. Returns 0 on success, otherwise an error code.
friendly reminder bestie: every single one of these returns 0 on success, and an error code otherwise. that part is not optional, it's the vibe check 😌

πŸ‘€ SEE ALSO πŸ‘€


πŸ’œ AUTHORS πŸ’œ

The radio API was written by Vladimir Popov and Maxim Tsyplakov for OpenBSD, and ported to NetBSD by Lennart Augustsson. legends only πŸ‘‘πŸ’…


okay that's the whole page, bestie β€” go forth and slay those tuners πŸ“»βœ¨

this lil treasure came from the Debian edition, dated July 9, 2018 β€” mwah, sign-off complete πŸŽ€πŸ’–

πŸ“¦ where this page comes from