39 #ifndef PLATFORM_CONF_H_
40 #define PLATFORM_CONF_H_
47 #define PLATFORM_NAME "MicaZ"
48 #define PLATFORM_TYPE MICAZ
50 #define F_CPU 7372800UL
58 #define CLOCK_CONF_SECOND 128
61 typedef unsigned short clock_time_t;
62 #define CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
63 #define INFINITE_TIME 0xffff
64 #define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND
65 #define COLLECT_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND
67 typedef unsigned long clock_time_t;
68 #define CLOCK_LT(a,b) ((signed long)((a)-(b)) < 0)
69 #define INFINITE_TIME 0xffffffff
76 #define LEDS_PxDIR DDRA // port direction register
77 #define LEDS_PxOUT PORTA // port register
78 #define LEDS_CONF_RED 0x04 //red led
79 #define LEDS_CONF_GREEN 0x02 // green led
80 #define LEDS_CONF_YELLOW 0x01 // yellow led
83 #define SLIP_PORT RS232_PORT_0
86 #define MMEM_CONF_SIZE 256
91 #define EEPROMFS_ADDR_CODEPROP 0x8000
93 #define EEPROM_NODE_ID_START 0x00
96 #define NETSTACK_CONF_RADIO cc2420_driver
104 #define SPI_TXBUF SPDR
105 #define SPI_RXBUF SPDR
107 #define BV(bitno) _BV(bitno)
109 #define SPI_WAITFOREOTx() do { while (!(SPSR & BV(SPIF))); } while (0)
110 #define SPI_WAITFOREORx() do { while (!(SPSR & BV(SPIF))); } while (0)
126 #define SPI_FLASH_ENABLE() ( P4OUT &= ~BV(FLASH_CS) )
127 #define SPI_FLASH_DISABLE() ( P4OUT |= BV(FLASH_CS) )
129 #define SPI_FLASH_HOLD() ( P4OUT &= ~BV(FLASH_HOLD) )
130 #define SPI_FLASH_UNHOLD() ( P4OUT |= BV(FLASH_HOLD) )
136 #define CC2420_CONF_SYMBOL_LOOP_COUNT 500
153 #define CC2420_FIFOP_PORT(type) P##type##E
154 #define CC2420_FIFOP_PIN 6
156 #define CC2420_FIFO_PORT(type) P##type##B
157 #define CC2420_FIFO_PIN 7
159 #define CC2420_CCA_PORT(type) P##type##D
160 #define CC2420_CCA_PIN 6
162 #define CC2420_SFD_PORT(type) P##type##D
163 #define CC2420_SFD_PIN 4
165 #define CC2420_CSN_PORT(type) P##type##B
166 #define CC2420_CSN_PIN 0
168 #define CC2420_VREG_PORT(type) P##type##A
169 #define CC2420_VREG_PIN 5
171 #define CC2420_RESET_PORT(type) P##type##A
172 #define CC2420_RESET_PIN 6
174 #define CC2420_IRQ_VECTOR INT6_vect
177 #define CC2420_FIFOP_IS_1 (!!(CC2420_FIFOP_PORT(IN) & BV(CC2420_FIFOP_PIN)))
178 #define CC2420_FIFO_IS_1 (!!(CC2420_FIFO_PORT(IN) & BV(CC2420_FIFO_PIN)))
179 #define CC2420_CCA_IS_1 (!!(CC2420_CCA_PORT(IN) & BV(CC2420_CCA_PIN)))
180 #define CC2420_SFD_IS_1 (!!(CC2420_SFD_PORT(IN) & BV(CC2420_SFD_PIN)))
183 #define SET_RESET_INACTIVE() (CC2420_RESET_PORT(ORT) |= BV(CC2420_RESET_PIN))
184 #define SET_RESET_ACTIVE() (CC2420_RESET_PORT(ORT) &= ~BV(CC2420_RESET_PIN))
187 #define SET_VREG_ACTIVE() (CC2420_VREG_PORT(ORT) |= BV(CC2420_VREG_PIN))
188 #define SET_VREG_INACTIVE() (CC2420_VREG_PORT(ORT) &= ~BV(CC2420_VREG_PIN))
194 #define CC2420_FIFOP_INT_INIT() do {\
196 CC2420_CLEAR_FIFOP_INT(); \
200 #define CC2420_ENABLE_FIFOP_INT() do { EIMSK |= 0x40; } while (0)
201 #define CC2420_DISABLE_FIFOP_INT() do { EIMSK &= ~0x40; } while (0)
202 #define CC2420_CLEAR_FIFOP_INT() do { EIFR = 0x40; } while (0)
208 #define CC2420_SPI_ENABLE() (PORTB &= ~BV(CSN))
209 #define CC2420_SPI_DISABLE() (PORTB |= BV(CSN))
void clock_delay_msec(uint16_t howlong)
Delay up to 65535 milliseconds.
void clock_adjust_ticks(clock_time_t howmany)
Adjust the system current clock time.