Skip to content

Commit 7db0184

Browse files
fg-cfhcarlescufi
authored andcommitted
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 <[email protected]>
1 parent eacec3d commit 7db0184

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

drivers/ieee802154/ieee802154_nrf5.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,8 @@ void nrf_802154_received_timestamp_raw(uint8_t *data, int8_t power, uint8_t lqi,
989989
nrf5_data.rx_frames[i].lqi = lqi;
990990

991991
#if defined(CONFIG_NET_PKT_TIMESTAMP)
992-
nrf5_data.rx_frames[i].time = nrf_802154_mhr_timestamp_get(time, data[0]);
992+
nrf5_data.rx_frames[i].time =
993+
nrf_802154_timestamp_end_to_phr_convert(time, data[0]);
993994
#endif
994995

995996
if (data[ACK_REQUEST_BYTE] & ACK_REQUEST_BIT) {
@@ -1084,9 +1085,8 @@ void nrf_802154_transmitted_raw(uint8_t *frame,
10841085
nrf5_data.ack_frame.lqi = metadata->data.transmitted.lqi;
10851086

10861087
#if defined(CONFIG_NET_PKT_TIMESTAMP)
1087-
nrf5_data.ack_frame.time =
1088-
nrf_802154_mhr_timestamp_get(
1089-
metadata->data.transmitted.time, nrf5_data.ack_frame.psdu[0]);
1088+
nrf5_data.ack_frame.time = nrf_802154_timestamp_end_to_phr_convert(
1089+
metadata->data.transmitted.time, nrf5_data.ack_frame.psdu[0]);
10901090
#endif
10911091
}
10921092

modules/openthread/platform/radio.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_OPENTHREAD_L2_LOG_LEVEL);
4141
#define SHORT_ADDRESS_SIZE 2
4242

4343
#define FCS_SIZE 2
44-
#define PHR_DURATION 32
4544
#if defined(CONFIG_OPENTHREAD_THREAD_VERSION_1_1)
4645
#define ACK_PKT_LENGTH 5
4746
#else
@@ -189,7 +188,7 @@ enum net_verdict ieee802154_handle_ack(struct net_if *iface, struct net_pkt *pkt
189188

190189
/* OpenThread expects the timestamp to point to the end of SFD */
191190
ack_frame.mInfo.mRxInfo.mTimestamp = pkt_time->second * USEC_PER_SEC +
192-
pkt_time->nanosecond / NSEC_PER_USEC - PHR_DURATION;
191+
pkt_time->nanosecond / NSEC_PER_USEC;
193192
#endif
194193

195194
return NET_OK;
@@ -480,8 +479,8 @@ static void openthread_handle_received_frame(otInstance *instance,
480479
struct net_ptp_time *pkt_time = net_pkt_timestamp(pkt);
481480

482481
/* OpenThread expects the timestamp to point to the end of SFD */
483-
recv_frame.mInfo.mRxInfo.mTimestamp = pkt_time->second * USEC_PER_SEC +
484-
pkt_time->nanosecond / NSEC_PER_USEC - PHR_DURATION;
482+
recv_frame.mInfo.mRxInfo.mTimestamp =
483+
pkt_time->second * USEC_PER_SEC + pkt_time->nanosecond / NSEC_PER_USEC;
485484
#endif
486485

487486
if (net_pkt_ieee802154_arb(pkt) && net_pkt_ieee802154_fv2015(pkt)) {

0 commit comments

Comments
 (0)