From 688fb3c8247b0607d77c2f82b64b92e0d3498fd3 Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Mon, 23 Jun 2025 08:01:35 +0200 Subject: [PATCH] lib: stm32wba: use reference count for backup domain accesses Add LINKLAYER_PLAT_EnableBackupDomainAccess() and LINKLAYER_PLAT_DisableBackupDomainAccess() to use Zephyr resources that use a reference counter for access requests, for enabling and disabling access the BackupDomain resources. Signed-off-by: Etienne Carriere --- .../STM32_WPAN/Target/linklayer_plat.c | 8 ++++++++ .../link_layer/ll_sys/inc/linklayer_plat.h | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/stm32wba/BLE_TransparentMode/STM32_WPAN/Target/linklayer_plat.c b/lib/stm32wba/BLE_TransparentMode/STM32_WPAN/Target/linklayer_plat.c index e173c11f6..046393555 100644 --- a/lib/stm32wba/BLE_TransparentMode/STM32_WPAN/Target/linklayer_plat.c +++ b/lib/stm32wba/BLE_TransparentMode/STM32_WPAN/Target/linklayer_plat.c @@ -70,12 +70,20 @@ void LINKLAYER_PLAT_ClockInit(void) AHB5_SwitchedOff = 0; radio_sleep_timer_val = 0; +#ifdef __ZEPHYR__ + LINKLAYER_PLAT_EnableBackupDomainAccess(); +#else LL_PWR_EnableBkUpAccess(); +#endif /* Select LSE as Sleep CLK */ __HAL_RCC_RADIOSLPTIM_CONFIG(RCC_RADIOSTCLKSOURCE_LSE); +#ifdef __ZEPHYR__ + LINKLAYER_PLAT_DisableBackupDomainAccess(); +#else LL_PWR_DisableBkUpAccess(); +#endif /* Enable AHB5ENR peripheral clock (bus CLK) */ __HAL_RCC_RADIO_CLK_ENABLE(); diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/inc/linklayer_plat.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/inc/linklayer_plat.h index 7898a577b..e22919a5a 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/inc/linklayer_plat.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/inc/linklayer_plat.h @@ -29,6 +29,22 @@ */ extern void LINKLAYER_PLAT_ClockInit(void); +#ifdef __ZEPHYR__ +/** + * @brief Enable access to backup domain resources + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_EnableBackupDomainAccess(void); + +/** + * @brief Disable access to backup domain resources + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_DisableBackupDomainAccess(void); +#endif /* __ZEPHYR__ */ + /** * @brief Link Layer active waiting loop. * @param delay: delay in us