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