Bluetooth controller nrf: nrf52 bsim radio hal header minor updates

Align the header a bit with the one for the real radio,
adding missing Tx power levels and removing TODO which did not
need doing.
The old one originated as a copy of the nrf52833 one, and did not
evolve like the real ones.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-09-21 10:09:47 +02:00 committed by Carles Cufí
commit 865f3c1614

View file

@ -185,14 +185,10 @@
static inline void hal_radio_reset(void)
{
/* TODO: Add any required setup for each radio event
*/
}
static inline void hal_radio_stop(void)
{
/* TODO: Add any required cleanup of actions taken in hal_radio_reset()
*/
}
static inline void hal_radio_ram_prio_setup(void)
@ -226,25 +222,39 @@ static inline uint32_t hal_radio_tx_power_min_get(void)
static inline uint32_t hal_radio_tx_power_max_get(void)
{
#if defined(RADIO_TXPOWER_TXPOWER_Pos4dBm)
return RADIO_TXPOWER_TXPOWER_Pos4dBm;
#else
return RADIO_TXPOWER_TXPOWER_0dBm;
#endif
return RADIO_TXPOWER_TXPOWER_Pos8dBm;
}
static inline uint32_t hal_radio_tx_power_floor(int8_t tx_power_lvl)
{
#if defined(RADIO_TXPOWER_TXPOWER_Pos4dBm)
if (tx_power_lvl >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos8dBm) {
return RADIO_TXPOWER_TXPOWER_Pos8dBm;
}
if (tx_power_lvl >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos7dBm) {
return RADIO_TXPOWER_TXPOWER_Pos7dBm;
}
if (tx_power_lvl >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos6dBm) {
return RADIO_TXPOWER_TXPOWER_Pos6dBm;
}
if (tx_power_lvl >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos5dBm) {
return RADIO_TXPOWER_TXPOWER_Pos5dBm;
}
if (tx_power_lvl >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos4dBm) {
return RADIO_TXPOWER_TXPOWER_Pos4dBm;
}
#endif
#if defined(RADIO_TXPOWER_TXPOWER_Pos3dBm)
if (tx_power_lvl >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos3dBm) {
return RADIO_TXPOWER_TXPOWER_Pos3dBm;
}
#endif
if (tx_power_lvl >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos2dBm) {
return RADIO_TXPOWER_TXPOWER_Pos2dBm;
}
if (tx_power_lvl >= (int8_t)RADIO_TXPOWER_TXPOWER_0dBm) {
return RADIO_TXPOWER_TXPOWER_0dBm;
}
@ -269,10 +279,7 @@ static inline uint32_t hal_radio_tx_power_floor(int8_t tx_power_lvl)
return RADIO_TXPOWER_TXPOWER_Neg20dBm;
}
if (tx_power_lvl >= (int8_t)RADIO_TXPOWER_TXPOWER_Neg30dBm) {
return RADIO_TXPOWER_TXPOWER_Neg30dBm;
}
/* Note: The -30 dBm power level is deprecated so ignore it! */
return RADIO_TXPOWER_TXPOWER_Neg40dBm;
}