drivers: ieee802154_nrf5: Notify about FPB value in ACK reponse
The radio driver will now notify the upper layer about Frame Pending Bit value in the ACK response it sent. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
00d1f6e772
commit
c39d0b6914
2 changed files with 26 additions and 1 deletions
|
@ -48,6 +48,11 @@ struct nrf5_802154_config {
|
|||
|
||||
static struct nrf5_802154_data nrf5_data;
|
||||
|
||||
#define ACK_REQUEST_BYTE 1
|
||||
#define ACK_REQUEST_BIT (1 << 5)
|
||||
#define FRAME_PENDING_BYTE 1
|
||||
#define FRAME_PENDING_BIT (1 << 4)
|
||||
|
||||
/* Convenience defines for RADIO */
|
||||
#define NRF5_802154_DATA(dev) \
|
||||
((struct nrf5_802154_data * const)(dev)->driver_data)
|
||||
|
@ -109,6 +114,7 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
|
|||
|
||||
net_pkt_set_ieee802154_lqi(pkt, rx_frame->lqi);
|
||||
net_pkt_set_ieee802154_rssi(pkt, rx_frame->rssi);
|
||||
net_pkt_set_ieee802154_ack_fpb(pkt, rx_frame->ack_fpb);
|
||||
|
||||
#if defined(CONFIG_NET_PKT_TIMESTAMP)
|
||||
struct net_ptp_time timestamp = {
|
||||
|
@ -554,6 +560,15 @@ void nrf_802154_received_timestamp_raw(uint8_t *data, int8_t power, uint8_t lqi,
|
|||
nrf5_data.rx_frames[i].rssi = power;
|
||||
nrf5_data.rx_frames[i].lqi = lqi;
|
||||
|
||||
if (data[ACK_REQUEST_BYTE] & ACK_REQUEST_BIT) {
|
||||
nrf5_data.rx_frames[i].ack_fpb =
|
||||
nrf5_data.last_frame_ack_fpb;
|
||||
} else {
|
||||
nrf5_data.rx_frames[i].ack_fpb = false;
|
||||
}
|
||||
|
||||
nrf5_data.last_frame_ack_fpb = false;
|
||||
|
||||
k_fifo_put(&nrf5_data.rx_fifo, &nrf5_data.rx_frames[i]);
|
||||
|
||||
return;
|
||||
|
@ -564,7 +579,13 @@ void nrf_802154_received_timestamp_raw(uint8_t *data, int8_t power, uint8_t lqi,
|
|||
|
||||
void nrf_802154_receive_failed(nrf_802154_rx_error_t error)
|
||||
{
|
||||
/* Intentionally empty. */
|
||||
nrf5_data.last_frame_ack_fpb = false;
|
||||
}
|
||||
|
||||
void nrf_802154_tx_ack_started(const uint8_t *data)
|
||||
{
|
||||
nrf5_data.last_frame_ack_fpb =
|
||||
data[FRAME_PENDING_BYTE] & FRAME_PENDING_BIT;
|
||||
}
|
||||
|
||||
void nrf_802154_transmitted_raw(const uint8_t *frame, uint8_t *ack,
|
||||
|
|
|
@ -20,6 +20,7 @@ struct nrf5_802154_rx_frame {
|
|||
u32_t time; /* RX timestamp. */
|
||||
u8_t lqi; /* Last received frame LQI value. */
|
||||
s8_t rssi; /* Last received frame RSSI value. */
|
||||
bool ack_fpb; /* FPB value in ACK sent for the received frame. */
|
||||
};
|
||||
|
||||
struct nrf5_802154_data {
|
||||
|
@ -43,6 +44,9 @@ struct nrf5_802154_data {
|
|||
*/
|
||||
struct nrf5_802154_rx_frame rx_frames[NRF_802154_RX_BUFFERS];
|
||||
|
||||
/* Frame pending bit value in ACK sent for the last received frame. */
|
||||
bool last_frame_ack_fpb;
|
||||
|
||||
/* CCA complete sempahore. Unlocked when CCA is complete. */
|
||||
struct k_sem cca_wait;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue