nrf_802154: rev 1bff96a60a6f40dae3a9262cb4a828035008df21
This commit updates revision of the nrf_802154 component. Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
This commit is contained in:
parent
b9633ecea6
commit
3786c55424
|
@ -1550,6 +1550,41 @@ void nrf_802154_csl_writer_period_set(uint16_t period);
|
|||
*/
|
||||
void nrf_802154_csl_writer_anchor_time_set(uint64_t anchor_time);
|
||||
|
||||
/**
|
||||
* @brief Sets the RxOnWhenIdle mode value.
|
||||
*
|
||||
* This function sets the RxOnWhenIdle mode value, which defaults to true. When enabled, the radio will
|
||||
* stay in receive state during idle periods. When disabled, the radio will stay in sleep state during
|
||||
* idle periods. The new value will only take effect after a completed operation.
|
||||
*
|
||||
* Notice that the period following a failed reception is not considered idle, rather continuation of
|
||||
* the reception state. Same goes for the finalization of a reception during a receive slot.
|
||||
*
|
||||
* An idle period is started in the following situations:
|
||||
* - After @ref nrf_802154_receive starts a receive state and a frame is correctly received and passed
|
||||
* the filtering:
|
||||
* - If the received frame requests an ACK: after the ACK was properly transmitted or immediately
|
||||
* if for some internal condition the ACK is not transmitted.
|
||||
* - If the received frame does not request an ACK: immediately, unless the received frame is an
|
||||
* spurious ACK.
|
||||
* - Immediately after a frame is transmitted, when no ACK is requested.
|
||||
* - After a frame is transmitted, when ACK is requested, if:
|
||||
* - ACK timeout expires.
|
||||
* - An invalid ACK is received (or not an ACK frame).
|
||||
* - The matching ACK is received, unless the transmitted frame was a Data Request Command and the
|
||||
* frame pending bit is set to true in the ACK.
|
||||
* - After a standalone CCA is completed.
|
||||
* - After a failed CCA during CSMA/CA procedure.
|
||||
* - After every Energy Detection operation.
|
||||
* - After a delayed reception times out.
|
||||
*
|
||||
* Combining disabled RxOnWhenIdle mode and enabled promiscuous mode is unsupported. Such configuration
|
||||
* may result in an undefined behavior.
|
||||
*
|
||||
* @param[in] rx_on_when_idle If RxOnWhenIdle mode should be enabled.
|
||||
*/
|
||||
void nrf_802154_rx_on_when_idle_set(bool rx_on_when_idle);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @defgroup nrf_802154_test_modes Test modes
|
||||
|
|
|
@ -411,6 +411,18 @@ typedef struct
|
|||
int8_t power; // !< Transmission power in dBm
|
||||
} nrf_802154_tx_power_metadata_t;
|
||||
|
||||
/**
|
||||
* @brief Structure passed in transmit metadata with information needed to set transmission channel.
|
||||
*
|
||||
* If the @p use_metadata_value field is set to true the channel used to transmit the frame is set to the value of the field @p channel.
|
||||
* Otherwise the value from PIB set by @ref nrf_802154_channel_set is used.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
bool use_metadata_value; // !< Set to true if the value in @p channel should be used as the TX channel
|
||||
uint8_t channel; // !< Transmission channel
|
||||
} nrf_802154_tx_channel_metadata_t;
|
||||
|
||||
/**
|
||||
* @brief Default initializer for nrf_802154_transmitted_frame_props_t.
|
||||
*/
|
||||
|
@ -427,7 +439,8 @@ typedef struct
|
|||
{
|
||||
nrf_802154_transmitted_frame_props_t frame_props; // !< Properties of the frame to be transmitted.
|
||||
bool cca; // !< If the driver is to perform a CCA procedure before transmission.
|
||||
nrf_802154_tx_power_metadata_t tx_power; // !< Information about the TX power to be used
|
||||
nrf_802154_tx_power_metadata_t tx_power; // !< Information about the TX power to be used.
|
||||
nrf_802154_tx_channel_metadata_t tx_channel; // !< Information about the TX channel to be used.
|
||||
} nrf_802154_transmit_metadata_t;
|
||||
|
||||
/**
|
||||
|
@ -438,7 +451,7 @@ typedef struct
|
|||
nrf_802154_transmitted_frame_props_t frame_props; // !< Properties of the frame to be transmitted.
|
||||
bool cca; // !< If the driver is to perform a CCA procedure before transmission.
|
||||
uint8_t channel; // !< Radio channel on which the frame is to be transmitted.
|
||||
nrf_802154_tx_power_metadata_t tx_power; // !< Information about the TX power to be used
|
||||
nrf_802154_tx_power_metadata_t tx_power; // !< Information about the TX power to be used.
|
||||
uint8_t extra_cca_attempts; // !< Maximum number of additional CCA attempts that can be performed if the first attempt returns busy channel. Ignored if @ref cca equals @c false.
|
||||
} nrf_802154_transmit_at_metadata_t;
|
||||
|
||||
|
@ -448,7 +461,8 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
nrf_802154_transmitted_frame_props_t frame_props; // !< Properties of the frame to be transmitted.
|
||||
nrf_802154_tx_power_metadata_t tx_power; // !< Information about the TX power to be used
|
||||
nrf_802154_tx_power_metadata_t tx_power; // !< Information about the TX power to be used.
|
||||
nrf_802154_tx_channel_metadata_t tx_channel; // !< Information about the TX channel to be used.
|
||||
} nrf_802154_transmit_csma_ca_metadata_t;
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,6 +78,7 @@ static uint8_t m_be; ///< Backoff exponent,
|
|||
static uint8_t * mp_data; ///< Pointer to a buffer containing PHR and PSDU of the frame being transmitted.
|
||||
static nrf_802154_transmitted_frame_props_t m_data_props; ///< Structure containing detailed properties of data in buffer.
|
||||
static nrf_802154_fal_tx_power_split_t m_tx_power; ///< Power to be used when transmitting the frame split into components.
|
||||
static uint8_t m_tx_channel; ///< Channel to be used to transmit the current frame.
|
||||
static csma_ca_state_t m_state; ///< The current state of the CSMA-CA procedure.
|
||||
|
||||
/**
|
||||
|
@ -193,6 +194,7 @@ static void frame_transmit(rsch_dly_ts_id_t dly_ts_id)
|
|||
{
|
||||
.frame_props = m_data_props,
|
||||
.tx_power = m_tx_power,
|
||||
.channel = m_tx_channel,
|
||||
.cca = true,
|
||||
.immediate = NRF_802154_CSMA_CA_WAIT_FOR_TIMESLOT ? false : true,
|
||||
.extra_cca_attempts = 0,
|
||||
|
@ -361,11 +363,16 @@ bool nrf_802154_csma_ca_start(uint8_t * p_d
|
|||
NRF_802154_ASSERT(result);
|
||||
(void)result;
|
||||
|
||||
uint8_t channel =
|
||||
p_metadata->tx_channel.use_metadata_value ? p_metadata->tx_channel.channel :
|
||||
nrf_802154_pib_channel_get();
|
||||
|
||||
mp_data = p_data;
|
||||
m_data_props = p_metadata->frame_props;
|
||||
m_nb = 0;
|
||||
m_be = nrf_802154_pib_csmaca_min_be_get();
|
||||
(void)nrf_802154_tx_power_convert_metadata_to_tx_power_split(nrf_802154_pib_channel_get(),
|
||||
m_tx_channel = channel;
|
||||
(void)nrf_802154_tx_power_convert_metadata_to_tx_power_split(channel,
|
||||
p_metadata->tx_power,
|
||||
&m_tx_power);
|
||||
|
||||
|
|
|
@ -113,12 +113,11 @@ typedef struct
|
|||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t * p_data; ///< Pointer to a buffer containing PHR and PSDU of the frame requested to be transmitted.
|
||||
nrf_802154_transmit_params_t params; ///< Transmission parameters.
|
||||
uint8_t channel; ///< Channel number on which transmission should be performed.
|
||||
uint8_t * p_data; ///< Pointer to a buffer containing PHR and PSDU of the frame requested to be transmitted.
|
||||
nrf_802154_transmit_params_t params; ///< Transmission parameters.
|
||||
|
||||
#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
|
||||
uint64_t time; ///< Target time of the first bit of the frame.
|
||||
uint64_t time; ///< Target time of the first bit of the frame.
|
||||
|
||||
#endif
|
||||
} dly_tx_data_t;
|
||||
|
@ -466,6 +465,11 @@ static void notify_rx_timeout(nrf_802154_sl_timer_t * p_timer)
|
|||
|
||||
NRF_802154_ASSERT(result);
|
||||
(void)result;
|
||||
|
||||
if (!nrf_802154_pib_rx_on_when_idle_get())
|
||||
{
|
||||
(void)nrf_802154_request_sleep(NRF_802154_TERM_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
@ -597,20 +601,11 @@ static void transmit_attempt(dly_op_data_t * p_dly_op_data)
|
|||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_HIGH);
|
||||
|
||||
// No need to enqueue transmit attempts. Proceed to transmission immediately
|
||||
nrf_802154_pib_channel_set(p_dly_op_data->tx.channel);
|
||||
|
||||
if (nrf_802154_request_channel_update(REQ_ORIG_DELAYED_TRX))
|
||||
{
|
||||
(void)nrf_802154_request_transmit(NRF_802154_TERM_802154,
|
||||
REQ_ORIG_DELAYED_TRX,
|
||||
p_dly_op_data->tx.p_data,
|
||||
&p_dly_op_data->tx.params,
|
||||
dly_tx_result_notify);
|
||||
}
|
||||
else
|
||||
{
|
||||
dly_tx_result_notify(false);
|
||||
}
|
||||
(void)nrf_802154_request_transmit(NRF_802154_TERM_802154,
|
||||
REQ_ORIG_DELAYED_TRX,
|
||||
p_dly_op_data->tx.p_data,
|
||||
&p_dly_op_data->tx.params,
|
||||
dly_tx_result_notify);
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_HIGH);
|
||||
}
|
||||
|
@ -796,7 +791,7 @@ bool nrf_802154_delayed_trx_transmit(uint8_t * p
|
|||
p_dly_tx_data->tx.params.cca = p_metadata->cca;
|
||||
p_dly_tx_data->tx.params.immediate = true;
|
||||
p_dly_tx_data->tx.params.extra_cca_attempts = p_metadata->extra_cca_attempts;
|
||||
p_dly_tx_data->tx.channel = p_metadata->channel;
|
||||
p_dly_tx_data->tx.params.channel = p_metadata->channel;
|
||||
p_dly_tx_data->id = NRF_802154_RESERVED_DTX_ID;
|
||||
|
||||
rsch_dly_ts_param_t dly_ts_param =
|
||||
|
|
|
@ -459,7 +459,8 @@ bool nrf_802154_receive(void)
|
|||
bool nrf_802154_transmit_raw(uint8_t * p_data,
|
||||
const nrf_802154_transmit_metadata_t * p_metadata)
|
||||
{
|
||||
bool result;
|
||||
bool result;
|
||||
uint8_t channel;
|
||||
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
||||
|
@ -469,22 +470,28 @@ bool nrf_802154_transmit_raw(uint8_t * p_data,
|
|||
{
|
||||
.frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT,
|
||||
.cca = true,
|
||||
.tx_power = {.use_metadata_value = false}
|
||||
.tx_power = {.use_metadata_value = false},
|
||||
.tx_channel = {.use_metadata_value = false}
|
||||
};
|
||||
|
||||
p_metadata = &metadata_default;
|
||||
}
|
||||
|
||||
channel =
|
||||
p_metadata->tx_channel.use_metadata_value ? p_metadata->tx_channel.channel :
|
||||
nrf_802154_pib_channel_get();
|
||||
|
||||
nrf_802154_transmit_params_t params =
|
||||
{
|
||||
.frame_props = p_metadata->frame_props,
|
||||
.tx_power = {0},
|
||||
.channel = channel,
|
||||
.cca = p_metadata->cca,
|
||||
.immediate = false,
|
||||
.extra_cca_attempts = 0U,
|
||||
};
|
||||
|
||||
(void)nrf_802154_tx_power_convert_metadata_to_tx_power_split(nrf_802154_pib_channel_get(),
|
||||
(void)nrf_802154_tx_power_convert_metadata_to_tx_power_split(channel,
|
||||
p_metadata->tx_power,
|
||||
¶ms.tx_power);
|
||||
|
||||
|
@ -508,7 +515,8 @@ bool nrf_802154_transmit(const uint8_t * p_data,
|
|||
uint8_t length,
|
||||
const nrf_802154_transmit_metadata_t * p_metadata)
|
||||
{
|
||||
bool result;
|
||||
bool result;
|
||||
uint8_t channel;
|
||||
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
||||
|
@ -518,22 +526,28 @@ bool nrf_802154_transmit(const uint8_t * p_data,
|
|||
{
|
||||
.frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT,
|
||||
.cca = true,
|
||||
.tx_power = {.use_metadata_value = false}
|
||||
.tx_power = {.use_metadata_value = false},
|
||||
.tx_channel = {.use_metadata_value = false}
|
||||
};
|
||||
|
||||
p_metadata = &metadata_default;
|
||||
}
|
||||
|
||||
channel =
|
||||
p_metadata->tx_channel.use_metadata_value ? p_metadata->tx_channel.channel :
|
||||
nrf_802154_pib_channel_get();
|
||||
|
||||
nrf_802154_transmit_params_t params =
|
||||
{
|
||||
.frame_props = p_metadata->frame_props,
|
||||
.tx_power = {0},
|
||||
.channel = channel,
|
||||
.cca = p_metadata->cca,
|
||||
.immediate = false,
|
||||
.extra_cca_attempts = 0U,
|
||||
};
|
||||
|
||||
(void)nrf_802154_tx_power_convert_metadata_to_tx_power_split(nrf_802154_pib_channel_get(),
|
||||
(void)nrf_802154_tx_power_convert_metadata_to_tx_power_split(channel,
|
||||
p_metadata->tx_power,
|
||||
¶ms.tx_power);
|
||||
|
||||
|
@ -781,6 +795,11 @@ void nrf_802154_promiscuous_set(bool enabled)
|
|||
nrf_802154_pib_promiscuous_set(enabled);
|
||||
}
|
||||
|
||||
void nrf_802154_rx_on_when_idle_set(bool enabled)
|
||||
{
|
||||
nrf_802154_pib_rx_on_when_idle_set(enabled);
|
||||
}
|
||||
|
||||
void nrf_802154_auto_ack_set(bool enabled)
|
||||
{
|
||||
nrf_802154_pib_auto_ack_set(enabled);
|
||||
|
@ -873,7 +892,8 @@ bool nrf_802154_transmit_csma_ca_raw(uint8_t
|
|||
static const nrf_802154_transmit_csma_ca_metadata_t metadata_default =
|
||||
{
|
||||
.frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT,
|
||||
.tx_power = {.use_metadata_value = false}
|
||||
.tx_power = {.use_metadata_value = false},
|
||||
.tx_channel = {.use_metadata_value = false}
|
||||
};
|
||||
|
||||
p_metadata = &metadata_default;
|
||||
|
@ -904,7 +924,8 @@ bool nrf_802154_transmit_csma_ca(const uint8_t *
|
|||
static const nrf_802154_transmit_csma_ca_metadata_t metadata_default =
|
||||
{
|
||||
.frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT,
|
||||
.tx_power = {.use_metadata_value = false}
|
||||
.tx_power = {.use_metadata_value = false},
|
||||
.tx_channel = {.use_metadata_value = false}
|
||||
};
|
||||
|
||||
p_metadata = &metadata_default;
|
||||
|
|
|
@ -124,6 +124,7 @@ static uint32_t m_ed_time_left; ///< Remaining ti
|
|||
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 nrf_802154_frame_parser_data_t m_current_rx_frame_data; ///< RX frame parser data.
|
||||
|
@ -989,6 +990,8 @@ static void rx_init(nrf_802154_trx_ramp_up_trigger_mode_t ru_tr_mode, bool * p_a
|
|||
|
||||
(void)nrf_802154_tx_power_split_pib_power_get(&split_power);
|
||||
|
||||
nrf_802154_trx_channel_set(nrf_802154_pib_channel_get());
|
||||
|
||||
nrf_802154_trx_receive_frame(BCC_INIT / 8U,
|
||||
ru_tr_mode,
|
||||
m_trx_receive_frame_notifications_mask,
|
||||
|
@ -1060,6 +1063,7 @@ static bool tx_init(const uint8_t * p_data,
|
|||
}
|
||||
#endif
|
||||
|
||||
nrf_802154_trx_channel_set(m_tx_channel);
|
||||
m_flags.tx_with_cca = cca;
|
||||
nrf_802154_trx_transmit_frame(nrf_802154_tx_work_buffer_get(p_data),
|
||||
rampup_trigg_mode,
|
||||
|
@ -1211,6 +1215,21 @@ static void modulated_carrier_init(const uint8_t * p_data)
|
|||
|
||||
#endif // NRF_802154_CARRIER_FUNCTIONS_ENABLED
|
||||
|
||||
/** Switches to idle state: rx or sleep depending on RxOnWhenIdle mode */
|
||||
static void switch_to_idle(void)
|
||||
{
|
||||
if (!nrf_802154_pib_rx_on_when_idle_get())
|
||||
{
|
||||
sleep_init();
|
||||
state_set(RADIO_STATE_SLEEP);
|
||||
}
|
||||
else
|
||||
{
|
||||
state_set(RADIO_STATE_RX);
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
* @section Radio Scheduler notification handlers
|
||||
**************************************************************************************************/
|
||||
|
@ -2024,8 +2043,7 @@ void nrf_802154_trx_receive_frame_received(void)
|
|||
{
|
||||
mp_current_rx_buffer->free = false;
|
||||
|
||||
state_set(RADIO_STATE_RX);
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
switch_to_idle();
|
||||
|
||||
received_frame_notify_and_nesting_allow(p_received_data);
|
||||
}
|
||||
|
@ -2040,8 +2058,7 @@ void nrf_802154_trx_receive_frame_received(void)
|
|||
|
||||
mp_current_rx_buffer->free = false;
|
||||
|
||||
state_set(RADIO_STATE_RX);
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
switch_to_idle();
|
||||
|
||||
received_frame_notify_and_nesting_allow(p_received_data);
|
||||
}
|
||||
|
@ -2059,7 +2076,7 @@ void nrf_802154_trx_receive_frame_received(void)
|
|||
// Find new buffer
|
||||
rx_buffer_in_use_set(nrf_802154_rx_buffer_free_find());
|
||||
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
switch_to_idle();
|
||||
|
||||
received_frame_notify_and_nesting_allow(p_received_data);
|
||||
}
|
||||
|
@ -2115,9 +2132,7 @@ void nrf_802154_trx_transmit_ack_transmitted(void)
|
|||
// Current buffer used for receive operation will be passed to the application
|
||||
mp_current_rx_buffer->free = false;
|
||||
|
||||
state_set(RADIO_STATE_RX);
|
||||
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
switch_to_idle();
|
||||
|
||||
received_frame_notify_and_nesting_allow(p_received_data);
|
||||
|
||||
|
@ -2170,9 +2185,7 @@ void nrf_802154_trx_transmit_frame_transmitted(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
state_set(RADIO_STATE_RX);
|
||||
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
switch_to_idle();
|
||||
|
||||
transmitted_frame_notify(NULL, 0, 0);
|
||||
}
|
||||
|
@ -2286,9 +2299,7 @@ static void on_bad_ack(void)
|
|||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
||||
// We received either a frame with incorrect CRC or not an ACK frame or not matching ACK
|
||||
state_set(RADIO_STATE_RX);
|
||||
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
switch_to_idle();
|
||||
|
||||
nrf_802154_transmit_done_metadata_t metadata = {};
|
||||
|
||||
|
@ -2317,8 +2328,38 @@ void nrf_802154_trx_receive_ack_received(void)
|
|||
|
||||
mp_current_rx_buffer->free = false;
|
||||
|
||||
state_set(RADIO_STATE_RX);
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
// Detect Frame Pending field set to one on Ack frame received after a Data Request Command
|
||||
bool should_receive = false;
|
||||
nrf_802154_frame_parser_data_t frame_data;
|
||||
|
||||
bool parse_result = nrf_802154_frame_parser_data_init(mp_tx_data,
|
||||
mp_tx_data[PHR_OFFSET] + PHR_SIZE,
|
||||
PARSE_LEVEL_FULL,
|
||||
&frame_data);
|
||||
|
||||
if (parse_result &&
|
||||
(nrf_802154_frame_parser_frame_type_get(&frame_data) == FRAME_TYPE_COMMAND))
|
||||
{
|
||||
const uint8_t * p_cmd = nrf_802154_frame_parser_mac_command_id_get(&frame_data);
|
||||
|
||||
if ((p_cmd != NULL) && (*p_cmd == MAC_CMD_DATA_REQ))
|
||||
{
|
||||
if (p_ack_data[FRAME_PENDING_OFFSET] & FRAME_PENDING_BIT)
|
||||
{
|
||||
should_receive = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (should_receive)
|
||||
{
|
||||
state_set(RADIO_STATE_RX);
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_to_idle();
|
||||
}
|
||||
|
||||
transmitted_frame_notify(p_ack_buffer->data, // phr + psdu
|
||||
rssi_last_measurement_get(), // rssi
|
||||
|
@ -2336,8 +2377,7 @@ void nrf_802154_trx_standalone_cca_finished(bool channel_was_idle)
|
|||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
||||
state_set(RADIO_STATE_RX);
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
switch_to_idle();
|
||||
|
||||
cca_notify(channel_was_idle);
|
||||
|
||||
|
@ -2383,8 +2423,7 @@ void nrf_802154_trx_transmit_frame_ccabusy(void)
|
|||
|
||||
nrf_802154_stat_counter_increment(cca_failed_attempts);
|
||||
|
||||
state_set(RADIO_STATE_RX);
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
switch_to_idle();
|
||||
|
||||
nrf_802154_transmit_done_metadata_t metadata = {};
|
||||
|
||||
|
@ -2426,8 +2465,7 @@ void nrf_802154_trx_energy_detection_finished(uint8_t ed_sample)
|
|||
{
|
||||
nrf_802154_trx_channel_set(nrf_802154_pib_channel_get());
|
||||
|
||||
state_set(RADIO_STATE_RX);
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
switch_to_idle();
|
||||
|
||||
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
|
||||
nrf_802154_energy_detected_t ed_result = {};
|
||||
|
@ -2484,6 +2522,28 @@ radio_state_t nrf_802154_core_state_get(void)
|
|||
return m_state;
|
||||
}
|
||||
|
||||
static bool core_sleep(nrf_802154_term_t term_lvl, req_originator_t req_orig, bool notify_abort)
|
||||
{
|
||||
bool result = current_operation_terminate(term_lvl, req_orig, notify_abort);
|
||||
|
||||
if (result)
|
||||
{
|
||||
// The order of calls in the following blocks is inverted to avoid RAAL races.
|
||||
if (timeslot_is_granted())
|
||||
{
|
||||
state_set(RADIO_STATE_FALLING_ASLEEP);
|
||||
falling_asleep_init();
|
||||
}
|
||||
else
|
||||
{
|
||||
sleep_init();
|
||||
state_set(RADIO_STATE_SLEEP);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool nrf_802154_core_sleep(nrf_802154_term_t term_lvl)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
|
@ -2494,22 +2554,7 @@ bool nrf_802154_core_sleep(nrf_802154_term_t term_lvl)
|
|||
{
|
||||
if ((m_state != RADIO_STATE_SLEEP) && (m_state != RADIO_STATE_FALLING_ASLEEP))
|
||||
{
|
||||
result = current_operation_terminate(term_lvl, REQ_ORIG_CORE, true);
|
||||
|
||||
if (result)
|
||||
{
|
||||
// The order of calls in the following blocks is inverted to avoid RAAL races.
|
||||
if (timeslot_is_granted())
|
||||
{
|
||||
state_set(RADIO_STATE_FALLING_ASLEEP);
|
||||
falling_asleep_init();
|
||||
}
|
||||
else
|
||||
{
|
||||
sleep_init();
|
||||
state_set(RADIO_STATE_SLEEP);
|
||||
}
|
||||
}
|
||||
result = core_sleep(term_lvl, REQ_ORIG_CORE, true);
|
||||
}
|
||||
|
||||
nrf_802154_critical_section_exit();
|
||||
|
@ -2619,8 +2664,7 @@ bool nrf_802154_core_transmit(nrf_802154_term_t term_lvl,
|
|||
|
||||
if (!result)
|
||||
{
|
||||
state_set(RADIO_STATE_RX);
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
switch_to_idle();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2633,8 +2677,9 @@ bool nrf_802154_core_transmit(nrf_802154_term_t term_lvl,
|
|||
m_coex_tx_request_mode == NRF_802154_COEX_TX_REQUEST_MODE_CCA_DONE;
|
||||
|
||||
state_set(p_params->cca ? RADIO_STATE_CCA_TX : RADIO_STATE_TX);
|
||||
mp_tx_data = p_data;
|
||||
m_tx_power = p_params->tx_power;
|
||||
mp_tx_data = p_data;
|
||||
m_tx_power = p_params->tx_power;
|
||||
m_tx_channel = p_params->channel;
|
||||
|
||||
uint8_t cca_attempts = p_params->cca ? (1 + p_params->extra_cca_attempts) : 0;
|
||||
|
||||
|
@ -2645,8 +2690,7 @@ bool nrf_802154_core_transmit(nrf_802154_term_t term_lvl,
|
|||
{
|
||||
if (!result)
|
||||
{
|
||||
state_set(RADIO_STATE_RX);
|
||||
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
|
||||
switch_to_idle();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2688,10 +2732,18 @@ bool nrf_802154_core_ack_timeout_handle(const nrf_802154_ack_timeout_handle_para
|
|||
{
|
||||
bool r;
|
||||
|
||||
r = core_receive(NRF_802154_TERM_802154,
|
||||
REQ_ORIG_ACK_TIMEOUT,
|
||||
false,
|
||||
NRF_802154_RESERVED_IMM_RX_WINDOW_ID);
|
||||
if (!nrf_802154_pib_rx_on_when_idle_get())
|
||||
{
|
||||
r = core_sleep(NRF_802154_TERM_802154, REQ_ORIG_ACK_TIMEOUT, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = core_receive(NRF_802154_TERM_802154,
|
||||
REQ_ORIG_ACK_TIMEOUT,
|
||||
false,
|
||||
NRF_802154_RESERVED_IMM_RX_WINDOW_ID);
|
||||
|
||||
}
|
||||
NRF_802154_ASSERT(r);
|
||||
(void)r;
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ typedef struct
|
|||
bool auto_ack : 1; ///< Indicating if auto ACK procedure is enabled.
|
||||
bool pan_coord : 1; ///< Indicating if radio is configured as the PAN coordinator.
|
||||
uint8_t channel : 5; ///< Channel on which the node receives messages.
|
||||
bool rx_on_when_idle; ///< Indicating if radio is in RxOnWhenIdle mode.
|
||||
nrf_802154_pib_coex_t coex; ///< Coex-related fields.
|
||||
|
||||
#if NRF_802154_CSMA_CA_ENABLED
|
||||
|
@ -176,10 +177,11 @@ static bool coex_rx_request_mode_is_supported(nrf_802154_coex_rx_request_mode_t
|
|||
|
||||
void nrf_802154_pib_init(void)
|
||||
{
|
||||
m_data.promiscuous = false;
|
||||
m_data.auto_ack = true;
|
||||
m_data.pan_coord = false;
|
||||
m_data.channel = 11;
|
||||
m_data.promiscuous = false;
|
||||
m_data.rx_on_when_idle = true;
|
||||
m_data.auto_ack = true;
|
||||
m_data.pan_coord = false;
|
||||
m_data.channel = 11;
|
||||
|
||||
memset(m_data.pan_id, 0xff, sizeof(m_data.pan_id));
|
||||
m_data.short_addr[0] = 0xfe;
|
||||
|
@ -222,6 +224,16 @@ void nrf_802154_pib_promiscuous_set(bool enabled)
|
|||
m_data.promiscuous = enabled;
|
||||
}
|
||||
|
||||
bool nrf_802154_pib_rx_on_when_idle_get(void)
|
||||
{
|
||||
return m_data.rx_on_when_idle;
|
||||
}
|
||||
|
||||
void nrf_802154_pib_rx_on_when_idle_set(bool enabled)
|
||||
{
|
||||
m_data.rx_on_when_idle = enabled;
|
||||
}
|
||||
|
||||
bool nrf_802154_pib_auto_ack_get(void)
|
||||
{
|
||||
return m_data.auto_ack;
|
||||
|
|
|
@ -69,6 +69,21 @@ bool nrf_802154_pib_promiscuous_get(void);
|
|||
*/
|
||||
void nrf_802154_pib_promiscuous_set(bool enabled);
|
||||
|
||||
/**
|
||||
* @brief Checks if the RxOnWhenIdle mode is enabled.
|
||||
*
|
||||
* @retval true The RxOnWhenIdle mode is enabled.
|
||||
* @retval false The RxOnWhenIdle mode is disabled.
|
||||
*/
|
||||
bool nrf_802154_pib_rx_on_when_idle_get(void);
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the RxOnWhenIdle mode.
|
||||
*
|
||||
* @param[in] enabled If the RxOnWhenIdle mode is to be enabled.
|
||||
*/
|
||||
void nrf_802154_pib_rx_on_when_idle_set(bool enabled);
|
||||
|
||||
/**
|
||||
* @brief Checks if the auto ACK procedure is enabled.
|
||||
*
|
||||
|
|
|
@ -125,24 +125,26 @@
|
|||
|
||||
#endif
|
||||
|
||||
#define SHORTS_MOD_CARRIER (NRF_RADIO_SHORT_TXREADY_START_MASK | \
|
||||
NRF_RADIO_SHORT_PHYEND_START_MASK)
|
||||
#define SHORTS_MOD_CARRIER (NRF_RADIO_SHORT_TXREADY_START_MASK | \
|
||||
NRF_RADIO_SHORT_PHYEND_START_MASK)
|
||||
|
||||
#define SHORTS_ED (NRF_RADIO_SHORT_READY_EDSTART_MASK)
|
||||
#define SHORTS_ED (NRF_RADIO_SHORT_READY_EDSTART_MASK)
|
||||
|
||||
#define SHORTS_CCA (NRF_RADIO_SHORT_RXREADY_CCASTART_MASK | \
|
||||
NRF_RADIO_SHORT_CCABUSY_DISABLE_MASK)
|
||||
#define SHORTS_CCA (NRF_RADIO_SHORT_RXREADY_CCASTART_MASK | \
|
||||
NRF_RADIO_SHORT_CCABUSY_DISABLE_MASK)
|
||||
|
||||
#define CRC_LENGTH 2 ///< Length of CRC in 802.15.4 frames [bytes]
|
||||
#define CRC_POLYNOMIAL 0x011021 ///< Polynomial used for CRC calculation in 802.15.4 frames
|
||||
#define CRC_LENGTH 2 ///< Length of CRC in 802.15.4 frames [bytes]
|
||||
#define CRC_POLYNOMIAL 0x011021 ///< Polynomial used for CRC calculation in 802.15.4 frames
|
||||
|
||||
#define TXRU_TIME 40 ///< Transmitter ramp up time [us]
|
||||
#define EVENT_LAT 23 ///< END event latency [us]
|
||||
#ifndef MAX_RXRAMPDOWN_CYCLES
|
||||
#define MAX_RXRAMPDOWN_CYCLES 32 ///< Maximum number of cycles that RX ramp-down might take
|
||||
#define TXRU_TIME 40 ///< Transmitter ramp up time [us]
|
||||
#define EVENT_LAT 23 ///< END event latency [us]
|
||||
|
||||
#if !defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
|
||||
#define MAX_RAMPDOWN_CYCLES (50 * (SystemCoreClock / 1000000UL)) ///< Maximum number of busy wait loop cycles that radio ramp-down is allowed to take
|
||||
#else
|
||||
#define MAX_RAMPDOWN_CYCLES 10
|
||||
#endif
|
||||
|
||||
#define RSSI_SETTLE_TIME_US 15 ///< Time required for RSSI measurements to become valid after signal level change.
|
||||
#define RSSI_SETTLE_TIME_US 15 ///< Time required for RSSI measurements to become valid after signal level change.
|
||||
|
||||
#if NRF_802154_INTERNAL_RADIO_IRQ_HANDLING
|
||||
void nrf_802154_radio_irq_handler(void); ///< Prototype required by internal RADIO IRQ handler
|
||||
|
@ -168,6 +170,12 @@ void nrf_802154_radio_irq_handler(void); ///< Prototype required by internal RAD
|
|||
#define NRF_802154_TRX_TEST_MODE_ALLOW_LATE_TX_ACK 0
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
|
||||
/// System Clock Frequency (Core Clock) provided by nrfx.
|
||||
extern uint32_t SystemCoreClock;
|
||||
|
||||
#endif
|
||||
|
||||
/// Common parameters for the FEM handling.
|
||||
static const mpsl_fem_event_t m_activate_rx_cc0 =
|
||||
{
|
||||
|
@ -325,6 +333,44 @@ static void timer_frequency_set_1mhz(void)
|
|||
nrf_timer_prescaler_set(NRF_802154_TIMER_INSTANCE, prescaler);
|
||||
}
|
||||
|
||||
static inline void wait_until_radio_is_disabled(void)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_HIGH);
|
||||
|
||||
bool radio_is_disabled = false;
|
||||
|
||||
/* RADIO should enter DISABLED state after no longer than RX ramp-down time or TX ramp-down
|
||||
* time, depending on its initial state before TASK_DISABLE was triggered. The loop below busy
|
||||
* waits for the state transition to complete. To prevent the CPU from spinning in an endless
|
||||
* loop, the maximum allowed number of loop cycles is limited. The limit's intention is not to
|
||||
* approximate the expected maximum time the transition might actually take, which is generally
|
||||
* very short, but to act as a safeguard against obviously incorrect and unexpected behaviors.
|
||||
* In practice, in most cases the radio will have already changed state to DISABLED before this
|
||||
* function starts. In the remaining cases several cycles of the loop should be sufficient for
|
||||
* the transition to complete.
|
||||
*/
|
||||
for (uint32_t i = 0; i < MAX_RAMPDOWN_CYCLES; i++)
|
||||
{
|
||||
if (nrf_radio_state_get(NRF_RADIO) == NRF_RADIO_STATE_DISABLED)
|
||||
{
|
||||
radio_is_disabled = true;
|
||||
break;
|
||||
}
|
||||
#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
|
||||
nrf_802154_delay_us(1);
|
||||
/* In this simulated board, and in general in the POSIX ARCH,
|
||||
* code takes 0 simulated time to execute.
|
||||
* Let's hold for 1 microsecond to allow the RADIO HW to clear the state
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
NRF_802154_ASSERT(radio_is_disabled);
|
||||
(void)radio_is_disabled;
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_HIGH);
|
||||
}
|
||||
|
||||
/** Reset radio peripheral. */
|
||||
static void nrf_radio_reset(void)
|
||||
{
|
||||
|
@ -348,6 +394,24 @@ static void nrf_radio_reset(void)
|
|||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
||||
/** Robustly disable the radio peripheral. */
|
||||
static void radio_robust_disable(void)
|
||||
{
|
||||
nrf_radio_state_t radio_state = nrf_radio_state_get(NRF_RADIO);
|
||||
|
||||
if ((radio_state == NRF_RADIO_STATE_RXDISABLE) || (radio_state == NRF_RADIO_STATE_TXDISABLE))
|
||||
{
|
||||
/* RADIO is in an unstable state that should resolve to DISABLED. Do nothing. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* RADIO is in a stable state and needs to be transitioned to DISABLED manually.
|
||||
* It cannot be disabled if EVENT_DISABLED is set. Clear it first. */
|
||||
nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_DISABLED);
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
static void channel_set(uint8_t channel)
|
||||
{
|
||||
NRF_802154_ASSERT(channel >= 11U && channel <= 26U);
|
||||
|
@ -589,39 +653,6 @@ static void pa_modulation_fix_apply(bool enable)
|
|||
|
||||
#endif
|
||||
|
||||
static inline void wait_until_radio_is_disabled(void)
|
||||
{
|
||||
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_HIGH);
|
||||
|
||||
bool radio_is_disabled = false;
|
||||
|
||||
// RADIO should enter DISABLED state after no longer than RX ramp-down time, which is equal
|
||||
// approximately 0.5us. Taking a bold assumption that a single iteration of the loop takes
|
||||
// one cycle to complete, 32 iterations would amount to exactly 0.5 us of execution time.
|
||||
// Please note that this approach ignores software latency completely, i.e. RADIO should
|
||||
// have changed state already before entering this function due to ISR processing delays.
|
||||
for (uint32_t i = 0; i < MAX_RXRAMPDOWN_CYCLES; i++)
|
||||
{
|
||||
if (nrf_radio_state_get(NRF_RADIO) == NRF_RADIO_STATE_DISABLED)
|
||||
{
|
||||
radio_is_disabled = true;
|
||||
break;
|
||||
}
|
||||
#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
|
||||
nrf_802154_delay_us(1);
|
||||
/* In this simulated board, and in general in the POSIX ARCH,
|
||||
* code takes 0 simulated time to execute.
|
||||
* Let's hold for 1 microsecond to allow the RADIO HW to clear the state
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
NRF_802154_ASSERT(radio_is_disabled);
|
||||
(void)radio_is_disabled;
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_HIGH);
|
||||
}
|
||||
|
||||
void nrf_802154_trx_module_reset(void)
|
||||
{
|
||||
m_trx_state = TRX_STATE_DISABLED;
|
||||
|
@ -802,7 +833,7 @@ void nrf_802154_trx_disable(void)
|
|||
ppi_all_clear();
|
||||
|
||||
#if !defined(RADIO_POWER_POWER_Msk)
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
wait_until_radio_is_disabled();
|
||||
nrf_radio_reset();
|
||||
#endif
|
||||
|
@ -1730,8 +1761,7 @@ static void go_idle_from_state_finished(void)
|
|||
|
||||
m_trx_state = TRX_STATE_GOING_IDLE;
|
||||
|
||||
nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_DISABLED);
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
|
||||
nrf_radio_int_enable(NRF_RADIO, NRF_RADIO_INT_DISABLED_MASK);
|
||||
|
||||
|
@ -1798,7 +1828,7 @@ static void receive_frame_abort(void)
|
|||
nrf_radio_shorts_set(NRF_RADIO, SHORTS_IDLE);
|
||||
|
||||
m_flags.missing_receive_buffer = false;
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
|
||||
nrf_timer_task_trigger(NRF_802154_TIMER_INSTANCE, NRF_TIMER_TASK_SHUTDOWN);
|
||||
|
||||
|
@ -1876,7 +1906,7 @@ static void receive_ack_abort(void)
|
|||
nrf_radio_shorts_set(NRF_RADIO, SHORTS_IDLE);
|
||||
m_flags.missing_receive_buffer = false;
|
||||
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
|
||||
nrf_timer_task_trigger(NRF_802154_TIMER_INSTANCE, NRF_TIMER_TASK_SHUTDOWN);
|
||||
|
||||
|
@ -1928,7 +1958,7 @@ static void standalone_cca_finish(void)
|
|||
nrf_radio_int_disable(NRF_RADIO, NRF_RADIO_INT_CCABUSY_MASK | NRF_RADIO_INT_CCAIDLE_MASK);
|
||||
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_CCASTOP);
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_HIGH);
|
||||
}
|
||||
|
@ -1980,8 +2010,7 @@ void nrf_802154_trx_continuous_carrier_restart(void)
|
|||
// Continuous carrier PPIs are configured without self-disabling
|
||||
// Triggering RADIO.TASK_DISABLE causes ramp-down -> RADIO.EVENTS_DISABLED -> EGU.TASK -> EGU.EVENT ->
|
||||
// RADIO.TASK_TXEN -> ramp_up -> new continous carrier
|
||||
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
@ -1994,7 +2023,7 @@ static void continuous_carrier_abort(void)
|
|||
|
||||
fem_for_pa_reset();
|
||||
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
|
||||
m_trx_state = TRX_STATE_FINISHED;
|
||||
|
||||
|
@ -2043,8 +2072,7 @@ void nrf_802154_trx_modulated_carrier_restart(void)
|
|||
// Modulated carrier PPIs are configured without self-disabling
|
||||
// Triggering RADIO.TASK_DISABLE causes ramp-down -> RADIO.EVENTS_DISABLED -> EGU.TASK -> EGU.EVENT ->
|
||||
// RADIO.TASK_TXEN -> ramp_up -> new modulated carrier
|
||||
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
|
||||
}
|
||||
|
@ -2059,7 +2087,7 @@ static void modulated_carrier_abort()
|
|||
|
||||
fem_for_pa_reset();
|
||||
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
|
||||
m_trx_state = TRX_STATE_FINISHED;
|
||||
|
||||
|
@ -2116,7 +2144,7 @@ static void energy_detection_finish(void)
|
|||
nrf_radio_shorts_set(NRF_RADIO, SHORTS_IDLE);
|
||||
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_EDSTOP);
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
|
||||
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_HIGH);
|
||||
}
|
||||
|
@ -2366,7 +2394,7 @@ static void transmit_frame_abort(void)
|
|||
m_flags.missing_receive_buffer = false;
|
||||
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_CCASTOP);
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
|
||||
m_trx_state = TRX_STATE_FINISHED;
|
||||
|
||||
|
@ -2438,7 +2466,7 @@ static void transmit_ack_abort(void)
|
|||
|
||||
nrf_radio_int_disable(NRF_RADIO, NRF_RADIO_INT_PHYEND_MASK | NRF_RADIO_INT_ADDRESS_MASK);
|
||||
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
|
||||
m_trx_state = TRX_STATE_FINISHED;
|
||||
|
||||
|
@ -2599,7 +2627,7 @@ static void irq_handler_ccabusy(void)
|
|||
* finish the procedure.
|
||||
*/
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_CCASTOP);
|
||||
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
|
||||
radio_robust_disable();
|
||||
nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_CCABUSY);
|
||||
|
||||
txframe_finish();
|
||||
|
|
|
@ -42,6 +42,7 @@ typedef struct
|
|||
{
|
||||
nrf_802154_transmitted_frame_props_t frame_props; // !< Properties of the frame to be transmitted.
|
||||
nrf_802154_fal_tx_power_split_t tx_power; // !< Power to be used when transmitting the frame, split into components to be applied on each stage on transmit path.
|
||||
uint8_t channel; // !< Transmission channel
|
||||
bool cca; // !< If the driver is to perform CCA procedure before transmission.
|
||||
bool immediate; // !< If true, the driver schedules transmission immediately or never. If false, the transmission may be postponed
|
||||
// until its preconditions are met.
|
||||
|
|
|
@ -465,6 +465,12 @@ typedef enum
|
|||
SPINEL_PROP_VENDOR_NORDIC_NRF_802154_SECURITY_KEY_REMOVE_ALL =
|
||||
SPINEL_PROP_VENDOR_NORDIC_NRF_802154__BEGIN + 66,
|
||||
|
||||
/**
|
||||
* Vendor property for nrf_802154_rx_on_when_idle_set serialization.
|
||||
*/
|
||||
SPINEL_PROP_VENDOR_NORDIC_NRF_802154_RX_ON_WHEN_IDLE_SET =
|
||||
SPINEL_PROP_VENDOR_NORDIC_NRF_802154__BEGIN + 67,
|
||||
|
||||
} spinel_prop_vendor_key_t;
|
||||
|
||||
/**
|
||||
|
@ -555,13 +561,33 @@ typedef enum
|
|||
#define NRF_802154_TX_POWER_METADATA_DECODE(tx_power_metadata) \
|
||||
(&(tx_power_metadata).use_metadata_value), (&(tx_power_metadata).power)
|
||||
|
||||
/**
|
||||
* @brief Spinel data type description for nrf_802154_tx_channel_metadata_t.
|
||||
*/
|
||||
#define SPINEL_DATATYPE_NRF_802154_TX_CHANNEL_METADATA_S \
|
||||
SPINEL_DATATYPE_BOOL_S /* use_metadata_value */ \
|
||||
SPINEL_DATATYPE_UINT8_S /* channel */
|
||||
|
||||
/**
|
||||
* @brief Encodes an instance of @ref SPINEL_DATATYPE_NRF_802154_TX_CHANNEL_METADATA_S data type.
|
||||
*/
|
||||
#define NRF_802154_TX_CHANNEL_METADATA_ENCODE(tx_channel_metadata) \
|
||||
((tx_channel_metadata).use_metadata_value), ((tx_channel_metadata).channel)
|
||||
|
||||
/**
|
||||
* @brief Decodes an instance of @ref SPINEL_DATATYPE_NRF_802154_TX_CHANNEL_METADATA_S data type.
|
||||
*/
|
||||
#define NRF_802154_TX_CHANNEL_METADATA_DECODE(tx_channel_metadata) \
|
||||
(&(tx_channel_metadata).use_metadata_value), (&(tx_channel_metadata).channel)
|
||||
|
||||
/**
|
||||
* @brief Spinel data type description for nrf_802154_transmit_metadata_t.
|
||||
*/
|
||||
#define SPINEL_DATATYPE_NRF_802154_TRANSMIT_METADATA_S \
|
||||
SPINEL_DATATYPE_NRF_802154_TRANSMITTED_FRAME_PROPS_S /* frame_props */ \
|
||||
SPINEL_DATATYPE_BOOL_S /* cca */ \
|
||||
SPINEL_DATATYPE_NRF_802154_TX_POWER_METADATA_S /* tx_power */
|
||||
SPINEL_DATATYPE_NRF_802154_TX_POWER_METADATA_S /* tx_power */ \
|
||||
SPINEL_DATATYPE_NRF_802154_TX_CHANNEL_METADATA_S /* tx_channel */
|
||||
|
||||
/**
|
||||
* @brief Encodes an instance of @ref SPINEL_DATATYPE_NRF_802154_TRANSMIT_METADATA_S data type.
|
||||
|
@ -569,7 +595,8 @@ typedef enum
|
|||
#define NRF_802154_TRANSMIT_METADATA_ENCODE(tx_metadata) \
|
||||
NRF_802154_TRANSMITTED_FRAME_PROPS_ENCODE((tx_metadata).frame_props), \
|
||||
((tx_metadata).cca), \
|
||||
NRF_802154_TX_POWER_METADATA_ENCODE((tx_metadata).tx_power)
|
||||
NRF_802154_TX_POWER_METADATA_ENCODE((tx_metadata).tx_power), \
|
||||
NRF_802154_TX_CHANNEL_METADATA_ENCODE((tx_metadata).tx_channel)
|
||||
|
||||
/**
|
||||
* @brief Decodes an instance of @ref SPINEL_DATATYPE_NRF_802154_TRANSMIT_METADATA_S data type.
|
||||
|
@ -577,28 +604,32 @@ typedef enum
|
|||
#define NRF_802154_TRANSMIT_METADATA_DECODE(tx_metadata) \
|
||||
NRF_802154_TRANSMITTED_FRAME_PROPS_DECODE((tx_metadata).frame_props), \
|
||||
(&(tx_metadata).cca), \
|
||||
NRF_802154_TX_POWER_METADATA_DECODE((tx_metadata).tx_power)
|
||||
NRF_802154_TX_POWER_METADATA_DECODE((tx_metadata).tx_power), \
|
||||
NRF_802154_TX_CHANNEL_METADATA_DECODE((tx_metadata).tx_channel)
|
||||
|
||||
/**
|
||||
* @brief Spinel data type description for nrf_802154_transmit_csma_ca_metadata_t.
|
||||
*/
|
||||
#define SPINEL_DATATYPE_NRF_802154_TRANSMIT_CSMA_CA_METADATA_S \
|
||||
SPINEL_DATATYPE_NRF_802154_TRANSMITTED_FRAME_PROPS_S /* frame_props */ \
|
||||
SPINEL_DATATYPE_NRF_802154_TX_POWER_METADATA_S /* tx_power */
|
||||
SPINEL_DATATYPE_NRF_802154_TX_POWER_METADATA_S /* tx_power */ \
|
||||
SPINEL_DATATYPE_NRF_802154_TX_CHANNEL_METADATA_S /* tx_channel */
|
||||
|
||||
/**
|
||||
* @brief Encodes an instance of @ref SPINEL_DATATYPE_NRF_802154_TRANSMIT_CSMA_CA_METADATA_S data type.
|
||||
*/
|
||||
#define NRF_802154_TRANSMIT_CSMA_CA_METADATA_ENCODE(tx_metadata) \
|
||||
NRF_802154_TRANSMITTED_FRAME_PROPS_ENCODE((tx_metadata).frame_props), \
|
||||
NRF_802154_TX_POWER_METADATA_ENCODE((tx_metadata).tx_power)
|
||||
NRF_802154_TX_POWER_METADATA_ENCODE((tx_metadata).tx_power), \
|
||||
NRF_802154_TX_CHANNEL_METADATA_ENCODE((tx_metadata).tx_channel)
|
||||
|
||||
/**
|
||||
* @brief Decodes an instance of @ref SPINEL_DATATYPE_NRF_802154_TRANSMIT_CSMA_CA_METADATA_S data type.
|
||||
*/
|
||||
#define NRF_802154_TRANSMIT_CSMA_CA_METADATA_DECODE(tx_metadata) \
|
||||
NRF_802154_TRANSMITTED_FRAME_PROPS_DECODE((tx_metadata).frame_props), \
|
||||
NRF_802154_TX_POWER_METADATA_DECODE((tx_metadata).tx_power)
|
||||
NRF_802154_TX_POWER_METADATA_DECODE((tx_metadata).tx_power), \
|
||||
NRF_802154_TX_CHANNEL_METADATA_DECODE((tx_metadata).tx_channel)
|
||||
|
||||
/**
|
||||
* @brief Spinel data type description for nrf_802154_csma_ca_min_be_set.
|
||||
|
@ -851,6 +882,11 @@ typedef enum
|
|||
*/
|
||||
#define SPINEL_DATATYPE_NRF_802154_PROMISCUOUS_SET SPINEL_DATATYPE_BOOL_S
|
||||
|
||||
/**
|
||||
* @brief Spinel data type description for nrf_802154_rx_on_when_idle_set.
|
||||
*/
|
||||
#define SPINEL_DATATYPE_NRF_802154_RX_ON_WHEN_IDLE_SET SPINEL_DATATYPE_BOOL_S
|
||||
|
||||
/**
|
||||
* @brief Spinel data type description for nrf_802154_cca.
|
||||
*/
|
||||
|
|
|
@ -741,6 +741,31 @@ bail:
|
|||
SERIALIZATION_ERROR_RAISE_IF_FAILED(error);
|
||||
}
|
||||
|
||||
void nrf_802154_rx_on_when_idle_set(bool enabled)
|
||||
{
|
||||
nrf_802154_ser_err_t res;
|
||||
|
||||
SERIALIZATION_ERROR_INIT(error);
|
||||
|
||||
NRF_802154_SPINEL_LOG_BANNER_CALLING();
|
||||
NRF_802154_SPINEL_LOG_VAR_NAMED("%s", enabled ? "true" : "false", "enabled");
|
||||
|
||||
nrf_802154_spinel_response_notifier_lock_before_request(SPINEL_PROP_LAST_STATUS);
|
||||
|
||||
res = nrf_802154_spinel_send_cmd_prop_value_set(
|
||||
SPINEL_PROP_VENDOR_NORDIC_NRF_802154_RX_ON_WHEN_IDLE_SET,
|
||||
SPINEL_DATATYPE_NRF_802154_RX_ON_WHEN_IDLE_SET,
|
||||
enabled);
|
||||
|
||||
SERIALIZATION_ERROR_CHECK(res, error, bail);
|
||||
|
||||
res = status_ok_await(CONFIG_NRF_802154_SER_DEFAULT_RESPONSE_TIMEOUT);
|
||||
SERIALIZATION_ERROR_CHECK(res, error, bail);
|
||||
|
||||
bail:
|
||||
SERIALIZATION_ERROR_RAISE_IF_FAILED(error);
|
||||
}
|
||||
|
||||
void nrf_802154_src_addr_matching_method_set(nrf_802154_src_addr_match_t match_method)
|
||||
{
|
||||
nrf_802154_ser_err_t res;
|
||||
|
@ -1163,7 +1188,8 @@ bool nrf_802154_transmit_csma_ca_raw(uint8_t
|
|||
static const nrf_802154_transmit_csma_ca_metadata_t metadata_default =
|
||||
{
|
||||
.frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT,
|
||||
.tx_power = {.use_metadata_value = false}
|
||||
.tx_power = {.use_metadata_value = false},
|
||||
.tx_channel = {.use_metadata_value = false}
|
||||
};
|
||||
|
||||
p_metadata = &metadata_default;
|
||||
|
@ -1460,7 +1486,8 @@ bool nrf_802154_transmit_raw(uint8_t * p_data,
|
|||
{
|
||||
.frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT,
|
||||
.cca = true,
|
||||
.tx_power = {.use_metadata_value = false}
|
||||
.tx_power = {.use_metadata_value = false},
|
||||
.tx_channel = {.use_metadata_value = false}
|
||||
};
|
||||
|
||||
p_metadata = &metadata_default;
|
||||
|
|
|
@ -413,6 +413,35 @@ static nrf_802154_ser_err_t spinel_decode_prop_nrf_802154_promiscuous_set(
|
|||
return nrf_802154_spinel_send_prop_last_status_is(SPINEL_STATUS_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode and dispatch SPINEL_PROP_VENDOR_NORDIC_NRF_802154_RX_ON_WHEN_IDLE_SET.
|
||||
*
|
||||
* @param[in] p_property_data Pointer to a buffer that contains data to be decoded.
|
||||
* @param[in] property_data_len Size of the @ref p_property_data buffer.
|
||||
*
|
||||
*/
|
||||
static nrf_802154_ser_err_t spinel_decode_prop_nrf_802154_rx_on_when_idle_set(
|
||||
const void * p_property_data,
|
||||
size_t property_data_len)
|
||||
{
|
||||
bool enabled;
|
||||
spinel_ssize_t siz;
|
||||
|
||||
siz = spinel_datatype_unpack(p_property_data,
|
||||
property_data_len,
|
||||
SPINEL_DATATYPE_NRF_802154_RX_ON_WHEN_IDLE_SET,
|
||||
&enabled);
|
||||
|
||||
if (siz < 0)
|
||||
{
|
||||
return NRF_802154_SERIALIZATION_ERROR_DECODING_FAILURE;
|
||||
}
|
||||
|
||||
nrf_802154_rx_on_when_idle_set(enabled);
|
||||
|
||||
return nrf_802154_spinel_send_prop_last_status_is(SPINEL_STATUS_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode and dispatch SPINEL_PROP_VENDOR_NORDIC_NRF_802154_CCA.
|
||||
*
|
||||
|
@ -1937,6 +1966,10 @@ nrf_802154_ser_err_t nrf_802154_spinel_decode_cmd_prop_value_set(const void * p_
|
|||
return spinel_decode_prop_nrf_802154_promiscuous_set(p_property_data,
|
||||
property_data_len);
|
||||
|
||||
case SPINEL_PROP_VENDOR_NORDIC_NRF_802154_RX_ON_WHEN_IDLE_SET:
|
||||
return spinel_decode_prop_nrf_802154_rx_on_when_idle_set(p_property_data,
|
||||
property_data_len);
|
||||
|
||||
case SPINEL_PROP_VENDOR_NORDIC_NRF_802154_CCA:
|
||||
return spinel_decode_prop_nrf_802154_cca(p_property_data, property_data_len);
|
||||
|
||||
|
|
Loading…
Reference in New Issue