From cb45883970d2f7d731779482a46e7dbe472daa15 Mon Sep 17 00:00:00 2001 From: dak664 Date: Fri, 18 Jun 2010 15:44:53 +0000 Subject: [PATCH] Turn on DEBUGFLOW and software CRC computation --- cpu/avr/radio/rf230bb/halbb.c | 10 +++++----- cpu/avr/radio/rf230bb/rf230bb.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cpu/avr/radio/rf230bb/halbb.c b/cpu/avr/radio/rf230bb/halbb.c index 55cfde0e9..de2949e1d 100644 --- a/cpu/avr/radio/rf230bb/halbb.c +++ b/cpu/avr/radio/rf230bb/halbb.c @@ -455,7 +455,7 @@ hal_frame_read(hal_rx_frame_t *rx_frame, rx_callback_t rx_callback) /*Check for correct frame length.*/ if ((frame_length >= HAL_MIN_FRAME_LENGTH) && (frame_length <= HAL_MAX_FRAME_LENGTH)){ - uint16_t crc = 0; +// uint16_t crc = 0; // if (rx_frame){ rx_data = (rx_frame->data); rx_frame->length = frame_length; @@ -475,8 +475,8 @@ hal_frame_read(hal_rx_frame_t *rx_frame, rx_callback_t rx_callback) // } else { // rx_callback(tempData); // } - - crc = _crc_ccitt_update(crc, tempData); +/* RF230 does crc in hardware, for speed we hope the buffer is not being overwritten! */ +// crc = _crc_ccitt_update(crc, tempData); while ((SPSR & (1 << SPIF)) == 0) {;} @@ -490,10 +490,10 @@ hal_frame_read(hal_rx_frame_t *rx_frame, rx_callback_t rx_callback) // } HAL_SS_HIGH(); - + rx_frame->crc = 1; /*Check calculated crc, and set crc field in hal_rx_frame_t accordingly.*/ // if (rx_frame){ - rx_frame->crc = (crc == HAL_CALCULATED_CRC_OK); +// rx_frame->crc = (crc == HAL_CALCULATED_CRC_OK); // } else { // rx_callback(crc != HAL_CALCULATED_CRC_OK); // } diff --git a/cpu/avr/radio/rf230bb/rf230bb.c b/cpu/avr/radio/rf230bb/rf230bb.c index a3bcbcccc..a21dc17b1 100644 --- a/cpu/avr/radio/rf230bb/rf230bb.c +++ b/cpu/avr/radio/rf230bb/rf230bb.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: rf230bb.c,v 1.10 2010/06/14 19:19:17 adamdunkels Exp $ + * @(#)$Id: rf230bb.c,v 1.11 2010/06/18 15:44:53 dak664 Exp $ */ /* * This code is almost device independent and should be easy to port. @@ -139,7 +139,7 @@ uint16_t RF230_sendpackets,RF230_receivepackets,RF230_sendfail,RF230_receivefail #endif /* Track flow through driver, see contiki-raven-main.c for example of use */ -#define DEBUGFLOWSIZE 64 +//#define DEBUGFLOWSIZE 64 #if DEBUGFLOWSIZE uint8_t debugflowsize,debugflow[DEBUGFLOWSIZE]; #define DEBUGFLOW(c) if (debugflowsize<(DEBUGFLOWSIZE-1)) debugflow[debugflowsize++]=c @@ -1026,7 +1026,7 @@ rf230_read(void *buf, unsigned short bufsize) len=rxframe.length; if (len==0) { -#if RADIOALWAYSON +#if RADIOALWAYSON && DEBUGFLOWSIZE if (RF230_receive_on==0) {if (debugflow[debugflowsize-1]!='z') DEBUGFLOW('z');} //cxmac calls with radio off? #endif return 0;