xref: /netbsd/share/man/man9/radio.9 (revision bf9ec67e)
1.\"	$NetBSD: radio.9,v 1.3 2002/01/02 02:15:42 wiz Exp $
2.\"	$OpenBSD: radio.9,v 1.2 2001/10/08 08:52:50 mpech 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 September 29, 2001
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    void
56    radio_attach_mi(rhwp, hdlp, dev)
57	struct radio_hw_if *rhwp;
58	void *hdlp;
59	struct device *dev;
60.Ed
61.Pp
62The
63.Va radio_hw_if
64struct is as shown above.
65The
66.Va hdlp
67argument is a handle to some low level data structure.
68It is sent as the first argument to all the functions in
69.Va radio_hw_if
70when the high level driver calls them.
71.Va dev
72is the device struct for the hardware device.
73.Pp
74The fields of
75.Va radio_hw_if
76are described in some more detail below.
77.Bd -literal
78int open (void *, int flags, int fmt, struct proc *p);
79  Optional.
80  Is called when the radio device is opened.
81  Returns 0 on success, otherwise an error code.
82
83int 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
88int get_info (void *, struct radio_info *);
89  Fill the radio_info struct.
90  Returns 0 on success, otherwise an error code.
91
92int set_info (void *, struct radio_info *);
93  Set values from the radio_info struct.
94  Returns 0 on success, otherwise an error code.
95
96int search (void *, int);
97  Returns 0 on success, otherwise an error code.
98.Ed
99.Sh SEE ALSO
100.Xr radio 4
101