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 "net/rime/rimestats.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#if CONTIKI_TARGET_COOJA
|
||||||
|
#include "lib/simEnvChange.h"
|
||||||
|
#endif /* CONTIKI_TARGET_COOJA */
|
||||||
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -172,7 +176,12 @@ send_one_packet(mac_callback_t sent, void *ptr)
|
||||||
/* Check for ack */
|
/* Check for ack */
|
||||||
wt = RTIMER_NOW();
|
wt = RTIMER_NOW();
|
||||||
watchdog_periodic();
|
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;
|
ret = MAC_TX_NOACK;
|
||||||
if(NETSTACK_RADIO.receiving_packet() ||
|
if(NETSTACK_RADIO.receiving_packet() ||
|
||||||
|
@ -181,10 +190,17 @@ send_one_packet(mac_callback_t sent, void *ptr)
|
||||||
int len;
|
int len;
|
||||||
uint8_t ackbuf[ACK_LEN];
|
uint8_t ackbuf[ACK_LEN];
|
||||||
|
|
||||||
wt = RTIMER_NOW();
|
if(AFTER_ACK_DETECTED_WAIT_TIME > 0) {
|
||||||
watchdog_periodic();
|
wt = RTIMER_NOW();
|
||||||
while(RTIMER_CLOCK_LT(RTIMER_NOW(),
|
watchdog_periodic();
|
||||||
wt + AFTER_ACK_DETECTED_WAIT_TIME));
|
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()) {
|
if(NETSTACK_RADIO.pending_packet()) {
|
||||||
len = NETSTACK_RADIO.read(ackbuf, ACK_LEN);
|
len = NETSTACK_RADIO.read(ackbuf, ACK_LEN);
|
||||||
|
|
|
@ -65,10 +65,10 @@
|
||||||
/* Default network config */
|
/* Default network config */
|
||||||
#if WITH_UIP6
|
#if WITH_UIP6
|
||||||
|
|
||||||
#define NULLRDC_CONF_802154_AUTOACK 0
|
#define NULLRDC_CONF_802154_AUTOACK 1
|
||||||
#define NULLRDC_CONF_SEND_802154_ACK 0
|
#define NULLRDC_CONF_SEND_802154_ACK 1
|
||||||
#define NULLRDC_CONF_ACK_WAIT_TIME RTIMER_SECOND / 500
|
#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 */
|
/* Network setup for IPv6 */
|
||||||
|
|
|
@ -162,10 +162,14 @@ radio_send(const void *payload, unsigned short payload_len)
|
||||||
{
|
{
|
||||||
int radiostate = simRadioHWOn;
|
int radiostate = simRadioHWOn;
|
||||||
|
|
||||||
/* Simulate turnaround time of 1ms */
|
/* Simulate turnaround time of 2ms for packets, 1ms for acks*/
|
||||||
#if WITH_TURNAROUND
|
#if WITH_TURNAROUND
|
||||||
simProcessRunValue = 1;
|
simProcessRunValue = 1;
|
||||||
cooja_mt_yield();
|
cooja_mt_yield();
|
||||||
|
if(payload_len > 3) {
|
||||||
|
simProcessRunValue = 1;
|
||||||
|
cooja_mt_yield();
|
||||||
|
}
|
||||||
#endif /* WITH_TURNAROUND */
|
#endif /* WITH_TURNAROUND */
|
||||||
|
|
||||||
if(!simRadioHWOn) {
|
if(!simRadioHWOn) {
|
||||||
|
|
Loading…
Reference in a new issue