CSMA/CA helper

This interface allows code from layer 2 (MAC) or higher to send packets with CSMA/CA, whatever the abilities and/or configuration of a given radio transceiver device are. More...

Detailed Description

This interface allows code from layer 2 (MAC) or higher to send packets with CSMA/CA, whatever the abilities and/or configuration of a given radio transceiver device are.

Modules

 CSMA/CA helper compile configurations
 

Files

file  csma_sender.h
 Interface definition for the CSMA/CA helper.
 

Data Structures

struct  csma_sender_conf_t
 Configuration type for backoff. More...
 

Functions

int csma_sender_csma_ca_send (netdev_t *dev, iolist_t *iolist, const csma_sender_conf_t *conf)
 Sends a 802.15.4 frame using the CSMA/CA method. More...
 
int csma_sender_cca_send (netdev_t *dev, iolist_t *iolist)
 Sends a 802.15.4 frame when medium is available. More...
 

Variables

const csma_sender_conf_t CSMA_SENDER_CONF_DEFAULT
 Default configuration.
 

Function Documentation

◆ csma_sender_cca_send()

int csma_sender_cca_send ( netdev_t dev,
iolist_t iolist 
)

Sends a 802.15.4 frame when medium is available.

Precondition
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.

It is especially useful for broadcasting specific packets, like beacons; or for many sending packets in burst.

Warning
ATTENTION: It only tries to send the given data once. If you want the complete CSMA/CA procedure with retries, use csma_sender_csma_ca_send().
Parameters
[in]devnetdev device, needs to be already initialized
[in]iolistpointer to the data
Returns
number of bytes that were actually send out
-ENODEV if dev is invalid
-ENOMSG if pkt is invalid
-EOVERFLOW if the payload size of pkt exceeds the payload size that can be handled by the device
-ECANCELED if an internal driver error occurred
-EBUSY if radio medium was not available to send the given data

◆ csma_sender_csma_ca_send()

int csma_sender_csma_ca_send ( netdev_t dev,
iolist_t iolist,
const csma_sender_conf_t conf 
)

Sends a 802.15.4 frame using the CSMA/CA method.

Precondition
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.

Parameters
[in]devnetdev device, needs to be already initialized
[in]iolistpointer to the data
[in]confconfiguration for the backoff; will be set to CSMA_SENDER_CONF_DEFAULT if NULL.
Returns
number of bytes that were actually send out
-ENODEV if dev is invalid
-ENOMSG if pkt is invalid
-EOVERFLOW if the payload size of pkt exceeds the payload size that can be handled by the device
-ECANCELED if an internal driver error occurred
-EBUSY if radio medium never was available to send the given data