summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-08-28 21:20:49 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-08-28 21:20:49 +0000
commit4fe86fbf743abca9dd1d480ecf51a352ecea4802 (patch)
tree1f6683838db7460699243598c864c4553e84de0e /sys
parent77cfe59dd06e0e167399b097c55a658e83667678 (diff)
update of radiotrack driver, including isapnp support; from jumbo@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/conf/GENERIC13
-rw-r--r--sys/dev/isa/files.isa8
-rw-r--r--sys/dev/isa/files.isapnp5
-rw-r--r--sys/dev/isa/pnpdevs4
-rw-r--r--sys/dev/isa/radiotrack.c314
-rw-r--r--sys/dev/isa/rt_isa.c97
-rw-r--r--sys/dev/isa/rt_isapnp.c69
-rw-r--r--sys/dev/isa/rtreg.h72
-rw-r--r--sys/dev/isa/rtvar.h53
9 files changed, 417 insertions, 218 deletions
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index 40a7b738499..7a0a01a1a0e 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.315 2002/07/24 22:47:11 deraadt Exp $
+# $OpenBSD: GENERIC,v 1.316 2002/08/28 21:20:48 mickey Exp $
# $NetBSD: GENERIC,v 1.48 1996/05/20 18:17:23 mrg Exp $
#
# GENERIC -- everything that's currently supported
@@ -465,17 +465,18 @@ bktr0 at pci? dev ? function ?
#sf2r0 at isa? port 0x384 # SoundForte RadioLink SF16-FMR2 FM Radio Card
#az0 at isa? port 0x350 # Aztech/PackardBell FM Radio Card
#rt0 at isa? port 0x30c # AIMS Lab Radiotrack FM Radio Card
+#rt* at isapnp?
#rtii0 at isa? port 0x30c # AIMS Lab Radiotrack II FM Radio Card
# FM-Radio support
radio* at bktr?
radio* at fms?
#radio* at gtp?
-#radio* at sfr0
-#radio* at sf2r0
-#radio* at az0
-#radio* at rt0
-#radio* at rtii0
+#radio* at sfr?
+#radio* at sf2r?
+#radio* at az?
+#radio* at rt?
+#radio* at rtii?
# Joystick driver. Probe is a little strange; add only if you have one.
#joy0 at isa? port 0x201
diff --git a/sys/dev/isa/files.isa b/sys/dev/isa/files.isa
index b5ea67c6b7b..5c1bba69cb7 100644
--- a/sys/dev/isa/files.isa
+++ b/sys/dev/isa/files.isa
@@ -1,4 +1,4 @@
-# $OpenBSD: files.isa,v 1.77 2002/05/06 16:37:43 mickey Exp $
+# $OpenBSD: files.isa,v 1.78 2002/08/28 21:20:48 mickey Exp $
# $NetBSD: files.isa,v 1.21 1996/05/16 03:45:55 mycroft Exp $
#
# Config file and device description for machine-independent ISA code.
@@ -355,8 +355,10 @@ file dev/isa/aztech.c az
# AIMS Lab Radiotrack & compatible
device rt: radiobus, lm700x
-attach rt at isa
-file dev/isa/radiotrack.c rt
+file dev/isa/radiotrack.c rt & (rt_isa | rt_isapnp)
+
+attach rt at isa with rt_isa
+file dev/isa/rt_isa.c rt_isa
# AIMS Lab Radiotrack II FM Radio Card
device rtii: radiobus, tea5757
diff --git a/sys/dev/isa/files.isapnp b/sys/dev/isa/files.isapnp
index 28a87962812..c78bb8eafbc 100644
--- a/sys/dev/isa/files.isapnp
+++ b/sys/dev/isa/files.isapnp
@@ -1,4 +1,4 @@
-# $OpenBSD: files.isapnp,v 1.23 2001/12/08 15:33:46 fgsch Exp $
+# $OpenBSD: files.isapnp,v 1.24 2002/08/28 21:20:48 mickey Exp $
# $NetBSD: files.isapnp,v 1.7 1997/10/16 17:16:36 matt Exp $
#
# Config file and device description for machine-independent ISAPnP code.
@@ -55,6 +55,9 @@ file dev/isa/if_ne_isapnp.c ne_isapnp
attach we at isapnp with we_isapnp
+attach rt at isapnp with rt_isapnp
+file dev/isa/rt_isapnp.c rt_isapnp
+
# Yamaha OPL3-SA3
device ym: audio, isa_dma, ad1848, auconv, midibus
attach ym at isapnp with ym_isapnp
diff --git a/sys/dev/isa/pnpdevs b/sys/dev/isa/pnpdevs
index 6d95f098935..79a3925da8f 100644
--- a/sys/dev/isa/pnpdevs
+++ b/sys/dev/isa/pnpdevs
@@ -1,4 +1,4 @@
-# $OpenBSD: pnpdevs,v 1.106 2002/01/02 19:41:11 mickey Exp $
+# $OpenBSD: pnpdevs,v 1.107 2002/08/28 21:20:48 mickey Exp $
#
# NOTE: All `com' devices also need pccom identifiers.
@@ -472,6 +472,8 @@ wss CDC0000 # OPL3-SAx Sound Board
ym @@@1001 # ALS100+
ym YMH0021 # OPL3-SA2 Sound Board
+rt MFRAD10 # FM Radio Tuner at Creative ViBRA16C PnP
+
wdc AZT0500 # AZT1008 PnP SOUND DEVICE (IDE CDROM DISAB)
wdc CSC0004 # CX4237B-SIDE CD (?)
wdc CTL2011 # Creative SB32 PnP (PNP0600)
diff --git a/sys/dev/isa/radiotrack.c b/sys/dev/isa/radiotrack.c
index a2534459bee..d8e72193e39 100644
--- a/sys/dev/isa/radiotrack.c
+++ b/sys/dev/isa/radiotrack.c
@@ -1,9 +1,9 @@
-/* $OpenBSD: radiotrack.c,v 1.3 2002/01/07 18:32:19 mickey Exp $ */
+/* $OpenBSD: radiotrack.c,v 1.4 2002/08/28 21:20:48 mickey Exp $ */
/* $RuOBSD: radiotrack.c,v 1.3 2001/10/18 16:51:36 pva Exp $ */
/*
- * Copyright (c) 2001 Maxim Tsyplakov <tm@oganer.net>,
- * Vladimir Popov <jumbo@narod.ru>
+ * Copyright (c) 2001, 2002 Maxim Tsyplakov <tm@oganer.net>,
+ * Vladimir Popov <jumbo@narod.ru>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,181 +35,137 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/device.h>
#include <sys/radioio.h>
#include <machine/bus.h>
-#include <dev/isa/isavar.h>
#include <dev/ic/lm700x.h>
+#include <dev/isa/isavar.h>
+#include <dev/isa/rtreg.h>
+#include <dev/isa/rtvar.h>
#include <dev/radio_if.h>
-#define RF_25K 25
-#define RF_50K 50
-#define RF_100K 100
-
-#define MAX_VOL 5 /* XXX Find real value */
-#define VOLUME_RATIO(x) (255 * x / MAX_VOL)
-
-#define RT_BASE_VALID(x) \
- ((x == 0x30C) || (x == 0x20C) || (x == 0x284) || (x == 0x384))
-
-#define CARD_RADIOTRACK 0x01
-#define CARD_SF16FMI 0x02
-#define CARD_UNKNOWN 0xFF
-
-#define RTRACK_CAPABILITIES RADIO_CAPS_DETECT_STEREO | \
- RADIO_CAPS_DETECT_SIGNAL | \
- RADIO_CAPS_SET_MONO | \
- RADIO_CAPS_REFERENCE_FREQ
-
-#define RT_WREN_ON (1 << 0)
-#define RT_WREN_OFF (0 << 0)
-
-#define RT_CLCK_ON (1 << 1)
-#define RT_CLCK_OFF (0 << 1)
-
-#define RT_DATA_ON (1 << 2)
-#define RT_DATA_OFF (0 << 2)
-
-#define RT_CARD_ON (1 << 3)
-#define RT_CARD_OFF (0 << 3)
-
-#define RT_SIGNAL_METER (1 << 4)
-#define RT_SIGNAL_METER_DELAY 150000
-
-#define RT_VOLUME_DOWN (1 << 6)
-#define RT_VOLUME_UP (2 << 6)
-#define RT_VOLUME_STEADY (3 << 6)
-#define RT_VOLUME_DELAY 100000
-
-int rt_probe(struct device *, void *, void *);
-void rt_attach(struct device *, struct device * self, void *);
+void rtattach(struct rt_softc *);
int rt_get_info(void *, struct radio_info *);
int rt_set_info(void *, struct radio_info *);
struct radio_hw_if rt_hw_if = {
- NULL, /* open */
- NULL, /* close */
+ NULL, /* open */
+ NULL, /* close */
rt_get_info,
rt_set_info,
NULL
};
-struct rt_softc {
- struct device sc_dev;
-
- int mute;
- u_int8_t vol;
- u_int8_t cardtype;
- u_int32_t freq;
- u_int32_t rf;
- u_int32_t stereo;
-
- struct lm700x_t lm;
-};
-
-struct cfattach rt_ca = {
- sizeof(struct rt_softc), rt_probe, rt_attach
-};
-
struct cfdriver rt_cd = {
NULL, "rt", DV_DULL
};
-int rt_find(bus_space_tag_t, bus_space_handle_t);
void rt_set_mute(struct rt_softc *, int);
void rt_set_freq(struct rt_softc *, u_int32_t);
u_int8_t rt_state(bus_space_tag_t, bus_space_handle_t);
+void sfi_lm700x_init(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
void rt_lm700x_init(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
void rt_lm700x_rset(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
u_int8_t rt_conv_vol(u_int8_t);
u_int8_t rt_unconv_vol(u_int8_t);
+void
+rtattach(struct rt_softc *sc) {
+ sc->sc_freq = MIN_FM_FREQ;
+ sc->sc_mute = 0;
+ sc->sc_vol = 0;
+ sc->sc_rf = LM700X_REF_050;
+ sc->sc_stereo = LM700X_STEREO;
+
+ sc->lm.wzcl = RT_WREN_ON | RT_CLCK_OFF | RT_DATA_OFF;
+ sc->lm.wzch = RT_WREN_ON | RT_CLCK_ON | RT_DATA_OFF;
+ sc->lm.wocl = RT_WREN_ON | RT_CLCK_OFF | RT_DATA_ON;
+ sc->lm.woch = RT_WREN_ON | RT_CLCK_ON | RT_DATA_ON;
+
+ switch (sc->sc_ct) {
+ case CARD_RADIOTRACK:
+ sc->lm.initdata = 0;
+ sc->lm.rsetdata = RT_SIGNAL_METER;
+ sc->lm.init = rt_lm700x_init;
+ sc->lm.rset = rt_lm700x_rset;
+ break;
+ case CARD_SF16FMI:
+ sc->lm.initdata = RT_CARD_OFF;
+ sc->lm.rsetdata = RT_CARD_ON;
+ sc->lm.init = sfi_lm700x_init;
+ sc->lm.rset = sfi_lm700x_init;
+ break;
+ }
+
+ rt_set_freq(sc, sc->sc_freq);
+ rt_set_mute(sc, sc->sc_vol);
+
+ radio_attach_mi(&rt_hw_if, sc, &sc->sc_dev);
+}
+
int
-rt_probe(struct device *parent, void *match, void *aux)
+rt_set_info(void *v, struct radio_info *ri)
{
- struct isa_attach_args *ia = aux;
- bus_space_tag_t iot = ia->ia_iot;
- bus_space_handle_t ioh;
- int iosize = 1, iobase = ia->ia_iobase;
-
- if (!RT_BASE_VALID(iobase)) {
- printf("rt: configured iobase 0x%x invalid\n", iobase);
- return (0);
- }
+ struct rt_softc *sc = v;
- if (bus_space_map(iot, iobase, iosize, 0, &ioh))
- return (0);
+ sc->sc_mute = ri->mute ? 1 : 0;
+ sc->sc_rf = lm700x_encode_ref(ri->rfreq);
- if (!rt_find(iot, ioh)) {
- bus_space_unmap(iot, ioh, iosize);
- return (0);
+ switch (sc->sc_ct) {
+ case CARD_RADIOTRACK:
+ sc->sc_vol = rt_conv_vol(ri->volume);
+ break;
+ case CARD_SF16FMI:
+ sc->sc_vol = ri->volume ? 1 : 0;
+ break;
}
+ /*
+ * Though SF16-FMI does not set stereo/mono
+ * it won't hurt to have this
+ */
+ sc->sc_stereo = ri->stereo ? LM700X_STEREO : LM700X_MONO;
+
+ rt_set_freq(sc, ri->freq);
+ rt_set_mute(sc, sc->sc_vol);
- bus_space_unmap(iot, ioh, iosize);
- ia->ia_iosize = iosize;
- return 1;
+ return (0);
}
-void
-rt_attach(struct device *parent, struct device *self, void *aux)
+int
+rt_get_info(void *v, struct radio_info *ri)
{
- struct rt_softc *sc = (void *) self;
- struct isa_attach_args *ia = aux;
-
- sc->lm.iot = ia->ia_iot;
- sc->rf = LM700X_REF_050;
- sc->stereo = LM700X_STEREO;
- sc->mute = 0;
- sc->freq = MIN_FM_FREQ;
- sc->vol = 0;
-
- /* remap I/O */
- if (bus_space_map(sc->lm.iot, ia->ia_iobase, ia->ia_iosize,
- 0, &sc->lm.ioh)) {
- printf(": bus_space_map() failed\n");
- return;
- }
+ struct rt_softc *sc = v;
- switch (sc->lm.iot) {
- case 0x20C:
- /* FALLTHROUGH */
- case 0x30C:
- sc->cardtype = CARD_RADIOTRACK;
- printf(": AIMS Lab Radiotrack or compatible\n");
+ switch (sc->sc_ct) {
+ case CARD_RADIOTRACK:
+ ri->caps = RTRACK_CAPABILITIES;
+ ri->info = 3 & rt_state(sc->lm.iot, sc->lm.ioh);
+ ri->volume = rt_unconv_vol(sc->sc_vol);
break;
- case 0x284:
- /* FALLTHROUGH */
- case 0x384:
- sc->cardtype = CARD_SF16FMI;
- printf(": SoundForte RadioX SF16-FMI\n");
+ case CARD_SF16FMI:
+ ri->caps = SF16FMI_CAPABILITIES;
+ ri->volume = sc->sc_vol ? 255 : 0;
+ ri->info = 0; /* UNSUPPORTED */
break;
default:
- sc->cardtype = CARD_UNKNOWN;
- printf(": Unknown card\n");
- break;
+ /* No such card */
+ return (1);
}
- /* Configure struct lm700x_t lm */
- sc->lm.offset = 0;
- sc->lm.wzcl = RT_WREN_ON | RT_CLCK_OFF | RT_DATA_OFF;
- sc->lm.wzch = RT_WREN_ON | RT_CLCK_ON | RT_DATA_OFF;
- sc->lm.wocl = RT_WREN_ON | RT_CLCK_OFF | RT_DATA_ON;
- sc->lm.woch = RT_WREN_ON | RT_CLCK_ON | RT_DATA_ON;
- sc->lm.initdata = 0;
- sc->lm.rsetdata = RT_DATA_ON | RT_CLCK_ON | RT_WREN_OFF;
- sc->lm.init = rt_lm700x_init;
- sc->lm.rset = rt_lm700x_rset;
+ ri->mute = sc->sc_mute;
+ ri->stereo = sc->sc_stereo == LM700X_STEREO ? 0 : 1;
+ ri->rfreq = lm700x_decode_ref(sc->sc_rf);
+ ri->freq = sc->sc_freq;
- rt_set_freq(sc, sc->freq);
+ /* UNSUPPORTED */
+ ri->lock = 0;
- radio_attach_mi(&rt_hw_if, sc, &sc->sc_dev);
+ return (0);
}
/*
@@ -220,7 +176,18 @@ rt_set_mute(struct rt_softc *sc, int vol)
{
int val;
- if (sc->mute) {
+ if (sc->sc_ct == CARD_UNKNOWN)
+ return;
+
+ if (sc->sc_ct == CARD_SF16FMI) {
+ val = vol ? RT_CARD_ON : RT_CARD_OFF;
+ bus_space_write_1(sc->lm.iot, sc->lm.ioh, 0,
+ sc->sc_mute ? RT_CARD_OFF : val);
+ return;
+ }
+
+ /* CARD_RADIOTRACK */
+ if (sc->sc_mute) {
bus_space_write_1(sc->lm.iot, sc->lm.ioh, 0,
RT_VOLUME_DOWN | RT_CARD_ON);
DELAY(MAX_VOL * RT_VOLUME_DELAY);
@@ -229,7 +196,7 @@ rt_set_mute(struct rt_softc *sc, int vol)
bus_space_write_1(sc->lm.iot, sc->lm.ioh, 0, RT_CARD_OFF);
bus_space_write_1(sc->lm.iot, sc->lm.ioh, 0, RT_CARD_OFF);
} else {
- val = sc->vol - vol;
+ val = sc->sc_vol - vol;
if (val < 0) {
val *= -1;
bus_space_write_1(sc->lm.iot, sc->lm.ioh, 0,
@@ -254,14 +221,14 @@ rt_set_freq(struct rt_softc *sc, u_int32_t nfreq)
if (nfreq < MIN_FM_FREQ)
nfreq = MIN_FM_FREQ;
- sc->freq = nfreq;
+ sc->sc_freq = nfreq;
- reg = lm700x_encode_freq(nfreq, sc->rf);
- reg |= sc->stereo | sc->rf | LM700X_DIVIDER_FM;
+ reg = lm700x_encode_freq(nfreq, sc->sc_rf);
+ reg |= sc->sc_stereo | sc->sc_rf | LM700X_DIVIDER_FM;
lm700x_hardware_write(&sc->lm, reg, RT_VOLUME_STEADY);
- rt_set_mute(sc, sc->vol);
+ rt_set_mute(sc, sc->sc_vol);
}
/*
@@ -288,7 +255,7 @@ rt_state(bus_space_tag_t iot, bus_space_handle_t ioh)
ret = RADIO_INFO_SIGNAL;
break;
}
-
+
return ret;
}
@@ -319,43 +286,11 @@ rt_unconv_vol(u_int8_t vol)
return VOLUME_RATIO(vol);
}
-int
-rt_find(bus_space_tag_t iot, bus_space_handle_t ioh)
+void
+sfi_lm700x_init(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off,
+ u_int32_t data)
{
- struct rt_softc sc;
-#if 0
- u_int i, scanres = 0;
-#endif
-
- sc.lm.iot = iot;
- sc.lm.ioh = ioh;
- sc.lm.offset = 0;
- sc.lm.wzcl = RT_WREN_ON | RT_CLCK_OFF | RT_DATA_OFF;
- sc.lm.wzch = RT_WREN_ON | RT_CLCK_ON | RT_DATA_OFF;
- sc.lm.wocl = RT_WREN_ON | RT_CLCK_OFF | RT_DATA_ON;
- sc.lm.woch = RT_WREN_ON | RT_CLCK_ON | RT_DATA_ON;
- sc.lm.initdata = 0;
- sc.lm.rsetdata = RT_SIGNAL_METER;
- sc.lm.init = rt_lm700x_init;
- sc.lm.rset = rt_lm700x_rset;
- sc.rf = LM700X_REF_050;
- sc.mute = 0;
- sc.stereo = LM700X_STEREO;
- sc.vol = 0;
-
- /*
- * Scan whole FM range. If there is a card it'll
- * respond on some frequency.
- */
- return 0;
-#if 0
- for (i = MIN_FM_FREQ; !scanres && i < MAX_FM_FREQ; i += 10) {
- rt_set_freq(&sc, i);
- scanres += rt_state(iot, ioh);
- }
-
- return scanres;
-#endif
+ bus_space_write_1(iot, ioh, off, data);
}
void
@@ -375,38 +310,3 @@ rt_lm700x_rset(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off,
DELAY(50000);
bus_space_write_1(iot, ioh, off, RT_VOLUME_STEADY | RT_CARD_ON | data);
}
-
-int
-rt_set_info(void *v, struct radio_info *ri)
-{
- struct rt_softc *sc = v;
-
- sc->mute = ri->mute ? 1 : 0;
- sc->vol = rt_conv_vol(ri->volume);
- sc->stereo = ri->stereo ? LM700X_STEREO : LM700X_MONO;
- sc->rf = lm700x_encode_ref(ri->rfreq);
-
- rt_set_freq(sc, ri->freq);
- rt_set_mute(sc, sc->vol);
-
- return (0);
-}
-
-int
-rt_get_info(void *v, struct radio_info *ri)
-{
- struct rt_softc *sc = v;
-
- ri->mute = sc->mute;
- ri->volume = rt_unconv_vol(sc->vol);
- ri->stereo = sc->stereo == LM700X_STEREO ? 0 : 1;
- ri->caps = RTRACK_CAPABILITIES;
- ri->rfreq = lm700x_decode_ref(sc->rf);
- ri->info = 3 & rt_state(sc->lm.iot, sc->lm.ioh);
- ri->freq = sc->freq;
-
- /* UNSUPPORTED */
- ri->lock = 0;
-
- return (0);
-}
diff --git a/sys/dev/isa/rt_isa.c b/sys/dev/isa/rt_isa.c
new file mode 100644
index 00000000000..c2c7894564c
--- /dev/null
+++ b/sys/dev/isa/rt_isa.c
@@ -0,0 +1,97 @@
+/* $OpenBSD: rt_isa.c,v 1.1 2002/08/28 21:20:48 mickey Exp $ */
+
+/*
+ * Copyright (c) 2001, 2002 Maxim Tsyplakov <tm@oganer.net>,
+ * Vladimir Popov <jumbo@narod.ru>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* ISA interface for AIMS Lab Radiotrack FM Radio Card device driver */
+
+/*
+ * Sanyo LM7000 Direct PLL Frequency Synthesizer
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+
+#include <dev/ic/lm700x.h>
+#include <dev/isa/isavar.h>
+#include <dev/isa/rtreg.h>
+#include <dev/isa/rtvar.h>
+
+int rt_isa_probe(struct device *, void *, void *);
+void rt_isa_attach(struct device *, struct device *, void *);
+
+struct cfattach rt_isa_ca = {
+ sizeof(struct rt_softc), rt_isa_probe, rt_isa_attach
+};
+
+int
+rt_isa_probe(struct device *parent, void *match, void *aux)
+{
+ struct isa_attach_args *ia = aux;
+ bus_space_handle_t ioh;
+ int iosize = 1;
+
+ if (!RT_BASE_VALID(ia->ia_iobase)) {
+ printf("rt: wrong iobase 0x%x\n", ia->ia_iobase);
+ return (0);
+ }
+
+ if (bus_space_map(ia->ia_iot, ia->ia_iobase, iosize, 0, &ioh))
+ return (0);
+
+ /* This doesn't work yet */
+ bus_space_unmap(ia->ia_iot, ioh, iosize);
+ return (0);
+#if 0
+ ia->ia_iosize = iosize;
+ return 1;
+#endif /* 0 */
+}
+
+void
+rt_isa_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct rt_softc *sc = (void *) self;
+ struct isa_attach_args *ia = aux;
+ bus_space_handle_t ioh;
+
+ /* remap I/O */
+ if (bus_space_map(ia->ia_iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) {
+ printf(": bus_space_map() failed\n");
+ return;
+ }
+
+ printf(": AIMS Lab Radiotrack or compatible\n");
+
+ sc->sc_ct = CARD_RADIOTRACK;
+ sc->lm.iot = ia->ia_iot;
+ sc->lm.ioh = ioh;
+
+ rtattach(sc);
+}
diff --git a/sys/dev/isa/rt_isapnp.c b/sys/dev/isa/rt_isapnp.c
new file mode 100644
index 00000000000..8290eb1e777
--- /dev/null
+++ b/sys/dev/isa/rt_isapnp.c
@@ -0,0 +1,69 @@
+/* $OpenBSD: rt_isapnp.c,v 1.1 2002/08/28 21:20:48 mickey Exp $ */
+
+/*
+ * Copyright (c) 2001, 2002 Maxim Tsyplakov <tm@oganer.net>,
+ * Vladimir Popov <jumbo@narod.ru>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* ISAPnP interface for AIMS Lab Radiotrack FM Radio Card device driver */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+
+#include <dev/ic/lm700x.h>
+#include <dev/isa/isavar.h>
+#include <dev/isa/rtreg.h>
+#include <dev/isa/rtvar.h>
+
+int rt_isapnp_probe(struct device *, void *, void *);
+void rt_isapnp_attach(struct device *, struct device *, void *);
+
+struct cfattach rt_isapnp_ca = {
+ sizeof(struct rt_softc), rt_isapnp_probe, rt_isapnp_attach
+};
+
+int
+rt_isapnp_probe(struct device *parent, void *match, void *aux)
+{
+ /* Always there */
+ return (1);
+}
+
+void
+rt_isapnp_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct rt_softc *sc = (void *)self;
+ struct isa_attach_args *ia = aux;
+
+ printf(": SF16-FMI\n");
+
+ sc->sc_ct = CARD_SF16FMI;
+ sc->lm.iot = ia->ia_iot;
+ sc->lm.ioh = ia->ipa_io[0].h; /* ia_ioh */
+
+ rtattach(sc);
+}
diff --git a/sys/dev/isa/rtreg.h b/sys/dev/isa/rtreg.h
new file mode 100644
index 00000000000..3171d1e2406
--- /dev/null
+++ b/sys/dev/isa/rtreg.h
@@ -0,0 +1,72 @@
+/* $OpenBSD: rtreg.h,v 1.1 2002/08/28 21:20:48 mickey Exp $ */
+
+/*
+ * Copyright (c) 2001, 2002 Maxim Tsyplakov <tm@oganer.net>,
+ * Vladimir Popov <jumbo@narod.ru>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* AIMS Lab Radiotrack FM Radio Card device driver */
+
+#ifndef _RTREG_H_
+#define _RTREG_H_
+
+#include <dev/isa/rtvar.h>
+
+#define RF_25K 25
+#define RF_50K 50
+#define RF_100K 100
+
+#define MAX_VOL 5 /* XXX Find real value */
+#define VOLUME_RATIO(x) (255 * x / MAX_VOL)
+
+#define RT_BASE_VALID(x) ((x == 0x20C) || (x == 0x30C))
+
+#define CARD_RADIOTRACK 0
+#define CARD_SF16FMI 1
+#define CARD_UNKNOWN -1
+
+#define RTRACK_CAPABILITIES RADIO_CAPS_DETECT_STEREO | \
+ RADIO_CAPS_DETECT_SIGNAL | \
+ RADIO_CAPS_SET_MONO | \
+ RADIO_CAPS_REFERENCE_FREQ
+
+#define SF16FMI_CAPABILITIES RADIO_CAPS_REFERENCE_FREQ
+
+#define RT_WREN_ON (1 << 0)
+#define RT_WREN_OFF (0 << 0)
+#define RT_CLCK_ON (1 << 1)
+#define RT_CLCK_OFF (0 << 1)
+#define RT_DATA_ON (1 << 2)
+#define RT_DATA_OFF (0 << 2)
+#define RT_CARD_ON (1 << 3)
+#define RT_CARD_OFF (0 << 3)
+#define RT_SIGNAL_METER (1 << 4)
+#define RT_VOLUME_DOWN (1 << 6)
+#define RT_VOLUME_UP (2 << 6)
+#define RT_VOLUME_STEADY (3 << 6)
+
+#define RT_SIGNAL_METER_DELAY 150000
+#define RT_VOLUME_DELAY 100000
+
+#endif /* _RTREG_H_ */
diff --git a/sys/dev/isa/rtvar.h b/sys/dev/isa/rtvar.h
new file mode 100644
index 00000000000..b481caa3454
--- /dev/null
+++ b/sys/dev/isa/rtvar.h
@@ -0,0 +1,53 @@
+/* $OpenBSD: rtvar.h,v 1.1 2002/08/28 21:20:48 mickey Exp $ */
+
+/*
+ * Copyright (c) 2001, 2002 Maxim Tsyplakov <tm@oganer.net>,
+ * Vladimir Popov <jumbo@narod.ru>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* AIMS Lab Radiotrack FM Radio Card device driver */
+
+/*
+ * Sanyo LM7000 Direct PLL Frequency Synthesizer
+ */
+
+#ifndef _RTVAR_H_
+#define _RTVAR_H_
+
+struct rt_softc {
+ struct device sc_dev;
+
+ int sc_ct; /* card type */
+ int sc_mute;
+ u_int8_t sc_vol;
+ u_int32_t sc_freq;
+ u_int32_t sc_rf;
+ u_int32_t sc_stereo;
+
+ struct lm700x_t lm;
+};
+
+void rtattach(struct rt_softc *);
+
+#endif /* _RTVAR_H_ */