message_t m_rx_buf;
#ifdef CC2420_HW_SECURITY
norace cc2420_receive_state_t m_state;
-#else
- cc2420_receive_state_t m_state;
-#endif
norace uint8_t packetLength = 0;
norace uint8_t pos = 0;
norace uint8_t secHdrPos = 0;
uint8_t flush_flag = 0;
uint16_t startTime = 0;
+ void beginDec();
+ void dec();
+#else
+ cc2420_receive_state_t m_state;
+#endif
+
/***************** Prototypes ****************/
void reset_state();
void beginReceive();
void waitForNextPacket();
void flush();
bool passesAddressCheck(message_t * ONE msg);
- void beginDec();
- void dec();
task void receiveDone_task();
call CSN.clr();
#ifndef TFRAMES_ENABLED
- atomic call SECCTRL1.write(skip+11+sizeof(security_header_t))+((skip+11+sizeof(security_header_t))<<8);
+ atomic call SECCTRL1.write(skip+11+sizeof(security_header_t)+((skip+11+sizeof(security_header_t))<<8));
#else
- atomic call SECCTRL1.write(skip+10+sizeof(security_header_t))+((skip+10+sizeof(security_header_t))<<8);
+ atomic call SECCTRL1.write(skip+10+sizeof(security_header_t)+((skip+10+sizeof(security_header_t))<<8));
#endif
call CSN.set();
case S_RX_LENGTH:
m_state = S_RX_FCF;
+#ifdef CC2420_HW_SECURITY
packetLength = rxFrameLength+1;
- if ( rxFrameLength + 1 > m_bytes_left || flush_flag == 1) {
+#endif
+ if ( rxFrameLength + 1 > m_bytes_left
+#ifdef CC2420_HW_SECURITY
+ || flush_flag == 1
+#endif
+ ) {
// Length of this packet is bigger than the RXFIFO, flush it out.
flush();
securityOn = 0;
authentication = 0;
#endif
- m_p_rx_buf = signal Receive.receive( m_p_rx_buf, m_p_rx_buf->data,
+ m_p_rx_buf = signal Receive.receive( m_p_rx_buf, m_p_rx_buf->data,
length - CC2420_SIZE);
}
atomic receivingPacket = FALSE;
* Flush out the Rx FIFO
*/
void flush() {
+#ifdef CC2420_HW_SECURITY
flush_flag = 0;
pos =0;
packetLength =0;
micLength = 0;
securityOn = 0;
authentication = 0;
+#endif
reset_state();
call CSN.set();