Skip to content

Commit 128e3ab

Browse files
ankunsnordicjm
authored andcommitted
nrf_802154: rev f469dc339856010e9b5cab494bd99dbecefc0025
This commit updates revision of the nrf_802154 component. Signed-off-by: Andrzej Kuros <[email protected]>
1 parent 2c29da4 commit 128e3ab

File tree

44 files changed

+117
-26
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+117
-26
lines changed

nrf_802154/doc/CHANGELOG.rst

Lines changed: 8 additions & 0 deletions

nrf_802154/driver/src/mac_features/nrf_802154_delayed_trx.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -975,17 +975,17 @@ bool nrf_802154_delayed_trx_abort(nrf_802154_term_t term_lvl, req_originator_t r
975975

976976
void nrf_802154_delayed_trx_rx_started_hook(const nrf_802154_frame_t * p_frame)
977977
{
978-
NRF_802154_ASSERT(nrf_802154_frame_parse_level_get(p_frame) >= PARSE_LEVEL_FCF_OFFSETS);
979-
980978
dly_op_data_t * p_dly_op_data = ongoing_dly_rx_slot_get();
981979

982980
if (p_dly_op_data != NULL)
983981
{
984-
p_dly_op_data->rx.extension_frame.sof_timestamp = nrf_802154_sl_timer_current_time_get();
985-
p_dly_op_data->rx.extension_frame.psdu_length =
982+
p_dly_op_data->rx.extension_frame.sof_timestamp =
983+
nrf_802154_sl_timer_current_time_get();
984+
p_dly_op_data->rx.extension_frame.psdu_length =
986985
nrf_802154_frame_length_get(p_frame);
987-
p_dly_op_data->rx.extension_frame.ack_requested = nrf_802154_frame_ar_bit_is_set(
988-
p_frame);
986+
p_dly_op_data->rx.extension_frame.ack_requested =
987+
(nrf_802154_frame_parse_level_get(p_frame) >= PARSE_LEVEL_FCF_OFFSETS) &&
988+
nrf_802154_frame_ar_bit_is_set(p_frame);
989989
}
990990
}
991991

nrf_802154/driver/src/nrf_802154_core.c

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,10 +1033,16 @@ static bool tx_init(const nrf_802154_frame_t * p_frame,
10331033
{
10341034
bool cca = cca_attempts > 0;
10351035

1036-
if (!timeslot_is_granted() || !nrf_802154_rsch_timeslot_request(
1037-
nrf_802154_tx_duration_get(p_frame->p_frame[0],
1038-
cca,
1039-
tx_frame_ack_is_requested(p_frame))))
1036+
if (!timeslot_is_granted())
1037+
{
1038+
return false;
1039+
}
1040+
1041+
uint32_t duration = nrf_802154_tx_duration_get(nrf_802154_frame_length_get(p_frame),
1042+
cca,
1043+
tx_frame_ack_is_requested(p_frame));
1044+
1045+
if (!nrf_802154_rsch_timeslot_request(duration, RSCH_TIMESLOT_PRIO_LOW))
10401046
{
10411047
return false;
10421048
}
@@ -1157,7 +1163,12 @@ static void ed_init(void)
11571163
/** Initialize CCA operation. */
11581164
static void cca_init(void)
11591165
{
1160-
if (!timeslot_is_granted() || !nrf_802154_rsch_timeslot_request(nrf_802154_cca_duration_get()))
1166+
if (!timeslot_is_granted())
1167+
{
1168+
return;
1169+
}
1170+
1171+
if (!nrf_802154_rsch_timeslot_request(nrf_802154_cca_duration_get(), RSCH_TIMESLOT_PRIO_LOW))
11611172
{
11621173
return;
11631174
}
@@ -1562,6 +1573,24 @@ void nrf_802154_trx_receive_ack_started(void)
15621573
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
15631574
}
15641575

1576+
void nrf_802154_trx_receive_ack_phr_received(void)
1577+
{
1578+
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
1579+
1580+
NRF_802154_ASSERT(m_state == RADIO_STATE_RX_ACK);
1581+
1582+
uint8_t * curr_rx_buffer = mp_current_rx_buffer != NULL ? &mp_current_rx_buffer->data[0] : NULL;
1583+
1584+
if ((curr_rx_buffer != NULL) && (curr_rx_buffer[PHR_OFFSET] != 0U))
1585+
{
1586+
uint16_t duration = nrf_802154_frame_duration_get(curr_rx_buffer[PHR_OFFSET],
1587+
false,
1588+
false);
1589+
1590+
(void)nrf_802154_rsch_timeslot_request(duration, RSCH_TIMESLOT_PRIO_HIGH);
1591+
}
1592+
}
1593+
15651594
static void on_rx_prestarted_timeout(nrf_802154_sl_timer_t * p_timer)
15661595
{
15671596
(void)p_timer;
@@ -1867,7 +1896,7 @@ uint8_t nrf_802154_trx_receive_frame_bcmatched(uint8_t bcc)
18671896
mp_current_rx_buffer->data[0],
18681897
nrf_802154_frame_ar_bit_is_set(&m_current_rx_frame_data));
18691898

1870-
if (nrf_802154_rsch_timeslot_request(duration))
1899+
if (nrf_802154_rsch_timeslot_request(duration, RSCH_TIMESLOT_PRIO_LOW))
18711900
{
18721901
m_flags.rx_timeslot_requested = true;
18731902

@@ -1977,7 +2006,7 @@ void nrf_802154_trx_receive_frame_received(void)
19772006
{
19782007
uint16_t duration = nrf_802154_ack_duration_with_turnaround_get();
19792008

1980-
if (nrf_802154_rsch_timeslot_request(duration))
2009+
if (nrf_802154_rsch_timeslot_request(duration, RSCH_TIMESLOT_PRIO_LOW))
19812010
{
19822011
m_flags.frame_filtered = true;
19832012
m_flags.rx_timeslot_requested = true;

nrf_802154/driver/src/nrf_802154_trx.c

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static void rx_flags_clear(void)
268268
m_flags.psdu_being_received = false;
269269
}
270270

271-
static void * volatile mp_receive_buffer;
271+
static uint8_t * volatile mp_receive_buffer;
272272

273273
/** Force the TIMER to be stopped and count from 0. */
274274
static inline void timer_stop_and_clear(void)
@@ -1295,12 +1295,16 @@ bool nrf_802154_trx_receive_buffer_set(void * p_receive_buffer)
12951295

12961296
bool result = false;
12971297

1298-
mp_receive_buffer = p_receive_buffer;
1298+
mp_receive_buffer = (uint8_t *)p_receive_buffer;
12991299

1300-
if ((p_receive_buffer != NULL) && m_flags.missing_receive_buffer)
1300+
if (p_receive_buffer != NULL)
13011301
{
1302-
receive_buffer_missing_buffer_set(p_receive_buffer);
1303-
result = true;
1302+
((uint8_t *)p_receive_buffer)[PHR_OFFSET] = 0U;
1303+
if (m_flags.missing_receive_buffer)
1304+
{
1305+
receive_buffer_missing_buffer_set(p_receive_buffer);
1306+
result = true;
1307+
}
13041308
}
13051309

13061310
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_HIGH);
@@ -1334,10 +1338,13 @@ void nrf_802154_trx_receive_frame(uint8_t bcc,
13341338

13351339
txpower_set(p_ack_tx_power->radio_tx_power);
13361340

1337-
if (mp_receive_buffer != NULL)
1341+
uint8_t * p_receive_buffer = mp_receive_buffer;
1342+
1343+
if (p_receive_buffer != NULL)
13381344
{
1345+
p_receive_buffer[PHR_OFFSET] = 0U;
13391346
m_flags.missing_receive_buffer = false;
1340-
nrf_radio_packetptr_set(NRF_RADIO, mp_receive_buffer);
1347+
nrf_radio_packetptr_set(NRF_RADIO, p_receive_buffer);
13411348
shorts |= SHORTS_RX_FREE_BUFFER;
13421349
}
13431350
else
@@ -1452,10 +1459,13 @@ void nrf_802154_trx_receive_ack(void)
14521459

14531460
m_trx_state = TRX_STATE_RXACK;
14541461

1455-
if (mp_receive_buffer != NULL)
1462+
uint8_t * p_receive_buffer = mp_receive_buffer;
1463+
1464+
if (p_receive_buffer != NULL)
14561465
{
1466+
p_receive_buffer[PHR_OFFSET] = 0U;
14571467
m_flags.missing_receive_buffer = false;
1458-
nrf_radio_packetptr_set(NRF_RADIO, mp_receive_buffer);
1468+
nrf_radio_packetptr_set(NRF_RADIO, p_receive_buffer);
14591469
shorts |= SHORTS_RX_FREE_BUFFER;
14601470
}
14611471
else
@@ -1467,6 +1477,8 @@ void nrf_802154_trx_receive_ack(void)
14671477

14681478
nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_ADDRESS);
14691479
ints_to_enable |= NRF_RADIO_INT_ADDRESS_MASK;
1480+
nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_FRAMESTART);
1481+
ints_to_enable |= NRF_RADIO_INT_FRAMESTART_MASK;
14701482
nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_CRCOK);
14711483
ints_to_enable |= NRF_RADIO_INT_CRCOK_MASK;
14721484
nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_CRCERROR);
@@ -2069,8 +2081,8 @@ static void rxack_finish_disable_ints(void)
20692081
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_HIGH);
20702082

