gnrc/lwmac : Move GNRC_LWMAC_TIME_BETWEEN_WR_US to 'CONFIG_'

This commit is contained in:
Akshai M 2020-05-22 23:02:28 +05:30
parent 1be3264ab3
commit e38dca5d42
3 changed files with 30 additions and 28 deletions

View File

@ -126,18 +126,18 @@ extern "C" {
*
* In LWMAC, when a sender initiates a transmission to a receiver, it starts
* with sending a stream of repeated WR packets with
* @ref GNRC_LWMAC_TIME_BETWEEN_WR_US interval between two consecutive WRs.
* After sending one WR (preamble) packet, the sender turns to the listen mode
* to receive the potential incoming WA (preamble-ACK) packet with a timeout of
* @ref GNRC_LWMAC_TIME_BETWEEN_WR_US. If no WA is received during
* @ref GNRC_LWMAC_TIME_BETWEEN_WR_US, the sender starts sending the next WR.
* It is referenced to the beginning of both WRs, but due to internal
* overhead, the exact spacing is slightly higher. The minimum possible value
* depends on the time it takes to completely send a WR with the given hardware
* (including processor) and data rate.
* @ref CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US interval between two consecutive
* WRs. After sending one WR (preamble) packet, the sender turns to the listen
* mode to receive the potential incoming WA (preamble-ACK) packet with a
* timeout of @ref CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US. If no WA is received
* during @ref CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US, the sender starts sending
* the next WR. It is referenced to the beginning of both WRs, but due to
* internal overhead, the exact spacing is slightly higher. The minimum
* possible value depends on the time it takes to completely send a WR with the
* given hardware (including processor) and data rate.
*/
#ifndef GNRC_LWMAC_TIME_BETWEEN_WR_US
#define GNRC_LWMAC_TIME_BETWEEN_WR_US (5U *US_PER_MS)
#ifndef CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US
#define CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US (5U *US_PER_MS)
#endif
/**
@ -148,14 +148,14 @@ extern "C" {
* period of @ref GNRC_LWMAC_WAKEUP_DURATION_US in each cycle. In the rest of
* the cycle, the node turns off the radio to conserve power.
* @ref GNRC_LWMAC_WAKEUP_DURATION_US is set to twice the duration of
* @ref GNRC_LWMAC_TIME_BETWEEN_WR_US, to guarantee that the wake-up period is
* long enough that receiver will not miss the WR (preamble) packet.
* @ref CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US, to guarantee that the wake-up
* period is long enough that receiver will not miss the WR (preamble) packet.
* Receiver needs to support @ref NETDEV_EVENT_RX_STARTED event in order to use
* time-between-WR as a sensible default here. Otherwise the duration of WRs as
* well as longest possible data broadcasts need to be taken into account.
*/
#ifndef GNRC_LWMAC_WAKEUP_DURATION_US
#define GNRC_LWMAC_WAKEUP_DURATION_US (GNRC_LWMAC_TIME_BETWEEN_WR_US * 2)
#define GNRC_LWMAC_WAKEUP_DURATION_US (CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US * 2)
#endif
/**
@ -178,17 +178,18 @@ extern "C" {
* @brief Time to idle between two successive broadcast packets, referenced to
* the start of the packet.
*
* The same limitation as for @ref GNRC_LWMAC_TIME_BETWEEN_WR_US apply here. In
* LWMAC, when a sender initiates a broadcast, it starts with sending a stream
* ofrepeated broadcast packets with @ref GNRC_LWMAC_TIME_BETWEEN_BROADCAST_US
* interval between two consecutive broadcast packets. After sending one
* broadcast packet, the sender turns to the listen mode with a timeout of
* The same limitation as for @ref CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US apply
* here. In LWMAC, when a sender initiates a broadcast, it starts with sending
* a stream ofrepeated broadcast packets with
* @ref GNRC_LWMAC_TIME_BETWEEN_BROADCAST_US interval between two consecutive
* broadcast packets. After sending one broadcast packet, the sender turns to
* the listen mode with a timeout of
* @ref GNRC_LWMAC_TIME_BETWEEN_BROADCAST_US. When this timeout expires, the
* sender sends the next broadcast packet until reaching the maximum broadcast
* duration of @ref GNRC_LWMAC_BROADCAST_DURATION_US.
*/
#ifndef GNRC_LWMAC_TIME_BETWEEN_BROADCAST_US
#define GNRC_LWMAC_TIME_BETWEEN_BROADCAST_US (GNRC_LWMAC_TIME_BETWEEN_WR_US)
#define GNRC_LWMAC_TIME_BETWEEN_BROADCAST_US (CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US)
#endif
/**
@ -269,10 +270,10 @@ extern "C" {
* WR to the receiver for starting the second round of transmission of the
* second data. The receiver should also immediately reply WA for continue
* receiving data packets. In case the sender doesn't receive WA during
* @ref GNRC_LWMAC_TIME_BETWEEN_WR_US, it regards the consecutive (burst)
* transmission failed and quits TX procedure (the data will be queued back
* to the transmission queue for normal transmission attempt in following
* cycles).
* @ref CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US, it regards the consecutive
* (burst) transmission failed and quits TX procedure (the data will be
* queued back to the transmission queue for normal transmission attempt in
* following cycles).
* 3. In case the second transmission succeeds, the sender repeats step (2) to
* send all the following pending packets.
*

View File

@ -398,7 +398,7 @@ static void _sleep_management(gnrc_netif_t *netif)
* always holding the medium (if the receiver's phase is recorded earlier in this
* particular node) */
uint32_t random_backoff;
random_backoff = random_uint32_range(0, GNRC_LWMAC_TIME_BETWEEN_WR_US);
random_backoff = random_uint32_range(0, CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US);
time_until_tx = time_until_tx + random_backoff;
gnrc_lwmac_set_timeout(netif, GNRC_LWMAC_TIMEOUT_WAIT_DEST_WAKEUP, time_until_tx);

View File

@ -663,7 +663,8 @@ static bool _lwmac_tx_update(gnrc_netif_t *netif)
netif->mac.tx.wr_sent++;
/* Set timeout for next WR in case no WA will be received */
gnrc_lwmac_set_timeout(netif, GNRC_LWMAC_TIMEOUT_WR, GNRC_LWMAC_TIME_BETWEEN_WR_US);
gnrc_lwmac_set_timeout(netif, GNRC_LWMAC_TIMEOUT_WR,
CONFIG_GNRC_LWMAC_TIME_BETWEEN_WR_US);
/* Debug WR timing */
LOG_DEBUG("[LWMAC-tx] Destination phase was: %" PRIu32 "\n",