add NULLRDC_CONF_802154_AUTOACK_HW for radios that only pass-up NOACK

status but not the actual ack packet.
This commit is contained in:
Mariano Alvira 2011-02-22 11:14:19 -08:00
parent a8f9119ace
commit e826ccd3b9
3 changed files with 40 additions and 5 deletions

View File

@ -42,6 +42,7 @@
#include "net/mac/nullrdc.h"
#include "net/packetbuf.h"
#include "net/netstack.h"
#include <string.h>
#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;

View File

@ -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. */

View File

@ -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 */