drivers: ieee802154: nRF5: remove RX PHR offset workaround

Builds upon the newly introduced nrf_802154_phr_timestamp_get() function
to calculate RX timestamps according to the timestamp definitions
introduced in earlier commits and removes the prior workaround to
calculate the start-of-frame message timestamp point.

Fixes: #59245

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This commit is contained in:
Florian Grandel 2023-07-13 10:30:26 +02:00 committed by Carles Cufí
parent eacec3dad2
commit 7db0184e1b
2 changed files with 7 additions and 8 deletions

View file

@ -989,7 +989,8 @@ void nrf_802154_received_timestamp_raw(uint8_t *data, int8_t power, uint8_t lqi,
nrf5_data.rx_frames[i].lqi = lqi;
#if defined(CONFIG_NET_PKT_TIMESTAMP)
nrf5_data.rx_frames[i].time = nrf_802154_mhr_timestamp_get(time, data[0]);
nrf5_data.rx_frames[i].time =
nrf_802154_timestamp_end_to_phr_convert(time, data[0]);
#endif
if (data[ACK_REQUEST_BYTE] & ACK_REQUEST_BIT) {
@ -1084,9 +1085,8 @@ void nrf_802154_transmitted_raw(uint8_t *frame,
nrf5_data.ack_frame.lqi = metadata->data.transmitted.lqi;
#if defined(CONFIG_NET_PKT_TIMESTAMP)
nrf5_data.ack_frame.time =
nrf_802154_mhr_timestamp_get(
metadata->data.transmitted.time, nrf5_data.ack_frame.psdu[0]);
nrf5_data.ack_frame.time = nrf_802154_timestamp_end_to_phr_convert(
metadata->data.transmitted.time, nrf5_data.ack_frame.psdu[0]);
#endif
}

View file

@ -41,7 +41,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_OPENTHREAD_L2_LOG_LEVEL);
#define SHORT_ADDRESS_SIZE 2
#define FCS_SIZE 2
#define PHR_DURATION 32
#if defined(CONFIG_OPENTHREAD_THREAD_VERSION_1_1)
#define ACK_PKT_LENGTH 5
#else
@ -189,7 +188,7 @@ enum net_verdict ieee802154_handle_ack(struct net_if *iface, struct net_pkt *pkt
/* OpenThread expects the timestamp to point to the end of SFD */
ack_frame.mInfo.mRxInfo.mTimestamp = pkt_time->second * USEC_PER_SEC +
pkt_time->nanosecond / NSEC_PER_USEC - PHR_DURATION;
pkt_time->nanosecond / NSEC_PER_USEC;
#endif
return NET_OK;
@ -480,8 +479,8 @@ static void openthread_handle_received_frame(otInstance *instance,
struct net_ptp_time *pkt_time = net_pkt_timestamp(pkt);
/* OpenThread expects the timestamp to point to the end of SFD */
recv_frame.mInfo.mRxInfo.mTimestamp = pkt_time->second * USEC_PER_SEC +
pkt_time->nanosecond / NSEC_PER_USEC - PHR_DURATION;
recv_frame.mInfo.mRxInfo.mTimestamp =
pkt_time->second * USEC_PER_SEC + pkt_time->nanosecond / NSEC_PER_USEC;
#endif
if (net_pkt_ieee802154_arb(pkt) && net_pkt_ieee802154_fv2015(pkt)) {