1.\" $RuOBSD: radio.4,v 1.4 2001/10/26 05:38:43 form Exp $ 2.\" $OpenBSD: radio.4,v 1.26 2007/05/31 19:19:51 jmc Exp $ 3.\" 4.\" Copyright (c) 2001 Vladimir Popov 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 4 29.Os 30.Sh NAME 31.Nm radio 32.Nd device-independent radio driver layer 33.Sh SYNOPSIS 34.Cd "radio* at az?" 35.Cd "radio* at bktr?" 36.Cd "radio* at fms?" 37.Cd "radio* at gtp?" 38.Cd "radio* at rt?" 39.Cd "radio* at rtii?" 40.Cd "radio* at sfr?" 41.Cd "radio* at sf2r?" 42.Cd "radio* at udsbr?" 43.Pp 44.Fd #include <sys/types.h> 45.Fd #include <sys/ioctl.h> 46.Fd #include <sys/radioio.h> 47.Sh DESCRIPTION 48The 49.Nm 50driver provides support for various FM radio cards. 51It provides an uniform programming interface layer above different underlying 52radio hardware drivers. 53.Pp 54For radio tuner controlling there is a single device file available: 55.Pa /dev/radio . 56.Pp 57The following 58.Xr ioctl 2 59commands are supported: 60.Pp 61.Bl -tag -width indent -compact 62.It Dv RIOCSSRCH (int) 63This command assumes that a signal search is required and gives direction 64of search to the driver \- 0 to search down and any non-zero value to search up. 65.It Dv RIOCGINFO (struct radio_info) 66.It Dv RIOCSINFO (struct radio_info) 67Get or set the current hardware device information into the struct radio_info 68structure. 69.Bd -literal 70struct radio_info { 71 int mute; 72 int volume; 73 int stereo; 74 int rfreq; /* reference frequency */ 75 int lock; /* locking field strength */ 76 u_int32_t freq; /* in kHz */ 77 u_int32_t caps; /* card capabilities */ 78#define RADIO_CAPS_DETECT_STEREO (1<<0) 79#define RADIO_CAPS_DETECT_SIGNAL (1<<1) 80#define RADIO_CAPS_SET_MONO (1<<2) 81#define RADIO_CAPS_HW_SEARCH (1<<3) 82#define RADIO_CAPS_HW_AFC (1<<4) 83#define RADIO_CAPS_REFERENCE_FREQ (1<<5) 84#define RADIO_CAPS_LOCK_SENSITIVITY (1<<6) 85#define RADIO_CARD_TYPE (0xFF<<16) 86 u_int32_t info; 87#define RADIO_INFO_STEREO (1<<0) 88#define RADIO_INFO_SIGNAL (1<<1) 89 u_int32_t tuner_mode; 90#define RADIO_TUNER_MODE_RADIO (1<<0) 91#define RADIO_TUNER_MODE_TV (1<<1) 92 u_int32_t chan; 93 u_int32_t chnlset; 94}; 95.Ed 96.Pp 97The 98.Va mute 99field is a boolean. 100.Pp 101The 102.Va volume 103field holds the card volume information and can be at most 255. 104.Pp 105The 106.Va stereo 107field is a boolean. 108.Pp 109The 110.Va rfreq 111holds information about the card reference frequency (not all cards support 112this feature). 113.Pp 114The 115.Va lock 116field holds information about the card locking field strength during 117an automatic search for cards that support this feature. 118.Pp 119The 120.Va freq 121field is the frequency in kHz the card is tuned to. 122.Pp 123The 124.Va tuner_mode 125field is the current tuning mode of the tuner. 126Valid modes are: 127.Pp 128.Bl -tag -width indent -compact 129.It Dv RADIO_TUNER_MODE_RADIO 130The tuner operates in FM radio mode. 131.It Dv RADIO_TUNER_MODE_TV 132The tuner operates in TV mode. 133.El 134.Pp 135The 136.Va caps 137field is read-only and describes the card capabilities. 138The capabilities can have the following values: 139.Pp 140.Bl -tag -width indent -compact 141.It Dv RADIO_CAPS_DETECT_STEREO 142The device can determine if it is tuned to a stereo signal. 143.It Dv RADIO_CAPS_DETECT_SIGNAL 144The device can determine if it is tuned or not. 145.It Dv RADIO_CAPS_SET_MONO 146The device is capable of forcibly setting its output to mono. 147.It Dv RADIO_CAPS_HW_SEARCH 148The device can do hardware search. 149.It Dv RADIO_CAPS_HW_AFC 150The device has an internal hardware automatic frequency control. 151.It Dv RADIO_CAPS_REFERENCE_FREQ 152The device allows changing the reference frequency of a received signal. 153.It Dv RADIO_CAPS_LOCK_SENSITIVITY 154The device allows changing the station lock sensitivity used during search 155operation. 156.It Dv RADIO_CARD_TYPE 157Some cards have several different incarnations. 158This allows the variant of the card to be determined. 159Currently not used. 160.El 161.Pp 162The 163.Va info 164field is read-only and describes the current state of the card \- 165tuned/not tuned, stereo signal/mono signal. 166.Pp 167.Bl -tag -width indent -compact 168.It Dv RADIO_INFO_STEREO 169Informs whether the device receives a stereo or mono signal. 170.It Dv RADIO_INFO_SIGNAL 171Informs whether the device receives a valid signal or noise. 172.El 173.Pp 174The 175.Va chan 176holds the TV channel the card is tuned to. 177.Pp 178The 179.Va chnlset 180specifies the TV channel set currently being used. 181The tuner uses the current channel set to derive the tuning frequency 182from the channel number. 183Western Europe is the default channel set. 184The following is a list of valid channel sets: 185.Bl -tag -width indent -compact 186.Pp 187.It 1 188U.S.A. Broadcast 189.It 2 190U.S.A. Cable IRC 191.It 3 192U.S.A. Cable HRC 193.It 4 194Western Europe 195.It 5 196Japan Broadcast 197.It 6 198Japan Cable 199.It 7 200Former U.S.S.R. and C.I.S. Countries 201.It 8 202Australia 203.It 9 204France 205.El 206.El 207.Pp 208Either 209.Va freq 210or 211.Va chan 212can be used to tune to FM radio stations or TV channels, 213respectively. 214Some devices may not support both functionalities. 215.Sh CHIPSETS 216LM700x is a frequency synthesizer IC. 217The LM700x is programmed through a 24-bit write-only shift register. 218The first 14 bits are frequency data. 219The next 2 bits are LSI test bits, and should always be zero. 220The next 4 bits are band data and time base data. 221They can be programmed to force a given reference frequency, or they can be 222set to zero and the next 3 bits can be used to set the reference frequency. 223The final bit selects the divider selection, which is 1 for FM and 0 for AM. 224The LM700x chips are used in 225.Xr az 4 226and 227.Xr rt 4 228cards. 229.Pp 230The TEA5757; TEA5759 is a 44-pin integrated AM/FM stereo radio circuit. 231The radio part is based on the TEA5712. 232The TEA5757 is used in FM-standards in which the local oscillator frequency 233is above the radio frequency (e.g. European and American standards). 234The TEA5759 is the version in which the oscillator frequency is below 235the radio frequency (e.g. Japanese standards). 236To conform with the Japanese standards, it is necessary to set the flags' least 237significant bit to 1. 238The TEA5757; TEA5759 has a 25-bit read-write shift register. 239The TEA5757 chips are used in 240.Xr gtp 4 , 241.Xr rtii 4 , 242.Xr sf2r 4 243and 244.Xr fms 4 245cards. 246.Pp 247The TC9216P, TC9217P and TC9217F are high speed PLL-LSI with built-in 2482 modulus prescaler. 249Each function is controlled through 3 serial bus lines (DATA, CLOCK and PERIOD) 250by the data setting to a pair of 24-bit registers, total of 48 bits. 251Address 8 bits and data 24 bits, total of 32 bits, are transferred in serial 252at the same time. 253The TC921x chips are used in 254.Xr sfr 4 255cards. 256.Sh FILES 257.Bl -tag -width /dev/radio -compact 258.It Pa /dev/radio 259.El 260.Sh SEE ALSO 261.Xr radioctl 1 , 262.Xr ioctl 2 , 263.Xr az 4 , 264.Xr bktr 4 , 265.Xr fms 4 , 266.Xr gtp 4 , 267.Xr intro 4 , 268.Xr rt 4 , 269.Xr rtii 4 , 270.Xr sf2r 4 , 271.Xr sfr 4 , 272.Xr udsbr 4 , 273.Xr radio 9 274.Sh HISTORY 275The 276.Nm 277device driver appeared in 278.Ox 3.0 . 279.Sh AUTHORS 280.An -nosplit 281The 282.Nm 283driver was written by 284.An Vladimir Popov Aq jumbo@narod.ru 285and 286.An Maxim Tsyplakov Aq tm@oganer.net . 287The man page was written by 288.An Vladimir Popov Aq jumbo@narod.ru . 289