NetBSD/share/man/man9/radio.9

130 lines
4.2 KiB
Groff

.\" $NetBSD: radio.9,v 1.6 2018/07/18 16:40:30 wiz Exp $
.\" $OpenBSD: radio.9,v 1.2 2001/10/08 08:52:50 mpech Exp $
.\"
.\" Copyright (c) Maxim Tsyplakov <tm@oganer.net>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
.\" ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd July 9, 2018
.Dt RADIO 9
.Os
.Sh NAME
.Nm radio
.Nd interface between low- and high-level FM radio drivers
.Sh SYNOPSIS
.In dev/radio_if.h
.Ft device_t
.Fo radio_attach_mi
.Fa "const struct radio_hw_if *rhwp"
.Fa "void *hdlp"
.Fa "device_t dev"
.Fc
.Sh DESCRIPTION
The
.Nm
layer provides support for digitally programmable FM radio tuners.
.Pp
It is divided into a machine independent, high-level part responsible for
managing device files, and low-level hardware drivers.
.Pp
The high-level radio driver attaches to the low-level driver
when the latter calls
.Fn radio_attach_mi .
.Pp
The
.Fa radio_hw_if
struct contains pointers to functions provided by the low-level driver.
The
.Fa hdlp
argument is a handle to a low-level driver's softc structure.
It is sent as the first argument to all the functions in
.Fa radio_hw_if
when the high-level driver calls them.
.Fa dev
is the device struct for the hardware device.
.Pp
The fields of
.Fa radio_hw_if
are described in some more detail below.
.Bd -literal
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);
};
.Ed
.Bl -tag -width XXXX
.It Fn (*open) "sc" "flags" "fmt" "lwp"
Called when the radio device is opened.
Optionally, if there is no need to call a driver's function when the device file is
opened,
.Dv NULL
should be passed in this field.
Returns 0 on success, otherwise an error code.
.It Fn (*close) "sc" "flags" "fmt" "lwp"
Called when the radio device is closed.
Optionally, if there is no need to call a driver's function when the device file is
closed,
.Dv NULL
should be passed in thie field.
Returns 0 on success, otherwise an error code.
.It Fn (*get_info) "sc" "ri"
Fills the radio_info struct.
This function is used to obtain the current state of a hardware device.
It is executed as a result of calling
.Dv RIOCGINFO
on a device file managed by the high-level driver.
Returns 0 on success, otherwise an error code.
.It Fn (*set_info) "sc" "ri"
Set values from the radio_info struct.
This function is used to modify the current state of a hardware device
(enable/disable various modes and parameters).
It is executed as a result of calling
.Dv RIOCSINFO
on a device file managed by the high-level driver.
Returns 0 on success, otherwise an error code.
.It Fn (*search) "sc" "ri"
Initiates automatic search for the radio station.
It is executed as a result of calling
.Dv RIOCSSRCH
on a device file managed by the high-level driver.
Returns 0 on success, otherwise an error code.
.El
.Sh SEE ALSO
.Xr radio 4
.Sh AUTHORS
.An -nosplit
The
.Nm
API was written by
.An Vladimir Popov
and
.An Maxim Tsyplakov
for
.Ox
and ported to
.Nx
by
.An Lennart Augustsson .