xref: /openbsd/share/man/man9/radio.9 (revision ee493d66)
1*ee493d66Smiod.\"	$OpenBSD: radio.9,v 1.12 2022/03/30 19:03:21 miod Exp $
2bdde9a22Smickey.\"	$RuOBSD: radio.9,v 1.3 2001/10/26 05:38:44 form Exp $
3fd928ad2Sgluk.\"
4fd928ad2Sgluk.\" Copyright (c) Maxim Tsyplakov <tm@oganer.net>
5fd928ad2Sgluk.\" All rights reserved.
6fd928ad2Sgluk.\"
7fd928ad2Sgluk.\" Redistribution and use in source and binary forms, with or without
8fd928ad2Sgluk.\" modification, are permitted provided that the following conditions
9fd928ad2Sgluk.\" are met:
10fd928ad2Sgluk.\" 1. Redistributions of source code must retain the above copyright
11fd928ad2Sgluk.\"    notice, this list of conditions and the following disclaimer.
12fd928ad2Sgluk.\" 2. Redistributions in binary form must reproduce the above copyright
13fd928ad2Sgluk.\"    notice, this list of conditions and the following disclaimer in the
14fd928ad2Sgluk.\"    documentation and/or other materials provided with the distribution.
15fd928ad2Sgluk.\"
16fd928ad2Sgluk.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17fd928ad2Sgluk.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18fd928ad2Sgluk.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19fd928ad2Sgluk.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20fd928ad2Sgluk.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21fd928ad2Sgluk.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22fd928ad2Sgluk.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23fd928ad2Sgluk.\" ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24fd928ad2Sgluk.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25fd928ad2Sgluk.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26fd928ad2Sgluk.\"
27*ee493d66Smiod.Dd $Mdocdate: March 30 2022 $
28fd928ad2Sgluk.Dt RADIO 9
29fd928ad2Sgluk.Os
30fd928ad2Sgluk.Sh NAME
31fd928ad2Sgluk.Nm radio
32fd928ad2Sgluk.Nd interface between low and high level radio drivers
33fd928ad2Sgluk.Sh DESCRIPTION
34fd928ad2SglukThe radio device driver is divided into a high level,
35fd928ad2Sglukhardware independent layer, and a low level hardware
36fd928ad2Sglukdependent layer.
37fd928ad2SglukThe interface between these is the
38fd928ad2Sgluk.Va radio_hw_if
39fd928ad2Sglukstructure.
40fd928ad2Sgluk.Bd -literal
41fd928ad2Sglukstruct radio_hw_if {
42bdde9a22Smickey	int	(*open)(void *, int, int, struct proc *);
43bdde9a22Smickey	int	(*close)(void *, int, int, struct proc *);
44bdde9a22Smickey	int     (*get_info)(void *, struct radio_info *);
45bdde9a22Smickey	int     (*set_info)(void *, struct radio_info *);
46bdde9a22Smickey	int     (*search)(void *, int);
47fd928ad2Sgluk};
48fd928ad2Sgluk.Ed
49fd928ad2Sgluk.Pp
50fd928ad2SglukThe high level radio driver attaches to the low level driver
51fd928ad2Sglukwhen the latter calls
52fd928ad2Sgluk.Va radio_attach_mi .
53fd928ad2SglukThis call should be
54fd928ad2Sgluk.Bd -literal
558db76839Swcobb.Ft void
56*ee493d66Smiod.Fn radio_attach_mi "const struct radio_hw_if *rhwp" "void *hdlp" \
578db76839Swcobb                    "struct device * dev"
58fd928ad2Sgluk.Ed
59fd928ad2Sgluk.Pp
60fd928ad2SglukThe
61fd928ad2Sgluk.Va radio_hw_if
62fd928ad2Sglukstruct is as shown above.
63fd928ad2SglukThe
64fd928ad2Sgluk.Va hdlp
65fd928ad2Sglukargument is a handle to some low level data structure.
66bdde9a22SmickeyIt is sent as the first argument to all the functions in
67fd928ad2Sgluk.Va radio_hw_if
68fd928ad2Sglukwhen the high level driver calls them.
69fd928ad2Sgluk.Va dev
70fd928ad2Sglukis the device struct for the hardware device.
71fd928ad2Sgluk.Pp
72fd928ad2SglukThe fields of
73fd928ad2Sgluk.Va radio_hw_if
74fd928ad2Sglukare described in some more detail below.
75fd928ad2Sgluk.Bd -literal
768db76839Swcobb.Ft int
778db76839Swcobb.Fn open "void *" "int flags" "int fmt" "struct proc *p"
78bdde9a22Smickey  Optional.
79fd928ad2Sgluk  Is called when the radio device is opened.
80fd928ad2Sgluk  Returns 0 on success, otherwise an error code.
81fd928ad2Sgluk
828db76839Swcobb.Ft int
838db76839Swcobb.Fn close "void *" "int flags" "int fmt" "struct proc *p"
84bdde9a22Smickey  Optional.
85fd928ad2Sgluk  Is called when the radio device is closed.
86fd928ad2Sgluk  Returns 0 on success, otherwise an error code.
87fd928ad2Sgluk
888db76839Swcobb.Ft int
898db76839Swcobb.Fn get_info "void *" "struct radio_info *"
90bdde9a22Smickey  Fill the radio_info struct.
91fd928ad2Sgluk  Returns 0 on success, otherwise an error code.
92bdde9a22Smickey
938db76839Swcobb.Ft int
948db76839Swcobb.Fn set_info "void *" "struct radio_info *"
95bdde9a22Smickey  Set values from the radio_info struct.
96bdde9a22Smickey  Returns 0 on success, otherwise an error code.
97bdde9a22Smickey
988db76839Swcobb.Ft int
998db76839Swcobb.Fn search "void *" "int"
100bdde9a22Smickey  Returns 0 on success, otherwise an error code.
1014c8a7c32Smpech.Ed
102fd928ad2Sgluk.Sh SEE ALSO
10394897848Sjmc.Xr radio 4
104601d79cdSjmc.Sh HISTORY
105601d79cdSjmcThe
106601d79cdSjmc.Nm
107601d79cdSjmcdevice driver appeared in
108601d79cdSjmc.Ox 3.0 .
109bdde9a22Smickey.Sh AUTHORS
110d281945cSjaredy.An -nosplit
111bdde9a22SmickeyThe
112bdde9a22Smickey.Nm
113bdde9a22Smickeydriver was written by
114f0641c22Sschwarze.An Vladimir Popov Aq Mt jumbo@narod.ru
115bdde9a22Smickeyand
116f0641c22Sschwarze.An Maxim Tsyplakov Aq Mt tm@oganer.net .
117bdde9a22SmickeyThe man page was written by
118f0641c22Sschwarze.An Maxim Tsyplakov Aq Mt tm@oganer.net .
119