From: jsg Date: Tue, 8 Mar 2022 00:13:19 +0000 (+0000) Subject: remove files used by isa radio drivers removed in 2016 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3be736e830f4a97214a5ba2b782429c3ea05d2b5;p=openbsd remove files used by isa radio drivers removed in 2016 lm700x: az, rt tc921x: sfr pt2254a: sfr, sf2r --- diff --git a/sys/conf/files b/sys/conf/files index 57af5b5b476..7df604d4b6e 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.712 2022/03/07 23:40:53 jsg Exp $ +# $OpenBSD: files,v 1.713 2022/03/08 00:13:19 jsg Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -28,9 +28,6 @@ define firmload # radio device attributes define tea5757 -define lm700x -define tc921x -define pt2254a device video attach video at video @@ -653,9 +650,6 @@ file dev/firmload.c firmload file dev/ic/dp8390.c dp8390nic file dev/ic/rtl80x9.c rtl80x9 file dev/ic/tea5757.c tea5757 -file dev/ic/lm700x.c lm700x -file dev/ic/tc921x.c tc921x -file dev/ic/pt2254a.c pt2254a file dev/midi.c midi | midibus needs-flag file dev/mulaw.c audio needs-flag file dev/vnd.c vnd needs-flag diff --git a/sys/dev/ic/lm700x.c b/sys/dev/ic/lm700x.c deleted file mode 100644 index 259cfb976f3..00000000000 --- a/sys/dev/ic/lm700x.c +++ /dev/null @@ -1,129 +0,0 @@ -/* $OpenBSD: lm700x.c,v 1.3 2007/05/22 04:14:03 jsg Exp $ */ - -/* - * Copyright (c) 2001 Vladimir Popov - * 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 AUTHOR ``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 AUTHOR 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. - */ - -/* Implementation of most common lm700x routines */ - -/* - * Sanyo LM7001 Direct PLL Frequency Synthesizer - * - * 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 -#include - -#include - -u_int32_t -lm700x_encode_freq(u_int32_t nfreq, u_int32_t rf) -{ - nfreq += IF_FREQ; - nfreq /= lm700x_decode_ref(rf); - return nfreq; -} - -void -lm700x_hardware_write(struct lm700x_t *lm, u_int32_t data, u_int32_t addon) -{ - int i; - - lm->init(lm->iot, lm->ioh, lm->offset, lm->rsetdata | addon); - - for (i = 0; i < LM700X_REGISTER_LENGTH; i++) - if (data & (1 << i)) { - bus_space_write_1(lm->iot, lm->ioh, lm->offset, - lm->wocl | addon); - DELAY(LM700X_WRITE_DELAY); - bus_space_write_1(lm->iot, lm->ioh, lm->offset, - lm->woch | addon); - DELAY(LM700X_WRITE_DELAY); - bus_space_write_1(lm->iot, lm->ioh, lm->offset, - lm->wocl | addon); - } else { - bus_space_write_1(lm->iot, lm->ioh, lm->offset, - lm->wzcl | addon); - DELAY(LM700X_WRITE_DELAY); - bus_space_write_1(lm->iot, lm->ioh, lm->offset, - lm->wzch | addon); - DELAY(LM700X_WRITE_DELAY); - bus_space_write_1(lm->iot, lm->ioh, lm->offset, - lm->wzcl | addon); - } - - lm->rset(lm->iot, lm->ioh, lm->offset, lm->rsetdata | addon); -} - -u_int32_t -lm700x_encode_ref(u_int8_t rf) -{ - u_int32_t ret; - - if (rf < 36) - ret = LM700X_REF_025; - else if (rf > 35 && rf < 75) - ret = LM700X_REF_050; - else - ret = LM700X_REF_100; - - return ret; -} - -u_int8_t -lm700x_decode_ref(u_int32_t rf) -{ - u_int8_t ret; - - switch (rf) { - case LM700X_REF_100: - ret = 100; - break; - case LM700X_REF_025: - ret = 25; - break; - case LM700X_REF_050: - /* FALLTHROUGH */ - default: - ret = 50; - break; - } - - return ret; -} diff --git a/sys/dev/ic/lm700x.h b/sys/dev/ic/lm700x.h deleted file mode 100644 index 5ca70936251..00000000000 --- a/sys/dev/ic/lm700x.h +++ /dev/null @@ -1,79 +0,0 @@ -/* $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 - * 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 AUTHOR ``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 AUTHOR 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. - */ - -#ifndef _LM700X_H_ -#define _LM700X_H_ - -#include - -#include - -#define LM700X_REGISTER_LENGTH 24 - -#define LM700X_DATA_MASK 0xFFC000 -#define LM700X_FREQ_MASK 0x003FFF - -#define LM700X_FREQ(x) (x << 0) /* 0x003FFF */ -#define LM700X_LSI(x) (x << 14) /* 0x00C000 */ /* always zero */ -#define LM700X_BAND(x) (x << 16) /* 0x070000 */ -#define LM700X_STEREO LM700X_BAND(3) -#define LM700X_MONO LM700X_BAND(1) -#define LM700X_TIME_BASE(x) (x << 19) /* 0x080000 */ /* always zero */ -#define LM700X_REF_FREQ(x) (x << 20) /* 0x700000 */ -#define LM700X_REF_100 LM700X_REF_FREQ(0) -#define LM700X_REF_025 LM700X_REF_FREQ(2) -#define LM700X_REF_050 LM700X_REF_FREQ(4) -/* The rest is for an AM band */ - -#define LM700X_DIVIDER_AM (0 << 23) /* 0x000000 */ -#define LM700X_DIVIDER_FM (1 << 23) /* 0x800000 */ - -#define LM700X_WRITE_DELAY 6 /* 6 microseconds */ - -struct lm700x_t { - bus_space_tag_t iot; - bus_space_handle_t ioh; - bus_size_t offset; - - 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_int32_t); - void (*rset)(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t); -}; - -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/pt2254a.c b/sys/dev/ic/pt2254a.c deleted file mode 100644 index 7428c43197d..00000000000 --- a/sys/dev/ic/pt2254a.c +++ /dev/null @@ -1,93 +0,0 @@ -/* $OpenBSD: pt2254a.c,v 1.1 2002/04/25 04:56:59 mickey Exp $ */ -/* - * Copyright (c) 2002 Vladimir Popov . - * - * 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 AUTHOR ``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 AUTHOR 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. - */ -/* - * Princeton Technology Corp.'s Electronic Volume Controller IC PT2254A - * http://www.princeton.com.tw - * - * PT2254A is an electronic volume controller IC utilizing CMOS Technology - * specially designed for use in audio equipment. It has two built-in - * channels making it highly suitable for mono and stereo sound applications. - * Through the specially designated signals that are applied externally to - * the data, clock and strobe input pins, PT2254A can control attenuation - * and channel balance. - */ - -#include - -#include - -u_int32_t -pt2254a_encode_volume(u_int8_t *current, u_int8_t max) { - u_int32_t ret = 0ul; - u_int8_t vol, tens, ones; - int steps; - - /* - * Volume management is done nonlinear. - * - * Approximate the curve with three lines: - * low volume: y = - (48 /(max/3)) * x + 68 - * middle volume: y = - (14 /(max/3)) * x + 34 - * high volume: y = - (6 /(max/3)) * x + 18 - */ - if (*current > 0 && *current <= max / 3) { - vol = PT2254A_MAX_ATTENUATION - (144 * (int)(*current) / max); - } else if (*current > max / 3 && *current <= 2 * max / 3) { - vol = 34 - (42 * (int)(*current) / max); - } else if (*current > 2 * max / 3) { - vol = 18 - (18 * (int)(*current) / max); - } else vol = PT2254A_MAX_ATTENUATION; - - /* Report adjusted volume */ - /* *current = max - (vol * max / PT2254A_MAX_ATTENUATION); */ - steps = *current * PT2254A_MAX_ATTENUATION / max; - *current = steps * max / PT2254A_MAX_ATTENUATION; - - tens = vol / 10; - ones = vol - tens * 10; - - ret = PT2254A_ATTENUATION_MAJOR(tens) | PT2254A_ATTENUATION_MINOR(ones); - - return ret; -} - -u_int32_t -pt2254a_compose_register(u_int32_t lvol, u_int32_t rvol, int left, int right) { - u_int32_t ret = 0ul; - - if (left == USE_CHANNEL) { - ret |= PT2254A_LEFT_CHANNEL; - ret |= lvol; - } - if (right == USE_CHANNEL) { - ret |= PT2254A_RIGHT_CHANNEL; - ret |= rvol; - } - - ret |= PT2254A_ZERO_PADDING; - ret |= PT2254A_EMPTY_BIT; - - return ret; -} diff --git a/sys/dev/ic/pt2254a.h b/sys/dev/ic/pt2254a.h deleted file mode 100644 index 7c1bb6247df..00000000000 --- a/sys/dev/ic/pt2254a.h +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: pt2254a.h,v 1.1 2002/04/25 04:56:59 mickey Exp $ */ -/* - * Copyright (c) 2002 Vladimir Popov . - * - * 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 AUTHOR ``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 AUTHOR 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. - */ -/* - * Princeton Technology Corp.'s Electronic Volume Controller IC PT2254A - * http://www.princeton.com.tw - * - * PT2254A is an electronic volume controller IC utilizing CMOS Technology - * specially designed for use in audio equipment. It has two built-in - * channels making it highly suitable for mono and stereo sound applications. - * Through the specially designated signals that are applied externally to - * the data, clock and strobe input pins, PT2254A can control attenuation - * and channel balance. - */ - -#ifndef _PT2254A_H_ -#define _PT2254A_H_ - -#define PT2254A_MAX_ATTENUATION 68 -#define PT2254A_ATTENUATION_STEPS 35 - -#define PT2254A_REGISTER_LENGTH 18 - -#define PT2254A_ATTENUATION_MAJOR_0dB (1 << 0) -#define PT2254A_ATTENUATION_MAJOR_10dB (1 << 1) -#define PT2254A_ATTENUATION_MAJOR_20dB (1 << 2) -#define PT2254A_ATTENUATION_MAJOR_30dB (1 << 3) -#define PT2254A_ATTENUATION_MAJOR_40dB (1 << 4) -#define PT2254A_ATTENUATION_MAJOR_50dB (1 << 5) -#define PT2254A_ATTENUATION_MAJOR_60dB (1 << 6) -#define PT2254A_ATTENUATION_MAJOR(x) (1 << x) - -#define PT2254A_ATTENUATION_MINOR_0dB (1 << 7) -#define PT2254A_ATTENUATION_MINOR_2dB (1 << 8 -#define PT2254A_ATTENUATION_MINOR_4dB (1 << 9) -#define PT2254A_ATTENUATION_MINOR_6dB (1 << 10) -#define PT2254A_ATTENUATION_MINOR_8dB (1 << 11) -#define PT2254A_ATTENUATION_MINOR(x) (1 << (7 + x / 2)) - -#define PT2254A_EMPTY_BIT (0 << 12) - -#define PT2254A_BOTH_CHANNELS (3 << 13) -#define PT2254A_LEFT_CHANNEL (1 << 13) -#define PT2254A_RIGHT_CHANNEL (1 << 14) - -#define PT2254A_ZERO_PADDING (0 << 15) - -#define USE_CHANNEL 1 - -u_int32_t pt2254a_encode_volume(u_int8_t *, u_int8_t); -u_int32_t pt2254a_compose_register(u_int32_t, u_int32_t, int, int); - -#endif /* _PT2254A_H_ */ diff --git a/sys/dev/ic/tc921x.c b/sys/dev/ic/tc921x.c deleted file mode 100644 index e5ea22f89de..00000000000 --- a/sys/dev/ic/tc921x.c +++ /dev/null @@ -1,172 +0,0 @@ -/* $OpenBSD: tc921x.c,v 1.3 2007/05/22 04:14:03 jsg Exp $ */ - -/* - * Copyright (c) 2001, 2002 Vladimir Popov . - * - * 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 AUTHOR ``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 AUTHOR 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. - */ -/* - * Toshiba's High Speed PLL for DTS - * - * TC9216P, TC9217P, TC9217F are a high speed PLL-LSI with built-in 2 modulus - * prescaler. Each function is controlled through 3 serial bus lines and high - * performance digital tuning system can be constituted. - * - * Each function is controlled by the data setting to a pair of 24-bit - * registers. Each data of these registers is exchanged with controller side - * by 3 serial lines of DATA, CLOCK and PERIOD. - * - * 8 address bits and 24 data bits, total 32 bits, are transferred thru - * serial port. - * - * Input data is latched to the first and second input registers at the fall - * of PERIOD signal and each function is activated. - * - * Each output data is latched to output register in parallel at the fall - * timing of the 9th of CLOCK signal and can be received serially over the - * DATA line. Serial data of DATA, CLOCK and PERIOD is synchronized with - * crystal oscillation clock and tacken into the internal circuit of LSI. - * Thus, if crystal oscillator is stopped, serial data can not be input. - */ - -#include -#include - -#include - -#define PL_CL_DL(c) ((0 << c->period) | (0 << c->clock) | (0 << c->data)) -#define PL_CL_DH(c) ((0 << c->period) | (0 << c->clock) | (1 << c->data)) -#define PL_CH_DL(c) ((0 << c->period) | (1 << c->clock) | (0 << c->data)) -#define PL_CH_DH(c) ((0 << c->period) | (1 << c->clock) | (1 << c->data)) - -#define PH_CL_DL(c) ((1 << c->period) | (0 << c->clock) | (0 << c->data)) -#define PH_CL_DH(c) ((1 << c->period) | (0 << c->clock) | (1 << c->data)) -#define PH_CH_DL(c) ((1 << c->period) | (1 << c->clock) | (0 << c->data)) -#define PH_CH_DH(c) ((1 << c->period) | (1 << c->clock) | (1 << c->data)) - -#define PERIOD_LOW 0 -#define PERIOD_HIGH 1 - -static void __tc921x_write_burst(unsigned int, u_int32_t, struct tc921x_t *, int); -static u_int32_t __tc921x_read_burst(unsigned int, struct tc921x_t *); - -u_int32_t -tc921x_encode_freq(u_int32_t freq) { - /* Normalize incoming frequency */ - if (freq < MIN_FM_FREQ) - freq = MIN_FM_FREQ; - if (freq > MAX_FM_FREQ) - freq = MAX_FM_FREQ; - - return (freq + IF_FREQ)/10; -} - -u_int32_t -tc921x_decode_freq(u_int32_t reg) { - return (reg & TC921X_D0_FREQ_DIVIDER) * 10 - IF_FREQ; -} - -u_int32_t -tc921x_read_addr(struct tc921x_t *c, u_int8_t addr) { - u_int32_t ret; - - /* Finish previous transmission - PERIOD HIGH, CLOCK HIGH, DATA HIGH */ - bus_space_write_1(c->iot, c->ioh, c->offset, PH_CH_DH(c)); - /* Start transmission - PERIOD LOW, CLOCK HIGH, DATA HIGH */ - bus_space_write_1(c->iot, c->ioh, c->offset, PL_CH_DH(c)); - - /* - * Period must be low when the register address transmission starts. - * Period must be high when the register data transmission starts. - * Do the switch in the middle of the address transmission. - */ - __tc921x_write_burst(4, addr, c, PERIOD_LOW); - __tc921x_write_burst(4, addr >> 4, c, PERIOD_HIGH); - - /* Reading data from the register */ - ret = __tc921x_read_burst(TC921X_REGISTER_LENGTH, c); - - /* End of transmission - PERIOD goes LOW then HIGH */ - bus_space_write_1(c->iot, c->ioh, c->offset, PL_CH_DH(c)); - bus_space_write_1(c->iot, c->ioh, c->offset, PH_CH_DH(c)); - - return ret; -} - -void -tc921x_write_addr(struct tc921x_t *c, u_int8_t addr, u_int32_t reg) { - /* Finish previous transmission - PERIOD HIGH, CLOCK HIGH, DATA HIGH */ - bus_space_write_1(c->iot, c->ioh, c->offset, PH_CH_DH(c)); - /* Start transmission - PERIOD LOW, CLOCK HIGH, DATA HIGH */ - bus_space_write_1(c->iot, c->ioh, c->offset, PL_CH_DH(c)); - - /* - * Period must be low when the register address transmission starts. - * Period must be high when the register data transmission starts. - * Do the switch in the middle of the address transmission. - */ - __tc921x_write_burst(4, addr, c, PERIOD_LOW); - __tc921x_write_burst(4, addr >> 4, c, PERIOD_HIGH); - - /* Writing data to the register */ - __tc921x_write_burst(TC921X_REGISTER_LENGTH, reg, c, 1); - - /* End of transmission - PERIOD goes LOW then HIGH */ - bus_space_write_1(c->iot, c->ioh, c->offset, PL_CH_DH(c)); - bus_space_write_1(c->iot, c->ioh, c->offset, PH_CH_DH(c)); -} - -static void -__tc921x_write_burst(unsigned int length, u_int32_t data, struct tc921x_t *c, int p) { - int i; - u_int8_t cldh, chdh, cldl, chdl; - - cldh = p == PERIOD_LOW ? PL_CL_DH(c) : PH_CL_DH(c); - chdh = p == PERIOD_LOW ? PL_CH_DH(c) : PH_CH_DH(c); - cldl = p == PERIOD_LOW ? PL_CL_DL(c) : PH_CL_DL(c); - chdl = p == PERIOD_LOW ? PL_CH_DL(c) : PH_CH_DL(c); - - for (i = 0; i < length; i++) - if (data & (1 << i)) { - bus_space_write_1(c->iot, c->ioh, c->offset, cldh); - bus_space_write_1(c->iot, c->ioh, c->offset, chdh); - } else { - bus_space_write_1(c->iot, c->ioh, c->offset, cldl); - bus_space_write_1(c->iot, c->ioh, c->offset, chdl); - } -} - -static u_int32_t -__tc921x_read_burst(unsigned int length, struct tc921x_t *c) { - unsigned int i; - u_int32_t ret = 0ul; - -#define DATA_ON (1 << c->data) - - for (i = 0; i < length; i++) { - bus_space_write_1(c->iot, c->ioh, c->offset, PH_CL_DH(c)); - bus_space_write_1(c->iot, c->ioh, c->offset, PH_CH_DH(c)); - ret |= bus_space_read_1(c->iot, c->ioh, c->offset) & DATA_ON ? - (1 << i) : (0 << i); - } - - return ret; -} diff --git a/sys/dev/ic/tc921x.h b/sys/dev/ic/tc921x.h deleted file mode 100644 index cfa12076a98..00000000000 --- a/sys/dev/ic/tc921x.h +++ /dev/null @@ -1,111 +0,0 @@ -/* $OpenBSD: tc921x.h,v 1.3 2007/05/22 04:14:03 jsg Exp $ */ - -/* - * Copyright (c) 2001, 2002 Vladimir Popov . - * - * 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 AUTHOR ``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 AUTHOR 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. - */ -/* - * Toshiba's High Speed PLL for DTS - * - * TC9216P, TC9217P, TC9217F are a high speed PLL-LSI with built-in 2 modulus - * prescaler. Each function is controlled through 3 serial bus lines and high - * performance digital tuning system can be constituted. - * - */ - -#ifndef _TC921X_H_ -#define _TC921X_H_ - -#include - -#include - -#define TC921X_REGISTER_LENGTH 24 - -/* Input Register at 0xD0 */ -#define TC921X_D0_FREQ_DIVIDER 0xFFFF - -/* (*) are only available at 4.5 MHz crystal resonator used */ -#define TC921X_D0_REF_FREQ_500_HZ (0x0 << 16) -#define TC921X_D0_REF_FREQ_1_KHZ (0x1 << 16) -#define TC921X_D0_REF_FREQ_2P5_KHZ (0x2 << 16) -#define TC921X_D0_REF_FREQ_3_KHZ (0x3 << 16) -#define TC921X_D0_REF_FREQ_3P125_KHZ (0x4 << 16) -#define TC921X_D0_REF_FREQ_3PXXX_KHZ (0x5 << 16) /* (*) */ -#define TC921X_D0_REF_FREQ_5_KHZ (0x6 << 16) -#define TC921X_D0_REF_FREQ_6P25_KHZ (0x7 << 16) -#define TC921X_D0_REF_FREQ_7PXXX_KHZ (0x8 << 16) /* (*) */ -#define TC921X_D0_REF_FREQ_9_KHZ (0x9 << 16) -#define TC921X_D0_REF_FREQ_10_KHZ (0xA << 16) -#define TC921X_D0_REF_FREQ_12P5_KHZ (0xB << 16) -#define TC921X_D0_REF_FREQ_25_KHZ (0xC << 16) -#define TC921X_D0_REF_FREQ_50_KHZ (0xD << 16) -#define TC921X_D0_REF_FREQ_100_KHZ (0xE << 16) -#define TC921X_D0_REF_FREQ_NOT_USED (0xF << 16) - -#define TC921X_D0_DIRECT_DIVIDING_MODE (0 << 20) -#define TC921X_D0_PULSE_SWALLOW_HF_MODE (2 << 20) -#define TC921X_D0_PULSE_SWALLOW_FM_MODE (1 << 20) -#define TC921X_D0_HALF_PULSE_SWALLOW_MODE (3 << 20) - -#define TC921X_D0_OSC_7POINT2_MHZ (1 << 22) -#define TC921X_D0_OSC_4POINT5_MHZ (0 << 22) - -#define TC921X_D0_OUT_CONTROL_ON (1 << 23) -#define TC921X_D0_OUT_CONTROL_OFF (0 << 23) - -/* Input Register at 0xD2 */ -#define TC921X_D2_GATE_TIME(x) (x << 0) -#define TC921X_D2_GATE_TIME_1MS TC921X_D2_GATE_TIME(0) -#define TC921X_D2_GATE_TIME_4MS TC921X_D2_GATE_TIME(1) -#define TC921X_D2_GATE_TIME_16MS TC921X_D2_GATE_TIME(2) -#define TC921X_D2_GATE_TIME_MANUAL TC921X_D2_GATE_TIME(3) - -#define TC921X_D2_COUNTER_MODE(x) (x << 2) - -#define TC921X_D2_COUNTER_INPUT_SC (1 << 5) -#define TC921X_D2_COUNTER_INPUT_HFC (1 << 6) -#define TC921X_D2_COUNTER_INPUT_LFC (1 << 7) - -#define TC921X_D2_START_BIT (1 << 8) -#define TC921X_D2_TEST_BIT (1 << 9) - -#define TC921X_D2_IO_PORT(x) (x << 10) -#define TC921X_D2_IO_PORT_OUTPUT(x) (x << 15) -#define TC921X_D2_IO_PORT_INPUT(x) (x << 19) - -struct tc921x_t { - bus_space_tag_t iot; - bus_space_handle_t ioh; - bus_size_t offset; - - u_int8_t period; - u_int8_t clock; - u_int8_t data; -}; - -void tc921x_write_addr(struct tc921x_t *, u_int8_t, u_int32_t); -u_int32_t tc921x_read_addr(struct tc921x_t *, u_int8_t); -u_int32_t tc921x_encode_freq(u_int32_t); -u_int32_t tc921x_decode_freq(u_int32_t); - -#endif /* _TC921X_H_ */