platform-conf.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef __PLATFORM_CONF_H__
00041 #define __PLATFORM_CONF_H__
00042
00043
00044
00045
00046
00047 #define PLATFORM PLATFORM_AVR
00048
00049
00050
00051
00052
00053 #define MCU_MHZ 7
00054
00055
00056 #define CLOCK_CONF_SECOND 128
00057
00058
00059
00060 #define LEDS_PxDIR DDRA // port direction register
00061 #define LEDS_PxOUT PORTA // port register
00062 #define LEDS_CONF_RED 0x04 //red led
00063 #define LEDS_CONF_GREEN 0x02 // green led
00064 #define LEDS_CONF_YELLOW 0x01 // yellow led
00065
00066
00067 #define SLIP_PORT RS232_PORT_0
00068
00069
00070 #define MMEM_CONF_SIZE 256
00071
00072
00073
00074
00075 #define EEPROMFS_ADDR_CODEPROP 0x8000
00076
00077 #define EEPROM_NODE_ID_START 0x00
00078
00079
00080 #define NETSTACK_CONF_RADIO cc2420_driver
00081
00082
00083
00084
00085
00086
00087
00088 #define SPI_TXBUF SPDR
00089 #define SPI_RXBUF SPDR
00090
00091 #define BV(bitno) _BV(bitno)
00092
00093 #define SPI_WAITFOREOTx() do { while (!(SPSR & BV(SPIF))); } while (0)
00094 #define SPI_WAITFOREORx() do { while (!(SPSR & BV(SPIF))); } while (0)
00095
00096 #define SCK 1
00097 #define MOSI 2
00098 #define MISO 3
00099
00100
00101
00102
00103
00104 #define FLASH_PWR 3
00105 #define FLASH_CS 4
00106 #define FLASH_HOLD 7
00107
00108
00109
00110 #define SPI_FLASH_ENABLE() ( P4OUT &= ~BV(FLASH_CS) )
00111 #define SPI_FLASH_DISABLE() ( P4OUT |= BV(FLASH_CS) )
00112
00113 #define SPI_FLASH_HOLD() ( P4OUT &= ~BV(FLASH_HOLD) )
00114 #define SPI_FLASH_UNHOLD() ( P4OUT |= BV(FLASH_HOLD) )
00115
00116
00117
00118
00119
00120 #define CC2420_CONF_SYMBOL_LOOP_COUNT 500
00121
00122
00123
00124
00125
00126 #define FIFO_P 6
00127 #define FIFO 7
00128 #define CCA 6
00129
00130 #define SFD 4
00131 #define CSN 0
00132 #define VREG_EN 5
00133 #define RESET_N 6
00134
00135
00136
00137 #define CC2420_FIFOP_PORT(type) P##type##E
00138 #define CC2420_FIFOP_PIN 6
00139
00140 #define CC2420_FIFO_PORT(type) P##type##B
00141 #define CC2420_FIFO_PIN 7
00142
00143 #define CC2420_CCA_PORT(type) P##type##D
00144 #define CC2420_CCA_PIN 6
00145
00146 #define CC2420_SFD_PORT(type) P##type##D
00147 #define CC2420_SFD_PIN 4
00148
00149 #define CC2420_CSN_PORT(type) P##type##B
00150 #define CC2420_CSN_PIN 0
00151
00152 #define CC2420_VREG_PORT(type) P##type##A
00153 #define CC2420_VREG_PIN 5
00154
00155 #define CC2420_RESET_PORT(type) P##type##A
00156 #define CC2420_RESET_PIN 6
00157
00158 #define CC2420_IRQ_VECTOR INT6_vect
00159
00160
00161 #define CC2420_FIFOP_IS_1 (!!(CC2420_FIFOP_PORT(IN) & BV(CC2420_FIFOP_PIN)))
00162 #define CC2420_FIFO_IS_1 (!!(CC2420_FIFO_PORT(IN) & BV(CC2420_FIFO_PIN)))
00163 #define CC2420_CCA_IS_1 (!!(CC2420_CCA_PORT(IN) & BV(CC2420_CCA_PIN)))
00164 #define CC2420_SFD_IS_1 (!!(CC2420_SFD_PORT(IN) & BV(CC2420_SFD_PIN)))
00165
00166
00167 #define SET_RESET_INACTIVE() (CC2420_RESET_PORT(ORT) |= BV(CC2420_RESET_PIN))
00168 #define SET_RESET_ACTIVE() (CC2420_RESET_PORT(ORT) &= ~BV(CC2420_RESET_PIN))
00169
00170
00171 #define SET_VREG_ACTIVE() (CC2420_VREG_PORT(ORT) |= BV(CC2420_VREG_PIN))
00172 #define SET_VREG_INACTIVE() (CC2420_VREG_PORT(ORT) &= ~BV(CC2420_VREG_PIN))
00173
00174
00175
00176
00177
00178 #define CC2420_FIFOP_INT_INIT() do {\
00179 EICRB |= 0x30; \
00180 CC2420_CLEAR_FIFOP_INT(); \
00181 } while (0)
00182
00183
00184 #define CC2420_ENABLE_FIFOP_INT() do { EIMSK |= 0x40; } while (0)
00185 #define CC2420_DISABLE_FIFOP_INT() do { EIMSK &= ~0x40; } while (0)
00186 #define CC2420_CLEAR_FIFOP_INT() do { EIFR = 0x40; } while (0)
00187
00188
00189
00190
00191
00192 #define CC2420_SPI_ENABLE() (PORTB &= ~BV(CSN))
00193 #define CC2420_SPI_DISABLE() (PORTB |= BV(CSN))
00194
00195 #endif