link-layer acks support for cooja motes
This commit is contained in:
parent
3caf1bfab4
commit
8041f66d8c
3 changed files with 29 additions and 9 deletions
|
@ -45,6 +45,10 @@
|
|||
#include "net/rime/rimestats.h"
|
||||
#include <string.h>
|
||||
|
||||
#if CONTIKI_TARGET_COOJA
|
||||
#include "lib/simEnvChange.h"
|
||||
#endif /* CONTIKI_TARGET_COOJA */
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
|
@ -172,7 +176,12 @@ send_one_packet(mac_callback_t sent, void *ptr)
|
|||
/* Check for ack */
|
||||
wt = RTIMER_NOW();
|
||||
watchdog_periodic();
|
||||
while(RTIMER_CLOCK_LT(RTIMER_NOW(), wt + ACK_WAIT_TIME));
|
||||
while(RTIMER_CLOCK_LT(RTIMER_NOW(), wt + ACK_WAIT_TIME)) {
|
||||
#if CONTIKI_TARGET_COOJA
|
||||
simProcessRunValue = 1;
|
||||
cooja_mt_yield();
|
||||
#endif /* CONTIKI_TARGET_COOJA */
|
||||
}
|
||||
|
||||
ret = MAC_TX_NOACK;
|
||||
if(NETSTACK_RADIO.receiving_packet() ||
|
||||
|
@ -181,10 +190,17 @@ send_one_packet(mac_callback_t sent, void *ptr)
|
|||
int len;
|
||||
uint8_t ackbuf[ACK_LEN];
|
||||
|
||||
wt = RTIMER_NOW();
|
||||
watchdog_periodic();
|
||||
while(RTIMER_CLOCK_LT(RTIMER_NOW(),
|
||||
wt + AFTER_ACK_DETECTED_WAIT_TIME));
|
||||
if(AFTER_ACK_DETECTED_WAIT_TIME > 0) {
|
||||
wt = RTIMER_NOW();
|
||||
watchdog_periodic();
|
||||
while(RTIMER_CLOCK_LT(RTIMER_NOW(),
|
||||
wt + AFTER_ACK_DETECTED_WAIT_TIME)) {
|
||||
#if CONTIKI_TARGET_COOJA
|
||||
simProcessRunValue = 1;
|
||||
cooja_mt_yield();
|
||||
#endif /* CONTIKI_TARGET_COOJA */
|
||||
}
|
||||
}
|
||||
|
||||
if(NETSTACK_RADIO.pending_packet()) {
|
||||
len = NETSTACK_RADIO.read(ackbuf, ACK_LEN);
|
||||
|
|
|
@ -65,10 +65,10 @@
|
|||
/* Default network config */
|
||||
#if WITH_UIP6
|
||||
|
||||
#define NULLRDC_CONF_802154_AUTOACK 0
|
||||
#define NULLRDC_CONF_SEND_802154_ACK 0
|
||||
#define NULLRDC_CONF_802154_AUTOACK 1
|
||||
#define NULLRDC_CONF_SEND_802154_ACK 1
|
||||
#define NULLRDC_CONF_ACK_WAIT_TIME RTIMER_SECOND / 500
|
||||
#define NULLRDC_CONF_AFTER_ACK_DETECTED_WAIT_TIME RTIMER_SECOND / 250
|
||||
#define NULLRDC_CONF_AFTER_ACK_DETECTED_WAIT_TIME 0
|
||||
|
||||
|
||||
/* Network setup for IPv6 */
|
||||
|
|
|
@ -162,10 +162,14 @@ radio_send(const void *payload, unsigned short payload_len)
|
|||
{
|
||||
int radiostate = simRadioHWOn;
|
||||
|
||||
/* Simulate turnaround time of 1ms */
|
||||
/* Simulate turnaround time of 2ms for packets, 1ms for acks*/
|
||||
#if WITH_TURNAROUND
|
||||
simProcessRunValue = 1;
|
||||
cooja_mt_yield();
|
||||
if(payload_len > 3) {
|
||||
simProcessRunValue = 1;
|
||||
cooja_mt_yield();
|
||||
}
|
||||
#endif /* WITH_TURNAROUND */
|
||||
|
||||
if(!simRadioHWOn) {
|
||||
|
|
Loading…
Reference in a new issue