@ -51,6 +51,9 @@
# include "hal/nrf_egu.h"
# include "hal/nrf_radio.h"
# include "hal/nrf_timer.h"
# if defined(NRF53_SERIES)
# include "hal/nrf_vreqctrl.h"
# endif
# include "nrf_802154_procedures_duration.h"
# include "nrf_802154_critical_section.h"
@ -195,7 +198,6 @@ static nrf_802154_flags_t m_flags; ///< Flags used to store the current driver s
/** @brief Value of TIMER internal counter from which the counting is resumed on RADIO.EVENTS_END event. */
static volatile uint32_t m_timer_value_on_radio_end_event ;
static volatile bool m_transmit_with_cca ;
static int8_t m_fem_gain_in_disabled ;
static void rxframe_finish_disable_ppis ( void ) ;
static void rxack_finish_disable_ppis ( void ) ;
@ -226,13 +228,29 @@ void rx_flags_clear(void)
static void * volatile mp_receive_buffer ;
static void txpower_set ( nrf_radio_txpower_t txpower )
{
# ifdef NRF53_SERIES
bool radio_high_voltage_enable = false ;
if ( ( int8_t ) txpower > 0 )
{
/* To get higher than 0dBm raise operating voltage of the radio, giving 3dBm power boost */
radio_high_voltage_enable = true ;
txpower - = 3 ;
}
nrf_vreqctrl_radio_high_voltage_set ( NRF_VREQCTRL_NS , radio_high_voltage_enable ) ;
# endif
nrf_radio_txpower_set ( NRF_RADIO , txpower ) ;
}
/** Initialize TIMER peripheral used by the driver. */
void nrf_timer_init ( void )
{
nrf_timer_task_trigger ( NRF_802154_TIMER_INSTANCE , NRF_TIMER_TASK_SHUTDOWN ) ;
nrf_timer_mode_set ( NRF_802154_TIMER_INSTANCE , NRF_TIMER_MODE_TIMER ) ;
nrf_timer_bit_width_set ( NRF_802154_TIMER_INSTANCE , NRF_TIMER_BIT_WIDTH_32 ) ;
nrf_timer_frequency_set ( NRF_802154_TIMER_INSTANCE , NRF_TIMER_FREQ_1MHz ) ;
nrf_timer_ prescaler _set( NRF_802154_TIMER_INSTANCE , NRF_TIMER_FREQ_1MHz ) ;
# if NRF_802154_DISABLE_BCC_MATCHING
// Setup timer for detecting PSDU reception.
@ -320,9 +338,9 @@ static void fem_for_lna_reset(void)
*
* @ note This function must be called before ramp up PPIs are configured .
*/
static void fem_for_pa_set ( int8 _t gain)
static void fem_for_pa_set ( const mpsl_fem_ga in_t * p_fem_ gain_data )
{
( void ) mpsl_fem_pa_gain_set ( gain) ;
( void ) mpsl_fem_pa_gain_set ( p_fem_ gain_data ) ;
if ( mpsl_fem_pa_configuration_set ( & m_activate_tx_cc0 , NULL ) = = 0 )
{
nrf_timer_shorts_enable ( m_activate_tx_cc0 . event . timer . p_timer_instance ,
@ -347,11 +365,11 @@ static void fem_for_pa_reset(void)
*
* @ note This function must be called before ramp up PPIs are configured .
*/
static void fem_for_tx_set ( bool cca , int8 _t gain)
static void fem_for_tx_set ( bool cca , const mpsl_fem_ga in_t * p_fem_ gain_data )
{
bool success ;
( void ) mpsl_fem_pa_gain_set ( gain) ;
( void ) mpsl_fem_pa_gain_set ( p_fem_ gain_data ) ;
if ( cca )
{
@ -461,7 +479,6 @@ void nrf_802154_trx_module_reset(void)
m_trx_state = TRX_STATE_DISABLED ;
m_timer_value_on_radio_end_event = 0 ;
m_transmit_with_cca = false ;
m_fem_gain_in_disabled = 0 ;
mp_receive_buffer = NULL ;
memset ( & m_flags , 0 , sizeof ( m_flags ) ) ;
@ -534,8 +551,6 @@ void nrf_802154_trx_enable(void)
assert ( nrf_radio_shorts_get ( NRF_RADIO ) = = SHORTS_IDLE ) ;
mpsl_fem_pa_is_configured ( & m_fem_gain_in_disabled ) ;
# if defined(NRF52840_XXAA) || \
defined ( NRF52833_XXAA )
mpsl_fem_abort_set ( nrf_radio_event_address_get ( NRF_RADIO , NRF_RADIO_EVENT_DISABLED ) ,
@ -646,9 +661,6 @@ void nrf_802154_trx_disable(void)
mpsl_fem_pa_configuration_clear ( ) ;
mpsl_fem_abort_clear ( ) ;
/* Restore gain of the FEM to the state latched in nrf_802154_trx_enable */
( void ) mpsl_fem_pa_gain_set ( m_fem_gain_in_disabled ) ;
if ( m_trx_state ! = TRX_STATE_IDLE )
{
fem_power_down_now ( ) ;
@ -909,9 +921,9 @@ bool nrf_802154_trx_receive_buffer_set(void * p_receive_buffer)
return result ;
}
void nrf_802154_trx_receive_frame ( uint8_t bcc ,
nrf_802154_trx_receive_notifications_t notifications_mask ,
const nrf_802154_ tx_power_split_t * p_ack_tx_power )
void nrf_802154_trx_receive_frame ( uint8_t bcc ,
nrf_802154_trx_receive_notifications_t notifications_mask ,
const nrf_802154_ fal_ tx_power_split_t * p_ack_tx_power )
{
nrf_802154_log_function_enter ( NRF_802154_LOG_VERBOSITY_LOW ) ;
@ -930,7 +942,7 @@ void nrf_802154_trx_receive_frame(uint8_t bcc,
m_flags . rssi_settled = false ;
nrf_radio_ txpower_set( NRF_RADIO , p_ack_tx_power - > radio_tx_power ) ;
txpower_set( p_ack_tx_power - > radio_tx_power ) ;
if ( mp_receive_buffer ! = NULL )
{
@ -1017,7 +1029,7 @@ void nrf_802154_trx_receive_frame(uint8_t bcc,
}
// Set FEM PA gain for ACK transmission
mpsl_fem_pa_gain_set ( p_ack_tx_power - > fem _gain ) ;
mpsl_fem_pa_gain_set ( & p_ack_tx_power - > fem ) ;
m_timer_value_on_radio_end_event = delta_time ;
@ -1145,7 +1157,7 @@ bool nrf_802154_trx_rssi_sample_is_available(void)
void nrf_802154_trx_transmit_frame ( const void * p_transmit_buffer ,
bool cca ,
const nrf_802154_ tx_power_split_t * p_tx_power ,
const nrf_802154_ fal_ tx_power_split_t * p_tx_power ,
nrf_802154_trx_transmit_notifications_t notifications_mask )
{
nrf_802154_log_function_enter ( NRF_802154_LOG_VERBOSITY_LOW ) ;
@ -1158,7 +1170,7 @@ void nrf_802154_trx_transmit_frame(const void * p_tra
m_trx_state = TRX_STATE_TXFRAME ;
m_transmit_with_cca = cca ;
nrf_radio_ txpower_set( NRF_RADIO , p_tx_power - > radio_tx_power ) ;
txpower_set( p_tx_power - > radio_tx_power ) ;
nrf_radio_packetptr_set ( NRF_RADIO , p_transmit_buffer ) ;
@ -1203,7 +1215,7 @@ void nrf_802154_trx_transmit_frame(const void * p_tra
nrf_radio_int_enable ( NRF_RADIO , ints_to_enable ) ;
fem_for_tx_set ( cca , p_tx_power - > fem _gain ) ;
fem_for_tx_set ( cca , & p_tx_power - > fem ) ;
nrf_802154_trx_antenna_update ( ) ;
nrf_802154_trx_ppi_for_ramp_up_set ( cca ? NRF_RADIO_TASK_RXEN : NRF_RADIO_TASK_TXEN , false ) ;
@ -1775,7 +1787,7 @@ static void standalone_cca_abort(void)
# if NRF_802154_CARRIER_FUNCTIONS_ENABLED
void nrf_802154_trx_continuous_carrier ( const nrf_802154_ tx_power_split_t * p_tx_power )
void nrf_802154_trx_continuous_carrier ( const nrf_802154_ fal_ tx_power_split_t * p_tx_power )
{
nrf_802154_log_function_enter ( NRF_802154_LOG_VERBOSITY_LOW ) ;
@ -1784,10 +1796,10 @@ void nrf_802154_trx_continuous_carrier(const nrf_802154_tx_power_split_t * p_tx_
m_trx_state = TRX_STATE_CONTINUOUS_CARRIER ;
// Set Tx Power
nrf_radio_ txpower_set( NRF_RADIO , p_tx_power - > radio_tx_power ) ;
txpower_set( p_tx_power - > radio_tx_power ) ;
// Set FEM
fem_for_pa_set ( p_tx_power - > fem _gain ) ;
fem_for_pa_set ( & p_tx_power - > fem ) ;
// Select antenna
nrf_802154_trx_antenna_update ( ) ;
@ -1830,8 +1842,8 @@ static void continuous_carrier_abort(void)
nrf_802154_log_function_exit ( NRF_802154_LOG_VERBOSITY_HIGH ) ;
}
void nrf_802154_trx_modulated_carrier ( const void * p_transmit_buffer ,
const nrf_802154_ tx_power_split_t * p_tx_power )
void nrf_802154_trx_modulated_carrier ( const void * p_transmit_buffer ,
const nrf_802154_ fal_ tx_power_split_t * p_tx_power )
{
nrf_802154_log_function_enter ( NRF_802154_LOG_VERBOSITY_LOW ) ;
@ -1841,7 +1853,7 @@ void nrf_802154_trx_modulated_carrier(const void * p_tran
m_trx_state = TRX_STATE_MODULATED_CARRIER ;
// Set Tx Power
nrf_radio_ txpower_set( NRF_RADIO , p_tx_power - > radio_tx_power ) ;
txpower_set( p_tx_power - > radio_tx_power ) ;
// Set Tx buffer
nrf_radio_packetptr_set ( NRF_RADIO , p_transmit_buffer ) ;
@ -1850,7 +1862,7 @@ void nrf_802154_trx_modulated_carrier(const void * p_tran
nrf_radio_shorts_set ( NRF_RADIO , SHORTS_MOD_CARRIER ) ;
// Set FEM
fem_for_pa_set ( p_tx_power - > fem _gain ) ;
fem_for_pa_set ( & p_tx_power - > fem ) ;
// Select antenna
nrf_802154_trx_antenna_update ( ) ;