Loading...
Searching...
No Matches

Radio ops struct declaration. More...

Detailed Description

Radio ops struct declaration.

Definition at line 531 of file radio.h.

#include <radio.h>

Data Fields

const uint32_t caps
 Radio device capabilities.
 
int(* write )(ieee802154_dev_t *dev, const iolist_t *psdu)
 Write a frame into the framebuffer.
 
int(* len )(ieee802154_dev_t *dev)
 Get the length of the received PSDU frame.
 
int(* read )(ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info)
 Read or discard the received frame and close the reception.
 
int(* peek )(ieee802154_dev_t *dev, void *buf, size_t offset, size_t size)
 Peek a part of a received frame from the internal framebuffer.
 
int(* off )(ieee802154_dev_t *dev)
 Turn off the device.
 
int(* request_on )(ieee802154_dev_t *dev)
 Request to turn on the device.
 
int(* confirm_on )(ieee802154_dev_t *dev)
 Confirmation function for ieee802154_radio_ops::request_on.
 
int(* request_op )(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)
 Request a radio operation.
 
int(* confirm_op )(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)
 Confirmation function for ieee802154_radio_ops::request_op.
 
int(* set_cca_threshold )(ieee802154_dev_t *dev, int8_t threshold)
 Set the threshold for the Energy Detection (first mode of CCA)
 
int(* set_cca_mode )(ieee802154_dev_t *dev, ieee802154_cca_mode_t mode)
 Set CCA mode.
 
int(* config_phy )(ieee802154_dev_t *dev, const ieee802154_phy_conf_t *conf)
 Set IEEE802.15.4 PHY configuration (channel, TX power)
 
int(* set_frame_retrans )(ieee802154_dev_t *dev, uint8_t retrans)
 Set number of frame retransmissions.
 
int(* set_csma_params )(ieee802154_dev_t *dev, const ieee802154_csma_be_t *bd, int8_t retries)
 Set the CSMA-CA parameters.
 
int(* set_frame_filter_mode )(ieee802154_dev_t *dev, ieee802154_filter_mode_t mode)
 Set the frame filter mode.
 
int(* get_frame_filter_mode )(ieee802154_dev_t *dev, ieee802154_filter_mode_t *mode)
 Get the frame filter mode.
 
int(* config_addr_filter )(ieee802154_dev_t *dev, ieee802154_af_cmd_t cmd, const void *value)
 Configure the address filter.
 
int(* config_src_addr_match )(ieee802154_dev_t *dev, ieee802154_src_match_t cmd, const void *value)
 Set the source address match configuration.
 
const struct ieee802154_radio_cipher_ops * cipher_ops
 Radio cipher ops.
 

Field Documentation

◆ caps

const uint32_t ieee802154_radio_ops::caps

Radio device capabilities.

This field contains bitflags of supported capabilities (ieee802154_rf_caps_t) by the device.

Definition at line 538 of file radio.h.

◆ cipher_ops

const struct ieee802154_radio_cipher_ops* ieee802154_radio_ops::cipher_ops

Radio cipher ops.

May be NULL if the radio does not support crypto acceleration.

Definition at line 916 of file radio.h.

◆ config_addr_filter

int(* ieee802154_radio_ops::config_addr_filter) (ieee802154_dev_t *dev, ieee802154_af_cmd_t cmd, const void *value)

Configure the address filter.

This functions is used for configuring the address filter parameters required by the IEEE 802.15.4 standard.

Precondition
The device is on
Parameters
[in]devIEEE802.15.4 device descriptor
[in]cmdcommand for the address filter
[in]valuevalue for cmd.
Return values
0on success
negativeerrno on error

Definition at line 888 of file radio.h.

◆ config_phy

int(* ieee802154_radio_ops::config_phy) (ieee802154_dev_t *dev, const ieee802154_phy_conf_t *conf)

Set IEEE802.15.4 PHY configuration (channel, TX power)

This function SHOULD NOT validate the PHY configurations unless it's specific to the device. The upper layer is responsible of all kind of validations. In case a configuration is not valid (e.g parameters out of range), this function should return -EINVAL

Precondition
The device is on
The transceiver state is IDLE.
Parameters
[in]devIEEE802.15.4 device descriptor
[in]confthe PHY configuration
Return values
0on success
-EINVALif the configuration is not valid for the device.
<0error, return value is negative errno indicating the cause.

Definition at line 808 of file radio.h.

◆ config_src_addr_match

int(* ieee802154_radio_ops::config_src_addr_match) (ieee802154_dev_t *dev, ieee802154_src_match_t cmd, const void *value)

Set the source address match configuration.

This function configures the source address match filter in order to set the Frame Pending bit in ACK frames accordingly. In case the radio doesn't support IEEE802154_CAP_SRC_ADDR_MATCH, this functions is used to activate the Frame Pending bit for all ACK frames (in order to be compliant with the IEEE 802.15.4 standard).

Precondition
The device is on
Parameters
[in]devIEEE802.15.4 device descriptor
[in]cmdcommand for the source address match configuration
[in]valuevalue associated to cmd.
Return values
0on success
negativeerrno on error

