Contiki 3.x
sfr-bits.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, George Oikonomou - <oikonomou@users.sourceforge.net>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * This file is part of the Contiki operating system.
30  */
31 
32 /**
33  * \file
34  * Header file with definitions of bit masks for some cc2530 SFRs
35  *
36  * \author
37  * George Oikonomou - <oikonomou@users.sourceforge.net>
38  */
39 
40 
41 #ifndef SFR_BITS_H_
42 #define SFR_BITS_H_
43 
44 /* CLKCON */
45 #define CLKCONCMD_OSC32K 0x80
46 #define CLKCONCMD_OSC 0x40
47 #define CLKCONCMD_TICKSPD2 0x20
48 #define CLKCONCMD_TICKSPD1 0x10
49 #define CLKCONCMD_TICKSPD0 0x08
50 #define CLKCONCMD_CLKSPD2 0x04
51 #define CLKCONCMD_CLKSPD1 0x02
52 #define CLKCONCMD_CLKSPD0 0x01
53 
54 /* SLEEPCMD and SLEEPSTA */
55 #define SLEEP_OSC32K_CALDIS 0x80
56 #define SLEEP_XOSC_STB 0x40
57 #define SLEEP_HFRC_STB 0x20
58 #define SLEEP_RST1 0x10 /* SLEEPSTA only */
59 #define SLEEP_RST0 0x08 /* SLEEPSTA only */
60 #define SLEEP_OSC_PD 0x04
61 #define SLEEP_MODE1 0x02
62 #define SLEEP_MODE0 0x01
63 
64 /* PCON */
65 #define PCON_IDLE 0x01
66 
67 /* T1CTL */
68 #define T1CTL_DIV1 0x08
69 #define T1CTL_DIV0 0x04
70 #define T1CTL_MODE1 0x02
71 #define T1CTL_MODE0 0x01
72 
73 /* T1CCTLx */
74 #define T1CCTL_RFIRQ 0x80
75 #define T1CCTL_IM 0x40
76 #define T1CCTL_CMP2 0x20
77 #define T1CCTL_CMP1 0x10
78 #define T1CCTL_CMP0 0x08
79 #define T1CCTL_MODE 0x04
80 #define T1CCTL_CAP1 0x02
81 #define T1CCTL_CAP0 0x01
82 
83 /* T1STAT */
84 #define T1STAT_OVFIF 0x20
85 #define T1STAT_CH4IF 0x10
86 #define T1STAT_CH3IF 0x08
87 #define T1STAT_CH2IF 0x04
88 #define T1STAT_CH1IF 0x02
89 #define T1STAT_CH0IF 0x01
90 
91 /* WDCTL */
92 #define WDCTL_CLR3 0x80
93 #define WDCTL_CLR2 0x40
94 #define WDCTL_CLR1 0x20
95 #define WDCTL_CLR0 0x10
96 #define WDCTL_MODE1 0x08
97 #define WDCTL_MODE0 0x04
98 #define WDCTL_INT1 0x02
99 #define WDCTL_INT0 0x01
100 
101 /* ADCCON1 */
102 #define ADCCON1_EOC 0x80
103 #define ADCCON1_ST 0x40
104 #define ADCCON1_STSEL1 0x20
105 #define ADCCON1_STSEL0 0x10
106 /* ADCCON1 - RNG bits */
107 #define ADCCON1_RCTRL1 0x08
108 #define ADCCON1_RCTRL0 0x04
109 
110 /* ADCCON3 */
111 #define ADCCON3_EREF1 0x80
112 #define ADCCON3_EREF0 0x40
113 #define ADCCON3_EDIV1 0x20
114 #define ADCCON3_EDIV0 0x10
115 #define ADCCON3_ECH3 0x08
116 #define ADCCON3_ECH2 0x04
117 #define ADCCON3_ECH1 0x02
118 #define ADCCON3_ECH0 0x01
119 
120 /* PERCFG */
121 #define PERCFG_T1CFG 0x40
122 #define PERCFG_T3CFG 0x20
123 #define PERCFG_T4CFG 0x10
124 #define PERCFG_U1CFG 0x02
125 #define PERCFG_U0CFG 0x01
126 
127 /* UxCSR */
128 #define UCSR_MODE 0x80
129 #define UCSR_RE 0x40
130 #define UCSR_SLAVE 0x20
131 #define UCSR_FE 0x10
132 #define UCSR_ERR 0x08
133 #define UCSR_RX_BYTE 0x04
134 #define UCSR_TX_BYTE 0x02
135 #define UCSR_ACTIVE 0x01
136 
137 /* IEN2 */
138 #define IEN2_WDTIE 0x20
139 #define IEN2_P1IE 0x10
140 #define IEN2_UTX1IE 0x08
141 #define IEN2_UTX0IE 0x04
142 #define IEN2_P2IE 0x02
143 #define IEN2_RFIE 0x01
144 
145 /* PICTL */
146 #define PICTL_PADSC 0x40
147 #define PICTL_P2ICON 0x08
148 #define PICTL_P1ICONH 0x04
149 #define PICTL_P1ICONL 0x02
150 #define PICTL_P0ICON 0x01
151 
152 /* DMAARM */
153 #define DMAARM_ABORT 0x80
154 #define DMAARM_DMAARM4 0x10
155 #define DMAARM_DMAARM3 0x08
156 #define DMAARM_DMAARM2 0x04
157 #define DMAARM_DMAARM1 0x02
158 #define DMAARM_DMAARM0 0x01
159 
160 /* DMAREQ */
161 #define DMAREQ_DMAREQ4 0x10
162 #define DMAREQ_DMAREQ3 0x08
163 #define DMAREQ_DMAREQ2 0x04
164 #define DMAREQ_DMAREQ1 0x02
165 #define DMAREQ_DMAREQ0 0x01
166 
167 /* DMAIRQ */
168 #define DMAIRQ_DMAIF4 0x10
169 #define DMAIRQ_DMAIF3 0x08
170 #define DMAIRQ_DMAIF2 0x04
171 #define DMAIRQ_DMAIF1 0x02
172 #define DMAIRQ_DMAIF0 0x01
173 /*---------------------------------------------------------------------------
174  * XREG bits, excluding RF and USB
175  *---------------------------------------------------------------------------*/
176 /* FCTL */
177 #define FCTL_BUSY 0x80
178 #define FCTL_FULL 0x40
179 #define FCTL_ABORT 0x20
180 #define FCTL_CM1 0x08
181 #define FCTL_CM0 0x04
182 #define FCTL_WRITE 0x02
183 #define FCTL_ERASE 0x01
184 /*---------------------------------------------------------------------------
185  * Radio Register Bits
186  *---------------------------------------------------------------------------*/
187 /* FRMFILT0 */
188 #define FRMFILT0_FRAME_FILTER_EN 0x01
189 
190 /* FRMCTRL0 */
191 #define FRMCTRL0_APPEND_DATA_MODE 0x80
192 #define FRMCTRL0_AUTOCRC 0x40
193 #define FRMCTRL0_AUTOACK 0x20
194 #define FRMCTRL0_ENERGY_SCAN 0x10
195 #define FRMCTRL0_RX_MODE1 0x08
196 #define FRMCTRL0_RX_MODE0 0x04
197 #define FRMCTRL0_TX_MODE1 0x02
198 #define FRMCTRL0_TX_MODE0 0x01
199 
200 /* FRMCTRL1 */
201 #define FRMCTRL1_PENDING_OR 0x04
202 #define FRMCTRL1_IGNORE_TX_UNDERF 0x02
203 #define FRMCTRL1_SET_RXENMASK_ON_TX 0x01
204 
205 /* FSMSTAT1 */
206 #define FSMSTAT1_FIFO 0x80
207 #define FSMSTAT1_FIFOP 0x40
208 #define FSMSTAT1_SFD 0x20
209 #define FSMSTAT1_CCA 0x10
210 #define FSMSTAT1_TX_ACTIVE 0x02
211 #define FSMSTAT1_RX_ACTIVE 0x01
212 
213 /* RSSISTAT */
214 #define RSSISTAT_RSSI_VALID 0x01
215 
216 /* RFRND */
217 #define RFRND_QRND 0x02
218 #define RFRND_IRND 0x01
219 
220 #endif /* SFR_BITS_H_ */