1.\" $OpenBSD: radio.9,v 1.12 2022/03/30 19:03:21 miod 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: March 30 2022 $ 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 "const 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 radio 4 104.Sh HISTORY 105The 106.Nm 107device driver appeared in 108.Ox 3.0 . 109.Sh AUTHORS 110.An -nosplit 111The 112.Nm 113driver was written by 114.An Vladimir Popov Aq Mt jumbo@narod.ru 115and 116.An Maxim Tsyplakov Aq Mt tm@oganer.net . 117The man page was written by 118.An Maxim Tsyplakov Aq Mt tm@oganer.net . 119