Definition at line 908 of file radio.h.

◆ confirm_on

int(* ieee802154_radio_ops::confirm_on) (ieee802154_dev_t *dev)

Confirmation function for ieee802154_radio_ops::request_on.

Precondition
Call to ieee802154_radio_ops::request_on was successful.
Postcondition
The transceiver state is IDLE During boot or in case the radio doesn't support IEEE802154_CAP_REG_RETENTION when off was called, the Physical Information Base will be undefined. Thus, take into consideration that the following functions should be called right after the radio is turned on again:
Parameters
[in]devIEEE802.15.4 device descriptor
Return values
0if the device is on
-EAGAINif the device is still busy turning on
negativeerrno on error

Definition at line 725 of file radio.h.

◆ confirm_op

int(* ieee802154_radio_ops::confirm_op) (ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)

Confirmation function for ieee802154_radio_ops::request_op.

This function must be called to finish a given ieee802154_hal_op_t.

Parameters
[in]devIEEE802.15.4 device descriptor
[in]opoperation to be confirmed
[in]ctxoperation specific context
Returns
status of the request
Return values
0on success
negativeerrno on error

Definition at line 758 of file radio.h.

◆ get_frame_filter_mode

int(* ieee802154_radio_ops::get_frame_filter_mode) (ieee802154_dev_t *dev, ieee802154_filter_mode_t *mode)

Get the frame filter mode.

Precondition
The device is on
Parameters
[in]devIEEE802.15.4 device descriptor
[out]modeaddress filter mode
Return values
0on success
negativeerrno on error

Definition at line 871 of file radio.h.

◆ len

int(* ieee802154_radio_ops::len) (ieee802154_dev_t *dev)

Get the length of the received PSDU frame.

This function provides non-destructive access to the received frame while a reception is pending (see ieee802154_radio_ops::read).

Precondition
The device is on
A reception is pending and the radio was set to IDLE beforehand (see ieee802154_radio_ops::read).
Postcondition
the frame buffer is still protected against new frame arrivals.
Parameters
[in]devIEEE802.15.4 device descriptor
Returns
length of the frame

Definition at line 570 of file radio.h.

◆ off

int(* ieee802154_radio_ops::off) (ieee802154_dev_t *dev)

Turn off the device.

Parameters
[in]devIEEE802.15.4 device descriptor

When this function returns, the radio shall be off.

Postcondition
the device is off
Return values
0on success
negativeerrno on error

Definition at line 682 of file radio.h.

◆ peek

int(* ieee802154_radio_ops::peek) (ieee802154_dev_t *dev, void *buf, size_t offset, size_t size)

Peek a part of a received frame from the internal framebuffer.

This function copies size bytes of the received PSDU frame, starting at offset, into buf without consuming the frame (see ieee802154_radio_ops::read): the received frame remains in the framebuffer until the reception is closed. Unlike ieee802154_radio_ops::read, this function MUST NOT release any kind of framebuffer protection and MUST NOT change the state of the radio.

This function MAY be NULL if the radio doesn't provide random access to the received frame.

Precondition
The device is on
buf != NULL
A reception is pending and the radio was set to IDLE beforehand (see ieee802154_radio_ops::read).
offset + size doesn't exceed the length of the received frame, excluding FCS.
Parameters
[in]devIEEE802.15.4 device descriptor
[out]bufbuffer to write the peeked bytes into.
[in]offsetoffset of the first byte to peek, relative to the start of the PSDU frame.
[in]sizenumber of bytes to peek
Returns
number of bytes written in buf
Return values
-EINVALif offset + size exceeds the length of the received frame

Definition at line 668 of file radio.h.

◆ read

int(* ieee802154_radio_ops::read) (ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info)

Read or discard the received frame and close the reception.

Reception lifecycle: a reception is opened by an indication (IEEE802154_RADIO_INDICATION_RX_DONE or IEEE802154_RADIO_INDICATION_CRC_ERROR) and MUST be closed by exactly one call to this function:

RX_DONE / CRC_ERROR read
NONE ---------------------> PENDING ---------------------> NONE
int(* read)(ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info)
Read or discard the received frame and close the reception.
Definition radio.h:636

While a reception is pending:

  • the upper layer SHOULD set the radio to IDLE (ieee802154_radio_set_idle) before any framebuffer access, since the behavior of radios after frame reception is undefined otherwise.
  • ieee802154_radio_ops::len and ieee802154_radio_ops::peek provide non-destructive access to the received frame.
  • the received frame remains valid until the reception is closed, unless another operation overwrites the framebuffer (e.g. a transmission). Radios that declare IEEE802154_CAP_FRAME_RETENTION keep the received frame valid regardless of interleaved operations between reception and calling this function.
  • new frame receptions might be blocked (framebuffer protection).

If buf is not NULL, the received PSDU frame is copied into buf and, if info is not NULL, the frame information (RSSI and LQI, if supported) is filled in. The FCS field is not copied and its size is not taken into account for the return value.

