Skip to content

Commit 528f138

Browse files
committed
drivers: nrf: add build asserts for memory-regions property
Add build asserts for "memory-regions" property in nrf drivers which is required on targets with DMM for saadc, pdm, pwm, twim, twim_rtio, twis, tdm, uarte, spim and spis. On targets where the property is not required the assertion macro expands to nothing. Signed-off-by: Michał Bainczyk <michal.bainczyk@nordicsemi.no>
1 parent b15404f commit 528f138

File tree

11 files changed

+24
-0
lines changed

11 files changed

+24
-0
lines changed

drivers/adc/adc_nrfx_saadc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,5 +711,7 @@ static DEVICE_API(adc, adc_nrfx_driver_api) = {
711711
/* Validate configuration of all channels. */
712712
DT_FOREACH_CHILD(DT_DRV_INST(0), VALIDATE_CHANNEL_CONFIG)
713713

714+
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(0));
715+
714716
DEVICE_DT_INST_DEFINE(0, init_saadc, NULL, NULL, NULL, POST_KERNEL,
715717
CONFIG_ADC_INIT_PRIORITY, &adc_nrfx_driver_api);

drivers/audio/dmic_nrfx_pdm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ static const struct _dmic_ops dmic_ops = {
730730
.clk_src = PDM_CLK_SRC(idx), \
731731
.mem_reg = DMM_DEV_TO_REG(PDM(idx)), \
732732
}; \
733+
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(PDM(idx)); \
733734
BUILD_ASSERT(PDM_CLK_SRC(idx) != ACLK || \
734735
NRF_PDM_HAS_SELECTABLE_CLOCK, \
735736
"Clock source ACLK is not available."); \

drivers/i2c/i2c_nrfx_twim.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ static DEVICE_API(i2c, i2c_nrfx_twim_driver_api) = {
253253

254254
#define I2C_NRFX_TWIM_DEVICE(idx) \
255255
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(I2C(idx)); \
256+
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(I2C(idx)); \
256257
BUILD_ASSERT(I2C_FREQUENCY(idx) != \
257258
I2C_NRFX_TWIM_INVALID_FREQUENCY, \
258259
"Wrong I2C " #idx " frequency setting in dts"); \

drivers/i2c/i2c_nrfx_twim_rtio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ static int i2c_nrfx_twim_rtio_deinit(const struct device *dev)
254254

255255
#define I2C_NRFX_TWIM_RTIO_DEVICE(idx) \
256256
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(I2C(idx)); \
257+
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(I2C(idx)); \
257258
BUILD_ASSERT(I2C_FREQUENCY(idx) != I2C_NRFX_TWIM_INVALID_FREQUENCY, \
258259
"Wrong I2C " #idx " frequency setting in dts"); \
259260
static void irq_connect##idx(void) \

drivers/i2c/i2c_nrfx_twis.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ static int shim_nrf_twis_deinit(const struct device *dev)
325325
_CONCAT_4(shim_nrf_twis_, name, _, id)
326326

327327
#define SHIM_NRF_TWIS_DEVICE_DEFINE(id) \
328+
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SHIM_NRF_TWIS_NODE(id)); \
328329
static void SHIM_NRF_TWIS_NAME(id, irq_connect)(void) \
329330
{ \
330331
IRQ_CONNECT( \

drivers/i2s/i2s_nrf_tdm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,7 @@ static DEVICE_API(i2s, tdm_nrf_drv_api) = {
11921192
BUILD_ASSERT((TDM_SCK_CLK_SRC(idx) != ACLK && TDM_MCK_CLK_SRC(idx) != ACLK) || \
11931193
DT_NODE_HAS_STATUS_OKAY(NODE_ACLK), \
11941194
"Clock source ACLK requires the audiopll node."); \
1195+
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(TDM(idx)); \
11951196
DEVICE_DT_DEFINE(TDM(idx), tdm_nrf_init##idx, NULL, &tdm_nrf_data##idx, &tdm_nrf_cfg##idx, \
11961197
POST_KERNEL, CONFIG_I2S_INIT_PRIORITY, &tdm_nrf_drv_api);
11971198

drivers/pwm/pwm_nrfx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ static int pwm_nrfx_init(const struct device *dev)
496496

497497
#define PWM_NRFX_DEVICE(idx) \
498498
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(PWM(idx)); \
499+
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(PWM(idx)); \
499500
static struct pwm_nrfx_data pwm_nrfx_##idx##_data; \
500501
static uint16_t pwm_##idx##_seq_values[NRF_PWM_CHANNEL_COUNT] \
501502
PWM_MEMORY_SECTION(idx); \

drivers/serial/uart_nrfx_uarte.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,6 +2632,7 @@ static int uarte_instance_init(const struct device *dev,
26322632

26332633
#define UART_NRF_UARTE_DEVICE(idx) \
26342634
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(UARTE(idx)); \
2635+
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(UARTE(idx)); \
26352636
UARTE_INT_DRIVEN(idx); \
26362637
PINCTRL_DT_DEFINE(UARTE(idx)); \
26372638
IF_ENABLED(CONFIG_UART_##idx##_ASYNC, ( \

drivers/spi/spi_nrfx_spim.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ static int spi_nrfx_deinit(const struct device *dev)
830830

831831
#define SPI_NRFX_SPIM_DEFINE(idx) \
832832
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(SPIM(idx)); \
833+
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SPIM(idx)); \
833834
static void irq_connect##idx(void) \
834835
{ \
835836
IRQ_CONNECT(DT_IRQN(SPIM(idx)), DT_IRQ(SPIM(idx), priority), \

drivers/spi/spi_nrfx_spis.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ static int spi_nrfx_init(const struct device *dev)
496496
#define SPIS_PROP(idx, prop) DT_PROP(SPIS(idx), prop)
497497

498498
#define SPI_NRFX_SPIS_DEFINE(idx) \
499+
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(SPIS(idx)); \
499500
static void irq_connect##idx(void) \
500501
{ \
501502
IRQ_CONNECT(DT_IRQN(SPIS(idx)), DT_IRQ(SPIS(idx), priority), \

0 commit comments

Comments
 (0)