mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
gnrc_netif: allow for wait of minimum time between sends
This commit is contained in:
parent
6c895e1484
commit
488c47cbf3
@ -137,6 +137,17 @@ extern "C" {
|
||||
#define GNRC_NETIF_DEFAULT_HL (64U) /**< default hop limit */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Minimum wait time in microseconds after a send operation
|
||||
*
|
||||
* @experimental
|
||||
*
|
||||
* This is purely meant as a debugging feature to slow down a radios sending.
|
||||
*/
|
||||
#ifndef GNRC_NETIF_MIN_WAIT_AFTER_SEND_US
|
||||
#define GNRC_NETIF_MIN_WAIT_AFTER_SEND_US (0U)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "fmt.h"
|
||||
#include "log.h"
|
||||
#include "sched.h"
|
||||
#include "xtimer.h"
|
||||
|
||||
#include "net/gnrc/netif.h"
|
||||
#include "net/gnrc/netif/internal.h"
|
||||
@ -1314,6 +1315,9 @@ static void *_gnrc_netif_thread(void *args)
|
||||
#endif
|
||||
/* now let rest of GNRC use the interface */
|
||||
gnrc_netif_release(netif);
|
||||
#if (GNRC_NETIF_MIN_WAIT_AFTER_SEND_US > 0U)
|
||||
xtimer_ticks32_t last_wakeup = xtimer_now();
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
DEBUG("gnrc_netif: waiting for incoming messages\n");
|
||||
@ -1335,6 +1339,13 @@ static void *_gnrc_netif_thread(void *args)
|
||||
else {
|
||||
netif->stats.tx_bytes += res;
|
||||
}
|
||||
#endif
|
||||
#if (GNRC_NETIF_MIN_WAIT_AFTER_SEND_US > 0U)
|
||||
xtimer_periodic_wakeup(&last_wakeup,
|
||||
GNRC_NETIF_MIN_WAIT_AFTER_SEND_US);
|
||||
/* override last_wakeup in case last_wakeup +
|
||||
* GNRC_NETIF_MIN_WAIT_AFTER_SEND_US was in the past */
|
||||
last_wakeup = xtimer_now();
|
||||
#endif
|
||||
break;
|
||||
case GNRC_NETAPI_MSG_TYPE_SET:
|
||||
|
Loading…
Reference in New Issue
Block a user