If buf is NULL, the received frame is discarded. This is the only way to close a reception without copying the frame (e.g. after IEEE802154_RADIO_INDICATION_CRC_ERROR, or when the upper layer doesn't need the frame).

Once this function returns, the reception is closed: the framebuffer may be reused and the transceiver can be set back to RX (ieee802154_radio_set_rx). If the radio provides any kind of framebuffer protection, this function releases it.

Precondition
The device is on
A reception is pending and the radio was set to IDLE beforehand (ieee802154_radio_set_idle), since the behavior of radios after frame reception is otherwise undefined.
Postcondition
The reception is closed. Don't call this function again until a new reception event is indicated, otherwise there's risk of RX underflow.
Parameters
[in]devIEEE802.15.4 device descriptor
[out]bufbuffer to write the received PSDU frame into, or NULL to discard the frame
[in]sizesize of buf
[in]infoinformation of the received frame (LQI, RSSI). Can be NULL if this information is not needed.
Returns
number of bytes written in buf (0 if buf == NULL)
Return values
-ENOBUFSif the frame doesn't fit in buf. In this case nothing is consumed: the reception stays pending and the received frame is not modified.

Definition at line 636 of file radio.h.

◆ request_on

int(* ieee802154_radio_ops::request_on) (ieee802154_dev_t *dev)

Request to turn on the device.

Note
ieee802154_radio_ops::confirm_on MUST be used to finish the procedure.
Precondition
The init function of the radio succeeded.
Parameters
[in]devIEEE802.15.4 device descriptor
Return values
0on success
negativeerrno on error

Definition at line 697 of file radio.h.

◆ request_op

int(* ieee802154_radio_ops::request_op) (ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)

Request a radio operation.

This functions is used to request a radio operation. See ieee802154_hal_op_t for a list of available operations.

Parameters
[in]devIEEE802.15.4 device descriptor
[in]opoperation to be executed
[in]ctxoperation specific context
Returns
status of the request
Return values
0on success
negativeerrno on error

Definition at line 742 of file radio.h.

◆ set_cca_mode

int(* ieee802154_radio_ops::set_cca_mode) (ieee802154_dev_t *dev, ieee802154_cca_mode_t mode)

Set CCA mode.

All radios MUST at least implement the first CCA mode (ED Threshold).

Precondition
The device is on
Parameters
[in]devIEEE802.15.4 device descriptor
[in]modethe CCA mode
Return values
0on success
-ENOTSUPif the mode is not supported
negativeerrno on error

Definition at line 787 of file radio.h.

◆ set_cca_threshold

int(* ieee802154_radio_ops::set_cca_threshold) (ieee802154_dev_t *dev, int8_t threshold)

Set the threshold for the Energy Detection (first mode of CCA)

Precondition
The device is on
Parameters
[in]devIEEE802.15.4 device descriptor
[in]thresholdthe threshold in dBm.
Return values
0on success
negativeerrno on error

Definition at line 771 of file radio.h.

◆ set_csma_params

int(* ieee802154_radio_ops::set_csma_params) (ieee802154_dev_t *dev, const ieee802154_csma_be_t *bd, int8_t retries)

Set the CSMA-CA parameters.

Precondition
The device is on
Parameters
[in]devIEEE802.15.4 device descriptor
[in]bdparameters of the exponential backoff. If NULL, the parameters are not altered.
[in]retriesnumber of CSMA-CA retries. If retries < 0, retransmissions with CSMA-CA MUST be disabled. If retries == 0, the ieee802154_radio_request_transmit function is equivalent to CCA send.
Return values
0on success
-EINVALif the settings are not supported.
negativeerrno on error

Definition at line 844 of file radio.h.

◆ set_frame_filter_mode

int(* ieee802154_radio_ops::set_frame_filter_mode) (ieee802154_dev_t *dev, ieee802154_filter_mode_t mode)

Set the frame filter mode.

Precondition
The device is on
Parameters
[in]devIEEE802.15.4 device descriptor
[in]modeaddress filter mode
Return values
0on success
negativeerrno on error

Definition at line 858 of file radio.h.

◆ set_frame_retrans

int(* ieee802154_radio_ops::set_frame_retrans) (ieee802154_dev_t *dev, uint8_t retrans)

Set number of frame retransmissions.

Precondition
The device is on
Note
This function pointer can be NULL if the device doesn't support frame retransmissions
Parameters
[in]devIEEE802.15.4 device descriptor
[in]retransthe number of retransmissions attempts.
Return values
0on success
negativeerrno on error

Definition at line 824 of file radio.h.

◆ write

int(* ieee802154_radio_ops::write) (ieee802154_dev_t *dev, const iolist_t *psdu)

Write a frame into the framebuffer.

This function shouldn't do any checks, so the frame MUST be valid. The previous content of the framebuffer is replaced by psdu.

Parameters
[in]devIEEE802.15.4 device descriptor
[in]psduPSDU frame to be sent
Return values
0on success
negativeerrno on error

Definition at line 552 of file radio.h.


The documentation for this struct was generated from the following file: