xref: /netbsd-src/sys/dev/ic/si470x_reg.h (revision 8068bca8feeaeb824a1a9d522786a989cbdb8b10)
1 /*	$NetBSD: si470x_reg.h,v 1.1 2013/01/13 01:15:02 jakllsch Exp $ */
2 
3 /*
4  * Copyright (c) 2012 Jonathan A. Kollasch
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  * 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 _DEV_IC_SI470X_REG_H_
30 #define _DEV_IC_SI470X_REG_H_
31 
32 #define __BIT16(x)		((uint16_t)__BIT(x))
33 #define __BITS16(x, y)		((uint16_t)__BITS((x), (y)))
34 
35 #define SI470X_DEVICEID		0x00
36 #define SI470X_PN		__BITS16(15, 12)
37 #define SI470X_MFGID		__BITS16(11, 0)
38 
39 #define SI470X_CHIPID		0x01
40 #define SI470X_REV		__BITS16(15, 10)
41 #define SI470X_DEV		__BITS16(9, 6)
42 #define SI470X_FIRMWARE		__BITS16(5, 0)
43 
44 #define SI470X_POWERCFG		0x02
45 #define SI470X_DSMUTE		__BIT16(15)
46 #define SI470X_DMUTE		__BIT16(14)
47 #define SI470X_MONO		__BIT16(13)
48 #define SI470X_RDSM		__BIT16(11)
49 #define SI470X_SKMODE		__BIT16(10)
50 #define SI470X_SEEKUP		__BIT16(9)
51 #define SI470X_SEEK		__BIT16(8)
52 #define SI470X_DISABLE		__BIT16(6)
53 #define SI470X_ENABLE		__BIT16(0)
54 
55 #define SI470X_CHANNEL		0x03
56 #define SI470X_TUNE		__BIT16(15)
57 #define SI470X_CHAN		__BITS16(9, 0)
58 
59 #define SI470X_SYSCONFIG1	0x04
60 #define SI470X_RDSIEN		__BIT16(15)
61 #define SI470X_STCIEN		__BIT16(14)
62 #define SI470X_RDS		__BIT16(12)
63 #define SI470X_DE		__BIT16(11)
64 #define SI470X_AGCD		__BIT16(10)
65 #define SI470X_BLNDADJ		__BITS16(7, 6)
66 #define SI470X_GPIO3		__BITS16(5, 4)
67 #define SI470X_GPIO2		__BITS16(3, 2)
68 #define SI470X_GPIO1		__BITS16(1, 0)
69 
70 #define SI470X_SYSCONFIG2	0x05
71 #define SI470X_SEEKTH		__BITS16(15, 8)
72 #define SI470X_BAND		__BITS16(7, 6)
73 #define SI470X_SPACE		__BITS16(5, 4)
74 #define SI470X_VOLUME		__BITS16(3, 0)
75 
76 #define SI470X_SYSCONFIG3	0x06
77 #define SI470X_SMUTER		__BITS16(15, 14)
78 #define SI470X_SMUTEA		__BITS16(13, 12)
79 #define SI470X_VOLEXT		__BIT16(8)
80 #define SI470X_SKSNR		__BITS16(7, 4)
81 #define SI470X_SKCNT		__BITS16(3, 0)
82 
83 #define SI470X_TEST1		0x07
84 #define SI470X_XOSCEN		__BIT16(15)
85 #define SI470X_AHIZEN		__BIT16(14)
86 
87 #define SI470X_TEST2		0x08
88 
89 #define SI470X_BOOTCONFIG	0x09
90 
91 #define SI470X_STATUSRSSI	0x0a
92 #define SI470X_RDSR		__BIT16(15)
93 #define SI470X_STC		__BIT16(14)
94 #define SI470X_SF_BL		__BIT16(13)
95 #define SI470X_AFCRL		__BIT16(12)
96 #define SI470X_RDSS		__BIT16(11)
97 #define SI470X_BLERA		__BITS16(9, 10)
98 #define SI470X_ST		__BIT16(8)
99 #define SI470X_RSSI		__BITS16(7, 0)
100 
101 #define SI470X_READCHANNEL	0x0b
102 #define SI470X_BLERB		__BITS16(15, 14)
103 #define SI470X_BLERC		__BITS16(13, 12)
104 #define SI470X_BLERD		__BITS16(11, 10)
105 #define SI470X_READCHAN		__BITS16(9, 0)
106 
107 #define SI470X_RDSA		0x0c
108 #define SI470X_RDSB		0x0d
109 #define SI470X_RDSC		0x0e
110 #define SI470X_RDSD		0x0f
111 
112 #endif /* _DEV_IC_SI470X_REG_H_ */
113