Contiki 2.6

sfr-bits.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2011, George Oikonomou - <oikonomou@users.sourceforge.net>
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the Institute nor the names of its contributors
00014  *    may be used to endorse or promote products derived from this software
00015  *    without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00027  * SUCH DAMAGE.
00028  *
00029  * This file is part of the Contiki operating system.
00030  */
00031 
00032 /**
00033  * \file
00034  *         Header file with definitions of bit masks for some cc2530 SFRs
00035  *
00036  * \author
00037  *         George Oikonomou - <oikonomou@users.sourceforge.net>
00038  */
00039 
00040 
00041 #ifndef SFR_BITS_H_
00042 #define SFR_BITS_H_
00043 
00044 /* CLKCON */
00045 #define CLKCONCMD_OSC32K    0x80
00046 #define CLKCONCMD_OSC       0x40
00047 #define CLKCONCMD_TICKSPD2  0x20
00048 #define CLKCONCMD_TICKSPD1  0x10
00049 #define CLKCONCMD_TICKSPD0  0x08
00050 #define CLKCONCMD_CLKSPD2   0x04
00051 #define CLKCONCMD_CLKSPD1   0x02
00052 #define CLKCONCMD_CLKSPD0   0x01
00053 
00054 /* SLEEPCMD and SLEEPSTA */
00055 #define SLEEP_OSC32K_CALDIS  0x80
00056 #define SLEEP_XOSC_STB       0x40
00057 #define SLEEP_HFRC_STB       0x20
00058 #define SLEEP_RST1           0x10 /* SLEEPSTA only */
00059 #define SLEEP_RST0           0x08 /* SLEEPSTA only */
00060 #define SLEEP_OSC_PD         0x04
00061 #define SLEEP_MODE1          0x02
00062 #define SLEEP_MODE0          0x01
00063 
00064 /* PCON */
00065 #define PCON_IDLE 0x01
00066 
00067 /* T1CTL */
00068 #define T1CTL_DIV1  0x08
00069 #define T1CTL_DIV0  0x04
00070 #define T1CTL_MODE1 0x02
00071 #define T1CTL_MODE0 0x01
00072 
00073 /* T1CCTLx */
00074 #define T1CCTL_RFIRQ 0x80
00075 #define T1CCTL_IM    0x40
00076 #define T1CCTL_CMP2  0x20
00077 #define T1CCTL_CMP1  0x10
00078 #define T1CCTL_CMP0  0x08
00079 #define T1CCTL_MODE  0x04
00080 #define T1CCTL_CAP1  0x02
00081 #define T1CCTL_CAP0  0x01
00082 
00083 /* T1STAT */
00084 #define T1STAT_OVFIF   0x20
00085 #define T1STAT_CH4IF   0x10
00086 #define T1STAT_CH3IF   0x08
00087 #define T1STAT_CH2IF   0x04
00088 #define T1STAT_CH1IF   0x02
00089 #define T1STAT_CH0IF   0x01
00090 
00091 /* WDCTL */
00092 #define WDCTL_CLR3  0x80
00093 #define WDCTL_CLR2  0x40
00094 #define WDCTL_CLR1  0x20
00095 #define WDCTL_CLR0  0x10
00096 #define WDCTL_MODE1 0x08
00097 #define WDCTL_MODE0 0x04
00098 #define WDCTL_INT1  0x02
00099 #define WDCTL_INT0  0x01
00100 
00101 /* ADCCON1 */
00102 #define ADCCON1_EOC     0x80
00103 #define ADCCON1_ST      0x40
00104 #define ADCCON1_STSEL1  0x20
00105 #define ADCCON1_STSEL0  0x10
00106 /* ADCCON1 - RNG bits */
00107 #define ADCCON1_RCTRL1  0x08
00108 #define ADCCON1_RCTRL0  0x04
00109 
00110 /* ADCCON3 */
00111 #define ADCCON3_EREF1 0x80
00112 #define ADCCON3_EREF0 0x40
00113 #define ADCCON3_EDIV1 0x20
00114 #define ADCCON3_EDIV0 0x10
00115 #define ADCCON3_ECH3  0x08
00116 #define ADCCON3_ECH2  0x04
00117 #define ADCCON3_ECH1  0x02
00118 #define ADCCON3_ECH0  0x01
00119 
00120 /* PERCFG */
00121 #define PERCFG_T1CFG 0x40
00122 #define PERCFG_T3CFG 0x20
00123 #define PERCFG_T4CFG 0x10
00124 #define PERCFG_U1CFG 0x02
00125 #define PERCFG_U0CFG 0x01
00126 
00127 /* UxCSR */
00128 #define UCSR_MODE    0x80
00129 #define UCSR_RE      0x40
00130 #define UCSR_SLAVE   0x20
00131 #define UCSR_FE      0x10
00132 #define UCSR_ERR     0x08
00133 #define UCSR_RX_BYTE 0x04
00134 #define UCSR_TX_BYTE 0x02
00135 #define UCSR_ACTIVE  0x01
00136 
00137 /* IEN2 */
00138 #define IEN2_WDTIE   0x20
00139 #define IEN2_P1IE    0x10
00140 #define IEN2_UTX1IE  0x08
00141 #define IEN2_UTX0IE  0x04
00142 #define IEN2_P2IE    0x02
00143 #define IEN2_RFIE    0x01
00144 
00145 /* PICTL */
00146 #define PICTL_PADSC   0x40
00147 #define PICTL_P2ICON  0x08
00148 #define PICTL_P1ICONH 0x04
00149 #define PICTL_P1ICONL 0x02
00150 #define PICTL_P0ICON  0x01
00151 /*---------------------------------------------------------------------------
00152  * XREG bits, excluding RF and USB
00153  *---------------------------------------------------------------------------*/
00154 /* FCTL */
00155 #define FCTL_BUSY     0x80
00156 #define FCTL_FULL     0x40
00157 #define FCTL_ABORT    0x20
00158 #define FCTL_CM1      0x08
00159 #define FCTL_CM0      0x04
00160 #define FCTL_WRITE    0x02
00161 #define FCTL_ERASE    0x01
00162 /*---------------------------------------------------------------------------
00163  * Radio Register Bits
00164  *---------------------------------------------------------------------------*/
00165 /* FRMCTRL0 */
00166 #define FRMCTRL0_APPEND_DATA_MODE   0x80
00167 #define FRMCTRL0_AUTOCRC            0x40
00168 #define FRMCTRL0_AUTOACK            0x20
00169 #define FRMCTRL0_ENERGY_SCAN        0x10
00170 #define FRMCTRL0_RX_MODE1           0x08
00171 #define FRMCTRL0_RX_MODE0           0x04
00172 #define FRMCTRL0_TX_MODE1           0x02
00173 #define FRMCTRL0_TX_MODE0           0x01
00174 
00175 /* FRMCTRL1 */
00176 #define FRMCTRL1_PENDING_OR         0x04
00177 #define FRMCTRL1_IGNORE_TX_UNDERF   0x02
00178 #define FRMCTRL1_SET_RXENMASK_ON_TX 0x01
00179 
00180 /* FSMSTAT1 */
00181 #define FSMSTAT1_FIFO               0x80
00182 #define FSMSTAT1_FIFOP              0x40
00183 #define FSMSTAT1_SFD                0x20
00184 #define FSMSTAT1_CCA                0x10
00185 #define FSMSTAT1_TX_ACTIVE          0x02
00186 #define FSMSTAT1_RX_ACTIVE          0x01
00187 
00188 /* RSSISTAT */
00189 #define RSSISTAT_RSSI_VALID         0x01
00190 
00191 /* RFRND */
00192 #define RFRND_QRND                  0x02
00193 #define RFRND_IRND                  0x01
00194 
00195 #endif /* SFR_BITS_H_ */