Skip to content

Commit 5af49c1

Browse files
nordic-krchcarlescufi
authored andcommitted
hal_nordic: Add protection against resource conflict
Add check in CMake files to prevent resource overlap for TIMER0, TIMER1, RTC0. Signed-off-by: Krzysztof Chruscinski <[email protected]>
1 parent 9a73b9c commit 5af49c1

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

modules/hal_nordic/nrf_802154/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ zephyr_library_named(nrf-802154-platform)
55
zephyr_interface_library_named(zephyr-802154-interface)
66

77
if (CONFIG_NRF_802154_RADIO_DRIVER)
8+
dt_nodelabel(timer1_node NODELABEL "timer1")
9+
dt_node_has_status(status_result PATH ${timer1_node} STATUS okay)
10+
if (${status_result})
11+
message(FATAL_ERROR "Resource conflict. IEEE802.15.4 Radio driver requires TIMER1 but "
12+
"timer1 node is enabled (for counter driver).")
13+
endif()
14+
815
target_sources(nrf-802154-platform
916
PRIVATE
1017
${CMAKE_CURRENT_SOURCE_DIR}/radio/platform/nrf_802154_random_zephyr.c

modules/hal_nordic/nrf_802154/radio/platform/nrf_802154_random_zephyr.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
#include <platform/nrf_802154_temperature.h>
99
#include <zephyr/drivers/entropy.h>
1010

11-
/* Ensure that counter driver for TIMER1 is not enabled. */
12-
BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(timer1), disabled),
13-
"Counter for TIMER1 must be disabled");
14-
1511
static uint32_t state;
1612

1713
static uint32_t next(void)

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@
2929

3030
#include "radio_internal.h"
3131

32-
/* Ensure that counter driver for RTC0 is not enabled. */
33-
BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(rtc0), disabled),
34-
"Counter for RTC0 must be disabled");
35-
3632
/* Converts the GPIO controller in a FEM property's GPIO specification
3733
* to its nRF register map pointer.
3834
*

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrfxx.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,6 @@
187187
#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
188188
#undef EVENT_TIMER
189189
#define EVENT_TIMER NRF_TIMER0
190-
/* Ensure that counter driver for TIMER0 is not enabled. */
191-
BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(timer0), disabled),
192-
"Counter for TIMER0 must be disabled");
193190
#define SW_SWITCH_TIMER EVENT_TIMER
194191
#define SW_SWITCH_TIMER_EVTS_COMP_BASE 0
195192
#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */

subsys/bluetooth/controller/ll_sw/nrf.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
# SPDX-License-Identifier: Apache-2.0
22

33
if(CONFIG_BT_LL_SW_SPLIT)
4+
dt_nodelabel(rtc0_node NODELABEL "rtc0")
5+
dt_node_has_status(status_result PATH ${rtc0_node} STATUS okay)
6+
if (${status_result})
7+
message(FATAL_ERROR "Resource conflict. Bluetooth Link Layer requires RTC0 but "
8+
"rtc0 node is enabled (for counter driver).")
9+
endif()
10+
dt_nodelabel(timer0_node NODELABEL "timer0")
11+
dt_node_has_status(status_result PATH ${timer0_node} STATUS okay)
12+
if (${status_result})
13+
message(FATAL_ERROR "Resource conflict. Bluetooth Link Layer requires TIMER0 but "
14+
"timer0 node is enabled (for counter driver).")
15+
endif()
416
zephyr_library_sources(
517
ll_sw/nordic/lll/lll.c
618
ll_sw/nordic/lll/lll_clock.c

0 commit comments

Comments
 (0)