From 28513fce9a54448edf916bf852a74c9c530b0d84 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Wed, 26 Feb 2014 17:28:18 +0100 Subject: [PATCH 1/2] moved debugging statements from header to c file Additionally, declaring the stacks as static. --- sys/net/routing/rpl/etx_beaconing.c | 46 +++++++++++++++-------------- sys/net/routing/rpl/etx_beaconing.h | 14 --------- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/sys/net/routing/rpl/etx_beaconing.c b/sys/net/routing/rpl/etx_beaconing.c index 991413873a..cc314f7034 100644 --- a/sys/net/routing/rpl/etx_beaconing.c +++ b/sys/net/routing/rpl/etx_beaconing.c @@ -14,7 +14,6 @@ * @} */ -#include "etx_beaconing.h" #include #include @@ -28,45 +27,53 @@ #include "sixlowpan/ip.h" #include "ieee802154_frame.h" +#include "etx_beaconing.h" -//prototytpes +#define ENABLE_DEBUG (0) +#include "debug.h" + +#if ENABLE_DEBUG +#define ETX_BEACON_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT + KERNEL_CONF_STACKSIZE_PRINTF_FLOAT) +#define ETX_RADIO_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT + KERNEL_CONF_STACKSIZE_PRINTF_FLOAT) +#define ETX_CLOCK_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT) +#else +#define ETX_BEACON_STACKSIZE (KERNEL_CONF_STACKSIZE_MAIN) +#define ETX_RADIO_STACKSIZE (KERNEL_CONF_STACKSIZE_MAIN) +#define ETX_CLOCK_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT) +#endif + +/* prototytpes */ static uint8_t etx_count_packet_tx(etx_neighbor_t *candidate); static void etx_set_packets_received(void); static bool etx_equal_id(ipv6_addr_t *id1, ipv6_addr_t *id2); //Buffer -char etx_beacon_buf[ETX_BEACON_STACKSIZE] = { 0 }; -char etx_radio_buf[ETX_RADIO_STACKSIZE] = { 0 }; -char etx_clock_buf[ETX_CLOCK_STACKSIZE] = { 0 }; +static char etx_beacon_buf[ETX_BEACON_STACKSIZE]; +static char etx_radio_buf[ETX_RADIO_STACKSIZE]; +static char etx_clock_buf[ETX_CLOCK_STACKSIZE]; -uint8_t etx_send_buf[ETX_BUF_SIZE] = { 0 }; -uint8_t etx_rec_buf[ETX_BUF_SIZE] = { 0 }; +static uint8_t etx_send_buf[ETX_BUF_SIZE]; +static uint8_t etx_rec_buf[ETX_BUF_SIZE]; //PIDs int etx_beacon_pid = 0; int etx_radio_pid = 0; int etx_clock_pid = 0; -/* - * xxx If you get a -Wmissing-braces warning here: - * A -Wmissing-braces warning at this point is a gcc-bug! - * Please delete this information once it's fixed - * See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119 - */ //Message queue for radio -msg_t msg_que[ETX_RCV_QUEUE_SIZE] = { {0} }; +msg_t msg_que[ETX_RCV_QUEUE_SIZE]; /* * The counter for the current 'round'. An ETX beacon is sent every ETX_INTERVAL * u-seconds and a node computes the ETX value by comparing the the received * probes vs the expected probes from a neighbor every ETX_ROUND intervals. */ -static uint8_t cur_round = 0; +static uint8_t cur_round; /* * If we have not yet reached WINDOW intervals, won't calculate the ETX just yet */ -static char reached_window = 0; +static char reached_window; /* * This could (and should) be done differently, once the RPL implementation @@ -76,14 +83,9 @@ static char reached_window = 0; * needing them to be in our parent array, so we have another array here in * which we put all necessary info for up to ETX_MAX_CANDIDATE_NEIHGBORS * candidates. - * - * xxx If you get a -Wmissing-braces warning here: - * A -Wmissing-braces warning at this point is a gcc-bug! - * Please delete this information once it's fixed - * See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119 */ //Candidate array -static etx_neighbor_t candidates[ETX_MAX_CANDIDATE_NEIGHBORS] = { {{{0}}} }; +static etx_neighbor_t candidates[ETX_MAX_CANDIDATE_NEIGHBORS]; /* * Each time we send a beacon packet we need to reset some values for the diff --git a/sys/net/routing/rpl/etx_beaconing.h b/sys/net/routing/rpl/etx_beaconing.h index a7eb040ac9..ba9c947c52 100644 --- a/sys/net/routing/rpl/etx_beaconing.h +++ b/sys/net/routing/rpl/etx_beaconing.h @@ -3,20 +3,6 @@ #include #include "sixlowpan.h" -//For debugging purposes -#define ENABLE_DEBUG (0) -#include "debug.h" - -#if ENABLE_DEBUG -#define ETX_BEACON_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT + KERNEL_CONF_STACKSIZE_PRINTF_FLOAT) -#define ETX_RADIO_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT + KERNEL_CONF_STACKSIZE_PRINTF_FLOAT) -#define ETX_CLOCK_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT) -#else -#define ETX_BEACON_STACKSIZE (KERNEL_CONF_STACKSIZE_MAIN) -#define ETX_RADIO_STACKSIZE (KERNEL_CONF_STACKSIZE_MAIN) -#define ETX_CLOCK_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT) -#endif - //[option|length|ipaddr.|packetcount] with up to 15 ipaddr|packetcount pairs // 1 Byte 1 Byte 1 Byte 1 Byte #define ETX_BUF_SIZE (32) From 1dc3b5910e7f4332b6d1c727103dc984ec42c32e Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Wed, 26 Feb 2014 19:07:02 +0100 Subject: [PATCH 2/2] amendment - to be squashed --- sys/net/routing/rpl/etx_beaconing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/routing/rpl/etx_beaconing.c b/sys/net/routing/rpl/etx_beaconing.c index cc314f7034..85e2b8c3cc 100644 --- a/sys/net/routing/rpl/etx_beaconing.c +++ b/sys/net/routing/rpl/etx_beaconing.c @@ -61,7 +61,7 @@ int etx_radio_pid = 0; int etx_clock_pid = 0; //Message queue for radio -msg_t msg_que[ETX_RCV_QUEUE_SIZE]; +static msg_t msg_que[ETX_RCV_QUEUE_SIZE]; /* * The counter for the current 'round'. An ETX beacon is sent every ETX_INTERVAL