The friendly Operating System for the Internet of Things
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

Files

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

Data Structures

struct  csma_sender_conf_t
 Configuration type for backoff. More...
 

Macros

#define CSMA_SENDER_MIN_BE_DEFAULT   (3U)
 Default Minimal CSMA/CA Backoff Exponent.
 
#define CSMA_SENDER_MAX_BE_DEFAULT   (5U)
 Default Maximal CSMA/CA Backoff Exponent.
 
#define CSMA_SENDER_MAX_BACKOFFS_DEFAULT   (4U)
 Default Maximal number of retries for sending a given packet with the CSMA/CA method.
 
#define CSMA_SENDER_BACKOFF_PERIOD_UNIT   (320U)
 CSMA/CA backoff period, in microseconds.
 

Functions

int csma_sender_csma_ca_send (netdev_t *dev, struct iovec *vector, unsigned count, 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, struct iovec *vector, unsigned count)
 Sends a 802.15.4 frame when medium is avaiable. More...
 

Variables

const csma_sender_conf_t CSMA_SENDER_CONF_DEFAULT
 Default configuration.
 

Function Documentation

int csma_sender_cca_send ( netdev_t dev,
struct iovec vector,
unsigned  count 
)
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]vectorpointer to the data
[in]countnumber of elements in vector
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 occured
-EBUSY if radio medium was not available to send the given data
int csma_sender_csma_ca_send ( netdev_t dev,
struct iovec vector,
unsigned  count,
const csma_sender_conf_t conf 
)
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]vectorpointer to the data
[in]countnumber of elements in vector
[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 occured
-EBUSY if radio medium never was available to send the given data