[BACK]Return to lm700x.h CVS log [TXT][DIR] Up to [local] / sys / dev / ic

Annotation of sys/dev/ic/lm700x.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: lm700x.h,v 1.2 2001/12/06 16:28:18 mickey Exp $       */
        !             2: /* $RuOBSD: lm700x.h,v 1.2 2001/10/18 16:51:36 pva Exp $ */
        !             3:
        !             4: /*
        !             5:  * Copyright (c) 2001 Vladimir Popov <jumbo@narod.ru>
        !             6:  * All rights reserved.
        !             7:  *
        !             8:  * Redistribution and use in source and binary forms, with or without
        !             9:  * modification, are permitted provided that the following conditions
        !            10:  * are met:
        !            11:  * 1. Redistributions of source code must retain the above copyright
        !            12:  *    notice, this list of conditions and the following disclaimer.
        !            13:  * 2. Redistributions in binary form must reproduce the above copyright
        !            14:  *    notice, this list of conditions and the following disclaimer in the
        !            15:  *    documentation and/or other materials provided with the distribution.
        !            16:  *
        !            17:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
        !            18:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
        !            19:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
        !            20:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
        !            21:  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
        !            22:  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
        !            23:  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
        !            24:  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
        !            25:  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
        !            26:  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            27:  */
        !            28:
        !            29: #ifndef _LM700X_H_
        !            30: #define _LM700X_H_
        !            31:
        !            32: #include <sys/types.h>
        !            33:
        !            34: #include <machine/bus.h>
        !            35:
        !            36: #define LM700X_REGISTER_LENGTH 24
        !            37:
        !            38: #define LM700X_DATA_MASK       0xFFC000
        !            39: #define LM700X_FREQ_MASK       0x003FFF
        !            40:
        !            41: #define LM700X_FREQ(x)         (x << 0)        /* 0x003FFF */
        !            42: #define LM700X_LSI(x)          (x << 14)       /* 0x00C000 */ /* always zero */
        !            43: #define LM700X_BAND(x)         (x << 16)       /* 0x070000 */
        !            44: #define                LM700X_STEREO   LM700X_BAND(3)
        !            45: #define                LM700X_MONO     LM700X_BAND(1)
        !            46: #define LM700X_TIME_BASE(x)    (x << 19)       /* 0x080000 */ /* always zero */
        !            47: #define LM700X_REF_FREQ(x)     (x << 20)       /* 0x700000 */
        !            48: #define                LM700X_REF_100  LM700X_REF_FREQ(0)
        !            49: #define                LM700X_REF_025  LM700X_REF_FREQ(2)
        !            50: #define                LM700X_REF_050  LM700X_REF_FREQ(4)
        !            51: /* The rest is for an AM band */
        !            52:
        !            53: #define LM700X_DIVIDER_AM      (0 << 23)       /* 0x000000 */
        !            54: #define LM700X_DIVIDER_FM      (1 << 23)       /* 0x800000 */
        !            55:
        !            56: #define LM700X_WRITE_DELAY     6               /* 6 microseconds */
        !            57:
        !            58: struct lm700x_t {
        !            59:        bus_space_tag_t iot;
        !            60:        bus_space_handle_t      ioh;
        !            61:        bus_size_t      offset;
        !            62:
        !            63:        u_int32_t       wzcl;   /* write zero clock low */
        !            64:        u_int32_t       wzch;   /* write zero clock high */
        !            65:        u_int32_t       wocl;   /* write one clock low */
        !            66:        u_int32_t       woch;   /* write one clock high */
        !            67:        u_int32_t       initdata;
        !            68:        u_int32_t       rsetdata;
        !            69:
        !            70:        void (*init)(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
        !            71:        void (*rset)(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
        !            72: };
        !            73:
        !            74: u_int32_t      lm700x_encode_freq(u_int32_t, u_int32_t);
        !            75: u_int32_t      lm700x_encode_ref(u_int8_t);
        !            76: u_int8_t       lm700x_decode_ref(u_int32_t);
        !            77: void   lm700x_hardware_write(struct lm700x_t *, u_int32_t, u_int32_t);
        !            78:
        !            79: #endif /* _LM700X_H_ */

CVSweb