xref: /openbsd-src/share/man/man9/radio.9 (revision 2b0358df1d88d06ef4139321dd05bd5e05d91eaf)
1.\"	$OpenBSD: radio.9,v 1.9 2007/05/31 19:20:00 jmc Exp $
2.\"	$RuOBSD: radio.9,v 1.3 2001/10/26 05:38:44 form Exp $
3.\"
4.\" Copyright (c) Maxim Tsyplakov <tm@oganer.net>
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23.\" ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd $Mdocdate: May 31 2007 $
28.Dt RADIO 9
29.Os
30.Sh NAME
31.Nm radio
32.Nd interface between low and high level radio drivers
33.Sh DESCRIPTION
34The radio device driver is divided into a high level,
35hardware independent layer, and a low level hardware
36dependent layer.
37The interface between these is the
38.Va radio_hw_if
39structure.
40.Bd -literal
41struct radio_hw_if {
42	int	(*open)(void *, int, int, struct proc *);
43	int	(*close)(void *, int, int, struct proc *);
44	int     (*get_info)(void *, struct radio_info *);
45	int     (*set_info)(void *, struct radio_info *);
46	int     (*search)(void *, int);
47};
48.Ed
49.Pp
50The high level radio driver attaches to the low level driver
51when the latter calls
52.Va radio_attach_mi .
53This call should be
54.Bd -literal
55.Ft void
56.Fn radio_attach_mi "struct radio_hw_if *rhwp" "void *hdlp" \
57                    "struct device * dev"
58.Ed
59.Pp
60The
61.Va radio_hw_if
62struct is as shown above.
63The
64.Va hdlp
65argument is a handle to some low level data structure.
66It is sent as the first argument to all the functions in
67.Va radio_hw_if
68when the high level driver calls them.
69.Va dev
70is the device struct for the hardware device.
71.Pp
72The fields of
73.Va radio_hw_if
74are described in some more detail below.
75.Bd -literal
76.Ft int
77.Fn open "void *" "int flags" "int fmt" "struct proc *p"
78  Optional.
79  Is called when the radio device is opened.
80  Returns 0 on success, otherwise an error code.
81
82.Ft int
83.Fn close "void *" "int flags" "int fmt" "struct proc *p"
84  Optional.
85  Is called when the radio device is closed.
86  Returns 0 on success, otherwise an error code.
87
88.Ft int
89.Fn get_info "void *" "struct radio_info *"
90  Fill the radio_info struct.
91  Returns 0 on success, otherwise an error code.
92
93.Ft int
94.Fn set_info "void *" "struct radio_info *"
95  Set values from the radio_info struct.
96  Returns 0 on success, otherwise an error code.
97
98.Ft int
99.Fn search "void *" "int"
100  Returns 0 on success, otherwise an error code.
101.Ed
102.Sh SEE ALSO
103.Xr az 4 ,
104.Xr gtp 4 ,
105.Xr radio 4 ,
106.Xr rt 4 ,
107.Xr rtii 4 ,
108.Xr sf2r 4 ,
109.Xr sfr 4
110.Sh HISTORY
111The
112.Nm
113device driver appeared in
114.Ox 3.0 .
115.Sh AUTHORS
116.An -nosplit
117The
118.Nm
119driver was written by
120.An Vladimir Popov Aq jumbo@narod.ru
121and
122.An Maxim Tsyplakov Aq tm@oganer.net .
123The man page was written by
124.An Maxim Tsyplakov Aq tm@oganer.net .
125