Contiki 2.6

cc2520_const.h

00001 /*
00002  * Copyright (c) 2011, Swedish Institute of Computer Science
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  */
00030 
00031 #ifndef CC2520_CONST_H
00032 #define CC2520_CONST_H
00033 
00034 /*
00035  * All constants are from the Chipcon cc2520 Data Sheet that at one
00036  * point in time could be found at
00037  * http://www.chipcon.com/files/cc2520_Data_Sheet_1_4.pdf
00038  *
00039  * The page numbers below refer to pages in this document.
00040  */
00041 
00042 /* Page 27. */
00043 enum cc2520_status_byte {
00044   CC2520_XOSC16M_STABLE = 7,
00045   CC2520_RSSI_VALID     = 6,
00046   CC2520_EXCEPTION_CHA = 5,
00047   CC2520_EXCEPTION_CHB = 4,
00048   CC2520_DPU_H  = 3,
00049   CC2520_DPU_L  = 2,
00050   CC2520_TX_ACTIVE      = 1,
00051   CC2520_RX_ACTIVE      = 0,
00052 
00053 };
00054 #define TX_FRM_DONE      0x02
00055 #define RX_FRM_DONE      0x01
00056 #define RX_FRM_ABORTED   0x20
00057 #define RX_FRM_UNDERFLOW 0x20
00058 
00059 /* Page 27. */
00060 enum cc2520_memory_size {
00061   CC2520_RAM_SIZE       = 640,
00062   CC2520_FIFO_SIZE      = 128,
00063 };
00064 
00065 /* Page 29. */
00066 enum cc2520_address {
00067   CC2520RAM_TXFIFO      = 0x100,
00068   CC2520RAM_RXFIFO      = 0x180,
00069   CC2520RAM_IEEEADDR    = 0x3EA,
00070   CC2520RAM_PANID       = 0x3F2,
00071   CC2520RAM_SHORTADDR   = 0x3F4,
00072 };
00073 
00074 // IEEE 802.15.4 defined constants (2.4 GHz logical channels)
00075 #define MIN_CHANNEL                                 11    // 2405 MHz
00076 #define MAX_CHANNEL                         26    // 2480 MHz
00077 #define CHANNEL_SPACING                     5     // MHz
00078 
00079 // FREG definitions (BSET/BCLR supported)
00080 #define CC2520_FRMFILT0                0x000
00081 #define CC2520_FRMFILT1                0x001
00082 #define CC2520_SRCMATCH                0x002
00083 #define CC2520_SRCSHORTEN0             0x004
00084 #define CC2520_SRCSHORTEN1             0x005
00085 #define CC2520_SRCSHORTEN2             0x006
00086 #define CC2520_SRCEXTEN0               0x008
00087 #define CC2520_SRCEXTEN1               0x009
00088 #define CC2520_SRCEXTEN2               0x00A
00089 #define CC2520_FRMCTRL0                0x00C
00090 #define CC2520_FRMCTRL1                0x00D
00091 #define CC2520_RXENABLE0               0x00E
00092 #define CC2520_RXENABLE1               0x00F
00093 #define CC2520_EXCFLAG0                0x010
00094 #define CC2520_EXCFLAG1                0x011
00095 #define CC2520_EXCFLAG2                0x012
00096 #define CC2520_EXCMASKA0               0x014
00097 #define CC2520_EXCMASKA1               0x015
00098 #define CC2520_EXCMASKA2               0x016
00099 #define CC2520_EXCMASKB0               0x018
00100 #define CC2520_EXCMASKB1               0x019
00101 #define CC2520_EXCMASKB2               0x01A
00102 #define CC2520_EXCBINDX0               0x01C
00103 #define CC2520_EXCBINDX1               0x01D
00104 #define CC2520_EXCBINDY0               0x01E
00105 #define CC2520_EXCBINDY1               0x01F
00106 #define CC2520_GPIOCTRL0               0x020
00107 #define CC2520_GPIOCTRL1               0x021
00108 #define CC2520_GPIOCTRL2               0x022
00109 #define CC2520_GPIOCTRL3               0x023
00110 #define CC2520_GPIOCTRL4               0x024
00111 #define CC2520_GPIOCTRL5               0x025
00112 #define CC2520_GPIOPOLARITY            0x026
00113 #define CC2520_GPIOCTRL                0x028
00114 #define CC2520_DPUCON                  0x02A
00115 #define CC2520_DPUSTAT                 0x02C
00116 #define CC2520_FREQCTRL                0x02E
00117 #define CC2520_FREQTUNE                0x02F
00118 #define CC2520_TXPOWER                 0x030
00119 #define CC2520_TXCTRL                  0x031
00120 #define CC2520_FSMSTAT0                0x032
00121 #define CC2520_FSMSTAT1                0x033
00122 #define CC2520_FIFOPCTRL               0x034
00123 #define CC2520_FSMCTRL                 0x035
00124 #define CC2520_CCACTRL0                0x036
00125 #define CC2520_CCACTRL1                0x037
00126 #define CC2520_RSSI                    0x038
00127 #define CC2520_RSSISTAT                0x039
00128 #define CC2520_TXFIFO_BUF              0x03A
00129 #define CC2520_RXFIRST                 0x03C
00130 #define CC2520_RXFIFOCNT               0x03E
00131 #define CC2520_TXFIFOCNT               0x03F
00132 
00133 // SREG definitions (BSET/BCLR unsupported)
00134 #define CC2520_CHIPID                  0x040
00135 #define CC2520_VERSION                 0x042
00136 #define CC2520_EXTCLOCK                0x044
00137 #define CC2520_MDMCTRL0                0x046
00138 #define CC2520_MDMCTRL1                0x047
00139 #define CC2520_FREQEST                 0x048
00140 #define CC2520_RXCTRL                  0x04A
00141 #define CC2520_FSCTRL                  0x04C
00142 #define CC2520_FSCAL0                  0x04E
00143 #define CC2520_FSCAL1                  0x04F
00144 #define CC2520_FSCAL2                  0x050
00145 #define CC2520_FSCAL3                  0x051
00146 #define CC2520_AGCCTRL0                0x052
00147 #define CC2520_AGCCTRL1                0x053
00148 #define CC2520_AGCCTRL2                0x054
00149 #define CC2520_AGCCTRL3                0x055
00150 #define CC2520_ADCTEST0                0x056
00151 #define CC2520_ADCTEST1                0x057
00152 #define CC2520_ADCTEST2                0x058
00153 #define CC2520_MDMTEST0                0x05A
00154 #define CC2520_MDMTEST1                0x05B
00155 #define CC2520_DACTEST0                0x05C
00156 #define CC2520_DACTEST1                0x05D
00157 #define CC2520_ATEST                   0x05E
00158 #define CC2520_DACTEST2                0x05F
00159 #define CC2520_PTEST0                  0x060
00160 #define CC2520_PTEST1                  0x061
00161 #define CC2520_RESERVED                0x062
00162 #define CC2520_DPUBIST                 0x07A
00163 #define CC2520_ACTBIST                 0x07C
00164 #define CC2520_RAMBIST                 0x07E
00165 
00166 // Instruction implementation
00167 #define CC2520_INS_SNOP                0x00
00168 #define CC2520_INS_IBUFLD              0x02
00169 #define CC2520_INS_SIBUFEX             0x03
00170 #define CC2520_INS_SSAMPLECCA          0x04
00171 #define CC2520_INS_SRES                0x0F
00172 #define CC2520_INS_MEMRD               0x10
00173 #define CC2520_INS_MEMWR               0x20
00174 #define CC2520_INS_RXBUF               0x30
00175 #define CC2520_INS_RXBUFCP             0x38
00176 #define CC2520_INS_RXBUFMOV            0x32
00177 #define CC2520_INS_TXBUF               0x3A
00178 #define CC2520_INS_TXBUFCP             0x3E
00179 #define CC2520_INS_RANDOM              0x3C
00180 #define CC2520_INS_SXOSCON             0x40
00181 #define CC2520_INS_STXCAL              0x41
00182 #define CC2520_INS_SRXON               0x42
00183 #define CC2520_INS_STXON               0x43
00184 #define CC2520_INS_STXONCCA            0x44
00185 #define CC2520_INS_SRFOFF              0x45
00186 #define CC2520_INS_SXOSCOFF            0x46
00187 #define CC2520_INS_SFLUSHRX            0x47
00188 #define CC2520_INS_SFLUSHTX            0x48
00189 #define CC2520_INS_SACK                0x49
00190 #define CC2520_INS_SACKPEND            0x4A
00191 #define CC2520_INS_SNACK               0x4B
00192 #define CC2520_INS_SRXMASKBITSET       0x4C
00193 #define CC2520_INS_SRXMASKBITCLR       0x4D
00194 #define CC2520_INS_RXMASKAND           0x4E
00195 #define CC2520_INS_RXMASKOR            0x4F
00196 #define CC2520_INS_MEMCP               0x50
00197 #define CC2520_INS_MEMCPR              0x52
00198 #define CC2520_INS_MEMXCP              0x54
00199 #define CC2520_INS_MEMXWR              0x56
00200 #define CC2520_INS_BCLR                0x58
00201 #define CC2520_INS_BSET                0x59
00202 #define CC2520_INS_CTR                 0x60
00203 #define CC2520_INS_CBCMAC              0x64
00204 #define CC2520_INS_UCBCMAC             0x66
00205 #define CC2520_INS_CCM                 0x68
00206 #define CC2520_INS_UCCM                0x6A
00207 #define CC2520_INS_ECB                 0x70
00208 #define CC2520_INS_ECBO                0x72
00209 #define CC2520_INS_ECBX                0x74
00210 #define CC2520_INS_ECBXO               0x76
00211 #define CC2520_INS_INC                 0x78
00212 #define CC2520_INS_ABORT               0x7F
00213 #define CC2520_INS_REGRD               0x80
00214 #define CC2520_INS_REGWR               0xC0
00215 
00216 #endif /* CC2520_CONST_H */