Disable PACKETBUF_ATTR_PACKET_TYPE in the non-Rime case by default

This commit is contained in:
Simon Duquennoy 2015-05-06 14:34:29 +02:00
parent 290fc829ea
commit 333e076b24
6 changed files with 24 additions and 5 deletions

View File

@ -1383,6 +1383,7 @@ output(const uip_lladdr_t *localdest)
set_packet_attrs(); set_packet_attrs();
} }
#if PACKETBUF_WITH_PACKET_TYPE
#define TCP_FIN 0x01 #define TCP_FIN 0x01
#define TCP_ACK 0x10 #define TCP_ACK 0x10
#define TCP_CTL 0x3f #define TCP_CTL 0x3f
@ -1397,6 +1398,7 @@ output(const uip_lladdr_t *localdest)
packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE, packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE,
PACKETBUF_ATTR_PACKET_TYPE_STREAM_END); PACKETBUF_ATTR_PACKET_TYPE_STREAM_END);
} }
#endif
/* /*
* The destination address will be tagged to each outbound * The destination address will be tagged to each outbound

View File

@ -373,11 +373,13 @@ send_packet(mac_callback_t sent, void *ptr)
} }
metadata->sent = sent; metadata->sent = sent;
metadata->cptr = ptr; metadata->cptr = ptr;
#if PACKETBUF_WITH_PACKET_TYPE
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) ==
PACKETBUF_ATTR_PACKET_TYPE_ACK) { PACKETBUF_ATTR_PACKET_TYPE_ACK) {
list_push(n->queued_packet_list, q); list_push(n->queued_packet_list, q);
} else { } else
#endif
{
list_add(n->queued_packet_list, q); list_add(n->queued_packet_list, q);
} }

View File

@ -473,7 +473,7 @@ send_packet(void)
return MAC_TX_ERR; return MAC_TX_ERR;
} }
#if WITH_STREAMING #if WITH_STREAMING && PACKETBUF_WITH_PACKET_TYPE
if(is_streaming == 1 && if(is_streaming == 1 &&
(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), (linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&is_streaming_to) || &is_streaming_to) ||
@ -517,7 +517,7 @@ send_packet(void)
wait = ((rtimer_clock_t)(e->time - now)) % (DEFAULT_PERIOD); wait = ((rtimer_clock_t)(e->time - now)) % (DEFAULT_PERIOD);
expected = now + wait - 2 * DEFAULT_ON_TIME; 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 */ /* Wait until the receiver is expected to be awake */
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) != if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) !=
PACKETBUF_ATTR_PACKET_TYPE_ACK && PACKETBUF_ATTR_PACKET_TYPE_ACK &&
@ -627,8 +627,11 @@ send_packet(void)
packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE) || packetbuf_attr(PACKETBUF_ATTR_ERELIABLE) ||
#endif /* NETSTACK_CONF_WITH_RIME */ #endif /* NETSTACK_CONF_WITH_RIME */
#if PACKETBUF_WITH_PACKET_TYPE
packetbuf_attr(PACKETBUF_ATTR_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 */ on(); /* Wait for ACK packet */
waiting_for_packet = 1; waiting_for_packet = 1;
} else { } else {

View File

@ -74,6 +74,12 @@
#define PACKETBUF_HDR_SIZE 48 #define PACKETBUF_HDR_SIZE 48
#endif #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 * \brief Clear and reset the packetbuf
* *
@ -309,7 +315,9 @@ enum {
PACKETBUF_ATTR_IS_CREATED_AND_SECURED, PACKETBUF_ATTR_IS_CREATED_AND_SECURED,
/* Scope 1 attributes: used between two neighbors only. */ /* Scope 1 attributes: used between two neighbors only. */
#if PACKETBUF_WITH_PACKET_TYPE
PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_PACKET_TYPE,
#endif
#if NETSTACK_CONF_WITH_RIME #if NETSTACK_CONF_WITH_RIME
PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_PACKET_ID,
PACKETBUF_ATTR_RELIABLE, PACKETBUF_ATTR_RELIABLE,

View File

@ -658,11 +658,13 @@ cc2420_transmit(unsigned short payload_len)
{ {
rtimer_clock_t sfd_timestamp; rtimer_clock_t sfd_timestamp;
sfd_timestamp = cc2420_sfd_start_time; sfd_timestamp = cc2420_sfd_start_time;
#if PACKETBUF_WITH_PACKET_TYPE
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) ==
PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) { PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) {
/* Write timestamp to last two bytes of packet in TXFIFO. */ /* 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); write_ram((uint8_t *) &sfd_timestamp, CC2420RAM_TXFIFO + payload_len - 1, 2, WRITE_RAM_IN_ORDER);
} }
#endif
} }
if(!(get_status() & BV(CC2420_TX_ACTIVE))) { if(!(get_status() & BV(CC2420_TX_ACTIVE))) {

View File

@ -438,11 +438,13 @@ cc2520_transmit(unsigned short payload_len)
{ {
rtimer_clock_t sfd_timestamp; rtimer_clock_t sfd_timestamp;
sfd_timestamp = cc2520_sfd_start_time; sfd_timestamp = cc2520_sfd_start_time;
#if PACKETBUF_WITH_PACKET_TYPE
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) ==
PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) { PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) {
/* Write timestamp to last two bytes of packet in TXFIFO. */ /* Write timestamp to last two bytes of packet in TXFIFO. */
CC2520_WRITE_RAM(&sfd_timestamp, CC2520RAM_TXFIFO + payload_len - 1, 2); CC2520_WRITE_RAM(&sfd_timestamp, CC2520RAM_TXFIFO + payload_len - 1, 2);
} }
#endif
} }
if(!(status() & BV(CC2520_TX_ACTIVE))) { if(!(status() & BV(CC2520_TX_ACTIVE))) {