1 /*-------------------------------------------------------------------------
2 Register Declarations for the ChipCon CC1111 Processor Range
4 Copyright © 2008 Keith Packard <keithp@keithp.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 Adapted from the Cygnal C8051F12x config file which is:
22 Copyright (C) 2003 - Maarten Brock, sourceforge.brock@dse.nl
24 This library is free software; you can redistribute it and/or
25 modify it under the terms of the GNU Lesser General Public
26 License as published by the Free Software Foundation; either
27 version 2.1 of the License, or (at your option) any later version.
29 This library is distributed in the hope that it will be useful,
30 but WITHOUT ANY WARRANTY; without even the implied warranty of
31 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32 Lesser General Public License for more details.
34 You should have received a copy of the GNU Lesser General Public
35 License along with this library; if not, write to the Free Software
36 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
37 -------------------------------------------------------------------------*/
44 __sfr __at 0xA8 IEN0; /* Interrupt Enable 0 Register */
46 __sbit __at 0xA8 RFTXRXIE; /* RF TX/RX done interrupt enable */
47 __sbit __at 0xA9 ADCIE; /* ADC interrupt enable */
48 __sbit __at 0xAA URX0IE; /* USART0 RX interrupt enable */
49 __sbit __at 0xAB URX1IE; /* USART1 RX interrupt enable (shared with I2S RX) */
50 __sbit __at 0xAB I2SRXIE; /* I2S RX interrupt enable (shared with USART1 RX) */
51 __sbit __at 0xAC ENCIE; /* AES encryption/decryption interrupt enable */
52 __sbit __at 0xAD STIE; /* Sleep Timer interrupt enable */
53 __sbit __at 0xAF EA; /* Enable All */
55 #define IEN0_EA (1 << 7)
56 #define IEN0_STIE (1 << 5)
57 #define IEN0_ENCIE (1 << 4)
58 #define IEN0_URX1IE (1 << 3)
59 #define IEN0_I2SRXIE (1 << 3)
60 #define IEN0_URX0IE (1 << 2)
61 #define IEN0_ADCIE (1 << 1)
62 #define IEN0_RFTXRXIE (1 << 0)
64 __sfr __at 0xB8 IEN1; /* Interrupt Enable 1 Register */
66 #define IEN1_P0IE (1 << 5) /* Port 0 interrupt enable */
67 #define IEN1_T4IE (1 << 4) /* Timer 4 interrupt enable */
68 #define IEN1_T3IE (1 << 3) /* Timer 3 interrupt enable */
69 #define IEN1_T2IE (1 << 2) /* Timer 2 interrupt enable */
70 #define IEN1_T1IE (1 << 1) /* Timer 1 interrupt enable */
71 #define IEN1_DMAIE (1 << 0) /* DMA transfer interrupt enable */
74 __sfr __at 0x9A IEN2; /* Interrupt Enable 2 Register */
76 #define IEN2_WDTIE (1 << 5) /* Watchdog timer interrupt enable */
77 #define IEN2_P1IE (1 << 4) /* Port 1 interrupt enable */
78 #define IEN2_UTX1IE (1 << 3) /* USART1 TX interrupt enable */
79 #define IEN2_I2STXIE (1 << 3) /* I2S TX interrupt enable */
80 #define IEN2_UTX0IE (1 << 2) /* USART0 TX interrupt enable */
81 #define IEN2_P2IE (1 << 1) /* Port 2 interrupt enable */
82 #define IEN2_USBIE (1 << 1) /* USB interrupt enable */
83 #define IEN2_RFIE (1 << 0) /* RF general interrupt enable */
86 __sfr __at 0xC6 CLKCON; /* Clock Control */
88 #define CLKCON_OSC32K_RC (1 << 7)
89 #define CLKCON_OSC32K_XTAL (0 << 7)
90 #define CLKCON_OSC32K_MASK (1 << 7)
91 #define CLKCON_OSC_RC (1 << 6)
92 #define CLKCON_OSC_XTAL (0 << 6)
93 #define CLKCON_OSC_MASK (1 << 6)
94 #define CLKCON_TICKSPD_MASK (7 << 3)
95 # define CLKCON_TICKSPD_1 (0 << 3)
96 # define CLKCON_TICKSPD_1_2 (1 << 3)
97 # define CLKCON_TICKSPD_1_4 (2 << 3)
98 # define CLKCON_TICKSPD_1_8 (3 << 3)
99 # define CLKCON_TICKSPD_1_16 (4 << 3)
100 # define CLKCON_TICKSPD_1_32 (5 << 3)
101 # define CLKCON_TICKSPD_1_64 (6 << 3)
102 # define CLKCON_TICKSPD_1_128 (7 << 3)
104 #define CLKCON_CLKSPD_MASK (7 << 0)
105 # define CLKCON_CLKSPD_1 (0 << 0)
106 # define CLKCON_CLKSPD_1_2 (1 << 0)
107 # define CLKCON_CLKSPD_1_4 (2 << 0)
108 # define CLKCON_CLKSPD_1_8 (3 << 0)
109 # define CLKCON_CLKSPD_1_16 (4 << 0)
110 # define CLKCON_CLKSPD_1_32 (5 << 0)
111 # define CLKCON_CLKSPD_1_64 (6 << 0)
112 # define CLKCON_CLKSPD_1_128 (7 << 0)
115 #define SLEEP_USB_EN (1 << 7)
116 #define SLEEP_XOSC_STB (1 << 6)
117 #define SLEEP_HFRC_STB (1 << 5)
118 #define SLEEP_RST_POWER (0 << 3)
119 #define SLEEP_RST_EXTERNAL (1 << 3)
120 #define SLEEP_RST_WATCHDOG (2 << 3)
121 #define SLEEP_RST_MASK (3 << 3)
122 #define SLEEP_OSC_PD (1 << 2)
123 #define SLEEP_MODE_PM0 (0 << 0)
124 #define SLEEP_MODE_PM1 (1 << 0)
125 #define SLEEP_MODE_PM2 (2 << 0)
126 #define SLEEP_MODE_PM3 (3 << 0)
127 #define SLEEP_MODE_MASK (3 << 0)
130 __sfr __at 0x87 PCON; /* Power Mode Control Register */
132 #define PCON_IDLE (1 << 0)
137 __sfr __at 0x88 TCON; /* CPU Interrupt Flag 1 */
139 __sbit __at 0x8F URX1IF; /* USART1 RX interrupt flag. Automatically cleared */
140 __sbit __at 0x8F I2SRXIF; /* I2S RX interrupt flag. Automatically cleared */
141 __sbit __at 0x8D ADCIF; /* ADC interrupt flag. Automatically cleared */
142 __sbit __at 0x8B URX0IF; /* USART0 RX interrupt flag. Automatically cleared */
143 __sbit __at 0x89 RFTXRXIF; /* RF TX/RX complete interrupt flag. Automatically cleared */
145 #define TCON_URX1IF (1 << 7)
146 #define TCON_I2SRXIF (1 << 7)
147 #define TCON_ADCIF (1 << 5)
148 #define TCON_URX0IF (1 << 3)
149 #define TCON_RFTXRXIF (1 << 1)
154 __sfr __at 0x98 S0CON; /* CPU Interrupt Flag 2 */
156 __sbit __at 0x98 ENCIF_0; /* AES interrupt 0. */
157 __sbit __at 0x99 ENCIF_1; /* AES interrupt 1. */
159 #define S0CON_ENCIF_1 (1 << 1)
160 #define S0CON_ENCIF_0 (1 << 0)
165 __sfr __at 0x9B S1CON; /* CPU Interrupt Flag 3 */
167 #define S1CON_RFIF_1 (1 << 1)
168 #define S1CON_RFIF_0 (1 << 0)
173 __sfr __at 0xC0 IRCON; /* CPU Interrupt Flag 4 */
175 __sbit __at 0xC0 DMAIF; /* DMA complete interrupt flag */
176 __sbit __at 0xC1 T1IF; /* Timer 1 interrupt flag. Automatically cleared */
177 __sbit __at 0xC2 T2IF; /* Timer 2 interrupt flag. Automatically cleared */
178 __sbit __at 0xC3 T3IF; /* Timer 3 interrupt flag. Automatically cleared */
179 __sbit __at 0xC4 T4IF; /* Timer 4 interrupt flag. Automatically cleared */
180 __sbit __at 0xC5 P0IF; /* Port0 interrupt flag */
181 __sbit __at 0xC7 STIF; /* Sleep Timer interrupt flag */
183 #define IRCON_DMAIF (1 << 0) /* DMA complete interrupt flag */
184 #define IRCON_T1IF (1 << 1) /* Timer 1 interrupt flag. Automatically cleared */
185 #define IRCON_T2IF (1 << 2) /* Timer 2 interrupt flag. Automatically cleared */
186 #define IRCON_T3IF (1 << 3) /* Timer 3 interrupt flag. Automatically cleared */
187 #define IRCON_T4IF (1 << 4) /* Timer 4 interrupt flag. Automatically cleared */
188 #define IRCON_P0IF (1 << 5) /* Port0 interrupt flag */
189 #define IRCON_STIF (1 << 7) /* Sleep Timer interrupt flag */
194 __sfr __at 0xE8 IRCON2; /* CPU Interrupt Flag 5 */
196 __sbit __at 0xE8 USBIF; /* USB interrupt flag (shared with Port2) */
197 __sbit __at 0xE8 P2IF; /* Port2 interrupt flag (shared with USB) */
198 __sbit __at 0xE9 UTX0IF; /* USART0 TX interrupt flag */
199 __sbit __at 0xEA UTX1IF; /* USART1 TX interrupt flag (shared with I2S TX) */
200 __sbit __at 0xEA I2STXIF; /* I2S TX interrupt flag (shared with USART1 TX) */
201 __sbit __at 0xEB P1IF; /* Port1 interrupt flag */
202 __sbit __at 0xEC WDTIF; /* Watchdog timer interrupt flag */
204 #define IRCON2_USBIF (1 << 0) /* USB interrupt flag (shared with Port2) */
205 #define IRCON2_P2IF (1 << 0) /* Port2 interrupt flag (shared with USB) */
206 #define IRCON2_UTX0IF (1 << 1) /* USART0 TX interrupt flag */
207 #define IRCON2_UTX1IF (1 << 2) /* USART1 TX interrupt flag (shared with I2S TX) */
208 #define IRCON2_I2STXIF (1 << 2) /* I2S TX interrupt flag (shared with USART1 TX) */
209 #define IRCON2_P1IF (1 << 3) /* Port1 interrupt flag */
210 #define IRCON2_WDTIF (1 << 4) /* Watchdog timer interrupt flag */
213 * IP1 - Interrupt Priority 1
217 * Interrupt priority groups:
220 * IPG1 ADC T1 P2INT/USB
222 * IPG3 URX1/I2SRX T3 UTX1 / I2STX
226 * Priority = (IP1 << 1) | IP0. Higher priority interrupts served first
229 __sfr __at 0xB9 IP1; /* Interrupt Priority 1 */
230 __sfr __at 0xA9 IP0; /* Interrupt Priority 0 */
232 #define IP1_IPG5 (1 << 5)
233 #define IP1_IPG4 (1 << 4)
234 #define IP1_IPG3 (1 << 3)
235 #define IP1_IPG2 (1 << 2)
236 #define IP1_IPG1 (1 << 1)
237 #define IP1_IPG0 (1 << 0)
239 #define IP0_IPG5 (1 << 5)
240 #define IP0_IPG4 (1 << 4)
241 #define IP0_IPG3 (1 << 3)
242 #define IP0_IPG2 (1 << 2)
243 #define IP0_IPG1 (1 << 1)
244 #define IP0_IPG0 (1 << 0)
249 #define T1CTL_MODE_SUSPENDED (0 << 0)
250 #define T1CTL_MODE_FREE (1 << 0)
251 #define T1CTL_MODE_MODULO (2 << 0)
252 #define T1CTL_MODE_UP_DOWN (3 << 0)
253 #define T1CTL_MODE_MASK (3 << 0)
254 #define T1CTL_DIV_1 (0 << 2)
255 #define T1CTL_DIV_8 (1 << 2)
256 #define T1CTL_DIV_32 (2 << 2)
257 #define T1CTL_DIV_128 (3 << 2)
258 #define T1CTL_DIV_MASK (3 << 2)
259 #define T1CTL_OVFIF (1 << 4)
260 #define T1CTL_CH0IF (1 << 5)
261 #define T1CTL_CH1IF (1 << 6)
262 #define T1CTL_CH2IF (1 << 7)
264 #define T1CCTL_NO_CAPTURE (0 << 0)
265 #define T1CCTL_CAPTURE_RISING (1 << 0)
266 #define T1CCTL_CAPTURE_FALLING (2 << 0)
267 #define T1CCTL_CAPTURE_BOTH (3 << 0)
268 #define T1CCTL_CAPTURE_MASK (3 << 0)
270 #define T1CCTL_MODE_CAPTURE (0 << 2)
271 #define T1CCTL_MODE_COMPARE (1 << 2)
273 #define T1CTL_CMP_SET (0 << 3)
274 #define T1CTL_CMP_CLEAR (1 << 3)
275 #define T1CTL_CMP_TOGGLE (2 << 3)
276 #define T1CTL_CMP_SET_CLEAR (3 << 3)
277 #define T1CTL_CMP_CLEAR_SET (4 << 3)
279 #define T1CTL_IM_DISABLED (0 << 6)
280 #define T1CTL_IM_ENABLED (1 << 6)
282 #define T1CTL_CPSEL_NORMAL (0 << 7)
283 #define T1CTL_CPSEL_RF (1 << 7)
286 * Timer 3 and Timer 4
290 __sfr __at 0xCA T3CNT;
291 __sfr __at 0xEA T4CNT;
295 __sfr __at 0xCB T3CTL;
296 __sfr __at 0xEB T4CTL;
298 #define TxCTL_DIV_1 (0 << 5)
299 #define TxCTL_DIV_2 (1 << 5)
300 #define TxCTL_DIV_4 (2 << 5)
301 #define TxCTL_DIV_8 (3 << 5)
302 #define TxCTL_DIV_16 (4 << 5)
303 #define TxCTL_DIV_32 (5 << 5)
304 #define TxCTL_DIV_64 (6 << 5)
305 #define TxCTL_DIV_128 (7 << 5)
306 #define TxCTL_START (1 << 4)
307 #define TxCTL_OVFIM (1 << 3)
308 #define TxCTL_CLR (1 << 2)
309 #define TxCTL_MODE_FREE (0 << 0)
310 #define TxCTL_MODE_DOWN (1 << 0)
311 #define TxCTL_MODE_MODULO (2 << 0)
312 #define TxCTL_MODE_UP_DOWN (3 << 0)
314 /* Timer 4 channel 0 compare control */
316 __sfr __at 0xCC T3CCTL0;
317 __sfr __at 0xCE T3CCTL1;
318 __sfr __at 0xEC T4CCTL0;
319 __sfr __at 0xEE T4CCTL1;
321 #define TxCCTLy_IM (1 << 6)
322 #define TxCCTLy_CMP_SET (0 << 3)
323 #define TxCCTLy_CMP_CLEAR (1 << 3)
324 #define TxCCTLy_CMP_TOGGLE (2 << 3)
325 #define TxCCTLy_CMP_SET_UP_CLEAR_DOWN (3 << 3)
326 #define TxCCTLy_CMP_CLEAR_UP_SET_DOWN (4 << 3)
327 #define TxCCTLy_CMP_SET_CLEAR_FF (5 << 3)
328 #define TxCCTLy_CMP_CLEAR_SET_00 (6 << 3)
329 #define TxCCTLy_CMP_MODE_ENABLE (1 << 2)
331 /* Timer compare value */
332 __sfr __at 0xCD T3CC0;
333 __sfr __at 0xCF T3CC1;
334 __sfr __at 0xED T4CC0;
335 __sfr __at 0xEF T4CC1;
341 __sfr __at 0xf1 PERCFG;
342 #define PERCFG_T1CFG_ALT_1 (0 << 6)
343 #define PERCFG_T1CFG_ALT_2 (1 << 6)
344 #define PERCFG_T1CFG_ALT_MASK (1 << 6)
346 #define PERCFG_T3CFG_ALT_1 (0 << 5)
347 #define PERCFG_T3CFG_ALT_2 (1 << 5)
348 #define PERCFG_T3CFG_ALT_MASK (1 << 5)
350 #define PERCFG_T4CFG_ALT_1 (0 << 4)
351 #define PERCFG_T4CFG_ALT_2 (1 << 4)
352 #define PERCFG_T4CFG_ALT_MASK (1 << 4)
354 #define PERCFG_U1CFG_ALT_1 (0 << 1)
355 #define PERCFG_U1CFG_ALT_2 (1 << 1)
356 #define PERCFG_U1CFG_ALT_MASK (1 << 1)
358 #define PERCFG_U0CFG_ALT_1 (0 << 0)
359 #define PERCFG_U0CFG_ALT_2 (1 << 0)
360 #define PERCFG_U0CFG_ALT_MASK (1 << 0)
362 /* directly addressed USB registers */
363 __xdata __at (0xde00) volatile uint8_t USBADDR;
364 __xdata __at (0xde01) volatile uint8_t USBPOW;
365 __xdata __at (0xde02) volatile uint8_t USBIIF;
367 __xdata __at (0xde04) volatile uint8_t USBOIF;
369 __xdata __at (0xde06) volatile uint8_t USBCIF;
371 # define USBCIF_SOFIF (1 << 3)
372 # define USBCIF_RSTIF (1 << 2)
373 # define USBCIF_RESUMEIF (1 << 1)
374 # define USBCIF_SUSPENDIF (1 << 0)
376 __xdata __at (0xde07) volatile uint8_t USBIIE;
378 __xdata __at (0xde09) volatile uint8_t USBOIE;
380 __xdata __at (0xde0b) volatile uint8_t USBCIE;
382 # define USBCIE_SOFIE (1 << 3)
383 # define USBCIE_RSTIE (1 << 2)
384 # define USBCIE_RESUMEIE (1 << 1)
385 # define USBCIE_SUSPENDIE (1 << 0)
387 __xdata __at (0xde0c) volatile uint8_t USBFRML;
388 __xdata __at (0xde0d) volatile uint8_t USBFRMH;
389 __xdata __at (0xde0e) volatile uint8_t USBINDEX;
391 /* indexed USB registers, must set USBINDEX to 0-5 */
392 __xdata __at (0xde10) volatile uint8_t USBMAXI;
393 __xdata __at (0xde11) volatile uint8_t USBCS0;
395 # define USBCS0_CLR_SETUP_END (1 << 7)
396 # define USBCS0_CLR_OUTPKT_RDY (1 << 6)
397 # define USBCS0_SEND_STALL (1 << 5)
398 # define USBCS0_SETUP_END (1 << 4)
399 # define USBCS0_DATA_END (1 << 3)
400 # define USBCS0_SENT_STALL (1 << 2)
401 # define USBCS0_INPKT_RDY (1 << 1)
402 # define USBCS0_OUTPKT_RDY (1 << 0)
404 __xdata __at (0xde11) volatile uint8_t USBCSIL;
406 # define USBCSIL_CLR_DATA_TOG (1 << 6)
407 # define USBCSIL_SENT_STALL (1 << 5)
408 # define USBCSIL_SEND_STALL (1 << 4)
409 # define USBCSIL_FLUSH_PACKET (1 << 3)
410 # define USBCSIL_UNDERRUN (1 << 2)
411 # define USBCSIL_PKT_PRESENT (1 << 1)
412 # define USBCSIL_INPKT_RDY (1 << 0)
414 __xdata __at (0xde12) volatile uint8_t USBCSIH;
416 # define USBCSIH_AUTOSET (1 << 7)
417 # define USBCSIH_ISO (1 << 6)
418 # define USBCSIH_FORCE_DATA_TOG (1 << 3)
419 # define USBCSIH_IN_DBL_BUF (1 << 0)
421 __xdata __at (0xde13) volatile uint8_t USBMAXO;
422 __xdata __at (0xde14) volatile uint8_t USBCSOL;
424 # define USBCSOL_CLR_DATA_TOG (1 << 7)
425 # define USBCSOL_SENT_STALL (1 << 6)
426 # define USBCSOL_SEND_STALL (1 << 5)
427 # define USBCSOL_FLUSH_PACKET (1 << 4)
428 # define USBCSOL_DATA_ERROR (1 << 3)
429 # define USBCSOL_OVERRUN (1 << 2)
430 # define USBCSOL_FIFO_FULL (1 << 1)
431 # define USBCSOL_OUTPKT_RDY (1 << 0)
433 __xdata __at (0xde15) volatile uint8_t USBCSOH;
435 # define USBCSOH_AUTOCLEAR (1 << 7)
436 # define USBCSOH_ISO (1 << 6)
437 # define USBCSOH_OUT_DBL_BUF (1 << 0)
439 __xdata __at (0xde16) volatile uint8_t USBCNT0;
440 __xdata __at (0xde16) volatile uint8_t USBCNTL;
441 __xdata __at (0xde17) volatile uint8_t USBCNTH;
443 __xdata __at (0xde20) volatile uint8_t USBFIFO[12];
445 /* ADC Data register, low and high */
446 __sfr __at 0xBA ADCL;
447 __sfr __at 0xBB ADCH;
448 __xdata __at (0xDFBA) volatile uint16_t ADCXDATA;
450 /* ADC Control Register 1 */
451 __sfr __at 0xB4 ADCCON1;
453 # define ADCCON1_EOC (1 << 7) /* conversion complete */
454 # define ADCCON1_ST (1 << 6) /* start conversion */
456 # define ADCCON1_STSEL_MASK (3 << 4) /* start select */
457 # define ADCCON1_STSEL_EXTERNAL (0 << 4) /* P2_0 pin triggers */
458 # define ADCCON1_STSEL_FULLSPEED (1 << 4) /* full speed, no waiting */
459 # define ADCCON1_STSEL_TIMER1 (2 << 4) /* timer 1 channel 0 */
460 # define ADCCON1_STSEL_START (3 << 4) /* set start bit */
462 # define ADCCON1_RCTRL_MASK (3 << 2) /* random number control */
463 # define ADCCON1_RCTRL_COMPLETE (0 << 2) /* operation completed */
464 # define ADCCON1_RCTRL_CLOCK_LFSR (1 << 2) /* Clock the LFSR once */
466 /* ADC Control Register 2 */
467 __sfr __at 0xB5 ADCCON2;
469 # define ADCCON2_SREF_MASK (3 << 6) /* reference voltage */
470 # define ADCCON2_SREF_1_25V (0 << 6) /* internal 1.25V */
471 # define ADCCON2_SREF_EXTERNAL (1 << 6) /* external on AIN7 cc1110 */
472 # define ADCCON2_SREF_VDD (2 << 6) /* VDD on the AVDD pin */
473 # define ADCCON2_SREF_EXTERNAL_DIFF (3 << 6) /* external on AIN6-7 cc1110 */
475 # define ADCCON2_SDIV_MASK (3 << 4) /* decimation rate */
476 # define ADCCON2_SDIV_64 (0 << 4) /* 7 bits */
477 # define ADCCON2_SDIV_128 (1 << 4) /* 9 bits */
478 # define ADCCON2_SDIV_256 (2 << 4) /* 10 bits */
479 # define ADCCON2_SDIV_512 (3 << 4) /* 12 bits */
481 # define ADCCON2_SCH_MASK (0xf << 0) /* Sequence channel select */
482 # define ADCCON2_SCH_SHIFT 0
483 # define ADCCON2_SCH_AIN0 (0 << 0)
484 # define ADCCON2_SCH_AIN1 (1 << 0)
485 # define ADCCON2_SCH_AIN2 (2 << 0)
486 # define ADCCON2_SCH_AIN3 (3 << 0)
487 # define ADCCON2_SCH_AIN4 (4 << 0)
488 # define ADCCON2_SCH_AIN5 (5 << 0)
489 # define ADCCON2_SCH_AIN6 (6 << 0)
490 # define ADCCON2_SCH_AIN7 (7 << 0)
491 # define ADCCON2_SCH_AIN0_AIN1 (8 << 0)
492 # define ADCCON2_SCH_AIN2_AIN3 (9 << 0)
493 # define ADCCON2_SCH_AIN4_AIN5 (0xa << 0)
494 # define ADCCON2_SCH_AIN6_AIN7 (0xb << 0)
495 # define ADCCON2_SCH_GND (0xc << 0)
496 # define ADCCON2_SCH_VREF (0xd << 0)
497 # define ADCCON2_SCH_TEMP (0xe << 0)
498 # define ADCCON2_SCH_VDD_3 (0xf << 0)
501 /* ADC Control Register 3 */
502 __sfr __at 0xB6 ADCCON3;
504 # define ADCCON3_EREF_MASK (3 << 6) /* extra conversion reference */
505 # define ADCCON3_EREF_1_25 (0 << 6) /* internal 1.25V */
506 # define ADCCON3_EREF_EXTERNAL (1 << 6) /* external AIN7 cc1110 */
507 # define ADCCON3_EREF_VDD (2 << 6) /* VDD on the AVDD pin */
508 # define ADCCON3_EREF_EXTERNAL_DIFF (3 << 6) /* external AIN6-7 cc1110 */
509 # define ADCCON3_EDIV_MASK (3 << 4) /* extral decimation */
510 # define ADCCON3_EDIV_64 (0 << 4) /* 7 bits */
511 # define ADCCON3_EDIV_128 (1 << 4) /* 9 bits */
512 # define ADCCON3_EDIV_256 (2 << 4) /* 10 bits */
513 # define ADCCON3_EDIV_512 (3 << 4) /* 12 bits */
514 # define ADCCON3_ECH_MASK (0xf << 0) /* Sequence channel select */
515 # define ADCCON3_ECH_SHIFT 0
516 # define ADCCON3_ECH_AIN0 (0 << 0)
517 # define ADCCON3_ECH_AIN1 (1 << 0)
518 # define ADCCON3_ECH_AIN2 (2 << 0)
519 # define ADCCON3_ECH_AIN3 (3 << 0)
520 # define ADCCON3_ECH_AIN4 (4 << 0)
521 # define ADCCON3_ECH_AIN5 (5 << 0)
522 # define ADCCON3_ECH_AIN6 (6 << 0)
523 # define ADCCON3_ECH_AIN7 (7 << 0)
524 # define ADCCON3_ECH_AIN0_AIN1 (8 << 0)
525 # define ADCCON3_ECH_AIN2_AIN3 (9 << 0)
526 # define ADCCON3_ECH_AIN4_AIN5 (0xa << 0)
527 # define ADCCON3_ECH_AIN6_AIN7 (0xb << 0)
528 # define ADCCON3_ECH_GND (0xc << 0)
529 # define ADCCON3_ECH_VREF (0xd << 0)
530 # define ADCCON3_ECH_TEMP (0xe << 0)
531 # define ADCCON3_ECH_VDD_3 (0xf << 0)
534 * ADC configuration register, this selects which
535 * GPIO pins are to be used as ADC inputs
537 __sfr __at 0xF2 ADCCFG;
543 __sfr __at 0xc9 WDCTL;
545 #define WDCTL_CLEAR_FIRST (0xa << 4)
546 #define WDCTL_CLEAR_SECOND (0x5 << 4)
547 #define WDCTL_EN (1 << 3)
548 #define WDCTL_MODE_WATCHDOG (0 << 2)
549 #define WDCTL_MODE_TIMER (1 << 2)
550 #define WDCTL_MODE_MASK (1 << 2)
551 #define WDCTL_INT_32768 (0 << 0)
552 #define WDCTL_INT_8192 (1 << 0)
553 #define WDCTL_INT_512 (2 << 0)
554 #define WDCTL_INT_64 (3 << 0)
557 * Pin selectors, these set which pins are
558 * using their peripheral function
560 __sfr __at 0xF3 P0SEL;
561 __sfr __at 0xF4 P1SEL;
562 __sfr __at 0xF5 P2SEL;
564 #define P2SEL_PRI3P1_USART0 (0 << 6)
565 #define P2SEL_PRI3P1_USART1 (1 << 6)
566 #define P2SEL_PRI3P1_MASK (1 << 6)
567 #define P2SEL_PRI2P1_USART1 (0 << 5)
568 #define P2SEL_PRI2P1_TIMER3 (1 << 5)
569 #define P2SEL_PRI2P1_MASK (1 << 5)
570 #define P2SEL_PRI1P1_TIMER1 (0 << 4)
571 #define P2SEL_PRI1P1_TIMER4 (1 << 4)
572 #define P2SEL_PRI1P1_MASK (1 << 4)
573 #define P2SEL_PRI0P1_USART0 (0 << 3)
574 #define P2SEL_PRI0P1_TIMER1 (1 << 3)
575 #define P2SEL_PRI0P1_MASK (1 << 3)
576 #define P2SEL_SELP2_4_GPIO (0 << 2)
577 #define P2SEL_SELP2_4_PERIPHERAL (1 << 2)
578 #define P2SEL_SELP2_4_MASK (1 << 2)
579 #define P2SEL_SELP2_3_GPIO (0 << 1)
580 #define P2SEL_SELP2_3_PERIPHERAL (1 << 1)
581 #define P2SEL_SELP2_3_MASK (1 << 1)
582 #define P2SEL_SELP2_0_GPIO (0 << 0)
583 #define P2SEL_SELP2_0_PERIPHERAL (1 << 0)
584 #define P2SEL_SELP2_0_MASK (1 << 0)
587 * For pins used as GPIOs, these set which are used as outputs
589 __sfr __at 0xFD P0DIR;
590 __sfr __at 0xFE P1DIR;
591 __sfr __at 0xFF P2DIR;
593 #define P2DIR_PRIP0_USART0_USART1 (0 << 6)
594 #define P2DIR_PRIP0_USART1_USART0 (1 << 6)
595 #define P2DIR_PRIP0_TIMER1_01_USART1 (2 << 6)
596 #define P2DIR_PRIP0_TIMER1_2_USART0 (3 << 6)
597 #define P2DIR_PRIP0_MASK (3 << 6)
599 __sfr __at 0x8F P0INP;
601 /* Select between tri-state and pull up/down
602 * for pins P0_0 - P0_7.
604 #define P0INP_MDP0_7_PULL (0 << 7)
605 #define P0INP_MDP0_7_TRISTATE (1 << 7)
606 #define P0INP_MDP0_6_PULL (0 << 6)
607 #define P0INP_MDP0_6_TRISTATE (1 << 6)
608 #define P0INP_MDP0_5_PULL (0 << 5)
609 #define P0INP_MDP0_5_TRISTATE (1 << 5)
610 #define P0INP_MDP0_4_PULL (0 << 4)
611 #define P0INP_MDP0_4_TRISTATE (1 << 4)
612 #define P0INP_MDP0_3_PULL (0 << 3)
613 #define P0INP_MDP0_3_TRISTATE (1 << 3)
614 #define P0INP_MDP0_2_PULL (0 << 2)
615 #define P0INP_MDP0_2_TRISTATE (1 << 2)
616 #define P0INP_MDP0_1_PULL (0 << 1)
617 #define P0INP_MDP0_1_TRISTATE (1 << 1)
618 #define P0INP_MDP0_0_PULL (0 << 0)
619 #define P0INP_MDP0_0_TRISTATE (1 << 0)
621 __sfr __at 0xF6 P1INP;
623 /* Select between tri-state and pull up/down
624 * for pins P1_2 - P1_7. Pins P1_0 and P1_1 are
627 #define P1INP_MDP1_7_PULL (0 << 7)
628 #define P1INP_MDP1_7_TRISTATE (1 << 7)
629 #define P1INP_MDP1_6_PULL (0 << 6)
630 #define P1INP_MDP1_6_TRISTATE (1 << 6)
631 #define P1INP_MDP1_5_PULL (0 << 5)
632 #define P1INP_MDP1_5_TRISTATE (1 << 5)
633 #define P1INP_MDP1_4_PULL (0 << 4)
634 #define P1INP_MDP1_4_TRISTATE (1 << 4)
635 #define P1INP_MDP1_3_PULL (0 << 3)
636 #define P1INP_MDP1_3_TRISTATE (1 << 3)
637 #define P1INP_MDP1_2_PULL (0 << 2)
638 #define P1INP_MDP1_2_TRISTATE (1 << 2)
640 __sfr __at 0xF7 P2INP;
641 /* P2INP has three extra bits which are used to choose
642 * between pull-up and pull-down when they are not tri-stated
644 #define P2INP_PDUP2_PULL_UP (0 << 7)
645 #define P2INP_PDUP2_PULL_DOWN (1 << 7)
646 #define P2INP_PDUP1_PULL_UP (0 << 6)
647 #define P2INP_PDUP1_PULL_DOWN (1 << 6)
648 #define P2INP_PDUP0_PULL_UP (0 << 5)
649 #define P2INP_PDUP0_PULL_DOWN (1 << 5)
651 /* For the P2 pins, choose between tri-state and pull up/down
654 #define P2INP_MDP2_4_PULL (0 << 4)
655 #define P2INP_MDP2_4_TRISTATE (1 << 4)
656 #define P2INP_MDP2_3_PULL (0 << 3)
657 #define P2INP_MDP2_3_TRISTATE (1 << 3)
658 #define P2INP_MDP2_2_PULL (0 << 2)
659 #define P2INP_MDP2_2_TRISTATE (1 << 2)
660 #define P2INP_MDP2_1_PULL (0 << 1)
661 #define P2INP_MDP2_1_TRISTATE (1 << 1)
662 #define P2INP_MDP2_0_PULL (0 << 0)
663 #define P2INP_MDP2_0_TRISTATE (1 << 0)
665 /* GPIO interrupt status flags */
666 __sfr __at 0x89 P0IFG;
667 __sfr __at 0x8A P1IFG;
668 __sfr __at 0x8B P2IFG;
670 #define P0IFG_USB_RESUME (1 << 7)
672 __sfr __at 0x8C PICTL;
673 #define PICTL_P2IEN (1 << 5)
674 #define PICTL_P0IENH (1 << 4)
675 #define PICTL_P0IENL (1 << 3)
676 #define PICTL_P2ICON (1 << 2)
677 #define PICTL_P1ICON (1 << 1)
678 #define PICTL_P0ICON (1 << 0)
683 __sbit __at 0x80 P0_0;
684 __sbit __at 0x81 P0_1;
685 __sbit __at 0x82 P0_2;
686 __sbit __at 0x83 P0_3;
687 __sbit __at 0x84 P0_4;
688 __sbit __at 0x85 P0_5;
689 __sbit __at 0x86 P0_6;
690 __sbit __at 0x87 P0_7;
694 __sbit __at 0x90 P1_0;
695 __sbit __at 0x91 P1_1;
696 __sbit __at 0x92 P1_2;
697 __sbit __at 0x93 P1_3;
698 __sbit __at 0x94 P1_4;
699 __sbit __at 0x95 P1_5;
700 __sbit __at 0x96 P1_6;
701 __sbit __at 0x97 P1_7;
705 __sbit __at 0xa0 P2_0;
706 __sbit __at 0xa1 P2_1;
707 __sbit __at 0xa2 P2_2;
708 __sbit __at 0xa3 P2_3;
709 __sbit __at 0xa4 P2_4;
712 struct cc_dma_channel {
723 # define DMA_LEN_HIGH_VLEN_MASK (7 << 5)
724 # define DMA_LEN_HIGH_VLEN_LEN (0 << 5)
725 # define DMA_LEN_HIGH_VLEN_PLUS_1 (1 << 5)
726 # define DMA_LEN_HIGH_VLEN (2 << 5)
727 # define DMA_LEN_HIGH_VLEN_PLUS_2 (3 << 5)
728 # define DMA_LEN_HIGH_VLEN_PLUS_3 (4 << 5)
729 # define DMA_LEN_HIGH_MASK (0x1f)
731 # define DMA_CFG0_WORDSIZE_8 (0 << 7)
732 # define DMA_CFG0_WORDSIZE_16 (1 << 7)
733 # define DMA_CFG0_TMODE_MASK (3 << 5)
734 # define DMA_CFG0_TMODE_SINGLE (0 << 5)
735 # define DMA_CFG0_TMODE_BLOCK (1 << 5)
736 # define DMA_CFG0_TMODE_REPEATED_SINGLE (2 << 5)
737 # define DMA_CFG0_TMODE_REPEATED_BLOCK (3 << 5)
742 # define DMA_CFG0_TRIGGER_NONE 0
743 # define DMA_CFG0_TRIGGER_PREV 1
744 # define DMA_CFG0_TRIGGER_T1_CH0 2
745 # define DMA_CFG0_TRIGGER_T1_CH1 3
746 # define DMA_CFG0_TRIGGER_T1_CH2 4
747 # define DMA_CFG0_TRIGGER_T2_OVFL 6
748 # define DMA_CFG0_TRIGGER_T3_CH0 7
749 # define DMA_CFG0_TRIGGER_T3_CH1 8
750 # define DMA_CFG0_TRIGGER_T4_CH0 9
751 # define DMA_CFG0_TRIGGER_T4_CH1 10
752 # define DMA_CFG0_TRIGGER_IOC_0 12
753 # define DMA_CFG0_TRIGGER_IOC_1 13
754 # define DMA_CFG0_TRIGGER_URX0 14
755 # define DMA_CFG0_TRIGGER_UTX0 15
756 # define DMA_CFG0_TRIGGER_URX1 16
757 # define DMA_CFG0_TRIGGER_UTX1 17
758 # define DMA_CFG0_TRIGGER_FLASH 18
759 # define DMA_CFG0_TRIGGER_RADIO 19
760 # define DMA_CFG0_TRIGGER_ADC_CHALL 20
761 # define DMA_CFG0_TRIGGER_ADC_CH0 21
762 # define DMA_CFG0_TRIGGER_ADC_CH1 22
763 # define DMA_CFG0_TRIGGER_ADC_CH2 23
764 # define DMA_CFG0_TRIGGER_ADC_CH3 24
765 # define DMA_CFG0_TRIGGER_ADC_CH4 25
766 # define DMA_CFG0_TRIGGER_ADC_CH5 26
767 # define DMA_CFG0_TRIGGER_ADC_CH6 27
768 # define DMA_CFG0_TRIGGER_I2SRX 27
769 # define DMA_CFG0_TRIGGER_ADC_CH7 28
770 # define DMA_CFG0_TRIGGER_I2STX 28
771 # define DMA_CFG0_TRIGGER_ENC_DW 29
772 # define DMA_CFG0_TRIGGER_ENC_UP 30
774 # define DMA_CFG1_SRCINC_MASK (3 << 6)
775 # define DMA_CFG1_SRCINC_0 (0 << 6)
776 # define DMA_CFG1_SRCINC_1 (1 << 6)
777 # define DMA_CFG1_SRCINC_2 (2 << 6)
778 # define DMA_CFG1_SRCINC_MINUS_1 (3 << 6)
780 # define DMA_CFG1_DESTINC_MASK (3 << 4)
781 # define DMA_CFG1_DESTINC_0 (0 << 4)
782 # define DMA_CFG1_DESTINC_1 (1 << 4)
783 # define DMA_CFG1_DESTINC_2 (2 << 4)
784 # define DMA_CFG1_DESTINC_MINUS_1 (3 << 4)
786 # define DMA_CFG1_IRQMASK (1 << 3)
787 # define DMA_CFG1_M8 (1 << 2)
789 # define DMA_CFG1_PRIORITY_MASK (3 << 0)
790 # define DMA_CFG1_PRIORITY_LOW (0 << 0)
791 # define DMA_CFG1_PRIORITY_NORMAL (1 << 0)
792 # define DMA_CFG1_PRIORITY_HIGH (2 << 0)
795 * DMAARM - DMA Channel Arm
798 __sfr __at 0xD6 DMAARM;
800 # define DMAARM_ABORT (1 << 7)
801 # define DMAARM_DMAARM4 (1 << 4)
802 # define DMAARM_DMAARM3 (1 << 3)
803 # define DMAARM_DMAARM2 (1 << 2)
804 # define DMAARM_DMAARM1 (1 << 1)
805 # define DMAARM_DMAARM0 (1 << 0)
808 * DMAREQ - DMA Channel Start Request and Status
811 __sfr __at 0xD7 DMAREQ;
813 # define DMAREQ_DMAREQ4 (1 << 4)
814 # define DMAREQ_DMAREQ3 (1 << 3)
815 # define DMAREQ_DMAREQ2 (1 << 2)
816 # define DMAREQ_DMAREQ1 (1 << 1)
817 # define DMAREQ_DMAREQ0 (1 << 0)
820 * DMA configuration 0 address
823 __sfr __at 0xD5 DMA0CFGH;
824 __sfr __at 0xD4 DMA0CFGL;
827 * DMA configuration 1-4 address
830 __sfr __at 0xD3 DMA1CFGH;
831 __sfr __at 0xD2 DMA1CFGL;
834 * DMAIRQ - DMA Interrupt Flag
837 __sfr __at 0xD1 DMAIRQ;
839 # define DMAIRQ_DMAIF4 (1 << 4)
840 # define DMAIRQ_DMAIF3 (1 << 3)
841 # define DMAIRQ_DMAIF2 (1 << 2)
842 # define DMAIRQ_DMAIF1 (1 << 1)
843 # define DMAIRQ_DMAIF0 (1 << 0)
849 /* USART config/status registers */
850 __sfr __at 0x86 U0CSR;
851 __sfr __at 0xF8 U1CSR;
853 # define UxCSR_MODE_UART (1 << 7)
854 # define UxCSR_MODE_SPI (0 << 7)
855 # define UxCSR_RE (1 << 6)
856 # define UxCSR_SLAVE (1 << 5)
857 # define UxCSR_MASTER (0 << 5)
858 # define UxCSR_FE (1 << 4)
859 # define UxCSR_ERR (1 << 3)
860 # define UxCSR_RX_BYTE (1 << 2)
861 # define UxCSR_TX_BYTE (1 << 1)
862 # define UxCSR_ACTIVE (1 << 0)
864 /* UART configuration registers */
865 __sfr __at 0xc4 U0UCR;
866 __sfr __at 0xfb U1UCR;
868 # define UxUCR_FLUSH (1 << 7)
869 # define UxUCR_FLOW_DISABLE (0 << 6)
870 # define UxUCR_FLOW_ENABLE (1 << 6)
871 # define UxUCR_D9_EVEN_PARITY (0 << 5)
872 # define UxUCR_D9_ODD_PARITY (1 << 5)
873 # define UxUCR_BIT9_8_BITS (0 << 4)
874 # define UxUCR_BIT9_9_BITS (1 << 4)
875 # define UxUCR_PARITY_DISABLE (0 << 3)
876 # define UxUCR_PARITY_ENABLE (1 << 3)
877 # define UxUCR_SPB_1_STOP_BIT (0 << 2)
878 # define UxUCR_SPB_2_STOP_BITS (1 << 2)
879 # define UxUCR_STOP_LOW (0 << 1)
880 # define UxUCR_STOP_HIGH (1 << 1)
881 # define UxUCR_START_LOW (0 << 0)
882 # define UxUCR_START_HIGH (1 << 0)
884 /* USART General configuration registers (mostly SPI) */
885 __sfr __at 0xc5 U0GCR;
886 __sfr __at 0xfc U1GCR;
888 # define UxGCR_CPOL_NEGATIVE (0 << 7)
889 # define UxGCR_CPOL_POSITIVE (1 << 7)
890 # define UxGCR_CPHA_FIRST_EDGE (0 << 6)
891 # define UxGCR_CPHA_SECOND_EDGE (1 << 6)
892 # define UxGCR_ORDER_LSB (0 << 5)
893 # define UxGCR_ORDER_MSB (1 << 5)
894 # define UxGCR_BAUD_E_MASK (0x1f)
895 # define UxGCR_BAUD_E_SHIFT 0
897 /* USART data registers */
898 __sfr __at 0xc1 U0DBUF;
899 __xdata __at (0xDFC1) volatile uint8_t U0DBUFXADDR;
900 __sfr __at 0xf9 U1DBUF;
901 __xdata __at (0xDFF9) volatile uint8_t U1DBUFXADDR;
903 /* USART baud rate registers, M value */
904 __sfr __at 0xc2 U0BAUD;
905 __sfr __at 0xfa U1BAUD;
907 /* Flash controller */
909 __sfr __at 0xAE FCTL;
910 #define FCTL_BUSY (1 << 7)
911 #define FCTL_SWBSY (1 << 6)
912 #define FCTL_CONTRD_ENABLE (1 << 4)
913 #define FCTL_WRITE (1 << 1)
914 #define FCTL_ERASE (1 << 0)
916 /* Flash write data. Write two bytes here */
917 __sfr __at 0xAF FWDATA;
918 __xdata __at (0xDFAF) volatile uint8_t FWDATAXADDR;
920 /* Flash write/erase address */
921 __sfr __at 0xAD FADDRH;
922 __sfr __at 0xAC FADDRL;
930 __xdata __at (0xDFD9) volatile uint8_t RFDXADDR;
932 __sfr __at 0xE9 RFIF;
933 #define RFIF_IM_TXUNF (1 << 7)
934 #define RFIF_IM_RXOVF (1 << 6)
935 #define RFIF_IM_TIMEOUT (1 << 5)
936 #define RFIF_IM_DONE (1 << 4)
937 #define RFIF_IM_CS (1 << 3)
938 #define RFIF_IM_PQT (1 << 2)
939 #define RFIF_IM_CCA (1 << 1)
940 #define RFIF_IM_SFD (1 << 0)
942 __sfr __at 0x91 RFIM;
943 #define RFIM_IM_TXUNF (1 << 7)
944 #define RFIM_IM_RXOVF (1 << 6)
945 #define RFIM_IM_TIMEOUT (1 << 5)
946 #define RFIM_IM_DONE (1 << 4)
947 #define RFIM_IM_CS (1 << 3)
948 #define RFIM_IM_PQT (1 << 2)
949 #define RFIM_IM_CCA (1 << 1)
950 #define RFIM_IM_SFD (1 << 0)
952 __sfr __at 0xE1 RFST;
954 #define RFST_SFSTXON 0x00
955 #define RFST_SCAL 0x01
956 #define RFST_SRX 0x02
957 #define RFST_STX 0x03
958 #define RFST_SIDLE 0x04
960 __xdata __at (0xdf00) uint8_t RF[0x3c];
962 __xdata __at (0xdf2f) uint8_t RF_IOCFG2;
963 #define RF_IOCFG2_OFF 0x2f
965 __xdata __at (0xdf30) uint8_t RF_IOCFG1;
966 #define RF_IOCFG1_OFF 0x30
968 __xdata __at (0xdf31) uint8_t RF_IOCFG0;
969 #define RF_IOCFG0_OFF 0x31
971 __xdata __at (0xdf00) uint8_t RF_SYNC1;
972 #define RF_SYNC1_OFF 0x00
974 __xdata __at (0xdf01) uint8_t RF_SYNC0;
975 #define RF_SYNC0_OFF 0x01
977 __xdata __at (0xdf02) uint8_t RF_PKTLEN;
978 #define RF_PKTLEN_OFF 0x02
980 __xdata __at (0xdf03) uint8_t RF_PKTCTRL1;
981 #define RF_PKTCTRL1_OFF 0x03
982 #define PKTCTRL1_PQT_MASK (0x7 << 5)
983 #define PKTCTRL1_PQT_SHIFT 5
984 #define PKTCTRL1_APPEND_STATUS (1 << 2)
985 #define PKTCTRL1_ADR_CHK_NONE (0 << 0)
986 #define PKTCTRL1_ADR_CHK_NO_BROADCAST (1 << 0)
987 #define PKTCTRL1_ADR_CHK_00_BROADCAST (2 << 0)
988 #define PKTCTRL1_ADR_CHK_00_FF_BROADCAST (3 << 0)
990 /* If APPEND_STATUS is used, two bytes will be added to the packet data */
991 #define PKT_APPEND_STATUS_0_RSSI_MASK (0xff)
992 #define PKT_APPEND_STATUS_0_RSSI_SHIFT 0
993 #define PKT_APPEND_STATUS_1_CRC_OK (1 << 7)
994 #define PKT_APPEND_STATUS_1_LQI_MASK (0x7f)
995 #define PKT_APPEND_STATUS_1_LQI_SHIFT 0
997 __xdata __at (0xdf04) uint8_t RF_PKTCTRL0;
998 #define RF_PKTCTRL0_OFF 0x04
999 #define RF_PKTCTRL0_WHITE_DATA (1 << 6)
1000 #define RF_PKTCTRL0_PKT_FORMAT_NORMAL (0 << 4)
1001 #define RF_PKTCTRL0_PKT_FORMAT_RANDOM (2 << 4)
1002 #define RF_PKTCTRL0_CRC_EN (1 << 2)
1003 #define RF_PKTCTRL0_LENGTH_CONFIG_FIXED (0 << 0)
1004 #define RF_PKTCTRL0_LENGTH_CONFIG_VARIABLE (1 << 0)
1006 __xdata __at (0xdf05) uint8_t RF_ADDR;
1007 #define RF_ADDR_OFF 0x05
1009 __xdata __at (0xdf06) uint8_t RF_CHANNR;
1010 #define RF_CHANNR_OFF 0x06
1012 __xdata __at (0xdf07) uint8_t RF_FSCTRL1;
1013 #define RF_FSCTRL1_OFF 0x07
1015 #define RF_FSCTRL1_FREQ_IF_SHIFT (0)
1017 __xdata __at (0xdf08) uint8_t RF_FSCTRL0;
1018 #define RF_FSCTRL0_OFF 0x08
1020 #define RF_FSCTRL0_FREQOFF_SHIFT (0)
1022 __xdata __at (0xdf09) uint8_t RF_FREQ2;
1023 #define RF_FREQ2_OFF 0x09
1025 __xdata __at (0xdf0a) uint8_t RF_FREQ1;
1026 #define RF_FREQ1_OFF 0x0a
1028 __xdata __at (0xdf0b) uint8_t RF_FREQ0;
1029 #define RF_FREQ0_OFF 0x0b
1031 __xdata __at (0xdf0c) uint8_t RF_MDMCFG4;
1032 #define RF_MDMCFG4_OFF 0x0c
1034 #define RF_MDMCFG4_CHANBW_E_SHIFT 6
1035 #define RF_MDMCFG4_CHANBW_M_SHIFT 4
1036 #define RF_MDMCFG4_DRATE_E_SHIFT 0
1038 __xdata __at (0xdf0d) uint8_t RF_MDMCFG3;
1039 #define RF_MDMCFG3_OFF 0x0d
1041 #define RF_MDMCFG3_DRATE_M_SHIFT 0
1043 __xdata __at (0xdf0e) uint8_t RF_MDMCFG2;
1044 #define RF_MDMCFG2_OFF 0x0e
1046 #define RF_MDMCFG2_DEM_DCFILT_OFF (1 << 7)
1047 #define RF_MDMCFG2_DEM_DCFILT_ON (0 << 7)
1049 #define RF_MDMCFG2_MOD_FORMAT_MASK (7 << 4)
1050 #define RF_MDMCFG2_MOD_FORMAT_2_FSK (0 << 4)
1051 #define RF_MDMCFG2_MOD_FORMAT_GFSK (1 << 4)
1052 #define RF_MDMCFG2_MOD_FORMAT_ASK_OOK (3 << 4)
1053 #define RF_MDMCFG2_MOD_FORMAT_MSK (7 << 4)
1055 #define RF_MDMCFG2_MANCHESTER_EN (1 << 3)
1057 #define RF_MDMCFG2_SYNC_MODE_MASK (0x7 << 0)
1058 #define RF_MDMCFG2_SYNC_MODE_NONE (0x0 << 0)
1059 #define RF_MDMCFG2_SYNC_MODE_15_16 (0x1 << 0)
1060 #define RF_MDMCFG2_SYNC_MODE_16_16 (0x2 << 0)
1061 #define RF_MDMCFG2_SYNC_MODE_30_32 (0x3 << 0)
1062 #define RF_MDMCFG2_SYNC_MODE_NONE_THRES (0x4 << 0)
1063 #define RF_MDMCFG2_SYNC_MODE_15_16_THRES (0x5 << 0)
1064 #define RF_MDMCFG2_SYNC_MODE_16_16_THRES (0x6 << 0)
1065 #define RF_MDMCFG2_SYNC_MODE_30_32_THRES (0x7 << 0)
1067 __xdata __at (0xdf0f) uint8_t RF_MDMCFG1;
1068 #define RF_MDMCFG1_OFF 0x0f
1070 #define RF_MDMCFG1_FEC_EN (1 << 7)
1071 #define RF_MDMCFG1_FEC_DIS (0 << 7)
1073 #define RF_MDMCFG1_NUM_PREAMBLE_MASK (7 << 4)
1074 #define RF_MDMCFG1_NUM_PREAMBLE_2 (0 << 4)
1075 #define RF_MDMCFG1_NUM_PREAMBLE_3 (1 << 4)
1076 #define RF_MDMCFG1_NUM_PREAMBLE_4 (2 << 4)
1077 #define RF_MDMCFG1_NUM_PREAMBLE_6 (3 << 4)
1078 #define RF_MDMCFG1_NUM_PREAMBLE_8 (4 << 4)
1079 #define RF_MDMCFG1_NUM_PREAMBLE_12 (5 << 4)
1080 #define RF_MDMCFG1_NUM_PREAMBLE_16 (6 << 4)
1081 #define RF_MDMCFG1_NUM_PREAMBLE_24 (7 << 4)
1083 #define RF_MDMCFG1_CHANSPC_E_MASK (3 << 0)
1084 #define RF_MDMCFG1_CHANSPC_E_SHIFT (0)
1086 __xdata __at (0xdf10) uint8_t RF_MDMCFG0;
1087 #define RF_MDMCFG0_OFF 0x10
1089 #define RF_MDMCFG0_CHANSPC_M_SHIFT (0)
1091 __xdata __at (0xdf11) uint8_t RF_DEVIATN;
1092 #define RF_DEVIATN_OFF 0x11
1094 #define RF_DEVIATN_DEVIATION_E_SHIFT 4
1095 #define RF_DEVIATN_DEVIATION_M_SHIFT 0
1097 __xdata __at (0xdf12) uint8_t RF_MCSM2;
1098 #define RF_MCSM2_OFF 0x12
1099 #define RF_MCSM2_RX_TIME_RSSI (1 << 4)
1100 #define RF_MCSM2_RX_TIME_QUAL (1 << 3)
1101 #define RF_MCSM2_RX_TIME_MASK (0x7)
1102 #define RF_MCSM2_RX_TIME_SHIFT 0
1103 #define RF_MCSM2_RX_TIME_END_OF_PACKET (7)
1105 __xdata __at (0xdf13) uint8_t RF_MCSM1;
1106 #define RF_MCSM1_OFF 0x13
1107 #define RF_MCSM1_CCA_MODE_ALWAYS (0 << 4)
1108 #define RF_MCSM1_CCA_MODE_RSSI_BELOW (1 << 4)
1109 #define RF_MCSM1_CCA_MODE_UNLESS_RECEIVING (2 << 4)
1110 #define RF_MCSM1_CCA_MODE_RSSI_BELOW_UNLESS_RECEIVING (3 << 4)
1111 #define RF_MCSM1_RXOFF_MODE_IDLE (0 << 2)
1112 #define RF_MCSM1_RXOFF_MODE_FSTXON (1 << 2)
1113 #define RF_MCSM1_RXOFF_MODE_TX (2 << 2)
1114 #define RF_MCSM1_RXOFF_MODE_RX (3 << 2)
1115 #define RF_MCSM1_TXOFF_MODE_IDLE (0 << 0)
1116 #define RF_MCSM1_TXOFF_MODE_FSTXON (1 << 0)
1117 #define RF_MCSM1_TXOFF_MODE_TX (2 << 0)
1118 #define RF_MCSM1_TXOFF_MODE_RX (3 << 0)
1120 __xdata __at (0xdf14) uint8_t RF_MCSM0;
1121 #define RF_MCSM0_OFF 0x14
1122 #define RF_MCSM0_FS_AUTOCAL_NEVER (0 << 4)
1123 #define RF_MCSM0_FS_AUTOCAL_FROM_IDLE (1 << 4)
1124 #define RF_MCSM0_FS_AUTOCAL_TO_IDLE (2 << 4)
1125 #define RF_MCSM0_FS_AUTOCAL_TO_IDLE_EVERY_4 (3 << 4)
1126 #define RF_MCSM0_MAGIC_3 (1 << 3)
1127 #define RF_MCSM0_MAGIC_2 (1 << 2)
1128 #define RF_MCSM0_CLOSE_IN_RX_0DB (0 << 0)
1129 #define RF_MCSM0_CLOSE_IN_RX_6DB (1 << 0)
1130 #define RF_MCSM0_CLOSE_IN_RX_12DB (2 << 0)
1131 #define RF_MCSM0_CLOSE_IN_RX_18DB (3 << 0)
1133 __xdata __at (0xdf15) uint8_t RF_FOCCFG;
1134 #define RF_FOCCFG_OFF 0x15
1135 #define RF_FOCCFG_FOC_BS_CS_GATE (1 << 5)
1136 #define RF_FOCCFG_FOC_PRE_K_1K (0 << 3)
1137 #define RF_FOCCFG_FOC_PRE_K_2K (1 << 3)
1138 #define RF_FOCCFG_FOC_PRE_K_3K (2 << 3)
1139 #define RF_FOCCFG_FOC_PRE_K_4K (3 << 3)
1140 #define RF_FOCCFG_FOC_POST_K_PRE_K (0 << 2)
1141 #define RF_FOCCFG_FOC_POST_K_PRE_K_OVER_2 (1 << 2)
1142 #define RF_FOCCFG_FOC_LIMIT_0 (0 << 0)
1143 #define RF_FOCCFG_FOC_LIMIT_BW_OVER_8 (1 << 0)
1144 #define RF_FOCCFG_FOC_LIMIT_BW_OVER_4 (2 << 0)
1145 #define RF_FOCCFG_FOC_LIMIT_BW_OVER_2 (3 << 0)
1147 __xdata __at (0xdf16) uint8_t RF_BSCFG;
1148 #define RF_BSCFG_OFF 0x16
1149 #define RF_BSCFG_BS_PRE_K_1K (0 << 6)
1150 #define RF_BSCFG_BS_PRE_K_2K (1 << 6)
1151 #define RF_BSCFG_BS_PRE_K_3K (2 << 6)
1152 #define RF_BSCFG_BS_PRE_K_4K (3 << 6)
1153 #define RF_BSCFG_BS_PRE_KP_1KP (0 << 4)
1154 #define RF_BSCFG_BS_PRE_KP_2KP (1 << 4)
1155 #define RF_BSCFG_BS_PRE_KP_3KP (2 << 4)
1156 #define RF_BSCFG_BS_PRE_KP_4KP (3 << 4)
1157 #define RF_BSCFG_BS_POST_KI_PRE_KI (0 << 3)
1158 #define RF_BSCFG_BS_POST_KI_PRE_KI_OVER_2 (1 << 3)
1159 #define RF_BSCFG_BS_POST_KP_PRE_KP (0 << 2)
1160 #define RF_BSCFG_BS_POST_KP_PRE_KP_OVER_2 (1 << 2)
1161 #define RF_BSCFG_BS_LIMIT_0 (0 << 0)
1162 #define RF_BSCFG_BS_LIMIT_3_125 (1 << 0)
1163 #define RF_BSCFG_BS_LIMIT_6_25 (2 << 0)
1164 #define RF_BSCFG_BS_LIMIT_12_5 (3 << 0)
1166 __xdata __at (0xdf17) uint8_t RF_AGCCTRL2;
1167 #define RF_AGCCTRL2_OFF 0x17
1169 #define RF_AGCCTRL2_MAX_DVGA_GAIN_ALL (0 << 6)
1170 #define RF_AGCCTRL2_MAX_DVGA_GAIN_BUT_1 (1 << 6)
1171 #define RF_AGCCTRL2_MAX_DVGA_GAIN_BUT_2 (2 << 6)
1172 #define RF_AGCCTRL2_MAX_DVGA_GAIN_BUT_3 (3 << 6)
1173 #define RF_AGCCTRL2_MAX_LNA_GAIN_0 (0 << 3)
1174 #define RF_AGCCTRL2_MAX_LNA_GAIN_2_6 (1 << 3)
1175 #define RF_AGCCTRL2_MAX_LNA_GAIN_6_1 (2 << 3)
1176 #define RF_AGCCTRL2_MAX_LNA_GAIN_7_4 (3 << 3)
1177 #define RF_AGCCTRL2_MAX_LNA_GAIN_9_2 (4 << 3)
1178 #define RF_AGCCTRL2_MAX_LNA_GAIN_11_5 (5 << 3)
1179 #define RF_AGCCTRL2_MAX_LNA_GAIN_14_6 (6 << 3)
1180 #define RF_AGCCTRL2_MAX_LNA_GAIN_17_1 (7 << 3)
1181 #define RF_AGCCTRL2_MAGN_TARGET_24dB (0 << 0)
1182 #define RF_AGCCTRL2_MAGN_TARGET_27dB (1 << 0)
1183 #define RF_AGCCTRL2_MAGN_TARGET_30dB (2 << 0)
1184 #define RF_AGCCTRL2_MAGN_TARGET_33dB (3 << 0)
1185 #define RF_AGCCTRL2_MAGN_TARGET_36dB (4 << 0)
1186 #define RF_AGCCTRL2_MAGN_TARGET_38dB (5 << 0)
1187 #define RF_AGCCTRL2_MAGN_TARGET_40dB (6 << 0)
1188 #define RF_AGCCTRL2_MAGN_TARGET_42dB (7 << 0)
1190 __xdata __at (0xdf18) uint8_t RF_AGCCTRL1;
1191 #define RF_AGCCTRL1_OFF 0x18
1193 #define RF_AGCCTRL1_AGC_LNA_PRIORITY_0 (0 << 6)
1194 #define RF_AGCCTRL1_AGC_LNA_PRIORITY_1 (1 << 6)
1195 #define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_DISABLE (0 << 4)
1196 #define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_6DB (1 << 4)
1197 #define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_10DB (2 << 4)
1198 #define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_14DB (3 << 4)
1199 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_DISABLE (0x8 << 0)
1200 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_7DB_BELOW (0x9 << 0)
1201 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_6DB_BELOW (0xa << 0)
1202 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_5DB_BELOW (0xb << 0)
1203 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_4DB_BELOW (0xc << 0)
1204 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_3DB_BELOW (0xd << 0)
1205 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_2DB_BELOW (0xe << 0)
1206 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_1DB_BELOW (0xf << 0)
1207 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_0DB (0x0 << 0)
1208 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_1DB_ABOVE (0x1 << 0)
1209 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_2DB_ABOVE (0x2 << 0)
1210 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_3DB_ABOVE (0x3 << 0)
1211 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_4DB_ABOVE (0x4 << 0)
1212 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_5DB_ABOVE (0x5 << 0)
1213 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_6DB_ABOVE (0x6 << 0)
1214 #define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_7DB_ABOVE (0x7 << 0)
1216 __xdata __at (0xdf19) uint8_t RF_AGCCTRL0;
1217 #define RF_AGCCTRL0_OFF 0x19
1219 #define RF_AGCCTRL0_HYST_LEVEL_NONE (0 << 6)
1220 #define RF_AGCCTRL0_HYST_LEVEL_LOW (1 << 6)
1221 #define RF_AGCCTRL0_HYST_LEVEL_MEDIUM (2 << 6)
1222 #define RF_AGCCTRL0_HYST_LEVEL_HIGH (3 << 6)
1223 #define RF_AGCCTRL0_WAIT_TIME_8 (0 << 4)
1224 #define RF_AGCCTRL0_WAIT_TIME_16 (1 << 4)
1225 #define RF_AGCCTRL0_WAIT_TIME_24 (2 << 4)
1226 #define RF_AGCCTRL0_WAIT_TIME_32 (3 << 4)
1227 #define RF_AGCCTRL0_AGC_FREEZE_NORMAL (0 << 2)
1228 #define RF_AGCCTRL0_AGC_FREEZE_SYNC (1 << 2)
1229 #define RF_AGCCTRL0_AGC_FREEZE_MANUAL_ANALOG (2 << 2)
1230 #define RF_AGCCTRL0_AGC_FREEZE_MANUAL_BOTH (3 << 2)
1231 #define RF_AGCCTRL0_FILTER_LENGTH_8 (0 << 0)
1232 #define RF_AGCCTRL0_FILTER_LENGTH_16 (1 << 0)
1233 #define RF_AGCCTRL0_FILTER_LENGTH_32 (2 << 0)
1234 #define RF_AGCCTRL0_FILTER_LENGTH_64 (3 << 0)
1236 __xdata __at (0xdf1a) uint8_t RF_FREND1;
1237 #define RF_FREND1_OFF 0x1a
1239 #define RF_FREND1_LNA_CURRENT_SHIFT 6
1240 #define RF_FREND1_LNA2MIX_CURRENT_SHIFT 4
1241 #define RF_FREND1_LODIV_BUF_CURRENT_RX_SHIFT 2
1242 #define RF_FREND1_MIX_CURRENT_SHIFT 0
1244 __xdata __at (0xdf1b) uint8_t RF_FREND0;
1245 #define RF_FREND0_OFF 0x1b
1247 #define RF_FREND0_LODIV_BUF_CURRENT_TX_MASK (0x3 << 4)
1248 #define RF_FREND0_LODIV_BUF_CURRENT_TX_SHIFT 4
1249 #define RF_FREND0_PA_POWER_MASK (0x7)
1250 #define RF_FREND0_PA_POWER_SHIFT 0
1252 __xdata __at (0xdf1c) uint8_t RF_FSCAL3;
1253 #define RF_FSCAL3_OFF 0x1c
1255 __xdata __at (0xdf1d) uint8_t RF_FSCAL2;
1256 #define RF_FSCAL2_OFF 0x1d
1258 __xdata __at (0xdf1e) uint8_t RF_FSCAL1;
1259 #define RF_FSCAL1_OFF 0x1e
1261 __xdata __at (0xdf1f) uint8_t RF_FSCAL0;
1262 #define RF_FSCAL0_OFF 0x1f
1264 __xdata __at (0xdf23) uint8_t RF_TEST2;
1265 #define RF_TEST2_OFF 0x23
1267 #define RF_TEST2_NORMAL_MAGIC 0x88
1268 #define RF_TEST2_RX_LOW_DATA_RATE_MAGIC 0x81
1270 __xdata __at (0xdf24) uint8_t RF_TEST1;
1271 #define RF_TEST1_OFF 0x24
1273 #define RF_TEST1_TX_MAGIC 0x31
1274 #define RF_TEST1_RX_LOW_DATA_RATE_MAGIC 0x35
1276 __xdata __at (0xdf25) uint8_t RF_TEST0;
1277 #define RF_TEST0_OFF 0x25
1279 #define RF_TEST0_7_2_MASK (0xfc)
1280 #define RF_TEST0_VCO_SEL_CAL_EN (1 << 1)
1281 #define RF_TEST0_0_MASK (1)
1283 /* These are undocumented, and must be computed
1284 * using the provided tool.
1286 __xdata __at (0xdf27) uint8_t RF_PA_TABLE7;
1287 #define RF_PA_TABLE7_OFF 0x27
1289 __xdata __at (0xdf28) uint8_t RF_PA_TABLE6;
1290 #define RF_PA_TABLE6_OFF 0x28
1292 __xdata __at (0xdf29) uint8_t RF_PA_TABLE5;
1293 #define RF_PA_TABLE5_OFF 0x29
1295 __xdata __at (0xdf2a) uint8_t RF_PA_TABLE4;
1296 #define RF_PA_TABLE4_OFF 0x2a
1298 __xdata __at (0xdf2b) uint8_t RF_PA_TABLE3;
1299 #define RF_PA_TABLE3_OFF 0x2b
1301 __xdata __at (0xdf2c) uint8_t RF_PA_TABLE2;
1302 #define RF_PA_TABLE2_OFF 0x2c
1304 __xdata __at (0xdf2d) uint8_t RF_PA_TABLE1;
1305 #define RF_PA_TABLE1_OFF 0x2d
1307 __xdata __at (0xdf2e) uint8_t RF_PA_TABLE0;
1308 #define RF_PA_TABLE0_OFF 0x2e
1310 __xdata __at (0xdf36) uint8_t RF_PARTNUM;
1311 #define RF_PARTNUM_OFF 0x36
1313 __xdata __at (0xdf37) uint8_t RF_VERSION;
1314 #define RF_VERSION_OFF 0x37
1316 __xdata __at (0xdf38) uint8_t RF_FREQEST;
1317 #define RF_FREQEST_OFF 0x38
1319 __xdata __at (0xdf39) uint8_t RF_LQI;
1320 #define RF_LQI_OFF 0x39
1322 #define RF_LQI_CRC_OK (1 << 7)
1323 #define RF_LQI_LQI_EST_MASK (0x7f)
1325 __xdata __at (0xdf3a) uint8_t RF_RSSI;
1326 #define RF_RSSI_OFF 0x3a
1328 __xdata __at (0xdf3b) uint8_t RF_MARCSTATE;
1329 #define RF_MARCSTATE_OFF 0x3b
1331 #define RF_MARCSTATE_MASK 0x1f
1332 #define RF_MARCSTATE_SLEEP 0x00
1333 #define RF_MARCSTATE_IDLE 0x01
1334 #define RF_MARCSTATE_VCOON_MC 0x03
1335 #define RF_MARCSTATE_REGON_MC 0x04
1336 #define RF_MARCSTATE_MANCAL 0x05
1337 #define RF_MARCSTATE_VCOON 0x06
1338 #define RF_MARCSTATE_REGON 0x07
1339 #define RF_MARCSTATE_STARTCAL 0x08
1340 #define RF_MARCSTATE_BWBOOST 0x09
1341 #define RF_MARCSTATE_FS_LOCK 0x0a
1342 #define RF_MARCSTATE_IFADCON 0x0b
1343 #define RF_MARCSTATE_ENDCAL 0x0c
1344 #define RF_MARCSTATE_RX 0x0d
1345 #define RF_MARCSTATE_RX_END 0x0e
1346 #define RF_MARCSTATE_RX_RST 0x0f
1347 #define RF_MARCSTATE_TXRX_SWITCH 0x10
1348 #define RF_MARCSTATE_RX_OVERFLOW 0x11
1349 #define RF_MARCSTATE_FSTXON 0x12
1350 #define RF_MARCSTATE_TX 0x13
1351 #define RF_MARCSTATE_TX_END 0x14
1352 #define RF_MARCSTATE_RXTX_SWITCH 0x15
1353 #define RF_MARCSTATE_TX_UNDERFLOW 0x16
1356 __xdata __at (0xdf3c) uint8_t RF_PKTSTATUS;
1357 #define RF_PKTSTATUS_OFF 0x3c
1359 #define RF_PKTSTATUS_CRC_OK (1 << 7)
1360 #define RF_PKTSTATUS_CS (1 << 6)
1361 #define RF_PKTSTATUS_PQT_REACHED (1 << 5)
1362 #define RF_PKTSTATUS_CCA (1 << 4)
1363 #define RF_PKTSTATUS_SFD (1 << 3)
1365 __xdata __at (0xdf3d) uint8_t RF_VCO_VC_DAC;
1366 #define RF_VCO_VC_DAC_OFF 0x3d
1370 __sfr __at 0xB1 ENCDI;
1371 __sfr __at 0xB2 ENCDO;
1372 __xdata __at (0xDFB1) volatile uint8_t ENCDIXADDR;
1373 __xdata __at (0xDFB2) volatile uint8_t ENCDOXADDR;
1375 __sfr __at 0xB3 ENCCCS;
1377 #define ENCCCS_MODE_CBC (0 << 4)
1378 #define ENCCCS_MODE_CFB (1 << 4)
1379 #define ENCCCS_MODE_OFB (2 << 4)
1380 #define ENCCCS_MODE_CTR (3 << 4)
1381 #define ENCCCS_MODE_ECB (4 << 4)
1382 #define ENCCCS_MODE_CBC_MAC (5 << 4)
1383 #define ENCCCS_RDY (1 << 3)
1384 #define ENCCCS_CMD_ENCRYPT (0 << 1)
1385 #define ENCCCS_CMD_DECRYPT (1 << 1)
1386 #define ENCCCS_CMD_LOAD_KEY (2 << 1)
1387 #define ENCCCS_CMD_LOAD_IV (3 << 1)
1388 #define ENCCCS_START (1 << 0)