summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-12-06 16:28:19 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-12-06 16:28:19 +0000
commit28ae66b9a2e7158c31273f41ec6ac2ea2eca46cd (patch)
tree4161ac92e3dc91108cec0bf39a2869473a2ea31c /sys
parent2f3d61a50f6d9ef08f2fb12745a98dabf3fdfc84 (diff)
update the radio chipset support
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/lm700x.c60
-rw-r--r--sys/dev/ic/lm700x.h28
-rw-r--r--sys/dev/ic/tea5757.c60
-rw-r--r--sys/dev/ic/tea5757.h26
4 files changed, 100 insertions, 74 deletions
diff --git a/sys/dev/ic/lm700x.c b/sys/dev/ic/lm700x.c
index 45a09182f2a..e622b67ba52 100644
--- a/sys/dev/ic/lm700x.c
+++ b/sys/dev/ic/lm700x.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm700x.c,v 1.1 2001/10/04 19:46:46 gluk Exp $ */
+/* $OpenBSD: lm700x.c,v 1.2 2001/12/06 16:28:18 mickey Exp $ */
/*
* Copyright (c) 2001 Vladimir Popov <jumbo@narod.ru>
@@ -27,38 +27,42 @@
/* Implementation of most common lm700x routines */
+/*
+ * Sanyo LM7001 Direct PLL Frequency Synthesizer
+ * ??? See http://www.redsword.com/tjacobs/geeb/fmcard.htm
+ *
+ * The LM7001J and LM7001JM (used in Aztech/PackardBell cards) are PLL
+ * frequency synthesizer LSIs for tuners. These LSIs are software compatible
+ * with LM7000 (used in Radiotrack, Radioreveal RA300, some Mediaforte cards),
+ * but do not include an IF calculation circuit.
+ *
+ * The FM VCO circuit includes a high-speed programmable divider that can
+ * divide directly.
+ *
+ * Features:
+ * Seven reference frequencies: 1, 5, 9, 10, 25, 50, and 100 kHz;
+ * Band-switching outputs (3 bits);
+ * Controller clock output (400 kHz);
+ * Serial input circuit for data input (using the CE, CL and DATA pins).
+ *
+ * The LM7001J and LM7001JM have a 24-bit shift register.
+ */
+
#include <sys/param.h>
#include <sys/radioio.h>
#include <dev/ic/lm700x.h>
-u_long
-lm700x_encode_freq(u_long nfreq, u_long rf)
+u_int32_t
+lm700x_encode_freq(u_int32_t nfreq, u_int32_t rf)
{
- u_char ref_freq;
-
- switch (rf) {
- case LM700X_REF_100:
- ref_freq = 100;
- break;
- case LM700X_REF_025:
- ref_freq = 25;
- break;
- case LM700X_REF_050:
- /* FALLTHROUGH */
- default:
- ref_freq = 50;
- break;
- }
-
nfreq += IF_FREQ;
- nfreq /= ref_freq;
-
+ nfreq /= lm700x_decode_ref(rf);
return nfreq;
}
void
-lm700x_hardware_write(struct lm700x_t *lm, u_long data, u_long addon)
+lm700x_hardware_write(struct lm700x_t *lm, u_int32_t data, u_int32_t addon)
{
int i;
@@ -88,10 +92,10 @@ lm700x_hardware_write(struct lm700x_t *lm, u_long data, u_long addon)
lm->rset(lm->iot, lm->ioh, lm->offset, lm->rsetdata | addon);
}
-u_long
-lm700x_encode_ref(u_char rf)
+u_int32_t
+lm700x_encode_ref(u_int8_t rf)
{
- u_long ret;
+ u_int32_t ret;
if (rf < 36)
ret = LM700X_REF_025;
@@ -103,10 +107,10 @@ lm700x_encode_ref(u_char rf)
return ret;
}
-u_char
-lm700x_decode_ref(u_long rf)
+u_int8_t
+lm700x_decode_ref(u_int32_t rf)
{
- u_char ret;
+ u_int8_t ret;
switch (rf) {
case LM700X_REF_100:
diff --git a/sys/dev/ic/lm700x.h b/sys/dev/ic/lm700x.h
index 4afab020242..5ca70936251 100644
--- a/sys/dev/ic/lm700x.h
+++ b/sys/dev/ic/lm700x.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: lm700x.h,v 1.1 2001/10/04 19:46:46 gluk Exp $ */
-/* $RuOBSD: lm700x.h,v 1.3 2001/10/04 19:25:39 gluk Exp $ */
+/* $OpenBSD: lm700x.h,v 1.2 2001/12/06 16:28:18 mickey Exp $ */
+/* $RuOBSD: lm700x.h,v 1.2 2001/10/18 16:51:36 pva Exp $ */
/*
* Copyright (c) 2001 Vladimir Popov <jumbo@narod.ru>
@@ -60,20 +60,20 @@ struct lm700x_t {
bus_space_handle_t ioh;
bus_size_t offset;
- u_long wzcl; /* write zero clock low */
- u_long wzch; /* write zero clock high */
- u_long wocl; /* write one clock low */
- u_long woch; /* write one clock high */
- u_long initdata;
- u_long rsetdata;
+ u_int32_t wzcl; /* write zero clock low */
+ u_int32_t wzch; /* write zero clock high */
+ u_int32_t wocl; /* write one clock low */
+ u_int32_t woch; /* write one clock high */
+ u_int32_t initdata;
+ u_int32_t rsetdata;
- void (*init)(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_long);
- void (*rset)(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_long);
+ void (*init)(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
+ void (*rset)(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
};
-u_long lm700x_encode_freq(u_long, u_long);
-u_long lm700x_encode_ref(u_char);
-u_char lm700x_decode_ref(u_long);
-void lm700x_hardware_write(struct lm700x_t *, u_long, u_long);
+u_int32_t lm700x_encode_freq(u_int32_t, u_int32_t);
+u_int32_t lm700x_encode_ref(u_int8_t);
+u_int8_t lm700x_decode_ref(u_int32_t);
+void lm700x_hardware_write(struct lm700x_t *, u_int32_t, u_int32_t);
#endif /* _LM700X_H_ */
diff --git a/sys/dev/ic/tea5757.c b/sys/dev/ic/tea5757.c
index cb9aae00a0d..3a2be1c0e17 100644
--- a/sys/dev/ic/tea5757.c
+++ b/sys/dev/ic/tea5757.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tea5757.c,v 1.1 2001/10/04 19:46:46 gluk Exp $ */
+/* $OpenBSD: tea5757.c,v 1.2 2001/12/06 16:28:18 mickey Exp $ */
/*
* Copyright (c) 2001 Vladimir Popov <jumbo@narod.ru>
@@ -27,6 +27,30 @@
/* Implementation of most common TEA5757 routines */
+/*
+ * Philips TEA5757H Self Tuned Radio
+ * http://www.semiconductors.philips.com/pip/TEA5757H
+ *
+ * The TEA5757; TEA5759 is a 44-pin integrated AM/FM stereo radio circuit.
+ * The radio part is based on the TEA5712.
+ *
+ * The TEA5757 is used in FM-standards in which the local oscillator
+ * frequency is above the radio frequency (e.g. European and American
+ * standards). The TEA5759 is the version in which the oscillator frequency
+ * is below the radio frequency (e.g. Japanese standard).
+ *
+ * The TEA5757; TEA5759 radio has a bus which consists of three wires:
+ * BUS-CLOCK: software driven clock input
+ * DATA: data input/output
+ * WRITE-ENABLE: write/read input
+ *
+ * The TEA5757; TEA5759 has a 25-bit shift register.
+ *
+ * The chips are used in Radiotrack II, Guillemot Maxi Radio FM 2000,
+ * Gemtek PCI cards and most Mediaforte FM tuners and sound cards with
+ * integrated FM tuners.
+ */
+
#include <sys/param.h>
#include <sys/radioio.h>
@@ -35,8 +59,8 @@
/*
* Convert frequency to hardware representation
*/
-u_long
-tea5757_encode_freq(u_long freq)
+u_int32_t
+tea5757_encode_freq(u_int32_t freq)
{
#ifdef RADIO_TEA5759
freq -= IF_FREQ;
@@ -54,8 +78,8 @@ tea5757_encode_freq(u_long freq)
/*
* Convert frequency from hardware representation
*/
-u_long
-tea5757_decode_freq(u_long freq)
+u_int32_t
+tea5757_decode_freq(u_int32_t freq)
{
freq &= TEA5757_FREQ;
freq *= 125; /* 12.5 kHz */
@@ -72,9 +96,9 @@ tea5757_decode_freq(u_long freq)
* Hardware search
*/
void
-tea5757_search(struct tea5757_t *tea, u_long stereo, u_long lock, int dir)
+tea5757_search(struct tea5757_t *tea, u_int32_t stereo, u_int32_t lock, int dir)
{
- u_long reg;
+ u_int32_t reg;
u_int co = 0;
reg = stereo | lock | TEA5757_SEARCH_START;
@@ -90,7 +114,7 @@ tea5757_search(struct tea5757_t *tea, u_long stereo, u_long lock, int dir)
}
void
-tea5757_hardware_write(struct tea5757_t *tea, u_long data)
+tea5757_hardware_write(struct tea5757_t *tea, u_int32_t data)
{
int i = TEA5757_REGISTER_LENGTH;
@@ -105,10 +129,10 @@ tea5757_hardware_write(struct tea5757_t *tea, u_long data)
tea->rset(tea->iot, tea->ioh, tea->offset, 0);
}
-u_long
-tea5757_set_freq(struct tea5757_t *tea, u_long stereo, u_long lock, u_long freq)
+u_int32_t
+tea5757_set_freq(struct tea5757_t *tea, u_int32_t stereo, u_int32_t lock, u_int32_t freq)
{
- u_long data = 0ul;
+ u_int32_t data = 0ul;
if (freq < MIN_FM_FREQ)
freq = MIN_FM_FREQ;
@@ -121,10 +145,10 @@ tea5757_set_freq(struct tea5757_t *tea, u_long stereo, u_long lock, u_long freq)
return freq;
}
-u_long
-tea5757_encode_lock(u_char lock)
+u_int32_t
+tea5757_encode_lock(u_int8_t lock)
{
- u_long ret;
+ u_int32_t ret;
if (lock < 8)
ret = TEA5757_S005;
@@ -138,10 +162,10 @@ tea5757_encode_lock(u_char lock)
return ret;
}
-u_char
-tea5757_decode_lock(u_long lock)
+u_int8_t
+tea5757_decode_lock(u_int32_t lock)
{
- u_char ret;
+ u_int8_t ret = 150;
switch (lock) {
case TEA5757_S005:
@@ -154,8 +178,6 @@ tea5757_decode_lock(u_long lock)
ret = 30;
break;
case TEA5757_S150:
- /* FALLTHROUGH */
- default:
ret = 150;
break;
}
diff --git a/sys/dev/ic/tea5757.h b/sys/dev/ic/tea5757.h
index a9aca55dcf2..0b1aa349fdb 100644
--- a/sys/dev/ic/tea5757.h
+++ b/sys/dev/ic/tea5757.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: tea5757.h,v 1.1 2001/10/04 19:46:46 gluk Exp $ */
-/* $RuOBSD: tea5757.h,v 1.5 2001/10/04 18:51:50 pva Exp $ */
+/* $OpenBSD: tea5757.h,v 1.2 2001/12/06 16:28:18 mickey Exp $ */
+/* $RuOBSD: tea5757.h,v 1.2 2001/10/18 16:51:36 pva Exp $ */
/*
* Copyright (c) 2001 Vladimir Popov <jumbo@narod.ru>
@@ -67,22 +67,22 @@ struct tea5757_t {
bus_size_t offset;
void (*init)(bus_space_tag_t, bus_space_handle_t, bus_size_t,
- u_long); /* init value */
+ u_int32_t); /* init value */
void (*rset)(bus_space_tag_t, bus_space_handle_t, bus_size_t,
- u_long); /* reset value */
+ u_int32_t); /* reset value */
void (*write_bit)(bus_space_tag_t, bus_space_handle_t, bus_size_t,
- u_char); /* the bit */
- u_long (*read)(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+ int); /* the bit */
+ u_int32_t (*read)(bus_space_tag_t, bus_space_handle_t, bus_size_t);
};
-u_long tea5757_encode_freq(u_long);
-u_long tea5757_decode_freq(u_long);
-u_long tea5757_encode_lock(u_char);
-u_char tea5757_decode_lock(u_long);
+u_int32_t tea5757_encode_freq(u_int32_t);
+u_int32_t tea5757_decode_freq(u_int32_t);
+u_int32_t tea5757_encode_lock(u_int8_t);
+u_int8_t tea5757_decode_lock(u_int32_t);
-u_long tea5757_set_freq(struct tea5757_t *, u_long, u_long, u_long);
-void tea5757_search(struct tea5757_t *, u_long, u_long, int);
+u_int32_t tea5757_set_freq(struct tea5757_t *, u_int32_t, u_int32_t, u_int32_t);
+void tea5757_search(struct tea5757_t *, u_int32_t, u_int32_t, int);
-void tea5757_hardware_write(struct tea5757_t *, u_long);
+void tea5757_hardware_write(struct tea5757_t *, u_int32_t);
#endif /* _TEA5757_H_ */