Radio ops struct declaration.
Definition at line 531 of file radio.h.
|
| 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.
|
| |
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] | dev | IEEE802.15.4 device descriptor |
| [in] | conf | the PHY configuration |
- Return values
-
| 0 | on success |
| -EINVAL | if the configuration is not valid for the device. |
| <0 | error, return value is negative errno indicating the cause. |
Definition at line 808 of file radio.h.
| 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] | dev | IEEE802.15.4 device descriptor |
| [out] | buf | buffer to write the peeked bytes into. |
| [in] | offset | offset of the first byte to peek, relative to the start of the PSDU frame. |
| [in] | size | number of bytes to peek |
- Returns
- number of bytes written in
buf
- Return values
-
| -EINVAL | if offset + size exceeds the length of the received frame |
Definition at line 668 of file radio.h.
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:
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.
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] | dev | IEEE802.15.4 device descriptor |
| [out] | buf | buffer to write the received PSDU frame into, or NULL to discard the frame |
| [in] | size | size of buf |
| [in] | info | information 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
-
| -ENOBUFS | if 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.