mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
csma_sender: assure preconditions
This commit is contained in:
parent
a3f2cdd6ea
commit
90201bfb6e
@ -81,6 +81,8 @@ void csma_sender_set_max_backoffs(uint8_t val);
|
||||
/**
|
||||
* @brief Sends a 802.15.4 frame using the CSMA/CA method
|
||||
*
|
||||
* @pre `dev != NULL`
|
||||
*
|
||||
* If the transceiver can (and is configured to) do hardware-assisted
|
||||
* CSMA/CA, this feature is used. Otherwise, a software procedure is used.
|
||||
*
|
||||
@ -103,6 +105,8 @@ int csma_sender_csma_ca_send(netdev2_t *dev, struct iovec *vector,
|
||||
/**
|
||||
* @brief Sends a 802.15.4 frame when medium is avaiable.
|
||||
*
|
||||
* @pre `dev != NULL`
|
||||
*
|
||||
* This function is useful for sending packets without the whole CSMA/CA
|
||||
* procedure, but *after* ensuring medium is available, that is after a
|
||||
* successful CCA.
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
@ -138,6 +139,7 @@ int csma_sender_csma_ca_send(netdev2_t *dev, struct iovec *vector,
|
||||
{
|
||||
netopt_enable_t hwfeat;
|
||||
|
||||
assert(dev);
|
||||
/* Does the transceiver do automatic CSMA/CA when sending? */
|
||||
int res = dev->driver->get(dev,
|
||||
NETOPT_CSMA,
|
||||
@ -210,6 +212,7 @@ int csma_sender_cca_send(netdev2_t *dev, struct iovec *vector, unsigned count)
|
||||
{
|
||||
netopt_enable_t hwfeat;
|
||||
|
||||
assert(dev);
|
||||
/* Does the transceiver do automatic CCA before sending? */
|
||||
int res = dev->driver->get(dev,
|
||||
NETOPT_AUTOCCA,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user