20712083
nrf_radio_int_disable(NRF_RADIO,
2072-
NRF_RADIO_INT_ADDRESS_MASK | NRF_RADIO_INT_CRCERROR_MASK |
2073-
NRF_RADIO_INT_CRCOK_MASK);
2084+
NRF_RADIO_INT_ADDRESS_MASK | NRF_RADIO_INT_FRAMESTART_MASK |
2085+
NRF_RADIO_INT_CRCERROR_MASK | NRF_RADIO_INT_CRCOK_MASK);
20742086

20752087
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_HIGH);
20762088
}
@@ -2444,6 +2456,25 @@ static void irq_handler_address(void)
24442456
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
24452457
}
24462458

2459+
static void irq_handler_framestart(void)
2460+
{
2461+
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
2462+
2463+
nrf_radio_int_disable(NRF_RADIO, NRF_RADIO_INT_FRAMESTART_MASK);
2464+
2465+
switch (m_trx_state)
2466+
{
2467+
case TRX_STATE_RXACK:
2468+
nrf_802154_trx_receive_ack_phr_received();
2469+
break;
2470+
2471+
default:
2472+
NRF_802154_ASSERT(false);
2473+
}
2474+
2475+
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
2476+
}
2477+
24472478
static void irq_handler_bcmatch(void)
24482479
{
24492480
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
@@ -2943,6 +2974,14 @@ void nrf_802154_radio_irq_handler(void)
29432974
irq_handler_address();
29442975
}
29452976

