From e826ccd3b9b64654208bbd0d3489b23637a4107d Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Tue, 22 Feb 2011 11:14:19 -0800 Subject: [PATCH] add NULLRDC_CONF_802154_AUTOACK_HW for radios that only pass-up NOACK status but not the actual ack packet. --- core/net/mac/nullrdc.c | 19 +++++++++++---- platform/redbee-econotag/contiki-conf.h | 3 ++- .../redbee-econotag/contiki-mc1322x-main.c | 23 +++++++++++++++++++ 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/core/net/mac/nullrdc.c b/core/net/mac/nullrdc.c index 1ddd4cbc8..6b8cbe2e3 100644 --- a/core/net/mac/nullrdc.c +++ b/core/net/mac/nullrdc.c @@ -42,6 +42,7 @@ #include "net/mac/nullrdc.h" #include "net/packetbuf.h" #include "net/netstack.h" +#include #define DEBUG 0 #if DEBUG @@ -59,6 +60,14 @@ #endif /* NULLRDC_CONF_802154_AUTOACK */ #endif /* NULLRDC_802154_AUTOACK */ +#ifndef NULLRDC_802154_AUTOACK_HW +#ifdef NULLRDC_CONF_802154_AUTOACK_HW +#define NULLRDC_802154_AUTOACK_HW NULLRDC_CONF_802154_AUTOACK_HW +#else +#define NULLRDC_802154_AUTOACK_HW 0 +#endif /* NULLRDC_CONF_802154_AUTOACK_HW */ +#endif /* NULLRDC_802154_AUTOACK_HW */ + #if NULLRDC_802154_AUTOACK #include "sys/rtimer.h" #include "dev/watchdog.h" @@ -66,7 +75,9 @@ #define ACK_WAIT_TIME RTIMER_SECOND / 2500 #define AFTER_ACK_DETECTED_WAIT_TIME RTIMER_SECOND / 1500 #define ACK_LEN 3 +#endif /* NULLRDC_802154_AUTOACK */ +#if NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW struct seqno { rimeaddr_t sender; uint8_t seqno; @@ -79,7 +90,7 @@ struct seqno { #endif /* NETSTACK_CONF_MAC_SEQNO_HISTORY */ static struct seqno received_seqnos[MAX_SEQNOS]; -#endif /* NULLRDC_802154_AUTOACK */ +#endif /* NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW */ /*---------------------------------------------------------------------------*/ static void @@ -87,9 +98,9 @@ send_packet(mac_callback_t sent, void *ptr) { int ret; packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr); -#if NULLRDC_802154_AUTOACK +#if NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1); -#endif /* NULLRDC_802154_AUTOACK */ +#endif /* NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW */ if(NETSTACK_FRAMER.create() == 0) { /* Failed to allocate space for headers */ @@ -196,7 +207,7 @@ packet_input(void) if(NETSTACK_FRAMER.parse() == 0) { PRINTF("nullrdc: failed to parse %u\n", packetbuf_datalen()); } else { -#if NULLRDC_802154_AUTOACK +#if NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW /* Check for duplicate packet by comparing the sequence number of the incoming packet with the last few ones we saw. */ int i; diff --git a/platform/redbee-econotag/contiki-conf.h b/platform/redbee-econotag/contiki-conf.h index 6f9edc11e..0839607f9 100644 --- a/platform/redbee-econotag/contiki-conf.h +++ b/platform/redbee-econotag/contiki-conf.h @@ -84,7 +84,8 @@ #define CONTIKI_MACA_RAW_MODE 0 #define USE_32KHZ_XTAL 0 -#define BLOCKING_TX 0 +#define BLOCKING_TX 1 +#define NULLRDC_CONF_802154_AUTOACK_HW 1 /* end of mc1322x specific config. */ diff --git a/platform/redbee-econotag/contiki-mc1322x-main.c b/platform/redbee-econotag/contiki-mc1322x-main.c index 7d822d4bb..ef3cce294 100644 --- a/platform/redbee-econotag/contiki-mc1322x-main.c +++ b/platform/redbee-econotag/contiki-mc1322x-main.c @@ -422,6 +422,29 @@ main(void) RF_CHANNEL); #endif /* WITH_UIP6 */ +<<<<<<< HEAD +======= + *MACA_MACPANID = 0xcdab; /* this is the hardcoded contiki pan, register is PACKET order */ + *MACA_MAC16ADDR = 0xffff; /* short addressing isn't used, set this to 0xffff for now */ + + *MACA_MAC64HI = + addr.u8[0] << 24 | + addr.u8[1] << 16 | + addr.u8[2] << 8 | + addr.u8[3]; + *MACA_MAC64LO = + addr.u8[4] << 24 | + addr.u8[5] << 16 | + addr.u8[6] << 8 | + addr.u8[7]; + PRINTF("setting panid 0x%04x\n\r", *MACA_MACPANID); + PRINTF("setting short mac 0x%04x\n\r", *MACA_MAC16ADDR); + PRINTF("setting long mac 0x%08x_%08x\n\r", *MACA_MAC64HI, *MACA_MAC64LO); + +#if NULLRDC_CONF_802154_AUTOACK_HW + set_prm_mode(AUTOACK); +#endif + #if PROFILE_CONF_ON profile_init(); #endif /* PROFILE_CONF_ON */