Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update revision of nrf_802154 #1426

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nrf_802154/common/include/nrf_802154_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ typedef uint8_t nrf_802154_rx_error_t;
#define NRF_802154_RX_ERROR_DELAYED_TIMEOUT 0x08 // !< Delayed reception timeslot ended.
#define NRF_802154_RX_ERROR_INVALID_LENGTH 0x09 // !< Received a frame with invalid length.
#define NRF_802154_RX_ERROR_DELAYED_ABORTED 0x0A // !< Delayed operation in the ongoing state was aborted by other request.
#define NRF_802154_RX_ERROR_NO_BUFFER 0x0B // !< Reception suppressed because there was no free buffer available.

/**
* @brief Possible errors during the energy detection.
Expand Down
2 changes: 2 additions & 0 deletions nrf_802154/doc/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Notable changes

* If a time slot ends while waiting for or receiving an ACK frame, the transmission terminates with the :c:macro:NRF_802154_TX_ERROR_NO_ACK error code.
This behavior allows the higher layer to distinguish between a frame that was not transmitted and a frame that was transmitted but did not receive an ACK frame. (KRKNWK-19126)
* When the nRF 802.15.4 Radio Driver prepares for a reception but no free buffer is left, the :c:func:`nrf_802154_receive_failed` callout is generated with a new error code :c:macro:NRF_802154_RX_ERROR_NO_BUFFER. (KRKNWK-19304)
* The default assignment of the DPPI channels on the nRF54L Series is changed so that the channels 14 and 15 are left unused for other purposes. (KRKNWK-19349)

nRF Connect SDK v2.7.0 - nRF 802.15.4 Radio Driver
**************************************************
Expand Down
40 changes: 6 additions & 34 deletions nrf_802154/driver/src/nrf_802154_aes_ccm_acc_ccm.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,12 @@
*
* Note that with this option set, IEEE 802.15.4 Information Elements injection is not supported.
*/
#define CCM_OUTPTR_POINTS_TO_RADIO_PACKETPTR 0
#define CCM_OUTPTR_POINTS_TO_RADIO_PACKETPTR 0

/** Configures if the CCM's START task is triggered at the same time the START task of the RADIO
* is triggered.
*
* Note that with this option set, multiprotocol with Bluetooth Low Energy is not supported.
*/
#define CCM_START_TASK_TRIGGERED_WITH_RADIO_START 0

#define CCM_ALEN_ATTR_ID 11 ///< Attribute field that identifies the alen CCM job
#define CCM_MLEN_ATTR_ID 12 ///< Attribute field that identifies the mlen CCM job
#define CCM_ADATA_ATTR_ID 13 ///< Attribute field that identifies the adata CCM job
#define CCM_MDATA_ATTR_ID 14 ///< Attribute field that identifies the mdata CCM job
#define CCM_ALEN_ATTR_ID 11 ///< Attribute field that identifies the alen CCM job
#define CCM_MLEN_ATTR_ID 12 ///< Attribute field that identifies the mlen CCM job
#define CCM_ADATA_ATTR_ID 13 ///< Attribute field that identifies the adata CCM job
#define CCM_MDATA_ATTR_ID 14 ///< Attribute field that identifies the mdata CCM job

#include "nrf_802154_aes_ccm.h"

Expand Down Expand Up @@ -114,7 +107,6 @@ static uint32_t m_nonce[4]; ///< Nonce used during the n
static void ccm_disable(void)
{
nrf_802154_irq_disable(nrfx_get_irq_number(NRF_802154_CCM_INSTANCE));
nrf_dppi_channels_disable(DPPIC_CCM, (1 << NRF_802154_DPPI_RADIO_TXREADY));
nrf_ccm_subscribe_clear(NRF_802154_CCM_INSTANCE, NRF_CCM_TASK_START);
nrf_ccm_subscribe_clear(NRF_802154_CCM_INSTANCE, NRF_CCM_TASK_STOP);
nrf_ccm_int_disable(NRF_802154_CCM_INSTANCE, NRF_CCM_INT_ERROR_MASK | NRF_CCM_INT_END_MASK);
Expand Down Expand Up @@ -188,21 +180,6 @@ static void ppi_configure(void)
nrf_ppib_receive_event_get(NRF_802154_DPPI_RADIO_DISABLED),
NRF_802154_DPPI_RADIO_DISABLED);

#if CCM_START_TASK_TRIGGERED_WITH_RADIO_START
nrf_ppib_subscribe_set(PPIB_RAD,
nrf_ppib_send_task_get(NRF_802154_DPPI_RADIO_TXREADY),
NRF_802154_DPPI_RADIO_TXREADY);
nrf_ppib_publish_set(PPIB_CCM,
nrf_ppib_receive_event_get(NRF_802154_DPPI_RADIO_TXREADY),
NRF_802154_DPPI_RADIO_TXREADY);

nrf_ccm_subscribe_set(NRF_802154_CCM_INSTANCE,
NRF_CCM_TASK_START,
NRF_802154_DPPI_RADIO_TXREADY);

dppi_ch_to_enable |= (1 << NRF_802154_DPPI_RADIO_TXREADY);
#endif // CCM_START_TASK_TRIGGERED_WITH_RADIO_START

nrf_ccm_subscribe_set(NRF_802154_CCM_INSTANCE,
NRF_CCM_TASK_STOP,
NRF_802154_DPPI_RADIO_DISABLED);
Expand All @@ -225,10 +202,6 @@ static void ccm_configure(void)
m_initialized = true;
}

#if CCM_START_TASK_TRIGGERED_WITH_RADIO_START
ccm_peripheral_configure();
ppi_configure();
#endif // CCM_START_TASK_TRIGGERED_WITH_RADIO_START
m_setup = true;
}

Expand Down Expand Up @@ -388,12 +361,11 @@ void nrf_802154_aes_ccm_transform_start(uint8_t * p_frame)
{
return;
}
#if !CCM_START_TASK_TRIGGERED_WITH_RADIO_START

ccm_peripheral_configure();
ppi_configure();

nrf_ccm_task_trigger(NRF_802154_CCM_INSTANCE, NRF_CCM_TASK_START);
#endif // !CCM_START_TASK_TRIGGERED_WITH_RADIO_START
}

void nrf_802154_aes_ccm_transform_abort(uint8_t * p_frame)
Expand Down
70 changes: 44 additions & 26 deletions nrf_802154/driver/src/nrf_802154_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include "nrf_802154_procedures_duration.h"
#include "nrf_802154_rssi.h"
#include "nrf_802154_rx_buffer.h"
#include "nrf_802154_sl_atomics.h"
#include "nrf_802154_sl_timer.h"
#include "nrf_802154_sl_utils.h"
#include "nrf_802154_stats.h"
Expand Down Expand Up @@ -118,18 +119,19 @@ static rx_buffer_t * const mp_current_rx_buffer = &nrf_802154_rx_buffers[0];

#endif

static uint8_t * mp_ack; ///< Pointer to Ack frame buffer.
static uint8_t * mp_tx_data; ///< Pointer to the data to transmit.
static uint32_t m_ed_time_left; ///< Remaining time of the current energy detection procedure [us].
static uint8_t m_ed_result; ///< Result of the current energy detection procedure.
static uint8_t m_last_lqi; ///< LQI of the last received non-ACK frame, corrected for the temperature.
static nrf_802154_fal_tx_power_split_t m_tx_power; ///< Power to be used to transmit the current frame split into components.
static uint8_t m_tx_channel; ///< Channel to be used to transmit the current frame.
static int8_t m_last_rssi; ///< RSSI of the last received non-ACK frame, corrected for the temperature.
static uint8_t * mp_ack; ///< Pointer to Ack frame buffer.
static uint8_t * mp_tx_data; ///< Pointer to the data to transmit.
static uint32_t m_ed_time_left; ///< Remaining time of the current energy detection procedure [us].
static uint8_t m_ed_result; ///< Result of the current energy detection procedure.
static uint8_t m_last_lqi; ///< LQI of the last received non-ACK frame, corrected for the temperature.
static nrf_802154_fal_tx_power_split_t m_tx_power; ///< Power to be used to transmit the current frame split into components.
static uint8_t m_tx_channel; ///< Channel to be used to transmit the current frame.
static int8_t m_last_rssi; ///< RSSI of the last received non-ACK frame, corrected for the temperature.
static uint8_t m_no_rx_buffer_notified; ///< Set when NRF_802154_RX_ERROR_NO_BUFFER has been notified.

static nrf_802154_frame_parser_data_t m_current_rx_frame_data; ///< RX frame parser data.
static nrf_802154_frame_parser_data_t m_current_rx_frame_data; ///< RX frame parser data.

static volatile radio_state_t m_state; ///< State of the radio driver.
static volatile radio_state_t m_state; ///< State of the radio driver.

typedef struct
{
Expand Down Expand Up @@ -933,6 +935,34 @@ static nrf_802154_trx_transmit_notifications_t make_trx_frame_transmit_notificat
return result;
}

static void notify_no_rx_buffer(void)
{
uint8_t old_value = 0U;

if (nrf_802154_sl_atomic_cas_u8(&m_no_rx_buffer_notified, &old_value, 1U))
{
receive_failed_notify(NRF_802154_RX_ERROR_NO_BUFFER);
}
}

static void rx_init_free_buffer_find_and_update(bool free_buffer)
{
if (!free_buffer)
{
// If no buffer was available, then find a new one.
rx_buffer_in_use_set(nrf_802154_rx_buffer_free_find());

uint8_t * rx_buffer = rx_buffer_get();

nrf_802154_trx_receive_buffer_set(rx_buffer);

if (NULL == rx_buffer)
{
notify_no_rx_buffer();
}
}
}

/**
* @brief Initializes RX operation
*
Expand Down Expand Up @@ -998,13 +1028,7 @@ static void rx_init(nrf_802154_trx_ramp_up_trigger_mode_t ru_tr_mode, bool * p_a
nrf_802154_timer_coord_timestamp_prepare(nrf_802154_trx_radio_crcok_event_handle_get());
#endif

// Find RX buffer if none available
if (!free_buffer)
{
rx_buffer_in_use_set(nrf_802154_rx_buffer_free_find());

nrf_802154_trx_receive_buffer_set(rx_buffer_get());
}
rx_init_free_buffer_find_and_update(free_buffer);

rx_data_clear();

Expand Down Expand Up @@ -2062,9 +2086,6 @@ void nrf_802154_trx_receive_frame_received(void)
// Current buffer will be passed to the application
mp_current_rx_buffer->free = false;

// Find new buffer
rx_buffer_in_use_set(nrf_802154_rx_buffer_free_find());

switch_to_idle();

received_frame_notify_and_nesting_allow(p_received_data);
Expand Down Expand Up @@ -2210,12 +2231,7 @@ void nrf_802154_trx_transmit_frame_transmitted(void)

nrf_802154_trx_receive_ack();

if (!rx_buffer_free)
{
rx_buffer_in_use_set(nrf_802154_rx_buffer_free_find());

nrf_802154_trx_receive_buffer_set(rx_buffer_get());
}
rx_init_free_buffer_find_and_update(rx_buffer_free);
}
else
{
Expand Down Expand Up @@ -2520,6 +2536,7 @@ void nrf_802154_core_init(void)
m_state = RADIO_STATE_SLEEP;
m_rsch_timeslot_is_granted = false;
m_rx_prestarted_trig_count = 0;
m_no_rx_buffer_notified = 0U;

nrf_802154_sl_timer_init(&m_rx_prestarted_timer);

Expand Down Expand Up @@ -2910,6 +2927,7 @@ bool nrf_802154_core_notify_buffer_free(uint8_t * p_data)
bool in_crit_sect = critical_section_enter_and_verify_timeslot_length();

p_buffer->free = true;
nrf_802154_sl_atomic_store_u8(&m_no_rx_buffer_notified, 0U);

if (in_crit_sect)
{
Expand Down
2 changes: 1 addition & 1 deletion nrf_802154/driver/src/nrf_802154_peripherals_nrf53.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ extern "C" {
* The DPPI channel that RADIO.CCABUSY event publishes to
*/
#ifndef NRF_802154_DPPI_RADIO_CCABUSY
#define NRF_802154_DPPI_RADIO_CCABUSY 14U
#define NRF_802154_DPPI_RADIO_CCABUSY 3U
#endif

/**
Expand Down
15 changes: 1 addition & 14 deletions nrf_802154/driver/src/nrf_802154_peripherals_nrf54h.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,6 @@ extern "C" {
#define NRF_802154_DPPI_RADIO_READY 4U
#endif

/**
* @def NRF_802154_DPPI_RADIO_TXREADY
*
* The DPPI channel that publishes RADIO_TXREADY event.
*
* @note This option is used if @ref NRF_802154_ENCRYPTION_ENABLED is set.
*
*/
#ifndef NRF_802154_DPPI_RADIO_TXREADY
#define NRF_802154_DPPI_RADIO_TXREADY 3U
#endif

/**
* @def NRF_802154_DPPI_RADIO_ADDRESS
*
Expand Down Expand Up @@ -274,7 +262,7 @@ extern "C" {
* The DPPI channel that RADIO.CCABUSY event publishes to
*/
#ifndef NRF_802154_DPPI_RADIO_CCABUSY
#define NRF_802154_DPPI_RADIO_CCABUSY 14U
#define NRF_802154_DPPI_RADIO_CCABUSY 3U
#endif

/**
Expand Down Expand Up @@ -307,7 +295,6 @@ extern "C" {
#define NRF_802154_DPPI_CHANNELS_USED_MASK ( \
(1UL << NRF_802154_DPPI_RADIO_DISABLED) | \
(1UL << NRF_802154_DPPI_RADIO_READY) | \
(1UL << NRF_802154_DPPI_RADIO_TXREADY) | \
(1UL << NRF_802154_DPPI_RADIO_ADDRESS) | \
(1UL << NRF_802154_DPPI_RADIO_END) | \
(1UL << NRF_802154_DPPI_RADIO_PHYEND) | \
Expand Down
21 changes: 4 additions & 17 deletions nrf_802154/driver/src/nrf_802154_peripherals_nrf54l.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,6 @@ extern "C" {
#define NRF_802154_DPPI_RADIO_READY 4U
#endif

/**
* @def NRF_802154_DPPI_RADIO_TXREADY
*
* The DPPI channel that publishes RADIO_TXREADY event.
*
* @note This option is used by the core module regardless of the driver configuration.
*
*/
#ifndef NRF_802154_DPPI_RADIO_TXREADY
#define NRF_802154_DPPI_RADIO_TXREADY 3U
#endif

/**
* @def NRF_802154_DPPI_RADIO_ADDRESS
*
Expand Down Expand Up @@ -232,7 +220,7 @@ extern "C" {
*
*/
#ifndef NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP
#define NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP 10U
#define NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP 23U
#endif

/**
Expand All @@ -245,7 +233,7 @@ extern "C" {
*
*/
#ifndef NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN
#define NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN 10U
#define NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN 23U
#endif

/**
Expand Down Expand Up @@ -274,7 +262,7 @@ extern "C" {
* The DPPI channel that RADIO.CCABUSY event publishes to
*/
#ifndef NRF_802154_DPPI_RADIO_CCABUSY
#define NRF_802154_DPPI_RADIO_CCABUSY 14U
#define NRF_802154_DPPI_RADIO_CCABUSY 3U
#endif

/**
Expand All @@ -283,7 +271,7 @@ extern "C" {
* The DPPI channel that triggers radio.
*/
#ifndef NRF_802154_DPPI_RADIO_HW_TRIGGER
#define NRF_802154_DPPI_RADIO_HW_TRIGGER 15U
#define NRF_802154_DPPI_RADIO_HW_TRIGGER 10U
#endif

/**
Expand All @@ -307,7 +295,6 @@ extern "C" {
#define NRF_802154_DPPI_CHANNELS_USED_MASK ( \
(1UL << NRF_802154_DPPI_RADIO_DISABLED) | \
(1UL << NRF_802154_DPPI_RADIO_READY) | \
(1UL << NRF_802154_DPPI_RADIO_TXREADY) | \
(1UL << NRF_802154_DPPI_RADIO_ADDRESS) | \
(1UL << NRF_802154_DPPI_RADIO_END) | \
(1UL << NRF_802154_DPPI_RADIO_PHYEND) | \
Expand Down
12 changes: 0 additions & 12 deletions nrf_802154/driver/src/nrf_802154_trx_dppi.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,11 @@ void nrf_802154_trx_ppi_for_enable(void)
nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_PHYEND, NRF_802154_DPPI_RADIO_PHYEND);
nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_CCAIDLE, NRF_802154_DPPI_RADIO_CCAIDLE);
nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_CCABUSY, NRF_802154_DPPI_RADIO_CCABUSY);
#if defined(NRF_802154_DPPI_RADIO_TXREADY)
nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_TXREADY, NRF_802154_DPPI_RADIO_TXREADY);
#endif

nrf_dppi_channels_enable(NRF_802154_DPPIC_INSTANCE,
(1UL << NRF_802154_DPPI_RADIO_CCABUSY) |
(1UL << PPI_DISABLED_EGU) |
(1UL << NRF_802154_DPPI_RADIO_READY) |
#if defined(NRF_802154_DPPI_RADIO_TXREADY)
(1UL << NRF_802154_DPPI_RADIO_TXREADY) |
#endif
(1UL << NRF_802154_DPPI_RADIO_ADDRESS) |
(1UL << NRF_802154_DPPI_RADIO_END) |
(1UL << NRF_802154_DPPI_RADIO_PHYEND) |
Expand All @@ -92,18 +86,12 @@ void nrf_802154_trx_ppi_for_disable(void)
(1UL << NRF_802154_DPPI_RADIO_CCABUSY) |
(1UL << PPI_DISABLED_EGU) |
(1UL << NRF_802154_DPPI_RADIO_READY) |
#if defined(NRF_802154_DPPI_RADIO_TXREADY)
(1UL << NRF_802154_DPPI_RADIO_TXREADY) |
#endif
(1UL << NRF_802154_DPPI_RADIO_ADDRESS) |
(1UL << NRF_802154_DPPI_RADIO_END) |
(1UL << NRF_802154_DPPI_RADIO_PHYEND) |
(1UL << NRF_802154_DPPI_RADIO_CCAIDLE) |
(1UL << NRF_802154_DPPI_RADIO_HW_TRIGGER));

#if defined(NRF_802154_DPPI_RADIO_TXREADY)
nrf_radio_publish_clear(NRF_RADIO, NRF_RADIO_EVENT_TXREADY);
#endif
#if NRF_802154_TEST_MODES_ENABLED
nrf_radio_publish_clear(NRF_RADIO, NRF_RADIO_EVENT_CCABUSY);
#endif // NRF_802154_TEST_MODES_ENABLED
Expand Down
Loading