2977+
if (nrf_radio_int_enable_check(NRF_RADIO, NRF_RADIO_INT_FRAMESTART_MASK) &&
2978+
nrf_radio_event_check(NRF_RADIO, NRF_RADIO_EVENT_FRAMESTART))
2979+
{
2980+
nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_FRAMESTART);
2981+
2982+
irq_handler_framestart();
2983+
}
2984+
29462985
// Check MAC frame header.
29472986
if (nrf_radio_int_enable_check(NRF_RADIO, NRF_RADIO_INT_BCMATCH_MASK) &&
29482987
nrf_radio_event_check(NRF_RADIO, NRF_RADIO_EVENT_BCMATCH))

nrf_802154/driver/src/nrf_802154_trx.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ void nrf_802154_trx_receive_frame(uint8_t bcc,
218218
*
219219
* During receive of an ack:
220220
* - @ref nrf_802154_trx_receive_ack_started is called when a frame has just started being received.
221+
* - @ref nrf_802154_trx_receive_ack_phr_received is called when PHR field of an ACK has been received.
221222
* - when a frame is received with correct crc, @ref nrf_802154_trx_receive_ack_received is called.
222223
* - when a frame is received with incorrect crc, @ref nrf_802154_trx_receive_ack_crcerror is called.
223224
* - no bcmatch events are generated.
@@ -466,6 +467,13 @@ uint32_t nrf_802154_trx_ramp_up_ppi_channel_get(void);
466467
*/
467468
extern void nrf_802154_trx_receive_ack_started(void);
468469

470+
/**@brief Handler called during reception of an ACK when PHR has been received.
471+
*
472+
* This handler is called from an ISR when receive of an ACK has been started, and
473+
* the RADIO received PHR field.
474+
*/
475+
extern void nrf_802154_trx_receive_ack_phr_received(void);
476+
469477
/**@brief Handler called at the beginning of frame reception (earliest possible moment).
470478
*
471479
* This handler is called from an ISR when:

nrf_802154/sl/include/rsch/nrf_802154_rsch.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ typedef enum
116116
RSCH_PRIO_MAX = RSCH_PRIO_TX, ///< Maximal priority available in the RSCH module.
117117
} rsch_prio_t;
118118

119+
typedef enum
120+
{
121+
RSCH_TIMESLOT_PRIO_LOW = 0,
122+
RSCH_TIMESLOT_PRIO_HIGH = 1,
123+
} rsch_timeslot_prio_t;
124+
119125
/**
120126
* @brief Enumeration of the delayed timeslot operation types.
121127
*/
@@ -227,7 +233,7 @@ void nrf_802154_rsch_continuous_ended(void);
227233
* @retval false Slot cannot be assigned due to other activities.
228234
*
229235
*/
230-
bool nrf_802154_rsch_timeslot_request(uint32_t length_us);
236+
bool nrf_802154_rsch_timeslot_request(uint32_t length_us, rsch_timeslot_prio_t prio);
231237

232238
/**
233239
* @brief Requests a timeslot in the future.
12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)