Radio ops struct declaration. More...
#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 a 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 uint32_t ieee802154_radio_ops::caps |
Radio device capabilities.
This field contains bitflags of supported capabilities (ieee802154_rf_caps_t) by the device.
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.
[in] | dev | IEEE802.15.4 device descriptor |
[in] | cmd | command for the address filter |
[in] | value | value for cmd . |
0 | on success |
negative | errno on error |
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
[in] | dev | IEEE802.15.4 device descriptor |
[in] | conf | the PHY configuration |
0 | on success |
-EINVAL | if the configuration is not valid for the device. |
<0 | error, return value is negative errno indicating the cause. |
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).
[in] | dev | IEEE802.15.4 device descriptor |
[in] | cmd | command for the source address match configuration |
[in] | value | value associated to cmd . |
0 | on success |
negative | errno on error |
int(* ieee802154_radio_ops::confirm_on) (ieee802154_dev_t *dev) |
Confirmation function for ieee802154_radio_ops::request_on.
[in] | dev | IEEE802.15.4 device descriptor |
0 | if the device is on |
-EAGAIN | if the device is still busy turning on |
negative | errno on error |
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.
[in] | dev | IEEE802.15.4 device descriptor |
[in] | op | operation to be confirmed |
[in] | ctx | operation specific context |
0 | on success |
negative | errno on error |
int(* ieee802154_radio_ops::get_frame_filter_mode) (ieee802154_dev_t *dev, ieee802154_filter_mode_t *mode) |
int(* ieee802154_radio_ops::len) (ieee802154_dev_t *dev) |
Get the length of the received PSDU frame.
[in] | dev | IEEE802.15.4 device descriptor |
int(* ieee802154_radio_ops::off) (ieee802154_dev_t *dev) |
int(* ieee802154_radio_ops::read) (ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info) |
Read a frame from the internal framebuffer.
This function reads the received frame from the internal framebuffer. It should try to copy the received PSDU frame into buf
. The FCS field will not be copied and its size not be taken into account for the return value. If the radio provides any kind of framebuffer protection, this function should release it.
[in] | dev | IEEE802.15.4 device descriptor |
[out] | buf | buffer to write the received PSDU frame into. |
[in] | size | size of buf |
[in] | info | information of the received frame (LQI, RSSI). Can be NULL if this information is not needed. |
number | of bytes written in buffer (0 if buf == NULL) |
-ENOBUFS | if the frame doesn't fit in buf |
int(* ieee802154_radio_ops::request_on) (ieee802154_dev_t *dev) |
Request to turn on the device.
[in] | dev | IEEE802.15.4 device descriptor |
0 | on success |
negative | errno on error |
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.
[in] | dev | IEEE802.15.4 device descriptor |
[in] | op | operation to be executed |
[in] | ctx | operation specific context |
0 | on success |
negative | errno on error |
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).
[in] | dev | IEEE802.15.4 device descriptor |
[in] | mode | the CCA mode |
0 | on success |
-ENOTSUP | if the mode is not supported |
negative | errno on error |
int(* ieee802154_radio_ops::set_cca_threshold) (ieee802154_dev_t *dev, int8_t threshold) |
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.
[in] | dev | IEEE802.15.4 device descriptor |
[in] | bd | parameters of the exponential backoff. If NULL, the parameters are not altered. |
[in] | retries | number 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. |
0 | on success |
-EINVAL | if the settings are not supported. |
negative | errno on error |
int(* ieee802154_radio_ops::set_frame_filter_mode) (ieee802154_dev_t *dev, ieee802154_filter_mode_t mode) |
int(* ieee802154_radio_ops::set_frame_retrans) (ieee802154_dev_t *dev, uint8_t retrans) |
Set number of frame retransmissions.
[in] | dev | IEEE802.15.4 device descriptor |
[in] | retrans | the number of retransmissions attempts. |
0 | on success |
negative | errno on error |
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
.
[in] | dev | IEEE802.15.4 device descriptor |
[in] | psdu | PSDU frame to be sent |
0 | on success |
negative | errno on error |