From bb76bb8beb7d492d9f7aac3235559270cebe5648 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 6 May 2015 14:10:19 +0200 Subject: [PATCH 1/3] Remove unused flag SICSLOWPAN_CONF_ACK_ALL. Include packetbuf attribute PACKETBUF_ATTR_RELIABLE only when RIME is compiled. --- core/net/ipv4/uip-over-mesh.c | 2 +- core/net/ipv6/sicslowpan.c | 5 ----- core/net/mac/contikimac/contikimac.c | 6 ------ core/net/mac/cxmac/cxmac.c | 5 ++--- core/net/mac/framer-802154.c | 1 - core/net/mac/sicslowmac/sicslowmac.c | 2 ++ core/net/packetbuf.h | 2 +- cpu/avr/radio/mac/sicslowmac.c | 2 ++ cpu/avr/radio/rf230bb/rf230bb.c | 2 ++ examples/ipv6/slip-radio/no-framer.c | 1 - platform/avr-atmega128rfa1/contiki-conf.h | 2 -- platform/avr-raven/contiki-conf.h | 2 -- platform/avr-ravenusb/contiki-conf.h | 3 --- 13 files changed, 10 insertions(+), 25 deletions(-) diff --git a/core/net/ipv4/uip-over-mesh.c b/core/net/ipv4/uip-over-mesh.c index 92c5dbfd4..e6709f1d4 100644 --- a/core/net/ipv4/uip-over-mesh.c +++ b/core/net/ipv4/uip-over-mesh.c @@ -262,8 +262,8 @@ uip_over_mesh_send(void) if(BUF->proto == UIP_PROTO_TCP) { #if NETSTACK_CONF_WITH_RIME packetbuf_set_attr(PACKETBUF_ATTR_ERELIABLE, 1); -#endif /* NETSTACK_CONF_WITH_RIME */ packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, 1); +#endif /* NETSTACK_CONF_WITH_RIME */ /* packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_PACKET_TYPE_STREAM);*/ } diff --git a/core/net/ipv6/sicslowpan.c b/core/net/ipv6/sicslowpan.c index 3be5a0f2a..320b5c5ba 100644 --- a/core/net/ipv6/sicslowpan.c +++ b/core/net/ipv6/sicslowpan.c @@ -1336,11 +1336,6 @@ send_packet(linkaddr_t *dest) packetbuf_set_addr(PACKETBUF_ADDR_SENDER,(void*)&uip_lladdr); #endif - /* Force acknowledge from sender (test hardware autoacks) */ -#if SICSLOWPAN_CONF_ACK_ALL - packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, 1); -#endif - /* Provide a callback function to receive the result of a packet transmission. */ NETSTACK_LLSEC.send(&packet_sent, NULL); diff --git a/core/net/mac/contikimac/contikimac.c b/core/net/mac/contikimac/contikimac.c index cdfffc13b..d5882845c 100644 --- a/core/net/mac/contikimac/contikimac.c +++ b/core/net/mac/contikimac/contikimac.c @@ -499,7 +499,6 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, uint8_t got_strobe_ack = 0; int len; uint8_t is_broadcast = 0; - uint8_t is_reliable = 0; uint8_t is_known_receiver = 0; uint8_t collisions; int transmit_len; @@ -546,11 +545,6 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]); #endif /* NETSTACK_CONF_WITH_IPV6 */ } - is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) -#if NETSTACK_CONF_WITH_RIME - || packetbuf_attr(PACKETBUF_ATTR_ERELIABLE) -#endif /* NETSTACK_CONF_WITH_RIME */ - ; if(!packetbuf_attr(PACKETBUF_ATTR_IS_CREATED_AND_SECURED)) { packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1); diff --git a/core/net/mac/cxmac/cxmac.c b/core/net/mac/cxmac/cxmac.c index ebf7651dd..857c67adb 100644 --- a/core/net/mac/cxmac/cxmac.c +++ b/core/net/mac/cxmac/cxmac.c @@ -453,8 +453,6 @@ send_packet(void) packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]); #endif /* NETSTACK_CONF_WITH_IPV6 */ } -/* is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || - packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);*/ len = NETSTACK_FRAMER.create(); strobe_len = len + sizeof(struct cxmac_hdr); if(len < 0 || strobe_len > (int)sizeof(strobe)) { @@ -624,8 +622,9 @@ send_packet(void) /* If we have received the strobe ACK, and we are sending a packet that will need an upper layer ACK (as signified by the PACKETBUF_ATTR_RELIABLE packet attribute), we keep the radio on. */ - if(got_strobe_ack && (packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || + if(got_strobe_ack && ( #if NETSTACK_CONF_WITH_RIME + packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || packetbuf_attr(PACKETBUF_ATTR_ERELIABLE) || #endif /* NETSTACK_CONF_WITH_RIME */ packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == diff --git a/core/net/mac/framer-802154.c b/core/net/mac/framer-802154.c index 03b091feb..67a61867a 100644 --- a/core/net/mac/framer-802154.c +++ b/core/net/mac/framer-802154.c @@ -242,7 +242,6 @@ parse(void) } packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr); packetbuf_set_attr(PACKETBUF_ATTR_PENDING, frame.fcf.frame_pending); - /* packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, frame.fcf.ack_required);*/ packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, frame.seq); #if LLSEC802154_SECURITY_LEVEL diff --git a/core/net/mac/sicslowmac/sicslowmac.c b/core/net/mac/sicslowmac/sicslowmac.c index 9d88a6b78..09d77ae17 100644 --- a/core/net/mac/sicslowmac/sicslowmac.c +++ b/core/net/mac/sicslowmac/sicslowmac.c @@ -106,7 +106,9 @@ send_packet(mac_callback_t sent, void *ptr) params.fcf.frame_type = FRAME802154_DATAFRAME; params.fcf.security_enabled = 0; params.fcf.frame_pending = 0; +#if NETSTACK_CONF_WITH_RIME params.fcf.ack_required = packetbuf_attr(PACKETBUF_ATTR_RELIABLE); +#endif params.fcf.panid_compression = 0; /* Insert IEEE 802.15.4 (2003) version bit. */ diff --git a/core/net/packetbuf.h b/core/net/packetbuf.h index 008fa02fc..12bfd0fab 100644 --- a/core/net/packetbuf.h +++ b/core/net/packetbuf.h @@ -309,10 +309,10 @@ enum { PACKETBUF_ATTR_IS_CREATED_AND_SECURED, /* Scope 1 attributes: used between two neighbors only. */ - PACKETBUF_ATTR_RELIABLE, PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_PACKET_TYPE, #if NETSTACK_CONF_WITH_RIME + PACKETBUF_ATTR_RELIABLE, PACKETBUF_ATTR_REXMIT, PACKETBUF_ATTR_MAX_REXMIT, PACKETBUF_ATTR_NUM_REXMIT, diff --git a/cpu/avr/radio/mac/sicslowmac.c b/cpu/avr/radio/mac/sicslowmac.c index 9a176277a..ea4616e39 100644 --- a/cpu/avr/radio/mac/sicslowmac.c +++ b/cpu/avr/radio/mac/sicslowmac.c @@ -409,7 +409,9 @@ sicslowmac_dataRequest(void) params.fcf.frameType = DATAFRAME; params.fcf.securityEnabled = false; params.fcf.framePending = false; +#if NETSTACK_CONF_WITH_RIME params.fcf.ackRequired = packetbuf_attr(PACKETBUF_ATTR_RELIABLE); +#endif params.fcf.panIdCompression = false; /* Insert IEEE 802.15.4 (2003) version bit. */ diff --git a/cpu/avr/radio/rf230bb/rf230bb.c b/cpu/avr/radio/rf230bb/rf230bb.c index e4181868c..aee2f6d29 100644 --- a/cpu/avr/radio/rf230bb/rf230bb.c +++ b/cpu/avr/radio/rf230bb/rf230bb.c @@ -1073,8 +1073,10 @@ rf230_transmit(unsigned short payload_len) if (tx_result==RADIO_TX_OK) { RIMESTATS_ADD(lltx); +#if NETSTACK_CONF_WITH_RIME if(packetbuf_attr(PACKETBUF_ATTR_RELIABLE)) RIMESTATS_ADD(ackrx); //ack was requested and received +#endif #if RF230_INSERTACK /* Not PAN broadcast to FFFF, and ACK was requested and received */ if (!((buffer[5]==0xff) && (buffer[6]==0xff)) && (buffer[0]&(1<<6))) diff --git a/examples/ipv6/slip-radio/no-framer.c b/examples/ipv6/slip-radio/no-framer.c index e3aed93b7..fbb749da8 100644 --- a/examples/ipv6/slip-radio/no-framer.c +++ b/examples/ipv6/slip-radio/no-framer.c @@ -109,7 +109,6 @@ parse(void) } packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr); packetbuf_set_attr(PACKETBUF_ATTR_PENDING, frame.fcf.frame_pending); - /* packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, frame.fcf.ack_required);*/ packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, frame.seq); PRINTF("15.4-IN: %2X", frame.fcf.frame_type); diff --git a/platform/avr-atmega128rfa1/contiki-conf.h b/platform/avr-atmega128rfa1/contiki-conf.h index 47f5c6584..545f6a253 100644 --- a/platform/avr-atmega128rfa1/contiki-conf.h +++ b/platform/avr-atmega128rfa1/contiki-conf.h @@ -191,8 +191,6 @@ typedef unsigned short uip_stats_t; #define CHANNEL_802_15_4 26 /* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */ #define RF230_CONF_AUTOACK 1 -/* Request 802.15.4 ACK on all packets sent (else autoretry). This is primarily for testing. */ -#define SICSLOWPAN_CONF_ACK_ALL 0 /* 1 + Number of auto retry attempts 0-15 (0 implies don't use extended TX_ARET_ON mode) */ #define RF230_CONF_FRAME_RETRIES 2 /* Number of csma retry attempts 0-5 in extended tx mode (7 does immediate tx with no csma) */ diff --git a/platform/avr-raven/contiki-conf.h b/platform/avr-raven/contiki-conf.h index 40469aa21..2fe0d6099 100644 --- a/platform/avr-raven/contiki-conf.h +++ b/platform/avr-raven/contiki-conf.h @@ -206,8 +206,6 @@ typedef unsigned short uip_stats_t; #define RADIO_CONF_CALIBRATE_INTERVAL 256 /* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */ #define RF230_CONF_AUTOACK 1 -/* Request 802.15.4 ACK on all packets sent (else autoretry). This is primarily for testing. */ -#define SICSLOWPAN_CONF_ACK_ALL 0 /* Number of auto retry attempts+1, 1-16. Set zero to disable extended TX_ARET_ON mode with CCA) */ #define RF230_CONF_FRAME_RETRIES 3 /* Number of CSMA attempts 0-7. 802.15.4 2003 standard max is 5. */ diff --git a/platform/avr-ravenusb/contiki-conf.h b/platform/avr-ravenusb/contiki-conf.h index 03001d02a..1ebe6d718 100644 --- a/platform/avr-ravenusb/contiki-conf.h +++ b/platform/avr-ravenusb/contiki-conf.h @@ -284,9 +284,6 @@ typedef unsigned short uip_stats_t; #define RADIO_CONF_CALIBRATE_INTERVAL 256 /* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */ #define RF230_CONF_AUTOACK 1 -/* Request 802.15.4 ACK on all packets sent by sicslowpan.c (else autoretry) */ -/* Broadcasts will be duplicated by the retry count, since no one will ACK them! */ -#define SICSLOWPAN_CONF_ACK_ALL 0 /* 1 + Number of auto retry attempts 0-15 (0 implies don't use extended TX_ARET_ON mode with CCA) */ #define RF230_CONF_FRAME_RETRIES 2 /* CCA theshold energy -91 to -61 dBm (default -77). Set this smaller than the expected minimum rssi to avoid packet collisions */ From 290fc829ea6f4e83f2b4ebba27ca7f58d346d273 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 6 May 2015 14:23:32 +0200 Subject: [PATCH 2/3] Consistently use PACKETBUF_ATTR_MAC_SEQNO for MAC sequence number, both input and output. Disable PACKETBUF_ATTR_PACKET_ID in the non-Rime case. --- core/net/mac/framer-802154.c | 3 +++ core/net/mac/mac-sequence.c | 4 ++-- core/net/mac/nullrdc.c | 2 +- core/net/packetbuf.h | 2 +- cpu/avr/radio/mac/sicslowmac.c | 2 ++ examples/ipv6/slip-radio/no-framer.c | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/core/net/mac/framer-802154.c b/core/net/mac/framer-802154.c index 67a61867a..987d142ba 100644 --- a/core/net/mac/framer-802154.c +++ b/core/net/mac/framer-802154.c @@ -242,7 +242,10 @@ parse(void) } packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr); packetbuf_set_attr(PACKETBUF_ATTR_PENDING, frame.fcf.frame_pending); + packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, frame.seq); +#if NETSTACK_CONF_WITH_RIME packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, frame.seq); +#endif #if LLSEC802154_SECURITY_LEVEL if(frame.fcf.security_enabled) { diff --git a/core/net/mac/mac-sequence.c b/core/net/mac/mac-sequence.c index 638dece13..40ac3c28a 100644 --- a/core/net/mac/mac-sequence.c +++ b/core/net/mac/mac-sequence.c @@ -74,7 +74,7 @@ mac_sequence_is_duplicate(void) for(i = 0; i < MAX_SEQNOS; ++i) { if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER), &received_seqnos[i].sender)) { - if(packetbuf_attr(PACKETBUF_ATTR_PACKET_ID) == received_seqnos[i].seqno) { + if(packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO) == received_seqnos[i].seqno) { /* Duplicate packet. */ return 1; } @@ -102,7 +102,7 @@ mac_sequence_register_seqno(void) for(j = i - 1; j > 0; --j) { memcpy(&received_seqnos[j], &received_seqnos[j - 1], sizeof(struct seqno)); } - received_seqnos[0].seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID); + received_seqnos[0].seqno = packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO); linkaddr_copy(&received_seqnos[0].sender, packetbuf_addr(PACKETBUF_ADDR_SENDER)); } diff --git a/core/net/mac/nullrdc.c b/core/net/mac/nullrdc.c index 3403b764e..07915b186 100644 --- a/core/net/mac/nullrdc.c +++ b/core/net/mac/nullrdc.c @@ -294,7 +294,7 @@ packet_input(void) if(duplicate) { /* Drop the packet. */ PRINTF("nullrdc: drop duplicate link layer packet %u\n", - packetbuf_attr(PACKETBUF_ATTR_PACKET_ID)); + packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO)); } else { mac_sequence_register_seqno(); } diff --git a/core/net/packetbuf.h b/core/net/packetbuf.h index 12bfd0fab..d3b6600ec 100644 --- a/core/net/packetbuf.h +++ b/core/net/packetbuf.h @@ -309,9 +309,9 @@ enum { PACKETBUF_ATTR_IS_CREATED_AND_SECURED, /* Scope 1 attributes: used between two neighbors only. */ - PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_PACKET_TYPE, #if NETSTACK_CONF_WITH_RIME + PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_RELIABLE, PACKETBUF_ATTR_REXMIT, PACKETBUF_ATTR_MAX_REXMIT, diff --git a/cpu/avr/radio/mac/sicslowmac.c b/cpu/avr/radio/mac/sicslowmac.c index ea4616e39..b836bcd3a 100644 --- a/cpu/avr/radio/mac/sicslowmac.c +++ b/cpu/avr/radio/mac/sicslowmac.c @@ -402,8 +402,10 @@ sicslowmac_dataRequest(void) frame_create_params_t params; frame_result_t result; +#if NETSTACK_CONF_WITH_RIME /* Save the msduHandle in a global variable. */ msduHandle = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID); +#endif /* Build the FCF. */ params.fcf.frameType = DATAFRAME; diff --git a/examples/ipv6/slip-radio/no-framer.c b/examples/ipv6/slip-radio/no-framer.c index fbb749da8..7f3447e97 100644 --- a/examples/ipv6/slip-radio/no-framer.c +++ b/examples/ipv6/slip-radio/no-framer.c @@ -109,7 +109,7 @@ parse(void) } packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr); packetbuf_set_attr(PACKETBUF_ATTR_PENDING, frame.fcf.frame_pending); - packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, frame.seq); + packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, frame.seq); PRINTF("15.4-IN: %2X", frame.fcf.frame_type); PRINTADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); From 333e076b24b4492f5405f76464a2f21ba6744897 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 6 May 2015 14:34:29 +0200 Subject: [PATCH 3/3] Disable PACKETBUF_ATTR_PACKET_TYPE in the non-Rime case by default --- core/net/ipv6/sicslowpan.c | 2 ++ core/net/mac/csma.c | 6 ++++-- core/net/mac/cxmac/cxmac.c | 9 ++++++--- core/net/packetbuf.h | 8 ++++++++ dev/cc2420/cc2420.c | 2 ++ dev/cc2520/cc2520.c | 2 ++ 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/core/net/ipv6/sicslowpan.c b/core/net/ipv6/sicslowpan.c index 320b5c5ba..62b9014c5 100644 --- a/core/net/ipv6/sicslowpan.c +++ b/core/net/ipv6/sicslowpan.c @@ -1383,6 +1383,7 @@ output(const uip_lladdr_t *localdest) set_packet_attrs(); } +#if PACKETBUF_WITH_PACKET_TYPE #define TCP_FIN 0x01 #define TCP_ACK 0x10 #define TCP_CTL 0x3f @@ -1397,6 +1398,7 @@ output(const uip_lladdr_t *localdest) packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_PACKET_TYPE_STREAM_END); } +#endif /* * The destination address will be tagged to each outbound diff --git a/core/net/mac/csma.c b/core/net/mac/csma.c index 6ede3ec8d..ab6fec726 100644 --- a/core/net/mac/csma.c +++ b/core/net/mac/csma.c @@ -373,11 +373,13 @@ send_packet(mac_callback_t sent, void *ptr) } metadata->sent = sent; metadata->cptr = ptr; - +#if PACKETBUF_WITH_PACKET_TYPE if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_ACK) { list_push(n->queued_packet_list, q); - } else { + } else +#endif + { list_add(n->queued_packet_list, q); } diff --git a/core/net/mac/cxmac/cxmac.c b/core/net/mac/cxmac/cxmac.c index 857c67adb..770a5c19d 100644 --- a/core/net/mac/cxmac/cxmac.c +++ b/core/net/mac/cxmac/cxmac.c @@ -473,7 +473,7 @@ send_packet(void) return MAC_TX_ERR; } -#if WITH_STREAMING +#if WITH_STREAMING && PACKETBUF_WITH_PACKET_TYPE if(is_streaming == 1 && (linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &is_streaming_to) || @@ -517,7 +517,7 @@ send_packet(void) wait = ((rtimer_clock_t)(e->time - now)) % (DEFAULT_PERIOD); expected = now + wait - 2 * DEFAULT_ON_TIME; -#if WITH_ACK_OPTIMIZATION +#if WITH_ACK_OPTIMIZATION && PACKETBUF_WITH_PACKET_TYPE /* Wait until the receiver is expected to be awake */ if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) != PACKETBUF_ATTR_PACKET_TYPE_ACK && @@ -627,8 +627,11 @@ send_packet(void) packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || packetbuf_attr(PACKETBUF_ATTR_ERELIABLE) || #endif /* NETSTACK_CONF_WITH_RIME */ +#if PACKETBUF_WITH_PACKET_TYPE packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == - PACKETBUF_ATTR_PACKET_TYPE_STREAM)) { + PACKETBUF_ATTR_PACKET_TYPE_STREAM || +#endif + 0)) { on(); /* Wait for ACK packet */ waiting_for_packet = 1; } else { diff --git a/core/net/packetbuf.h b/core/net/packetbuf.h index d3b6600ec..3c1839bf1 100644 --- a/core/net/packetbuf.h +++ b/core/net/packetbuf.h @@ -74,6 +74,12 @@ #define PACKETBUF_HDR_SIZE 48 #endif +#ifdef PACKETBUF_CONF_WITH_PACKET_TYPE +#define PACKETBUF_WITH_PACKET_TYPE PACKETBUF_CONF_WITH_PACKET_TYPE +#else +#define PACKETBUF_WITH_PACKET_TYPE NETSTACK_CONF_WITH_RIME +#endif + /** * \brief Clear and reset the packetbuf * @@ -309,7 +315,9 @@ enum { PACKETBUF_ATTR_IS_CREATED_AND_SECURED, /* Scope 1 attributes: used between two neighbors only. */ +#if PACKETBUF_WITH_PACKET_TYPE PACKETBUF_ATTR_PACKET_TYPE, +#endif #if NETSTACK_CONF_WITH_RIME PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_RELIABLE, diff --git a/dev/cc2420/cc2420.c b/dev/cc2420/cc2420.c index 970f9dca7..d455e02df 100644 --- a/dev/cc2420/cc2420.c +++ b/dev/cc2420/cc2420.c @@ -658,11 +658,13 @@ cc2420_transmit(unsigned short payload_len) { rtimer_clock_t sfd_timestamp; sfd_timestamp = cc2420_sfd_start_time; +#if PACKETBUF_WITH_PACKET_TYPE if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) { /* Write timestamp to last two bytes of packet in TXFIFO. */ write_ram((uint8_t *) &sfd_timestamp, CC2420RAM_TXFIFO + payload_len - 1, 2, WRITE_RAM_IN_ORDER); } +#endif } if(!(get_status() & BV(CC2420_TX_ACTIVE))) { diff --git a/dev/cc2520/cc2520.c b/dev/cc2520/cc2520.c index 249bc6ad6..b6c0e43fa 100644 --- a/dev/cc2520/cc2520.c +++ b/dev/cc2520/cc2520.c @@ -438,11 +438,13 @@ cc2520_transmit(unsigned short payload_len) { rtimer_clock_t sfd_timestamp; sfd_timestamp = cc2520_sfd_start_time; +#if PACKETBUF_WITH_PACKET_TYPE if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) { /* Write timestamp to last two bytes of packet in TXFIFO. */ CC2520_WRITE_RAM(&sfd_timestamp, CC2520RAM_TXFIFO + payload_len - 1, 2); } +#endif } if(!(status() & BV(CC2520_TX_ACTIVE))) {