From 2f27388d0443105daaa608e89870a2f1ce54fc4d Mon Sep 17 00:00:00 2001 From: Thomas Eichinger Date: Mon, 6 Oct 2014 16:33:59 +0200 Subject: [PATCH] sys/transceiver: cleanup and fix for cc2420 and at86rf231 cc2420: the payload pointer was set twice at86rf231: payload_len was not copied from the radio driver buffer --- drivers/at86rf231/at86rf231_rx.c | 6 +++--- sys/transceiver/transceiver.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/at86rf231/at86rf231_rx.c b/drivers/at86rf231/at86rf231_rx.c index fe8de74b05..628d989069 100644 --- a/drivers/at86rf231/at86rf231_rx.c +++ b/drivers/at86rf231/at86rf231_rx.c @@ -28,7 +28,7 @@ #define ENABLE_DEBUG (0) #if ENABLE_DEBUG -#define DEBUG_ENABLED (1) +#define DEBUG_ENABLED #endif #include "debug.h" @@ -68,7 +68,7 @@ void at86rf231_rx_handler(void) at86rf231_rx_buffer[rx_buffer_next].length); if (at86rf231_rx_buffer[rx_buffer_next].frame.fcf.frame_type != 2) { -#if DEBUG_ENABLED +#ifdef DEBUG_ENABLED ieee802154_frame_print_fcf_frame(&at86rf231_rx_buffer[rx_buffer_next].frame); #endif @@ -81,7 +81,7 @@ void at86rf231_rx_handler(void) } } else { -#if DEBUG_ENABLED +#ifdef DEBUG_ENABLED DEBUG("GOT ACK for SEQ %u\n", at86rf231_rx_buffer[rx_buffer_next].frame.seq_nr); ieee802154_frame_print_fcf_frame(&at86rf231_rx_buffer[rx_buffer_next].frame); #endif diff --git a/sys/transceiver/transceiver.c b/sys/transceiver/transceiver.c index aaa1ee3087..ab8e615f2f 100644 --- a/sys/transceiver/transceiver.c +++ b/sys/transceiver/transceiver.c @@ -573,6 +573,7 @@ void receive_cc2420_packet(ieee802154_packet_t *trans_p) memcpy(&data_buffer[transceiver_buffer_pos * CC2420_MAX_DATA_LENGTH], p->frame.payload, p->frame.payload_len); trans_p->frame.payload = (uint8_t *) & (data_buffer[transceiver_buffer_pos * CC2420_MAX_DATA_LENGTH]); + trans_p->frame.payload_len = p->frame.payload_len; eINT(); #ifdef DEBUG_ENABLED @@ -608,8 +609,6 @@ void receive_cc2420_packet(ieee802154_packet_t *trans_p) return; } #endif - trans_p->frame.payload = (uint8_t *) &(data_buffer[transceiver_buffer_pos * CC2420_MAX_DATA_LENGTH]); - trans_p->frame.payload_len = p->frame.payload_len; DEBUG("transceiver: Content: %s\n", trans_p->data); } #endif @@ -667,6 +666,7 @@ void receive_at86rf231_packet(ieee802154_packet_t *trans_p) memcpy(&data_buffer[transceiver_buffer_pos * AT86RF231_MAX_DATA_LENGTH], p->frame.payload, p->frame.payload_len); trans_p->frame.payload = (uint8_t *) & (data_buffer[transceiver_buffer_pos * AT86RF231_MAX_DATA_LENGTH]); + trans_p->frame.payload_len = p->frame.payload_len; eINT(); #ifdef DEBUG_ENABLED