Merge branch 'contiki' into osd
This commit is contained in:
commit
877bf27f5a
245 changed files with 8117 additions and 6356 deletions
|
@ -341,7 +341,6 @@ powercycle(struct rtimer *t, void *ptr)
|
|||
|
||||
while(1) {
|
||||
static uint8_t packet_seen;
|
||||
static rtimer_clock_t t0;
|
||||
static uint8_t count;
|
||||
|
||||
#if SYNC_CYCLE_STARTS
|
||||
|
@ -365,7 +364,6 @@ powercycle(struct rtimer *t, void *ptr)
|
|||
packet_seen = 0;
|
||||
|
||||
for(count = 0; count < CCA_COUNT_MAX; ++count) {
|
||||
t0 = RTIMER_NOW();
|
||||
if(we_are_sending == 0 && we_are_receiving_burst == 0) {
|
||||
powercycle_turn_radio_on();
|
||||
/* Check if a packet is seen in the air. If so, we keep the
|
||||
|
@ -501,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;
|
||||
|
@ -548,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);
|
||||
|
@ -676,11 +668,12 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
|
|||
|
||||
{
|
||||
rtimer_clock_t wt;
|
||||
rtimer_clock_t txtime;
|
||||
int ret;
|
||||
|
||||
txtime = RTIMER_NOW();
|
||||
ret = NETSTACK_RADIO.transmit(transmit_len);
|
||||
rtimer_clock_t txtime = RTIMER_NOW();
|
||||
#if RDC_CONF_HARDWARE_ACK
|
||||
int ret = NETSTACK_RADIO.transmit(transmit_len);
|
||||
#else
|
||||
NETSTACK_RADIO.transmit(transmit_len);
|
||||
#endif
|
||||
|
||||
#if RDC_CONF_HARDWARE_ACK
|
||||
/* For radios that block in the transmit routine and detect the
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
@ -475,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) ||
|
||||
|
@ -519,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 &&
|
||||
|
@ -624,12 +622,16 @@ 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 */
|
||||
#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 {
|
||||
|
|
|
@ -242,8 +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_RELIABLE, frame.fcf.ack_required);*/
|
||||
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) {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -264,11 +264,13 @@ send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
|
|||
static void
|
||||
packet_input(void)
|
||||
{
|
||||
#if NULLRDC_SEND_802154_ACK
|
||||
int original_datalen;
|
||||
uint8_t *original_dataptr;
|
||||
|
||||
original_datalen = packetbuf_datalen();
|
||||
original_dataptr = packetbuf_dataptr();
|
||||
#endif
|
||||
|
||||
#if NULLRDC_802154_AUTOACK
|
||||
if(packetbuf_datalen() == ACK_LEN) {
|
||||
|
@ -294,7 +296,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();
|
||||
}
|
||||
|
|
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue