nrf_802154: rev cc772ff0a57506bd728ff3d08d03ee4ef8ffbb9d
This commit updates revision of the nrf_802154 component. Signed-off-by: Andrzej Kuros <andrzej.kuros@nordicsemi.no>
This commit is contained in:
parent
dce8519f7d
commit
daf8752851
|
@ -41,10 +41,6 @@
|
|||
|
||||
#include <nrfx.h>
|
||||
|
||||
#if NRF_802154_USE_INTERNAL_INCLUDES
|
||||
#include "nrf_802154_config_internal.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -508,7 +504,11 @@ extern "C" {
|
|||
* Enables ECB peripheral to be used as hardware accelerator for on-the-fly AES-CCM* encryption.
|
||||
*/
|
||||
#ifndef NRF_802154_ENCRYPTION_ACCELERATOR_ECB
|
||||
#if defined(NRF52_SERIES) || defined(NRF5340_XXAA)
|
||||
#define NRF_802154_ENCRYPTION_ACCELERATOR_ECB 1
|
||||
#elif defined(NRF54H_SERIES) || defined(NRF54L_SERIES)
|
||||
#define NRF_802154_ENCRYPTION_ACCELERATOR_ECB 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,8 +44,10 @@ target_include_directories(nrf-802154-driver
|
|||
target_sources(nrf-802154-driver
|
||||
PRIVATE
|
||||
src/nrf_802154.c
|
||||
src/nrf_802154_aes_ccm_acc_ccm.c
|
||||
src/nrf_802154_aes_ccm_acc_ecb.c
|
||||
src/nrf_802154_bsim_utils.c
|
||||
src/nrf_802154_co.c
|
||||
src/nrf_802154_core.c
|
||||
src/nrf_802154_core_hooks.c
|
||||
src/nrf_802154_critical_section.c
|
||||
|
|
|
@ -74,6 +74,16 @@
|
|||
#elif defined(NRF53_SERIES)
|
||||
#define TX_SETUP_TIME_MAX 360u ///< Maximum time needed to prepare TX procedure [us]. It does not include TX ramp-up time.
|
||||
#define RX_SETUP_TIME_MAX 290u ///< Maximum time needed to prepare RX procedure [us]. It does not include RX ramp-up time.
|
||||
#elif defined(NRF54L_SERIES)
|
||||
#define TX_SETUP_TIME_MAX 600u ///< Maximum time needed to prepare TX procedure [us]. It does not include TX ramp-up time.
|
||||
#define RX_SETUP_TIME_MAX 600u ///< Maximum time needed to prepare RX procedure [us]. It does not include RX ramp-up time.
|
||||
#elif defined(NRF54H_SERIES)
|
||||
#ifndef TX_SETUP_TIME_MAX
|
||||
#define TX_SETUP_TIME_MAX 400u ///< Maximum time needed to prepare TX procedure [us]. It does not include TX ramp-up time.
|
||||
#endif
|
||||
#ifndef RX_SETUP_TIME_MAX
|
||||
#define RX_SETUP_TIME_MAX 400u ///< Maximum time needed to prepare RX procedure [us]. It does not include RX ramp-up time.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -155,7 +155,15 @@ static bool csl_phase_calc(uint32_t * p_csl_phase)
|
|||
if (result)
|
||||
{
|
||||
// Round to the nearest integer when converting us to CSL units
|
||||
*p_csl_phase = (us + (CSL_US_PER_UNIT >> 1)) / CSL_US_PER_UNIT;
|
||||
uint32_t csl_phase = (us + (CSL_US_PER_UNIT >> 1)) / CSL_US_PER_UNIT;
|
||||
|
||||
if (0 == csl_phase)
|
||||
{
|
||||
// If the phase was rounded down to 0, increase it by one period.
|
||||
csl_phase = m_csl_period;
|
||||
}
|
||||
|
||||
*p_csl_phase = csl_phase;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -907,7 +907,7 @@ bool nrf_802154_transmit_csma_ca_raw(uint8_t
|
|||
result = are_frame_properties_valid(&p_metadata->frame_props);
|
||||
if (result)
|
||||
{
|
||||
nrf_802154_request_csma_ca_start(p_data, p_metadata);
|
||||
result = nrf_802154_request_csma_ca_start(p_data, p_metadata);
|
||||
}
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
@ -940,7 +940,7 @@ bool nrf_802154_transmit_csma_ca(const uint8_t *
|
|||
if (result)
|
||||
{
|
||||
tx_buffer_fill(p_data, length);
|
||||
nrf_802154_request_csma_ca_start(m_tx_buffer, p_metadata);
|
||||
result = nrf_802154_request_csma_ca_start(m_tx_buffer, p_metadata);
|
||||
}
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
|
|
@ -0,0 +1,410 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nrf_802154_config.h"
|
||||
|
||||
#if NRF_802154_ENCRYPTION_ENABLED && !NRF_802154_ENCRYPTION_ACCELERATOR_ECB
|
||||
|
||||
/** Configures if the CCM's OUT.PTR pointer points to the same memory location as PACKETPTR register
|
||||
* of the RADIO.
|
||||
*
|
||||
* Note that with this option set, IEEE 802.15.4 Information Elements injection is not supported.
|
||||
*/
|
||||
#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
|
||||
|
||||
#include "nrf_802154_aes_ccm.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "hal/nrf_ccm.h"
|
||||
#include "hal/nrf_dppi.h"
|
||||
#include "hal/nrf_ppib.h"
|
||||
#include "helpers/nrf_vdma.h"
|
||||
|
||||
#include "nrf_802154_assert.h"
|
||||
#include "nrf_802154_const.h"
|
||||
#include "nrf_802154_tx_work_buffer.h"
|
||||
#include "nrf_802154_peripherals.h"
|
||||
#include "nrf_802154_utils_byteorder.h"
|
||||
#include "platform/nrf_802154_irq.h"
|
||||
|
||||
#if defined(NRF54H_SERIES)
|
||||
#include "hal/nrf_spu.h"
|
||||
#define PPIB_RAD NRF_PPIB020
|
||||
#define PPIB_CCM NRF_PPIB030
|
||||
#define DPPIC_CCM NRF_DPPIC030
|
||||
#elif defined(NRF54L_SERIES)
|
||||
#define PPIB_RAD NRF_PPIB10
|
||||
#define PPIB_CCM NRF_PPIB00
|
||||
#define DPPIC_CCM NRF_DPPIC00
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint16_t alen;
|
||||
uint16_t mlen;
|
||||
} in;
|
||||
|
||||
struct
|
||||
{
|
||||
uint16_t alen;
|
||||
uint16_t mlen;
|
||||
} out;
|
||||
} ccm_params_t;
|
||||
|
||||
__ALIGN(8) static nrf_vdma_job_t m_in_job_list[5]; ///< CCM DMA input job list array.
|
||||
__ALIGN(8) static nrf_vdma_job_t m_out_job_list[5]; ///< CCM DMA output job list array.
|
||||
|
||||
static bool m_setup; ///< Was encryption setup
|
||||
static ccm_params_t m_ccm_params; ///< CCM peripheral parameters.
|
||||
static bool m_initialized; ///< Module init status.
|
||||
static nrf_ccm_config_t m_ccm_config; ///< CCM configuration used during the next transmission.
|
||||
static uint32_t m_key[4]; ///< Key used during the next transmission.
|
||||
static uint32_t m_nonce[4]; ///< Nonce used during the next transmission.
|
||||
|
||||
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);
|
||||
nrf_ccm_disable(NRF_802154_CCM_INSTANCE);
|
||||
}
|
||||
|
||||
static void ccm_irq_handler(void)
|
||||
{
|
||||
if (nrf_ccm_int_enable_check(NRF_802154_CCM_INSTANCE, NRF_CCM_INT_ERROR_MASK) &&
|
||||
nrf_ccm_event_check(NRF_802154_CCM_INSTANCE, NRF_CCM_EVENT_ERROR))
|
||||
{
|
||||
nrf_ccm_event_clear(NRF_802154_CCM_INSTANCE, NRF_CCM_EVENT_ERROR);
|
||||
NRF_802154_ASSERT(false);
|
||||
}
|
||||
|
||||
if (nrf_ccm_int_enable_check(NRF_802154_CCM_INSTANCE, NRF_CCM_INT_END_MASK) &&
|
||||
nrf_ccm_event_check(NRF_802154_CCM_INSTANCE, NRF_CCM_EVENT_END))
|
||||
{
|
||||
nrf_ccm_event_clear(NRF_802154_CCM_INSTANCE, NRF_CCM_EVENT_END);
|
||||
nrf_802154_tx_work_buffer_is_secured_set();
|
||||
ccm_disable();
|
||||
}
|
||||
}
|
||||
|
||||
static void u8_string_to_u32x4_big_endian(const uint8_t * p_input,
|
||||
uint8_t input_len,
|
||||
uint32_t * p_output)
|
||||
{
|
||||
const uint8_t unaligned = input_len % sizeof(uint32_t);
|
||||
const uint8_t len = unaligned > 0 ? unaligned : sizeof(uint32_t);
|
||||
const uint8_t shift = (sizeof(uint32_t) - len) * 8;
|
||||
uint32_t data = big_32_to_host((uint8_t *)p_input);
|
||||
|
||||
p_input += len;
|
||||
data >>= shift;
|
||||
p_output[3] = data;
|
||||
|
||||
for (int i = 2; i >= 0; i--)
|
||||
{
|
||||
data = big_32_to_host((uint8_t *)p_input);
|
||||
p_input += sizeof(uint32_t);
|
||||
p_output[i] = data;
|
||||
}
|
||||
}
|
||||
|
||||
static void ccm_peripheral_configure(void)
|
||||
{
|
||||
nrf_802154_irq_clear_pending(nrfx_get_irq_number(NRF_802154_CCM_INSTANCE));
|
||||
nrf_802154_irq_enable(nrfx_get_irq_number(NRF_802154_CCM_INSTANCE));
|
||||
|
||||
nrf_ccm_enable(NRF_802154_CCM_INSTANCE);
|
||||
nrf_ccm_configure(NRF_802154_CCM_INSTANCE, &m_ccm_config);
|
||||
nrf_ccm_key_set(NRF_802154_CCM_INSTANCE, m_key);
|
||||
nrf_ccm_nonce_set(NRF_802154_CCM_INSTANCE, m_nonce);
|
||||
nrf_ccm_in_ptr_set(NRF_802154_CCM_INSTANCE, m_in_job_list);
|
||||
nrf_ccm_out_ptr_set(NRF_802154_CCM_INSTANCE, m_out_job_list);
|
||||
nrf_ccm_event_clear(NRF_802154_CCM_INSTANCE, NRF_CCM_EVENT_ERROR);
|
||||
nrf_ccm_event_clear(NRF_802154_CCM_INSTANCE, NRF_CCM_EVENT_END);
|
||||
nrf_ccm_int_enable(NRF_802154_CCM_INSTANCE, NRF_CCM_INT_ERROR_MASK | NRF_CCM_INT_END_MASK);
|
||||
nrf_ccm_adatamask_set(NRF_802154_CCM_INSTANCE, 0xff);
|
||||
}
|
||||
|
||||
static void ppi_configure(void)
|
||||
{
|
||||
uint32_t dppi_ch_to_enable = (1 << NRF_802154_DPPI_RADIO_DISABLED);
|
||||
|
||||
nrf_ppib_subscribe_set(PPIB_RAD,
|
||||
nrf_ppib_send_task_get(NRF_802154_DPPI_RADIO_DISABLED),
|
||||
NRF_802154_DPPI_RADIO_DISABLED);
|
||||
nrf_ppib_publish_set(PPIB_CCM,
|
||||
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);
|
||||
|
||||
nrf_dppi_channels_enable(DPPIC_CCM, dppi_ch_to_enable);
|
||||
}
|
||||
|
||||
static void ccm_configure(void)
|
||||
{
|
||||
if (!m_initialized)
|
||||
{
|
||||
// DMASEC is set to non-secure by default, which prevents the CCM from accessing
|
||||
// secure memory. Change the DMASEC to secure.
|
||||
#if defined(NRF54H_SERIES)
|
||||
nrf_spu_periph_perm_dmasec_set(NRF_SPU030, 10, true);
|
||||
#endif
|
||||
nrf_802154_irq_init(nrfx_get_irq_number(NRF_802154_CCM_INSTANCE),
|
||||
NRF_802154_ECB_PRIORITY,
|
||||
ccm_irq_handler);
|
||||
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;
|
||||
}
|
||||
|
||||
static void vdma_jobs_fill(const nrf_802154_aes_ccm_data_t * p_aes_ccm_data,
|
||||
uint8_t * p_adata,
|
||||
uint8_t * p_mdata,
|
||||
uint8_t macsize)
|
||||
{
|
||||
// CCM peripheral job list integer params pointed by p_job_ptr must have big-endian byte order.
|
||||
host_16_to_little(p_aes_ccm_data->auth_data_len, (uint8_t *)&m_ccm_params.in.alen);
|
||||
host_16_to_little(p_aes_ccm_data->plain_text_data_len, (uint8_t *)&m_ccm_params.in.mlen);
|
||||
|
||||
nrf_vdma_job_fill(&m_in_job_list[0],
|
||||
&m_ccm_params.in.alen,
|
||||
sizeof(m_ccm_params.in.alen),
|
||||
CCM_ALEN_ATTR_ID);
|
||||
nrf_vdma_job_fill(&m_in_job_list[1],
|
||||
&m_ccm_params.in.mlen,
|
||||
sizeof(m_ccm_params.in.mlen),
|
||||
CCM_MLEN_ATTR_ID);
|
||||
nrf_vdma_job_fill(&m_in_job_list[2],
|
||||
p_aes_ccm_data->auth_data,
|
||||
p_aes_ccm_data->auth_data_len,
|
||||
CCM_ADATA_ATTR_ID);
|
||||
nrf_vdma_job_fill(&m_in_job_list[3],
|
||||
p_aes_ccm_data->plain_text_data,
|
||||
p_aes_ccm_data->plain_text_data_len,
|
||||
CCM_MDATA_ATTR_ID);
|
||||
nrf_vdma_job_terminate(&m_in_job_list[4]);
|
||||
|
||||
nrf_vdma_job_fill(&m_out_job_list[0],
|
||||
&m_ccm_params.out.alen,
|
||||
sizeof(m_ccm_params.out.alen),
|
||||
CCM_ALEN_ATTR_ID);
|
||||
nrf_vdma_job_fill(&m_out_job_list[1],
|
||||
&m_ccm_params.out.mlen,
|
||||
sizeof(m_ccm_params.out.mlen),
|
||||
CCM_MLEN_ATTR_ID);
|
||||
nrf_vdma_job_fill(&m_out_job_list[2],
|
||||
p_adata,
|
||||
p_aes_ccm_data->auth_data_len,
|
||||
CCM_ADATA_ATTR_ID);
|
||||
nrf_vdma_job_fill(&m_out_job_list[3],
|
||||
p_mdata,
|
||||
p_aes_ccm_data->plain_text_data_len + macsize,
|
||||
CCM_MDATA_ATTR_ID);
|
||||
nrf_vdma_job_terminate(&m_out_job_list[4]);
|
||||
}
|
||||
|
||||
static bool ccm_data_fill(const nrf_802154_aes_ccm_data_t * p_aes_ccm_data,
|
||||
uint8_t * p_adata,
|
||||
uint8_t * p_mdata)
|
||||
{
|
||||
nrf_ccm_maclen_t maclen;
|
||||
uint8_t macsize;
|
||||
|
||||
switch (p_aes_ccm_data->mic_level)
|
||||
{
|
||||
case SECURITY_LEVEL_MIC_32:
|
||||
case SECURITY_LEVEL_ENC_MIC_32:
|
||||
maclen = NRF_CCM_MODE_MACLEN_M4;
|
||||
macsize = 4;
|
||||
break;
|
||||
|
||||
case SECURITY_LEVEL_MIC_64:
|
||||
case SECURITY_LEVEL_ENC_MIC_64:
|
||||
maclen = NRF_CCM_MODE_MACLEN_M8;
|
||||
macsize = 8;
|
||||
break;
|
||||
|
||||
case SECURITY_LEVEL_MIC_128:
|
||||
case SECURITY_LEVEL_ENC_MIC_128:
|
||||
maclen = NRF_CCM_MODE_MACLEN_M16;
|
||||
macsize = 16;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
m_ccm_config.mode = NRF_CCM_MODE_ENCRYPTION;
|
||||
m_ccm_config.datarate = NRF_CCM_DATARATE_250K;
|
||||
m_ccm_config.protocol = NRF_CCM_MODE_PROTOCOL_IEEE802154;
|
||||
m_ccm_config.mac_length = maclen;
|
||||
|
||||
u8_string_to_u32x4_big_endian(p_aes_ccm_data->key, sizeof(p_aes_ccm_data->key), m_key);
|
||||
u8_string_to_u32x4_big_endian(p_aes_ccm_data->nonce, sizeof(p_aes_ccm_data->nonce), m_nonce);
|
||||
|
||||
vdma_jobs_fill(p_aes_ccm_data, p_adata, p_mdata, macsize);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool nrf_802154_aes_ccm_transform_prepare(const nrf_802154_aes_ccm_data_t * p_aes_ccm_data)
|
||||
{
|
||||
uint8_t * p_work_buffer;
|
||||
uint8_t * p_ciphertext;
|
||||
|
||||
m_setup = false;
|
||||
|
||||
// Verify that all necessary data is available
|
||||
if (p_aes_ccm_data->raw_frame == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify that the optional data, if exists, is complete
|
||||
if (((p_aes_ccm_data->auth_data_len != 0) && (p_aes_ccm_data->auth_data == NULL)) ||
|
||||
((p_aes_ccm_data->plain_text_data_len != 0) && (p_aes_ccm_data->plain_text_data == NULL)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify that the MIC level is valid
|
||||
if (p_aes_ccm_data->mic_level > SECURITY_LEVEL_MIC_LEVEL_MASK)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ptrdiff_t offset;
|
||||
|
||||
if (p_aes_ccm_data->auth_data)
|
||||
{
|
||||
offset = p_aes_ccm_data->auth_data_len + PHR_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = p_aes_ccm_data->raw_frame[PHR_OFFSET] + PHR_SIZE;
|
||||
}
|
||||
|
||||
NRF_802154_ASSERT((offset >= 0) && (offset <= MAX_PACKET_SIZE + PHR_SIZE));
|
||||
|
||||
nrf_802154_tx_work_buffer_plain_text_offset_set(offset);
|
||||
p_work_buffer = nrf_802154_tx_work_buffer_enable_for(p_aes_ccm_data->raw_frame);
|
||||
p_ciphertext = p_work_buffer + offset;
|
||||
|
||||
#if CCM_OUTPTR_POINTS_TO_RADIO_PACKETPTR
|
||||
memcpy(p_work_buffer, p_aes_ccm_data->raw_frame, PHR_SIZE);
|
||||
memset(&p_work_buffer[PSDU_OFFSET], 0, p_aes_ccm_data->raw_frame[PHR_OFFSET]);
|
||||
#else
|
||||
memcpy(p_work_buffer, p_aes_ccm_data->raw_frame, offset);
|
||||
memset(p_ciphertext, 0, p_aes_ccm_data->raw_frame[PHR_OFFSET] + PHR_SIZE - offset);
|
||||
#endif // CCM_OUTPTR_POINTS_TO_RADIO_PACKETPTR
|
||||
|
||||
if (ccm_data_fill(p_aes_ccm_data, p_work_buffer + PHR_SIZE, p_ciphertext))
|
||||
{
|
||||
ccm_configure();
|
||||
m_setup = true;
|
||||
}
|
||||
|
||||
return m_setup;
|
||||
}
|
||||
|
||||
void nrf_802154_aes_ccm_transform_start(uint8_t * p_frame)
|
||||
{
|
||||
if (m_setup == false)
|
||||
{
|
||||
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)
|
||||
{
|
||||
ccm_disable();
|
||||
m_setup = false;
|
||||
memset(m_key, 0, sizeof(m_key));
|
||||
memset(m_nonce, 0, sizeof(m_nonce));
|
||||
}
|
||||
|
||||
void nrf_802154_aes_ccm_transform_reset(void)
|
||||
{
|
||||
m_setup = false;
|
||||
memset(m_key, 0, sizeof(m_key));
|
||||
memset(m_nonce, 0, sizeof(m_nonce));
|
||||
}
|
||||
|
||||
#endif // NRF_802154_ENCRYPTION_ENABLED && !NRF_802154_ENCRYPTION_ACCELERATOR_ECB
|
|
@ -0,0 +1,159 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements final exit point for calling callouts provided by an application.
|
||||
* It is intended to be the only place where callouts provided by the application
|
||||
* are called.
|
||||
*/
|
||||
|
||||
#define NRF_802154_MODULE_ID NRF_802154_DRV_MODULE_ID_CO
|
||||
|
||||
#include "nrf_802154_co.h"
|
||||
#include "nrf_802154_debug.h"
|
||||
|
||||
void nrf_802154_co_cca_done(bool channel_free)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_cca_done(channel_free);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
void nrf_802154_co_cca_failed(nrf_802154_cca_error_t error)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_cca_failed(error);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
void nrf_802154_co_energy_detected(const nrf_802154_energy_detected_t * p_result)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_energy_detected(p_result);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
void nrf_802154_co_energy_detection_failed(nrf_802154_ed_error_t error)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_energy_detection_failed(error);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
void nrf_802154_co_tx_ack_started(const uint8_t * p_data)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_tx_ack_started(p_data);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
#if NRF_802154_USE_RAW_API || defined(DOXYGEN)
|
||||
|
||||
#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN)
|
||||
|
||||
void nrf_802154_co_received_raw(uint8_t * p_data, int8_t power, uint8_t lqi)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_received_raw(p_data, power, lqi);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
#endif // !NRF_802154_SERIALIZATION_HOST
|
||||
|
||||
#endif // NRF_802154_USE_RAW_API
|
||||
|
||||
#if !NRF_802154_USE_RAW_API || defined(DOXYGEN)
|
||||
#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN)
|
||||
|
||||
void nrf_802154_co_received(uint8_t * p_data, uint8_t length, int8_t power, uint8_t lqi)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_received(p_data, length, power, lqi);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
#endif // !NRF_802154_SERIALIZATION_HOST
|
||||
#endif // !NRF_802154_USE_RAW_API
|
||||
|
||||
void nrf_802154_co_receive_failed(nrf_802154_rx_error_t error, uint32_t id)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_receive_failed(error, id);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
#if NRF_802154_USE_RAW_API || defined(DOXYGEN)
|
||||
|
||||
void nrf_802154_co_transmitted_raw(uint8_t * p_frame,
|
||||
const nrf_802154_transmit_done_metadata_t * p_metadata)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_transmitted_raw(p_frame, p_metadata);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
#endif // NRF_802154_USE_RAW_API
|
||||
|
||||
#if !NRF_802154_USE_RAW_API || defined(DOXYGEN)
|
||||
|
||||
void nrf_802154_co_transmitted(uint8_t * p_frame,
|
||||
const nrf_802154_transmit_done_metadata_t * p_metadata)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_transmitted(p_frame, p_metadata);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
#endif // !NRF_802154_USE_RAW_API
|
||||
|
||||
void nrf_802154_co_transmit_failed(uint8_t * p_frame,
|
||||
nrf_802154_tx_error_t error,
|
||||
const nrf_802154_transmit_done_metadata_t * p_metadata)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_transmit_failed(p_frame, error, p_metadata);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN)
|
||||
|
||||
void nrf_802154_co_tx_started(const uint8_t * p_frame)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
nrf_802154_tx_started(p_frame);
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
#endif // !NRF_802154_SERIALIZATION_HOST
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file defines an interface for final exit points for calling callouts of an application.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nrf_802154_callouts.h"
|
||||
#include "nrf_802154_types.h"
|
||||
|
||||
/** @brief Calls @ref nrf_802154_cca_done.
|
||||
* @note See @ref nrf_802154_cca_done for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_cca_done(bool channel_free);
|
||||
|
||||
/** @brief Calls @ref nrf_802154_cca_failed.
|
||||
* @note See @ref nrf_802154_cca_failed for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_cca_failed(nrf_802154_cca_error_t error);
|
||||
|
||||
/** @brief Calls @ref nrf_802154_energy_detected.
|
||||
* @note See @ref nrf_802154_energy_detected for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_energy_detected(const nrf_802154_energy_detected_t * p_result);
|
||||
|
||||
/** @brief Calls @ref nrf_802154_energy_detection_failed.
|
||||
* @note See @ref nrf_802154_energy_detection_failed for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_energy_detection_failed(nrf_802154_ed_error_t error);
|
||||
|
||||
/** @brief Calls @ref nrf_802154_tx_ack_started.
|
||||
* @note See @ref nrf_802154_tx_ack_started for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_tx_ack_started(const uint8_t * p_data);
|
||||
|
||||
#if NRF_802154_USE_RAW_API || defined(DOXYGEN)
|
||||
#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN)
|
||||
|
||||
/** @brief Calls @ref nrf_802154_received_raw.
|
||||
* @note See @ref nrf_802154_received_raw for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_received_raw(uint8_t * p_data, int8_t power, uint8_t lqi);
|
||||
|
||||
#endif // !NRF_802154_SERIALIZATION_HOST
|
||||
#endif // NRF_802154_USE_RAW_API
|
||||
|
||||
#if !NRF_802154_USE_RAW_API || defined(DOXYGEN)
|
||||
#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN)
|
||||
|
||||
/** @brief Calls @ref nrf_802154_received.
|
||||
* @note See @ref nrf_802154_received for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_received(uint8_t * p_data, uint8_t length, int8_t power, uint8_t lqi);
|
||||
|
||||
#endif // !NRF_802154_SERIALIZATION_HOST
|
||||
#endif // !NRF_802154_USE_RAW_API
|
||||
|
||||
/** @brief Calls @ref nrf_802154_receive_failed.
|
||||
* @note See @ref nrf_802154_receive_failed for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_receive_failed(nrf_802154_rx_error_t error, uint32_t id);
|
||||
|
||||
#if NRF_802154_USE_RAW_API || defined(DOXYGEN)
|
||||
|
||||
/** @brief Calls @ref nrf_802154_transmitted_raw.
|
||||
* @note See @ref nrf_802154_transmitted_raw for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_transmitted_raw(uint8_t * p_frame,
|
||||
const nrf_802154_transmit_done_metadata_t * p_metadata);
|
||||
|
||||
#endif // NRF_802154_USE_RAW_API
|
||||
|
||||
#if !NRF_802154_USE_RAW_API || defined(DOXYGEN)
|
||||
|
||||
/** @brief Calls @ref nrf_802154_transmitted.
|
||||
* @note See @ref nrf_802154_transmitted for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_transmitted(uint8_t * p_frame,
|
||||
const nrf_802154_transmit_done_metadata_t * p_metadata);
|
||||
|
||||
#endif // !NRF_802154_USE_RAW_API
|
||||
|
||||
/** @brief Calls @ref nrf_802154_transmit_failed.
|
||||
* @note See @ref nrf_802154_transmit_failed for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_transmit_failed(uint8_t * p_frame,
|
||||
nrf_802154_tx_error_t error,
|
||||
const nrf_802154_transmit_done_metadata_t * p_metadata);
|
||||
|
||||
#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN)
|
||||
|
||||
/** @brief Calls @ref nrf_802154_tx_started.
|
||||
* @note See @ref nrf_802154_tx_started for documentation of parameters.
|
||||
*/
|
||||
void nrf_802154_co_tx_started(const uint8_t * p_frame);
|
||||
|
||||
#endif // !NRF_802154_SERIALIZATION_HOST
|
|
@ -62,7 +62,8 @@ typedef enum
|
|||
NRF_802154_DRV_MODULE_ID_DELAYED_TRX = 6U,
|
||||
NRF_802154_DRV_MODULE_ID_ACK_TIMEOUT = 7U,
|
||||
NRF_802154_DRV_MODULE_ID_TRX_PPI = 8U,
|
||||
NRF_802154_DRV_MODULE_ID_NOTIFICATION = 9U
|
||||
NRF_802154_DRV_MODULE_ID_NOTIFICATION = 9U,
|
||||
NRF_802154_DRV_MODULE_ID_CO = 10U
|
||||
} nrf_802154_drv_modules_list_t;
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "nrf_802154.h"
|
||||
#include "nrf_802154_co.h"
|
||||
#include "nrf_802154_critical_section.h"
|
||||
#include "nrf_802154_debug.h"
|
||||
#include "nrf_802154_tx_work_buffer.h"
|
||||
|
@ -64,9 +65,9 @@ void nrf_802154_notify_received(uint8_t * p_data, int8_t power, uint8_t lqi)
|
|||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
||||
#if NRF_802154_USE_RAW_API
|
||||
nrf_802154_received_raw(p_data, power, lqi);
|
||||
nrf_802154_co_received_raw(p_data, power, lqi);
|
||||
#else // NRF_802154_USE_RAW_API
|
||||
nrf_802154_received(p_data + RAW_PAYLOAD_OFFSET, p_data[RAW_LENGTH_OFFSET], power, lqi);
|
||||
nrf_802154_co_received(p_data + RAW_PAYLOAD_OFFSET, p_data[RAW_LENGTH_OFFSET], power, lqi);
|
||||
#endif // NRF_802154_USE_RAW_API
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
@ -78,7 +79,7 @@ bool nrf_802154_notify_receive_failed(nrf_802154_rx_error_t error, uint32_t id,
|
|||
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
||||
nrf_802154_receive_failed(error, id);
|
||||
nrf_802154_co_receive_failed(error, id);
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
||||
|
@ -95,7 +96,7 @@ void nrf_802154_notify_transmitted(uint8_t * p_frame
|
|||
&p_metadata->frame_props);
|
||||
// Notify
|
||||
#if NRF_802154_USE_RAW_API
|
||||
nrf_802154_transmitted_raw(p_frame, p_metadata);
|
||||
nrf_802154_co_transmitted_raw(p_frame, p_metadata);
|
||||
#else // NRF_802154_USE_RAW_API
|
||||
if (p_metadata->data.transmitted.p_ack != NULL)
|
||||
{
|
||||
|
@ -117,9 +118,9 @@ void nrf_802154_notify_transmit_failed(uint8_t
|
|||
|
||||
// Notify
|
||||
#if NRF_802154_USE_RAW_API
|
||||
nrf_802154_transmit_failed(p_frame, error, p_metadata);
|
||||
nrf_802154_co_transmit_failed(p_frame, error, p_metadata);
|
||||
#else // NRF_802154_USE_RAW_API
|
||||
nrf_802154_transmit_failed(p_frame + RAW_PAYLOAD_OFFSET, error, p_metadata);
|
||||
nrf_802154_co_transmit_failed(p_frame + RAW_PAYLOAD_OFFSET, error, p_metadata);
|
||||
#endif // NRF_802154_USE_RAW_API
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
@ -129,7 +130,7 @@ void nrf_802154_notify_energy_detected(const nrf_802154_energy_detected_t * p_re
|
|||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
||||
nrf_802154_energy_detected(p_result);
|
||||
nrf_802154_co_energy_detected(p_result);
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
@ -138,7 +139,7 @@ void nrf_802154_notify_energy_detection_failed(nrf_802154_ed_error_t error)
|
|||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
||||
nrf_802154_energy_detection_failed(error);
|
||||
nrf_802154_co_energy_detection_failed(error);
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
@ -147,7 +148,7 @@ void nrf_802154_notify_cca(bool is_free)
|
|||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
||||
nrf_802154_cca_done(is_free);
|
||||
nrf_802154_co_cca_done(is_free);
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
@ -156,7 +157,7 @@ void nrf_802154_notify_cca_failed(nrf_802154_cca_error_t error)
|
|||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
||||
nrf_802154_cca_failed(error);
|
||||
nrf_802154_co_cca_failed(error);
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "nrf_802154.h"
|
||||
#include "nrf_802154_co.h"
|
||||
#include "nrf_802154_config.h"
|
||||
#include "nrf_802154_debug.h"
|
||||
#include "nrf_802154_queue.h"
|
||||
|
@ -705,27 +706,27 @@ static void irq_handler_ntf_event(void)
|
|||
{
|
||||
case NTF_TYPE_RECEIVED:
|
||||
#if NRF_802154_USE_RAW_API
|
||||
nrf_802154_received_raw(p_slot->data.received.p_data,
|
||||
p_slot->data.received.power,
|
||||
p_slot->data.received.lqi);
|
||||
nrf_802154_co_received_raw(p_slot->data.received.p_data,
|
||||
p_slot->data.received.power,
|
||||
p_slot->data.received.lqi);
|
||||
#else // NRF_802154_USE_RAW_API
|
||||
nrf_802154_received(p_slot->data.received.p_data + RAW_PAYLOAD_OFFSET,
|
||||
p_slot->data.received.p_data[RAW_LENGTH_OFFSET],
|
||||
p_slot->data.received.power,
|
||||
p_slot->data.received.lqi);
|
||||
nrf_802154_co_received(p_slot->data.received.p_data + RAW_PAYLOAD_OFFSET,
|
||||
p_slot->data.received.p_data[RAW_LENGTH_OFFSET],
|
||||
p_slot->data.received.power,
|
||||
p_slot->data.received.lqi);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case NTF_TYPE_RECEIVE_FAILED:
|
||||
nrf_802154_receive_failed(p_slot->data.receive_failed.error,
|
||||
p_slot->data.receive_failed.id);
|
||||
nrf_802154_co_receive_failed(p_slot->data.receive_failed.error,
|
||||
p_slot->data.receive_failed.id);
|
||||
break;
|
||||
|
||||
case NTF_TYPE_TRANSMITTED:
|
||||
{
|
||||
#if NRF_802154_USE_RAW_API
|
||||
nrf_802154_transmitted_raw(p_slot->data.transmitted.p_frame,
|
||||
&p_slot->data.transmitted.metadata);
|
||||
nrf_802154_co_transmitted_raw(p_slot->data.transmitted.p_frame,
|
||||
&p_slot->data.transmitted.metadata);
|
||||
#else // NRF_802154_USE_RAW_API
|
||||
if (p_slot->data.transmitted.metadata.data.transmitted.p_ack != NULL)
|
||||
{
|
||||
|
@ -733,19 +734,19 @@ static void irq_handler_ntf_event(void)
|
|||
p_slot->data.transmitted.metadata.data.transmitted.p_ack[RAW_LENGTH_OFFSET];
|
||||
p_slot->data.transmitted.metadata.data.transmitted.p_ack += RAW_PAYLOAD_OFFSET;
|
||||
}
|
||||
nrf_802154_transmitted(p_slot->data.transmitted.p_frame + RAW_PAYLOAD_OFFSET,
|
||||
&p_slot->data.transmitted.metadata);
|
||||
nrf_802154_co_transmitted(p_slot->data.transmitted.p_frame + RAW_PAYLOAD_OFFSET,
|
||||
&p_slot->data.transmitted.metadata);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case NTF_TYPE_TRANSMIT_FAILED:
|
||||
#if NRF_802154_USE_RAW_API
|
||||
nrf_802154_transmit_failed(p_slot->data.transmit_failed.p_frame,
|
||||
p_slot->data.transmit_failed.error,
|
||||
&p_slot->data.transmit_failed.metadata);
|
||||
nrf_802154_co_transmit_failed(p_slot->data.transmit_failed.p_frame,
|
||||
p_slot->data.transmit_failed.error,
|
||||
&p_slot->data.transmit_failed.metadata);
|
||||
#else // NRF_802154_USE_RAW_API
|
||||
nrf_802154_transmit_failed(
|
||||
nrf_802154_co_transmit_failed(
|
||||
p_slot->data.transmit_failed.p_frame + RAW_PAYLOAD_OFFSET,
|
||||
p_slot->data.transmit_failed.error,
|
||||
&p_slot->data.transmit_failed.metadata);
|
||||
|
@ -753,20 +754,20 @@ static void irq_handler_ntf_event(void)
|
|||
break;
|
||||
|
||||
case NTF_TYPE_ENERGY_DETECTED:
|
||||
nrf_802154_energy_detected(&p_slot->data.energy_detected.result);
|
||||
nrf_802154_co_energy_detected(&p_slot->data.energy_detected.result);
|
||||
break;
|
||||
|
||||
case NTF_TYPE_ENERGY_DETECTION_FAILED:
|
||||
nrf_802154_energy_detection_failed(
|
||||
nrf_802154_co_energy_detection_failed(
|
||||
p_slot->data.energy_detection_failed.error);
|
||||
break;
|
||||
|
||||
case NTF_TYPE_CCA:
|
||||
nrf_802154_cca_done(p_slot->data.cca.result);
|
||||
nrf_802154_co_cca_done(p_slot->data.cca.result);
|
||||
break;
|
||||
|
||||
case NTF_TYPE_CCA_FAILED:
|
||||
nrf_802154_cca_failed(p_slot->data.cca_failed.error);
|
||||
nrf_802154_co_cca_failed(p_slot->data.cca_failed.error);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -49,6 +49,10 @@
|
|||
#include "nrf_802154_peripherals_nrf52.h"
|
||||
#elif defined(NRF5340_XXAA)
|
||||
#include "nrf_802154_peripherals_nrf53.h"
|
||||
#elif defined(NRF54L_SERIES)
|
||||
#include "nrf_802154_peripherals_nrf54l.h"
|
||||
#elif defined(NRF54H_SERIES)
|
||||
#include "nrf_802154_peripherals_nrf54h.h"
|
||||
#endif
|
||||
|
||||
#ifdef NRF_802154_USE_INTERNAL_INCLUDES
|
||||
|
|
|
@ -0,0 +1,344 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Module that defines the 802.15.4 driver peripheral usage for nRF54H family.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NRF_802154_PERIPHERALS_NRF54H_H__
|
||||
#define NRF_802154_PERIPHERALS_NRF54H_H__
|
||||
|
||||
#include <nrfx.h>
|
||||
#include "nrf_802154_config.h"
|
||||
#include "nrf_802154_sl_periphs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_INSTANCE_NO
|
||||
*
|
||||
* Id of the EGU instance used by the driver to synchronize DPPIs and for requests and
|
||||
* notifications if SWI is in use.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_EGU_INSTANCE_NO
|
||||
#define NRF_802154_EGU_INSTANCE_NO 020
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_INSTANCE
|
||||
*
|
||||
* The EGU instance used by the driver to synchronize PPIs and for requests and notifications if
|
||||
* SWI is in use.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_EGU_INSTANCE NRFX_CONCAT_2(NRF_EGU, NRF_802154_EGU_INSTANCE_NO)
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_IRQ_HANDLER
|
||||
*
|
||||
* The EGU IRQ handler used by the driver for requests and notifications if SWI is in use.
|
||||
*
|
||||
* @note This option is used when the driver uses SWI to process requests and notifications.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_EGU_IRQ_HANDLER \
|
||||
NRFX_CONCAT_3(EGU, NRF_802154_EGU_INSTANCE_NO, _IRQHandler)
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_RAMP_UP_EVENT
|
||||
*
|
||||
* The EGU event used by the driver to trigger radio ramp-up.
|
||||
*/
|
||||
#define NRF_802154_EGU_RAMP_UP_EVENT NRF_EGU_EVENT_TRIGGERED15
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_RAMP_UP_TASK
|
||||
*
|
||||
* The EGU task used by the driver to trigger radio ramp-up.
|
||||
*/
|
||||
#define NRF_802154_EGU_RAMP_UP_TASK NRF_EGU_TASK_TRIGGER15
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_USED_MASK
|
||||
*
|
||||
* Bit mask of instances of SWI/EGU peripherals used by the 802.15.4 driver.
|
||||
*/
|
||||
#ifndef NRF_802154_EGU_USED_MASK
|
||||
#define NRF_802154_EGU_USED_MASK (1 << NRF_802154_EGU_INSTANCE_NO)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_CCM_INSTANCE_NO
|
||||
*
|
||||
* Id of the CCM instance used by the driver to encrypt outgoing frames.
|
||||
*
|
||||
* @note This option is used when @ref NRF_802154_ENCRYPTION_ENABLED is set.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_CCM_INSTANCE_NO 030
|
||||
|
||||
/**
|
||||
* @def NRF_802154_CCM_INSTANCE
|
||||
*
|
||||
* The CCM instance used by the driver to encrypt outgoing frames.
|
||||
*
|
||||
* @note This option is used when @ref NRF_802154_ENCRYPTION_ENABLED is set.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_CCM_INSTANCE NRFX_CONCAT_2(NRF_CCM, NRF_802154_CCM_INSTANCE_NO)
|
||||
|
||||
/**
|
||||
* @def NRF_802154_RTC_INSTANCE_NO
|
||||
*
|
||||
* Number of the RTC instance used in the standalone timer driver implementation.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_RTC_INSTANCE_NO
|
||||
#define NRF_802154_RTC_INSTANCE_NO 2
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPIC_INSTANCE_NO
|
||||
*
|
||||
* Id of the DPPIC instance used by the driver to connect peripherals to radio.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_DPPIC_INSTANCE_NO 020
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPIC_INSTANCE
|
||||
*
|
||||
* The DPPIC instance used by the driver to connect peripherals to radio.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_DPPIC_INSTANCE NRFX_CONCAT_2(NRF_DPPIC, NRF_802154_DPPIC_INSTANCE_NO)
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_DISABLED
|
||||
*
|
||||
* The DPPI channel that publishes RADIO_DISABLED event.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_DISABLED
|
||||
#define NRF_802154_DPPI_RADIO_DISABLED 7U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_READY
|
||||
*
|
||||
* The DPPI channel that publishes RADIO_READY event.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_READY
|
||||
#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
|
||||
*
|
||||
* The DPPI channel that publishes RADIO_ADDRESS event.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_ADDRESS
|
||||
#define NRF_802154_DPPI_RADIO_ADDRESS 5U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_END
|
||||
*
|
||||
* The DPPI channel that publishes RADIO_END event.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_END
|
||||
#define NRF_802154_DPPI_RADIO_END 6U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_PHYEND
|
||||
*
|
||||
* The DPPI channel that publishes RADIO_PHYEND event.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_PHYEND
|
||||
#define NRF_802154_DPPI_RADIO_PHYEND 12U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP
|
||||
*
|
||||
* The DPPI channel that connects EGU event to RADIO_TXEN or RADIO_RXEN task.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
* The peripheral is shared with @ref NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP
|
||||
#define NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP 10U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN
|
||||
*
|
||||
* The DPPI channel that connects TIMER_COMPARE event to RADIO_TXEN task.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
* The peripheral is shared with @ref NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN
|
||||
#define NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN 10U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC
|
||||
*
|
||||
* The DPPI channel that connects RADIO_SYNC event to EGU_SYNC task.
|
||||
* EGU_SYNC task belongs to one of EGU channels
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC
|
||||
#define NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC 8U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_CCAIDLE
|
||||
*
|
||||
* The DPPI channel that RADIO.CCAIDLE event publishes to
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_CCAIDLE
|
||||
#define NRF_802154_DPPI_RADIO_CCAIDLE 9U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_CCABUSY
|
||||
*
|
||||
* The DPPI channel that RADIO.CCABUSY event publishes to
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_CCABUSY
|
||||
#define NRF_802154_DPPI_RADIO_CCABUSY 14U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_HW_TRIGGER
|
||||
*
|
||||
* The DPPI channel that triggers radio.
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_HW_TRIGGER
|
||||
#define NRF_802154_DPPI_RADIO_HW_TRIGGER 15U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_TIMESTAMPS_USED_MASK
|
||||
*
|
||||
* Helper bit mask of DPPI channels used by the 802.15.4 driver for timestamping.
|
||||
*/
|
||||
#ifdef NRF_802154_FRAME_TIMESTAMP_ENABLED
|
||||
#define NRF_802154_DPPI_TIMESTAMPS_USED_MASK \
|
||||
(1UL << NRF_802154_PPI_TIMESTAMP_EVENT_TO_TIMER_CAPTURE)
|
||||
#else // NRF_802154_FRAME_TIMESTAMP_ENABLED
|
||||
#define NRF_802154_DPPI_TIMESTAMPS_USED_MASK 0U
|
||||
#endif // NRF_802154_FRAME_TIMESTAMP_ENABLED
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_CHANNELS_USED_MASK
|
||||
*
|
||||
* Bit mask of DPPI channels used by the 802.15.4 driver.
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_CHANNELS_USED_MASK
|
||||
#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) | \
|
||||
(1UL << NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP) | \
|
||||
(1UL << NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN) | \
|
||||
(1UL << NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC) | \
|
||||
(1UL << NRF_802154_DPPI_RADIO_CCAIDLE) | \
|
||||
(1UL << NRF_802154_DPPI_RADIO_CCABUSY) | \
|
||||
(1UL << NRF_802154_DPPI_RADIO_HW_TRIGGER) | \
|
||||
NRF_802154_DPPI_TIMESTAMPS_USED_MASK)
|
||||
#endif // NRF_802154_DPPI_CHANNELS_USED_MASK
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_GROUPS_USED_MASK
|
||||
*
|
||||
* Bit mask of DPPI groups identifiers used by the 802.15.4 driver.
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_GROUPS_USED_MASK
|
||||
#define NRF_802154_DPPI_GROUPS_USED_MASK 0UL
|
||||
#endif // NRF_802154_DPPI_GROUPS_USED_MASK
|
||||
|
||||
/**
|
||||
* @def NRF_802154_TIMER_INSTANCE_NO
|
||||
*
|
||||
* Number of the timer instance used both by the driver for ACK IFS and by the FEM module.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_TIMER_INSTANCE_NO 022
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NRF_802154_PERIPHERALS_NRF54H_H__
|
|
@ -0,0 +1,344 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Module that defines the 802.15.4 driver peripheral usage for nRF54L family.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NRF_802154_PERIPHERALS_NRF54L_H__
|
||||
#define NRF_802154_PERIPHERALS_NRF54L_H__
|
||||
|
||||
#include <nrfx.h>
|
||||
#include "nrf_802154_config.h"
|
||||
#include "nrf_802154_sl_periphs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_INSTANCE_NO
|
||||
*
|
||||
* Id of the EGU instance used by the driver to synchronize DPPIs and for requests and
|
||||
* notifications if SWI is in use.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_EGU_INSTANCE_NO
|
||||
#define NRF_802154_EGU_INSTANCE_NO 10
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_INSTANCE
|
||||
*
|
||||
* The EGU instance used by the driver to synchronize PPIs and for requests and notifications if
|
||||
* SWI is in use.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_EGU_INSTANCE NRFX_CONCAT_2(NRF_EGU, NRF_802154_EGU_INSTANCE_NO)
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_IRQ_HANDLER
|
||||
*
|
||||
* The EGU IRQ handler used by the driver for requests and notifications if SWI is in use.
|
||||
*
|
||||
* @note This option is used when the driver uses SWI to process requests and notifications.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_EGU_IRQ_HANDLER \
|
||||
NRFX_CONCAT_3(EGU, NRF_802154_EGU_INSTANCE_NO, _IRQHandler)
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_RAMP_UP_EVENT
|
||||
*
|
||||
* The EGU event used by the driver to trigger radio ramp-up.
|
||||
*/
|
||||
#define NRF_802154_EGU_RAMP_UP_EVENT NRF_EGU_EVENT_TRIGGERED15
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_RAMP_UP_TASK
|
||||
*
|
||||
* The EGU task used by the driver to trigger radio ramp-up.
|
||||
*/
|
||||
#define NRF_802154_EGU_RAMP_UP_TASK NRF_EGU_TASK_TRIGGER15
|
||||
|
||||
/**
|
||||
* @def NRF_802154_EGU_USED_MASK
|
||||
*
|
||||
* Bit mask of instances of SWI/EGU peripherals used by the 802.15.4 driver.
|
||||
*/
|
||||
#ifndef NRF_802154_EGU_USED_MASK
|
||||
#define NRF_802154_EGU_USED_MASK (1 << NRF_802154_EGU_INSTANCE_NO)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_CCM_INSTANCE_NO
|
||||
*
|
||||
* Id of the CCM instance used by the driver to encrypt outgoing frames.
|
||||
*
|
||||
* @note This option is used when @ref NRF_802154_ENCRYPTION_ENABLED is set.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_CCM_INSTANCE_NO 00
|
||||
|
||||
/**
|
||||
* @def NRF_802154_CCM_INSTANCE
|
||||
*
|
||||
* The CCM instance used by the driver to encrypt outgoing frames.
|
||||
*
|
||||
* @note This option is used when @ref NRF_802154_ENCRYPTION_ENABLED is set.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_CCM_INSTANCE NRFX_CONCAT_2(NRF_CCM, NRF_802154_CCM_INSTANCE_NO)
|
||||
|
||||
/**
|
||||
* @def NRF_802154_RTC_INSTANCE_NO
|
||||
*
|
||||
* Number of the RTC instance used in the standalone timer driver implementation.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_RTC_INSTANCE_NO
|
||||
#define NRF_802154_RTC_INSTANCE_NO 2
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPIC_INSTANCE_NO
|
||||
*
|
||||
* Id of the DPPIC instance used by the driver to connect peripherals to radio.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_DPPIC_INSTANCE_NO 10
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPIC_INSTANCE
|
||||
*
|
||||
* The DPPIC instance used by the driver to connect peripherals to radio.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_DPPIC_INSTANCE NRFX_CONCAT_2(NRF_DPPIC, NRF_802154_DPPIC_INSTANCE_NO)
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_DISABLED
|
||||
*
|
||||
* The DPPI channel that publishes RADIO_DISABLED event.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_DISABLED
|
||||
#define NRF_802154_DPPI_RADIO_DISABLED 7U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_READY
|
||||
*
|
||||
* The DPPI channel that publishes RADIO_READY event.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_READY
|
||||
#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
|
||||
*
|
||||
* The DPPI channel that publishes RADIO_ADDRESS event.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_ADDRESS
|
||||
#define NRF_802154_DPPI_RADIO_ADDRESS 5U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_END
|
||||
*
|
||||
* The DPPI channel that publishes RADIO_END event.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_END
|
||||
#define NRF_802154_DPPI_RADIO_END 6U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_PHYEND
|
||||
*
|
||||
* The DPPI channel that publishes RADIO_PHYEND event.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_PHYEND
|
||||
#define NRF_802154_DPPI_RADIO_PHYEND 12U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP
|
||||
*
|
||||
* The DPPI channel that connects EGU event to RADIO_TXEN or RADIO_RXEN task.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
* The peripheral is shared with @ref NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP
|
||||
#define NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP 10U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN
|
||||
*
|
||||
* The DPPI channel that connects TIMER_COMPARE event to RADIO_TXEN task.
|
||||
*
|
||||
* @note This option is used by the core module regardless of the driver configuration.
|
||||
* The peripheral is shared with @ref NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN
|
||||
#define NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN 10U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC
|
||||
*
|
||||
* The DPPI channel that connects RADIO_SYNC event to EGU_SYNC task.
|
||||
* EGU_SYNC task belongs to one of EGU channels
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC
|
||||
#define NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC 8U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_CCAIDLE
|
||||
*
|
||||
* The DPPI channel that RADIO.CCAIDLE event publishes to
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_CCAIDLE
|
||||
#define NRF_802154_DPPI_RADIO_CCAIDLE 9U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_CCABUSY
|
||||
*
|
||||
* The DPPI channel that RADIO.CCABUSY event publishes to
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_CCABUSY
|
||||
#define NRF_802154_DPPI_RADIO_CCABUSY 14U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_RADIO_HW_TRIGGER
|
||||
*
|
||||
* The DPPI channel that triggers radio.
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_RADIO_HW_TRIGGER
|
||||
#define NRF_802154_DPPI_RADIO_HW_TRIGGER 15U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_TIMESTAMPS_USED_MASK
|
||||
*
|
||||
* Helper bit mask of DPPI channels used by the 802.15.4 driver for timestamping.
|
||||
*/
|
||||
#ifdef NRF_802154_FRAME_TIMESTAMP_ENABLED
|
||||
#define NRF_802154_DPPI_TIMESTAMPS_USED_MASK \
|
||||
(1UL << NRF_802154_PPI_TIMESTAMP_EVENT_TO_TIMER_CAPTURE)
|
||||
#else // NRF_802154_FRAME_TIMESTAMP_ENABLED
|
||||
#define NRF_802154_DPPI_TIMESTAMPS_USED_MASK 0U
|
||||
#endif // NRF_802154_FRAME_TIMESTAMP_ENABLED
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_CHANNELS_USED_MASK
|
||||
*
|
||||
* Bit mask of DPPI channels used by the 802.15.4 driver.
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_CHANNELS_USED_MASK
|
||||
#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) | \
|
||||
(1UL << NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP) | \
|
||||
(1UL << NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN) | \
|
||||
(1UL << NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC) | \
|
||||
(1UL << NRF_802154_DPPI_RADIO_CCAIDLE) | \
|
||||
(1UL << NRF_802154_DPPI_RADIO_CCABUSY) | \
|
||||
(1UL << NRF_802154_DPPI_RADIO_HW_TRIGGER) | \
|
||||
NRF_802154_DPPI_TIMESTAMPS_USED_MASK)
|
||||
#endif // NRF_802154_DPPI_CHANNELS_USED_MASK
|
||||
|
||||
/**
|
||||
* @def NRF_802154_DPPI_GROUPS_USED_MASK
|
||||
*
|
||||
* Bit mask of DPPI groups identifiers used by the 802.15.4 driver.
|
||||
*/
|
||||
#ifndef NRF_802154_DPPI_GROUPS_USED_MASK
|
||||
#define NRF_802154_DPPI_GROUPS_USED_MASK 0UL
|
||||
#endif // NRF_802154_DPPI_GROUPS_USED_MASK
|
||||
|
||||
/**
|
||||
* @def NRF_802154_TIMER_INSTANCE_NO
|
||||
*
|
||||
* Number of the timer instance used both by the driver for ACK IFS and by the FEM module.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_TIMER_INSTANCE_NO 10
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NRF_802154_PERIPHERALS_NRF54L_H__
|
|
@ -941,7 +941,7 @@ static void irq_handler_req_event(void)
|
|||
break;
|
||||
|
||||
case REQ_TYPE_CSMA_CA_START:
|
||||
*(p_slot->data.receive_at_cancel.p_result) =
|
||||
*(p_slot->data.csma_ca_start.p_result) =
|
||||
nrf_802154_csma_ca_start(p_slot->data.csma_ca_start.p_data,
|
||||
p_slot->data.csma_ca_start.p_metadata);
|
||||
break;
|
||||
|
|
|
@ -371,6 +371,135 @@ static inline void wait_until_radio_is_disabled(void)
|
|||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_HIGH);
|
||||
}
|
||||
|
||||
#if !defined(RADIO_POWER_POWER_Msk)
|
||||
static inline void radio_reset_without_power_reg(void)
|
||||
{
|
||||
/* SUBSCRIBE registers */
|
||||
NRF_RADIO->SUBSCRIBE_TXEN = 0;
|
||||
NRF_RADIO->SUBSCRIBE_RXEN = 0;
|
||||
NRF_RADIO->SUBSCRIBE_START = 0;
|
||||
NRF_RADIO->SUBSCRIBE_STOP = 0;
|
||||
NRF_RADIO->SUBSCRIBE_DISABLE = 0;
|
||||
NRF_RADIO->SUBSCRIBE_RSSISTART = 0;
|
||||
NRF_RADIO->SUBSCRIBE_BCSTART = 0;
|
||||
NRF_RADIO->SUBSCRIBE_BCSTOP = 0;
|
||||
NRF_RADIO->SUBSCRIBE_EDSTART = 0;
|
||||
NRF_RADIO->SUBSCRIBE_EDSTOP = 0;
|
||||
NRF_RADIO->SUBSCRIBE_CCASTART = 0;
|
||||
NRF_RADIO->SUBSCRIBE_CCASTOP = 0;
|
||||
|
||||
/* EVENT registers */
|
||||
NRF_RADIO->EVENTS_READY = 0;
|
||||
NRF_RADIO->EVENTS_ADDRESS = 0;
|
||||
NRF_RADIO->EVENTS_PAYLOAD = 0;
|
||||
NRF_RADIO->EVENTS_END = 0;
|
||||
NRF_RADIO->EVENTS_DISABLED = 0;
|
||||
NRF_RADIO->EVENTS_DEVMATCH = 0;
|
||||
NRF_RADIO->EVENTS_DEVMISS = 0;
|
||||
NRF_RADIO->EVENTS_BCMATCH = 0;
|
||||
NRF_RADIO->EVENTS_CRCOK = 0;
|
||||
NRF_RADIO->EVENTS_CRCERROR = 0;
|
||||
NRF_RADIO->EVENTS_FRAMESTART = 0;
|
||||
NRF_RADIO->EVENTS_EDEND = 0;
|
||||
NRF_RADIO->EVENTS_EDSTOPPED = 0;
|
||||
NRF_RADIO->EVENTS_CCAIDLE = 0;
|
||||
NRF_RADIO->EVENTS_CCABUSY = 0;
|
||||
NRF_RADIO->EVENTS_CCASTOPPED = 0;
|
||||
NRF_RADIO->EVENTS_RATEBOOST = 0;
|
||||
NRF_RADIO->EVENTS_TXREADY = 0;
|
||||
NRF_RADIO->EVENTS_RXREADY = 0;
|
||||
NRF_RADIO->EVENTS_MHRMATCH = 0;
|
||||
NRF_RADIO->EVENTS_PHYEND = 0;
|
||||
NRF_RADIO->EVENTS_CTEPRESENT = 0;
|
||||
|
||||
/* PUBLISH registers */
|
||||
NRF_RADIO->PUBLISH_READY = 0;
|
||||
NRF_RADIO->PUBLISH_ADDRESS = 0;
|
||||
NRF_RADIO->PUBLISH_PAYLOAD = 0;
|
||||
NRF_RADIO->PUBLISH_END = 0;
|
||||
NRF_RADIO->PUBLISH_DISABLED = 0;
|
||||
NRF_RADIO->PUBLISH_DEVMATCH = 0;
|
||||
NRF_RADIO->PUBLISH_DEVMISS = 0;
|
||||
NRF_RADIO->PUBLISH_BCMATCH = 0;
|
||||
NRF_RADIO->PUBLISH_CRCOK = 0;
|
||||
NRF_RADIO->PUBLISH_CRCERROR = 0;
|
||||
NRF_RADIO->PUBLISH_FRAMESTART = 0;
|
||||
NRF_RADIO->PUBLISH_EDEND = 0;
|
||||
NRF_RADIO->PUBLISH_EDSTOPPED = 0;
|
||||
NRF_RADIO->PUBLISH_CCAIDLE = 0;
|
||||
NRF_RADIO->PUBLISH_CCABUSY = 0;
|
||||
NRF_RADIO->PUBLISH_CCASTOPPED = 0;
|
||||
NRF_RADIO->PUBLISH_RATEBOOST = 0;
|
||||
NRF_RADIO->PUBLISH_TXREADY = 0;
|
||||
NRF_RADIO->PUBLISH_RXREADY = 0;
|
||||
NRF_RADIO->PUBLISH_MHRMATCH = 0;
|
||||
NRF_RADIO->PUBLISH_PHYEND = 0;
|
||||
NRF_RADIO->PUBLISH_CTEPRESENT = 0;
|
||||
|
||||
/* INTEN registers */
|
||||
NRF_RADIO->INTENSET00 = 0;
|
||||
NRF_RADIO->INTENCLR00 = 0xffffffff;
|
||||
|
||||
#if !defined(NRF54H20_ENGA_XXAA)
|
||||
NRF_RADIO->TASKS_SOFTRESET = 1;
|
||||
#else /* defined(NRF54H20_ENGA_XXAA) */
|
||||
NRF_RADIO->TASKS_TXEN = 0;
|
||||
NRF_RADIO->TASKS_RXEN = 0;
|
||||
NRF_RADIO->TASKS_START = 0;
|
||||
NRF_RADIO->TASKS_STOP = 0;
|
||||
NRF_RADIO->TASKS_DISABLE = 0;
|
||||
NRF_RADIO->TASKS_RSSISTART = 0;
|
||||
NRF_RADIO->TASKS_BCSTART = 0;
|
||||
NRF_RADIO->TASKS_BCSTOP = 0;
|
||||
NRF_RADIO->TASKS_EDSTART = 0;
|
||||
NRF_RADIO->TASKS_EDSTOP = 0;
|
||||
NRF_RADIO->TASKS_CCASTART = 0;
|
||||
NRF_RADIO->TASKS_CCASTOP = 0;
|
||||
NRF_RADIO->SHORTS = 0;
|
||||
NRF_RADIO->PACKETPTR = 0;
|
||||
NRF_RADIO->FREQUENCY = 0;
|
||||
NRF_RADIO->TXPOWER = 0;
|
||||
NRF_RADIO->MODE = 0;
|
||||
NRF_RADIO->PCNF0 = 0;
|
||||
NRF_RADIO->PCNF1 = 0;
|
||||
NRF_RADIO->BASE0 = 0;
|
||||
NRF_RADIO->BASE1 = 0;
|
||||
NRF_RADIO->PREFIX0 = 0;
|
||||
NRF_RADIO->PREFIX1 = 0;
|
||||
NRF_RADIO->TXADDRESS = 0;
|
||||
NRF_RADIO->RXADDRESSES = 0;
|
||||
NRF_RADIO->CRCCNF = 0;
|
||||
NRF_RADIO->CRCPOLY = 0;
|
||||
NRF_RADIO->CRCINIT = 0;
|
||||
NRF_RADIO->TIFS = 0;
|
||||
NRF_RADIO->DATAWHITEIV = 0;
|
||||
NRF_RADIO->BCC = 0;
|
||||
NRF_RADIO->DACNF = 0;
|
||||
NRF_RADIO->MHRMATCHCONF = 0;
|
||||
NRF_RADIO->MHRMATCHMASK = 0;
|
||||
NRF_RADIO->SFD = 0xA7;
|
||||
NRF_RADIO->EDCTRL = RADIO_EDCTRL_ResetValue;
|
||||
NRF_RADIO->CCACTRL = 0x52D0000;
|
||||
NRF_RADIO->DFEMODE = 0;
|
||||
NRF_RADIO->CTEINLINECONF = 0x2800;
|
||||
NRF_RADIO->DFECTRL1 = 0x23282;
|
||||
NRF_RADIO->DFECTRL2 = 0;
|
||||
NRF_RADIO->SWITCHPATTERN = 0;
|
||||
NRF_RADIO->CLEARPATTERN = 0;
|
||||
NRF_RADIO->DFEPACKET.PTR = 0;
|
||||
NRF_RADIO->DFEPACKET.MAXCNT = 0x1000;
|
||||
|
||||
for (uint8_t i = 0; i < 8; i++)
|
||||
{
|
||||
NRF_RADIO->DAB[i] = 0;
|
||||
NRF_RADIO->DAP[i] = 0;
|
||||
NRF_RADIO->PSEL.DFEGPIO[i] = 0xFFFFFFFF;
|
||||
}
|
||||
#endif /* !defined(NRF54H20_ENGA_XXAA) */
|
||||
}
|
||||
|
||||
#endif /* !defined(RADIO_POWER_POWER_Msk) */
|
||||
|
||||
/** Reset radio peripheral. */
|
||||
static void nrf_radio_reset(void)
|
||||
{
|
||||
|
@ -379,6 +508,8 @@ static void nrf_radio_reset(void)
|
|||
#if defined(RADIO_POWER_POWER_Msk)
|
||||
nrf_radio_power_set(NRF_RADIO, false);
|
||||
nrf_radio_power_set(NRF_RADIO, true);
|
||||
#else
|
||||
radio_reset_without_power_reg();
|
||||
#endif
|
||||
|
||||
NRF_802154_TRX_RADIO_RESET_INTERNAL();
|
||||
|
@ -676,6 +807,63 @@ void nrf_802154_trx_init(void)
|
|||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
#if defined(NRF54H_SERIES)
|
||||
static void radio_trims_apply(void)
|
||||
{
|
||||
#if defined(NRF54H20_ENGA_XXAA)
|
||||
/* HMPAN-18 */
|
||||
NRF_RADIO->TIMING = 1;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND1 = 0x01A80004;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND2 = 0x02100002;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND3 = 0x008C0032;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND4 = 0x00280880;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND5 = NRF_FICR->TRIM.RADIOCORE.RADIO.LOOPGAIN | 0x00580000;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND6 = 0x01280000;
|
||||
|
||||
NRF_RADIO->SPHYNXANA.FSCTRL0 = NRF_FICR->TRIM.RADIOCORE.RADIO.SPHYNXANA.FSCTRL0;
|
||||
NRF_RADIO->SPHYNXANA.FSCTRL1 = NRF_FICR->TRIM.RADIOCORE.RADIO.SPHYNXANA.FSCTRL1;
|
||||
NRF_RADIO->SPHYNXANA.FSCTRL2 = NRF_FICR->TRIM.RADIOCORE.RADIO.SPHYNXANA.FSCTRL2;
|
||||
NRF_RADIO->SPHYNXANA.RXCTRL = NRF_FICR->TRIM.RADIOCORE.RADIO.SPHYNXANA.RXCTRL;
|
||||
NRF_RADIO->SPHYNXANA.OVRRXTRIMCODE = NRF_FICR->TRIM.RADIOCORE.RADIO.SPHYNXANA.OVRRXTRIMCODE;
|
||||
NRF_RADIO->RXAGC.CALIBRATION = NRF_FICR->TRIM.RADIOCORE.RADIO.RXAGC.CALIBRATION;
|
||||
NRF_RADIO->EXPECTEDPVTTOTRATIO = NRF_FICR->TRIM.RADIOCORE.RADIO.PVTTOT;
|
||||
NRF_RADIO->ESTKDTCVAL = NRF_FICR->TRIM.RADIOCORE.RADIO.KDTC;
|
||||
NRF_RADIO->TXINTERFACEHFGAIN = NRF_FICR->TRIM.RADIOCORE.RADIO.TXHFGAIN;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND7 = NRF_FICR->TRIM.RADIOCORE.RADIO.PVTTOFIX;
|
||||
|
||||
/* HMPAN-1 */
|
||||
uint32_t temp;
|
||||
|
||||
NRF_RADIO->QOVERRIDE27 = 0;
|
||||
temp = NRF_RADIO->DBCCORR & ~RADIO_DBCCORR_TH_Msk;
|
||||
NRF_RADIO->DBCCORR = temp | (0x2d << RADIO_DBCCORR_TH_Pos);
|
||||
temp = NRF_RADIO->ADDRWINSIZE & ~RADIO_ADDRWINSIZE_IEEE802154_Msk;
|
||||
NRF_RADIO->ADDRWINSIZE = temp | (0x18 << RADIO_ADDRWINSIZE_IEEE802154_Pos);
|
||||
|
||||
#elif defined(NRF54H20_XXAA)
|
||||
/* HMPAN-76 */
|
||||
if (NRF_RADIO->ADPLLTRIMCOMMAND0 == RADIO_ADPLLTRIMCOMMAND0_ResetValue)
|
||||
{
|
||||
NRF_RADIO->ADPLLTRIMCOMMAND0 = 0x0058120E;
|
||||
}
|
||||
|
||||
NRF_RADIO->ADPLLTRIMCOMMAND1 = 0x008C0032;
|
||||
NRF_RADIO->ADPLLTRIMCOMMAND2 = 0x00800005;
|
||||
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND1 = 0x01280000;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND2 = 0x00F8AA4F;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND3 = 0x007C0015;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND4 = 0x00800005;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND5 = 0x02100002;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND6 = 0x00280640;
|
||||
NRF_RADIO->ADPLLSTARTUPCOMMAND7 = 0x003005C0;
|
||||
#endif
|
||||
|
||||
nrf_radio_fast_ramp_up_enable_set(NRF_RADIO, true);
|
||||
}
|
||||
|
||||
#endif /* defined(NRF54H_SERIES) */
|
||||
|
||||
void nrf_802154_trx_enable(void)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
@ -711,6 +899,10 @@ void nrf_802154_trx_enable(void)
|
|||
packet_conf.maxlen = MAX_PACKET_SIZE;
|
||||
nrf_radio_packet_configure(NRF_RADIO, &packet_conf);
|
||||
|
||||
#if defined(NRF54H_SERIES)
|
||||
radio_trims_apply();
|
||||
#endif
|
||||
|
||||
NRF_802154_TRX_ENABLE_INTERNAL();
|
||||
|
||||
#if defined(RADIO_MODECNF0_RU_Msk)
|
||||
|
|
|
@ -54,7 +54,11 @@
|
|||
*
|
||||
*/
|
||||
#ifndef NRF_802154_EGU_INSTANCE_NO
|
||||
#if defined(NRF52_SERIES) || defined(NRF5340_XXAA)
|
||||
#define NRF_802154_EGU_INSTANCE_NO 0
|
||||
#elif defined(NRF54L_SERIES)
|
||||
#define NRF_802154_EGU_INSTANCE_NO 10
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -197,4 +201,25 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NRF54L_SERIES)
|
||||
/**
|
||||
* @def NRF_802154_SL_DPPIC_INSTANCE_NO
|
||||
*
|
||||
* Id of the DPPIC instance used by the driver to connect peripherals to the radio.
|
||||
*
|
||||
*/
|
||||
#ifndef NRF_802154_SL_DPPIC_INSTANCE_NO
|
||||
#define NRF_802154_SL_DPPIC_INSTANCE_NO 10
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def NRF_802154_SL_DPPIC_INSTANCE
|
||||
*
|
||||
* The DPPIC instance used by the driver to connect peripherals to the radio.
|
||||
*
|
||||
*/
|
||||
#define NRF_802154_SL_DPPIC_INSTANCE NRFX_CONCAT_2(NRF_DPPIC, NRF_802154_SL_DPPIC_INSTANCE_NO)
|
||||
|
||||
#endif // defined(NRF54L_SERIES)
|
||||
|
||||
#endif // NRF_802154_SL_PERIPHS_H__
|
||||
|
|
Loading…
Reference in New Issue