Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions drivers/gpio/gpio_nrfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,12 +594,23 @@
}
#endif

#define GPIOTE_IRQ_HANDLER_CONNECT(node_id) \
IRQ_CONNECT(DT_IRQN(node_id), \
DT_IRQ(node_id, priority), \
gpio_nrfx_gpiote_irq_handler, \
&GPIOTE_NRFX_INST_BY_NODE(node_id), \
0);
#define GPIOTE_IRQ_HANDLER_CONNECT(node_id) \
NRF_DT_IRQ_CONNECT( \
node_id, \
gpio_nrfx_gpiote_irq_handler, \
&GPIOTE_NRFX_INST_BY_NODE(node_id) \
)

#define GPIOTE_IRQ_DIRECT_DEFINE(node_id) \
NRF_DT_IRQ_DIRECT_DEFINE( \
node_id, \
gpio_nrfx_gpiote_irq_handler, \
&GPIOTE_NRFX_INST_BY_NODE(node_id) \
)

#ifdef CONFIG_GPIO_NRFX_INTERRUPT
DT_FOREACH_STATUS_OKAY(nordic_nrf_gpiote, GPIOTE_IRQ_DIRECT_DEFINE);
#endif /* CONFIG_GPIO_NRFX_INTERRUPT */

Check notice on line 613 in drivers/gpio/gpio_nrfx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/gpio/gpio_nrfx.c:613 -#define GPIOTE_IRQ_HANDLER_CONNECT(node_id) \ - NRF_DT_IRQ_CONNECT( \ - node_id, \ - gpio_nrfx_gpiote_irq_handler, \ - &GPIOTE_NRFX_INST_BY_NODE(node_id) \ - ) - -#define GPIOTE_IRQ_DIRECT_DEFINE(node_id) \ - NRF_DT_IRQ_DIRECT_DEFINE( \ - node_id, \ - gpio_nrfx_gpiote_irq_handler, \ - &GPIOTE_NRFX_INST_BY_NODE(node_id) \ - ) +#define GPIOTE_IRQ_HANDLER_CONNECT(node_id) \ + NRF_DT_IRQ_CONNECT(node_id, gpio_nrfx_gpiote_irq_handler, \ + &GPIOTE_NRFX_INST_BY_NODE(node_id)) + +#define GPIOTE_IRQ_DIRECT_DEFINE(node_id) \ + NRF_DT_IRQ_DIRECT_DEFINE(node_id, gpio_nrfx_gpiote_irq_handler, \ + &GPIOTE_NRFX_INST_BY_NODE(node_id)) #ifdef CONFIG_GPIO_NRFX_INTERRUPT - DT_FOREACH_STATUS_OKAY(nordic_nrf_gpiote, GPIOTE_IRQ_DIRECT_DEFINE); +DT_FOREACH_STATUS_OKAY(nordic_nrf_gpiote, GPIOTE_IRQ_DIRECT_DEFINE);

Check notice on line 613 in drivers/gpio/gpio_nrfx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/gpio/gpio_nrfx.c:613 -#define GPIOTE_IRQ_HANDLER_CONNECT(node_id) \ - NRF_DT_IRQ_CONNECT( \ - node_id, \ - gpio_nrfx_gpiote_irq_handler, \ - &GPIOTE_NRFX_INST_BY_NODE(node_id) \ - ) - -#define GPIOTE_IRQ_DIRECT_DEFINE(node_id) \ - NRF_DT_IRQ_DIRECT_DEFINE( \ - node_id, \ - gpio_nrfx_gpiote_irq_handler, \ - &GPIOTE_NRFX_INST_BY_NODE(node_id) \ - ) +#define GPIOTE_IRQ_HANDLER_CONNECT(node_id) \ + NRF_DT_IRQ_CONNECT(node_id, gpio_nrfx_gpiote_irq_handler, \ + &GPIOTE_NRFX_INST_BY_NODE(node_id)) + +#define GPIOTE_IRQ_DIRECT_DEFINE(node_id) \ + NRF_DT_IRQ_DIRECT_DEFINE(node_id, gpio_nrfx_gpiote_irq_handler, \ + &GPIOTE_NRFX_INST_BY_NODE(node_id)) #ifdef CONFIG_GPIO_NRFX_INTERRUPT - DT_FOREACH_STATUS_OKAY(nordic_nrf_gpiote, GPIOTE_IRQ_DIRECT_DEFINE); +DT_FOREACH_STATUS_OKAY(nordic_nrf_gpiote, GPIOTE_IRQ_DIRECT_DEFINE);

static int gpio_nrfx_pm_hook(const struct device *port, enum pm_device_action action)
{
Expand Down
12 changes: 10 additions & 2 deletions drivers/i2c/i2c_nrfx_twim.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,20 @@
"Wrong I2C " #inst " frequency setting in dts"); \
static struct i2c_nrfx_twim_data twim_##inst##_data; \
static struct i2c_nrfx_twim_common_config twim_##inst##z_config; \
NRF_DT_INST_IRQ_DIRECT_DEFINE( \
inst, \
nrfx_twim_irq_handler, \
&_CONCAT_3(twim_, inst, _data.twim) \
) \
static void pre_init##inst(void) \
{ \
twim_##inst##z_config.twim = &twim_##inst##_data.twim; \
twim_##inst##_data.twim.p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst); \
IRQ_CONNECT(DT_INST_IRQN(inst), DT_INST_IRQ(inst, priority), \
nrfx_twim_irq_handler, &twim_##inst##_data.twim, 0); \
NRF_DT_INST_IRQ_CONNECT( \
inst, \
nrfx_twim_irq_handler, \
&_CONCAT_3(twim_, inst, _data.twim) \
) \
} \
IF_ENABLED(USES_MSG_BUF(inst), \
(static uint8_t twim_##inst##_msg_buf[MSG_BUF_SIZE(inst)] \
Expand All @@ -311,5 +319,5 @@
PM_DEVICE_DT_INST_GET(inst), &twim_##inst##_data, \
&twim_##inst##z_config, POST_KERNEL, \
CONFIG_I2C_INIT_PRIORITY, &i2c_nrfx_twim_driver_api) \

Check notice on line 322 in drivers/i2c/i2c_nrfx_twim.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/i2c/i2c_nrfx_twim.c:322 -#define I2C_NRFX_TWIM_DEVICE(inst) \ - NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ - BUILD_ASSERT(I2C_FREQUENCY(inst) != I2C_NRFX_TWIM_INVALID_FREQUENCY, \ - "Wrong I2C " #inst " frequency setting in dts"); \ - static struct i2c_nrfx_twim_data twim_##inst##_data; \ - static struct i2c_nrfx_twim_common_config twim_##inst##z_config; \ - NRF_DT_INST_IRQ_DIRECT_DEFINE( \ - inst, \ - nrfx_twim_irq_handler, \ - &_CONCAT_3(twim_, inst, _data.twim) \ - ) \ - static void pre_init##inst(void) \ - { \ - twim_##inst##z_config.twim = &twim_##inst##_data.twim; \ - twim_##inst##_data.twim.p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst); \ - NRF_DT_INST_IRQ_CONNECT( \ - inst, \ - nrfx_twim_irq_handler, \ - &_CONCAT_3(twim_, inst, _data.twim) \ - ) \ - } \ +#define I2C_NRFX_TWIM_DEVICE(inst) \ + NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ + BUILD_ASSERT(I2C_FREQUENCY(inst) != I2C_NRFX_TWIM_INVALID_FREQUENCY, \ + "Wrong I2C " #inst " frequency setting in dts"); \ + static struct i2c_nrfx_twim_data twim_##inst##_data; \ + static struct i2c_nrfx_twim_common_config twim_##inst##z_config; \ + NRF_DT_INST_IRQ_DIRECT_DEFINE(inst, nrfx_twim_irq_handler, \ + &_CONCAT_3(twim_, inst, _data.twim)) \ + static void pre_init##inst(void) \ + { \ + twim_##inst##z_config.twim = &twim_##inst##_data.twim; \ + twim_##inst##_data.twim.p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst); \ + NRF_DT_INST_IRQ_CONNECT(inst, nrfx_twim_irq_handler, \ + &_CONCAT_3(twim_, inst, _data.twim)) \ + } \ IF_ENABLED(USES_MSG_BUF(inst), \ (static uint8_t twim_##inst##_msg_buf[MSG_BUF_SIZE(inst)] \ - DMM_MEMORY_SECTION(DT_DRV_INST(inst));)) \ - PINCTRL_DT_INST_DEFINE(inst); \ - static struct i2c_nrfx_twim_common_config twim_##inst##z_config = { \ - .twim_config = \ - { \ - .skip_gpio_cfg = true, \ - .skip_psel_cfg = true, \ - .frequency = I2C_FREQUENCY(inst), \ - }, \ - .event_handler = event_handler, \ - .msg_buf_size = MSG_BUF_SIZE(inst), \ - .pre_init = pre_init##inst, \ - .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ + DMM_MEMORY_SECTION(DT_DRV_INST(inst));)) \ + PINCTRL_DT_INST_DEFINE(inst); \ + static struct i2c_nrfx_twim_common_config twim_##inst##z_config = { \ + .twim_config = \ + { \ + .skip_gpio_cfg = true, \ + .skip_psel_cfg = true, \ + .frequency = I2C_FREQUENCY(inst), \ + }, \ + .event_handler = event_handler,

Check notice on line 322 in drivers/i2c/i2c_nrfx_twim.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/i2c/i2c_nrfx_twim.c:322 -#define I2C_NRFX_TWIM_DEVICE(inst) \ - NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ - BUILD_ASSERT(I2C_FREQUENCY(inst) != I2C_NRFX_TWIM_INVALID_FREQUENCY, \ - "Wrong I2C " #inst " frequency setting in dts"); \ - static struct i2c_nrfx_twim_data twim_##inst##_data; \ - static struct i2c_nrfx_twim_common_config twim_##inst##z_config; \ - NRF_DT_INST_IRQ_DIRECT_DEFINE( \ - inst, \ - nrfx_twim_irq_handler, \ - &_CONCAT_3(twim_, inst, _data.twim) \ - ) \ - static void pre_init##inst(void) \ - { \ - twim_##inst##z_config.twim = &twim_##inst##_data.twim; \ - twim_##inst##_data.twim.p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst); \ - NRF_DT_INST_IRQ_CONNECT( \ - inst, \ - nrfx_twim_irq_handler, \ - &_CONCAT_3(twim_, inst, _data.twim) \ - ) \ - } \ +#define I2C_NRFX_TWIM_DEVICE(inst) \ + NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ + BUILD_ASSERT(I2C_FREQUENCY(inst) != I2C_NRFX_TWIM_INVALID_FREQUENCY, \ + "Wrong I2C " #inst " frequency setting in dts"); \ + static struct i2c_nrfx_twim_data twim_##inst##_data; \ + static struct i2c_nrfx_twim_common_config twim_##inst##z_config; \ + NRF_DT_INST_IRQ_DIRECT_DEFINE(inst, nrfx_twim_irq_handler, \ + &_CONCAT_3(twim_, inst, _data.twim)) \ + static void pre_init##inst(void) \ + { \ + twim_##inst##z_config.twim = &twim_##inst##_data.twim; \ + twim_##inst##_data.twim.p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst); \ + NRF_DT_INST_IRQ_CONNECT(inst, nrfx_twim_irq_handler, \ + &_CONCAT_3(twim_, inst, _data.twim)) \ + } \ IF_ENABLED(USES_MSG_BUF(inst), \ (static uint8_t twim_##inst##_msg_buf[MSG_BUF_SIZE(inst)] \ - DMM_MEMORY_SECTION(DT_DRV_INST(inst));)) \ - PINCTRL_DT_INST_DEFINE(inst); \ - static struct i2c_nrfx_twim_common_config twim_##inst##z_config = { \ - .twim_config = \ - { \ - .skip_gpio_cfg = true, \ - .skip_psel_cfg = true, \ - .frequency = I2C_FREQUENCY(inst), \ - }, \ - .event_handler = event_handler, \ - .msg_buf_size = MSG_BUF_SIZE(inst), \ - .pre_init = pre_init##inst, \ - .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ + DMM_MEMORY_SECTION(DT_DRV_INST(inst));)) \ + PINCTRL_DT_INST_DEFINE(inst); \ + static struct i2c_nrfx_twim_common_config twim_##inst##z_config = { \ + .twim_config = \ + { \ + .skip_gpio_cfg = true, \ + .skip_psel_cfg = true, \ + .frequency = I2C_FREQUENCY(inst), \ + }, \ + .event_handler = event_handler,
DT_INST_FOREACH_STATUS_OKAY(I2C_NRFX_TWIM_DEVICE)
12 changes: 10 additions & 2 deletions drivers/i2c/i2c_nrfx_twim_rtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,19 @@
.p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst), \
}, \
}; \
NRF_DT_INST_IRQ_DIRECT_DEFINE( \
inst, \
nrfx_twim_irq_handler, \
&_CONCAT_3(twim_, inst, z_data.twim) \
) \
static void pre_init##inst(void) \
{ \
twim_##inst##z_data.twim.p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst); \
IRQ_CONNECT(DT_INST_IRQN(inst), DT_INST_IRQ(inst, priority), \
nrfx_twim_irq_handler, &twim_##inst##z_data.twim, 0); \
NRF_DT_INST_IRQ_CONNECT( \
inst, \
nrfx_twim_irq_handler, \
&_CONCAT_3(twim_, inst, z_data.twim) \
) \
} \
IF_ENABLED(USES_MSG_BUF(inst), (MSG_BUF_DEFINE(inst);)) \
I2C_RTIO_DEFINE(_i2c##inst##_twim_rtio, \
Expand Down Expand Up @@ -287,5 +295,5 @@
PM_DEVICE_DT_INST_GET(inst), &twim_##inst##z_data, \
&twim_##inst##z_config, POST_KERNEL, \
CONFIG_I2C_INIT_PRIORITY, &i2c_nrfx_twim_driver_api); \

Check notice on line 298 in drivers/i2c/i2c_nrfx_twim_rtio.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/i2c/i2c_nrfx_twim_rtio.c:298 -#define I2C_NRFX_TWIM_RTIO_DEVICE(inst) \ - NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ - BUILD_ASSERT(I2C_FREQUENCY(inst) != I2C_NRFX_TWIM_INVALID_FREQUENCY, \ - "Wrong I2C " #inst " frequency setting in dts"); \ - static struct i2c_nrfx_twim_rtio_data twim_##inst##z_data = { \ - .twim = \ - { \ - .p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst), \ - }, \ - }; \ - NRF_DT_INST_IRQ_DIRECT_DEFINE( \ - inst, \ - nrfx_twim_irq_handler, \ - &_CONCAT_3(twim_, inst, z_data.twim) \ - ) \ - static void pre_init##inst(void) \ - { \ - twim_##inst##z_data.twim.p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst); \ - NRF_DT_INST_IRQ_CONNECT( \ - inst, \ - nrfx_twim_irq_handler, \ - &_CONCAT_3(twim_, inst, z_data.twim) \ - ) \ - } \ - IF_ENABLED(USES_MSG_BUF(inst), (MSG_BUF_DEFINE(inst);)) \ - I2C_RTIO_DEFINE(_i2c##inst##_twim_rtio, \ - DT_INST_PROP_OR(n, sq_size, CONFIG_I2C_RTIO_SQ_SIZE), \ - DT_INST_PROP_OR(n, cq_size, CONFIG_I2C_RTIO_CQ_SIZE)); \ - PINCTRL_DT_INST_DEFINE(inst); \ - static const struct i2c_nrfx_twim_rtio_config twim_##inst##z_config = { \ - .common = \ - { \ - .twim_config = \ - { \ - .skip_gpio_cfg = true, \ - .skip_psel_cfg = true, \ - .frequency = I2C_FREQUENCY(inst), \ - }, \ - .event_handler = event_handler, \ - .msg_buf_size = MSG_BUF_SIZE(inst), \ - .pre_init = pre_init##inst, \ - .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ - IF_ENABLED(USES_MSG_BUF(inst), (.msg_buf = MSG_BUF_SYM(inst),)) \ - .max_transfer_size = MAX_TRANSFER_SIZE(inst), \ - .twim = &twim_##inst##z_data.twim, \ - }, \ - .ctx = &_i2c##inst##_twim_rtio, \ - }; \ - PM_DEVICE_DT_INST_DEFINE(inst, twim_nrfx_pm_action, I2C_PM_ISR_SAFE(inst)); \ - I2C_DEVICE_DT_INST_DEINIT_DEFINE(inst, i2c_nrfx_twim_rtio_init, \ - i2c_nrfx_twim_rtio_deinit, \ - PM_DEVICE_DT_INST_GET(inst), &twim_##inst##z_data, \ - &twim_##inst##z_config, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, &i2c_nrfx_twim_driver_api); \ +#define I2C_NRFX_TWIM_RTIO_DEVICE(inst) \ + NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ + BUILD_ASSERT(I2C_FREQUENCY(inst) != I2C_NRFX_TWIM_INVALID_FREQUENCY, \ + "Wrong I2C " #inst " frequency setting in dts"); \ + static struct i2c_nrfx_twim_rtio_data twim_##inst##z_data = { \ + .twim = \ + { \ + .p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst), \ + }, \ + }; \ + NRF_DT_INST_IRQ_DIRECT_DEFINE(inst, nrfx_twim_irq_handler, \ + &_CONCAT_3(twim_, inst, z_data.twim)) \ + static void pre_init##inst(void) \ + { \ + twim_##inst##z_data.twim.p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst); \ + NRF_DT_INST_IRQ_CONNECT(inst, nrfx_twim_irq_handler, \ + &_CONCAT_3(twim_, inst, z_data.twim)) \ + } \ + IF_ENABLED(U

Check notice on line 298 in drivers/i2c/i2c_nrfx_twim_rtio.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/i2c/i2c_nrfx_twim_rtio.c:298 -#define I2C_NRFX_TWIM_RTIO_DEVICE(inst) \ - NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ - BUILD_ASSERT(I2C_FREQUENCY(inst) != I2C_NRFX_TWIM_INVALID_FREQUENCY, \ - "Wrong I2C " #inst " frequency setting in dts"); \ - static struct i2c_nrfx_twim_rtio_data twim_##inst##z_data = { \ - .twim = \ - { \ - .p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst), \ - }, \ - }; \ - NRF_DT_INST_IRQ_DIRECT_DEFINE( \ - inst, \ - nrfx_twim_irq_handler, \ - &_CONCAT_3(twim_, inst, z_data.twim) \ - ) \ - static void pre_init##inst(void) \ - { \ - twim_##inst##z_data.twim.p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst); \ - NRF_DT_INST_IRQ_CONNECT( \ - inst, \ - nrfx_twim_irq_handler, \ - &_CONCAT_3(twim_, inst, z_data.twim) \ - ) \ - } \ - IF_ENABLED(USES_MSG_BUF(inst), (MSG_BUF_DEFINE(inst);)) \ - I2C_RTIO_DEFINE(_i2c##inst##_twim_rtio, \ - DT_INST_PROP_OR(n, sq_size, CONFIG_I2C_RTIO_SQ_SIZE), \ - DT_INST_PROP_OR(n, cq_size, CONFIG_I2C_RTIO_CQ_SIZE)); \ - PINCTRL_DT_INST_DEFINE(inst); \ - static const struct i2c_nrfx_twim_rtio_config twim_##inst##z_config = { \ - .common = \ - { \ - .twim_config = \ - { \ - .skip_gpio_cfg = true, \ - .skip_psel_cfg = true, \ - .frequency = I2C_FREQUENCY(inst), \ - }, \ - .event_handler = event_handler, \ - .msg_buf_size = MSG_BUF_SIZE(inst), \ - .pre_init = pre_init##inst, \ - .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ - IF_ENABLED(USES_MSG_BUF(inst), (.msg_buf = MSG_BUF_SYM(inst),)) \ - .max_transfer_size = MAX_TRANSFER_SIZE(inst), \ - .twim = &twim_##inst##z_data.twim, \ - }, \ - .ctx = &_i2c##inst##_twim_rtio, \ - }; \ - PM_DEVICE_DT_INST_DEFINE(inst, twim_nrfx_pm_action, I2C_PM_ISR_SAFE(inst)); \ - I2C_DEVICE_DT_INST_DEINIT_DEFINE(inst, i2c_nrfx_twim_rtio_init, \ - i2c_nrfx_twim_rtio_deinit, \ - PM_DEVICE_DT_INST_GET(inst), &twim_##inst##z_data, \ - &twim_##inst##z_config, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, &i2c_nrfx_twim_driver_api); \ +#define I2C_NRFX_TWIM_RTIO_DEVICE(inst) \ + NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ + BUILD_ASSERT(I2C_FREQUENCY(inst) != I2C_NRFX_TWIM_INVALID_FREQUENCY, \ + "Wrong I2C " #inst " frequency setting in dts"); \ + static struct i2c_nrfx_twim_rtio_data twim_##inst##z_data = { \ + .twim = \ + { \ + .p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst), \ + }, \ + }; \ + NRF_DT_INST_IRQ_DIRECT_DEFINE(inst, nrfx_twim_irq_handler, \ + &_CONCAT_3(twim_, inst, z_data.twim)) \ + static void pre_init##inst(void) \ + { \ + twim_##inst##z_data.twim.p_twim = (NRF_TWIM_Type *)DT_INST_REG_ADDR(inst); \ + NRF_DT_INST_IRQ_CONNECT(inst, nrfx_twim_irq_handler, \ + &_CONCAT_3(twim_, inst, z_data.twim)) \ + } \ + IF_ENABLED(U
DT_INST_FOREACH_STATUS_OKAY(I2C_NRFX_TWIM_RTIO_DEVICE)
14 changes: 12 additions & 2 deletions drivers/i2c/i2c_nrfx_twis.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,22 @@
#define SHIM_NRF_TWIS_DEVICE_DEFINE(id) \
static struct shim_nrf_twis_data SHIM_NRF_TWIS_NAME(id, data); \
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(id)); \
\
NRF_DT_INST_IRQ_DIRECT_DEFINE( \
id, \
nrfx_twis_irq_handler, \
&SHIM_NRF_TWIS_NAME(id, data).twis \
) \
\
static void SHIM_NRF_TWIS_NAME(id, pre_init)(void) \
{ \
SHIM_NRF_TWIS_NAME(id, data).twis.p_reg = (NRF_TWIS_Type *)DT_INST_REG_ADDR(id); \
IRQ_CONNECT(DT_INST_IRQN(id), DT_INST_IRQ(id, priority), nrfx_twis_irq_handler, \
&SHIM_NRF_TWIS_NAME(id, data).twis, 0); \
NRF_DT_INST_IRQ_CONNECT( \
id, \
nrfx_twis_irq_handler, \
&SHIM_NRF_TWIS_NAME(id, data).twis \
) \
} \

Check notice on line 328 in drivers/i2c/i2c_nrfx_twis.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/i2c/i2c_nrfx_twis.c:328 - NRF_DT_INST_IRQ_DIRECT_DEFINE( \ - id, \ - nrfx_twis_irq_handler, \ - &SHIM_NRF_TWIS_NAME(id, data).twis \ - ) \ + NRF_DT_INST_IRQ_DIRECT_DEFINE(id, nrfx_twis_irq_handler, \ + &SHIM_NRF_TWIS_NAME(id, data).twis) \ \ static void SHIM_NRF_TWIS_NAME(id, pre_init)(void) \ { \ SHIM_NRF_TWIS_NAME(id, data).twis.p_reg = (NRF_TWIS_Type *)DT_INST_REG_ADDR(id); \ - NRF_DT_INST_IRQ_CONNECT( \ - id, \ - nrfx_twis_irq_handler, \ - &SHIM_NRF_TWIS_NAME(id, data).twis \ - ) \ + NRF_DT_INST_IRQ_CONNECT(id, nrfx_twis_irq_handler, \ + &SHIM_NRF_TWIS_NAME(id, data).twis) \

Check notice on line 328 in drivers/i2c/i2c_nrfx_twis.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/i2c/i2c_nrfx_twis.c:328 - NRF_DT_INST_IRQ_DIRECT_DEFINE( \ - id, \ - nrfx_twis_irq_handler, \ - &SHIM_NRF_TWIS_NAME(id, data).twis \ - ) \ + NRF_DT_INST_IRQ_DIRECT_DEFINE(id, nrfx_twis_irq_handler, \ + &SHIM_NRF_TWIS_NAME(id, data).twis) \ \ static void SHIM_NRF_TWIS_NAME(id, pre_init)(void) \ { \ SHIM_NRF_TWIS_NAME(id, data).twis.p_reg = (NRF_TWIS_Type *)DT_INST_REG_ADDR(id); \ - NRF_DT_INST_IRQ_CONNECT( \ - id, \ - nrfx_twis_irq_handler, \ - &SHIM_NRF_TWIS_NAME(id, data).twis \ - ) \ + NRF_DT_INST_IRQ_CONNECT(id, nrfx_twis_irq_handler, \ + &SHIM_NRF_TWIS_NAME(id, data).twis) \
\
static void SHIM_NRF_TWIS_NAME(id, event_handler)(nrfx_twis_event_t const *event) \
{ \
Expand All @@ -335,7 +345,7 @@
}; \
\
PM_DEVICE_DT_INST_DEFINE(id, shim_nrf_twis_pm_action_cb,); \
\

Check notice on line 348 in drivers/i2c/i2c_nrfx_twis.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/i2c/i2c_nrfx_twis.c:348 - PM_DEVICE_DT_INST_DEFINE(id, shim_nrf_twis_pm_action_cb,); \ + PM_DEVICE_DT_INST_DEFINE(id, shim_nrf_twis_pm_action_cb, ); \

Check notice on line 348 in drivers/i2c/i2c_nrfx_twis.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/i2c/i2c_nrfx_twis.c:348 - PM_DEVICE_DT_INST_DEFINE(id, shim_nrf_twis_pm_action_cb,); \ + PM_DEVICE_DT_INST_DEFINE(id, shim_nrf_twis_pm_action_cb, ); \
DEVICE_DT_INST_DEINIT_DEFINE(id, shim_nrf_twis_init, shim_nrf_twis_deinit, \
PM_DEVICE_DT_INST_GET(id), &SHIM_NRF_TWIS_NAME(id, data), \
&SHIM_NRF_TWIS_NAME(id, config), POST_KERNEL, \
Expand Down
12 changes: 10 additions & 2 deletions drivers/spi/spi_nrfx_spim.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,18 @@
.dev = DEVICE_DT_GET(DT_DRV_INST(inst)), \
.busy = false, \
}; \
NRF_DT_INST_IRQ_DIRECT_DEFINE( \
inst, \
nrfx_spim_irq_handler, \
&_CONCAT_3(spi_, inst, _data.spim) \
) \
static void irq_connect##inst(void) \
{ \
IRQ_CONNECT(DT_INST_IRQN(inst), DT_INST_IRQ(inst, priority), \
nrfx_spim_irq_handler, &spi_##inst##_data.spim, 0); \
NRF_DT_INST_IRQ_CONNECT( \
inst, \
nrfx_spim_irq_handler, \
&_CONCAT_3(spi_, inst, _data.spim) \
); \
} \
PINCTRL_DT_INST_DEFINE(inst); \
static const struct spi_nrfx_config spi_##inst##z_config = { \
Expand Down Expand Up @@ -655,5 +663,5 @@
&spi_##inst##z_config, \
POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \
&spi_nrfx_driver_api)

Check notice on line 666 in drivers/spi/spi_nrfx_spim.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/spi/spi_nrfx_spim.c:666 -#define SPI_NRFX_SPIM_DEFINE(inst) \ - NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ +#define SPI_NRFX_SPIM_DEFINE(inst) \ + NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ IF_ENABLED(SPI_BUFFER_IN_RAM, \ (static uint8_t spim_##inst##_tx_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ DMM_MEMORY_SECTION(DT_DRV_INST(inst)); \ static uint8_t spim_##inst##_rx_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ - DMM_MEMORY_SECTION(DT_DRV_INST(inst));)) \ - static struct spi_nrfx_data spi_##inst##_data = { \ - .spim = NRFX_SPIM_INSTANCE(DT_INST_REG_ADDR(inst)), \ + DMM_MEMORY_SECTION(DT_DRV_INST(inst));)) \ + static struct spi_nrfx_data spi_##inst##_data = { \ + .spim = NRFX_SPIM_INSTANCE(DT_INST_REG_ADDR(inst)), \ IF_ENABLED(CONFIG_MULTITHREADING, \ - (SPI_CONTEXT_INIT_LOCK(spi_##inst##_data, ctx),)) \ - IF_ENABLED(CONFIG_MULTITHREADING, \ - (SPI_CONTEXT_INIT_SYNC(spi_##inst##_data, ctx),)) \ - SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(inst), ctx) \ - IF_ENABLED(SPI_BUFFER_IN_RAM, \ + (SPI_CONTEXT_INIT_LOCK(spi_##inst##_data, ctx),)) \ + IF_ENABLED(CONFIG_MULTITHREADING, \ + (SPI_CONTEXT_INIT_SYNC(spi_##inst##_data, ctx),)) SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(inst), \ + ctx) \ + IF_ENABLED(SPI_BUFFER_IN_RAM, \ (.tx_buffer = spim_##inst##_tx_buffer, \ - .rx_buffer = spim_##inst##_rx_buffer,)) \ - .dev = DEVICE_DT_GET(DT_DRV_INST(inst)), \ - .busy = false, \ - }; \ - NRF_DT_INST_IRQ_DIRECT_DEFINE( \ - inst, \ - nrfx_spim_irq_handler, \ - &_CONCAT_3(spi_, inst, _data.spim) \ - ) \ - static void irq_connect##inst(void) \ - { \ - NRF_DT_INST_IRQ_CONNECT( \ - inst, \ - nrfx_spim_irq_handler, \ - &_CONCAT_3(spi_, inst, _data.spim) \ - ); \ - } \ - PINCTRL_DT_INST_DEFINE(inst); \ - static const struct spi_nrfx_config spi_##inst##z_config = { \ - .max_freq = DT_INST_PROP(inst, max_frequency), \ - .def_config = { \ - .skip_gpio_cfg = true, \ - .skip_psel_cfg = true, \ - .ss_pin = NRF_SPIM_PIN_NOT_CONNECTED, \ - .orc = DT_INST_PROP(inst, overrun_character), \ - SPI_NRFX_SPIM_EXTENDED_CONFIG(inst) \ - }, \ - .irq_connect = irq_connect##inst, \ - .max_chunk_len = BIT_MASK( \ - DT_INST_PROP(inst, easydma_maxcnt_bits)), \ - .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ - .wake_gpiote = WAKE_GPIOTE_NODE(DT_DRV_INST(inst)), \ - .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(DT_DRV_INST(inst), \ - wake_gpios, \ - WAKE_PIN_NOT_USED), \ - .mem_reg = DMM_DEV_TO_REG(DT_DRV_INST(inst)), \ - }; \ - BUILD_ASSERT(!DT_INST_NODE_HAS_PROP(inst, wake_gpios) || \ - !(DT_GPIO_FLAGS(DT_DRV_INST(inst), wake_gpios) & \ - GPIO_ACTIVE_LOW), \ - "WAKE line must be configured as active high"); \ - PM_DEVICE_DT_INST_DEFINE(inst, spim_nrfx_pm_action); \ - SPI_DEVICE_DT_INST_DEINIT_DEFINE(inst, \ - spi_nrfx_init, \ - spi_nrfx_deinit, \ - PM_DEVICE_DT_INST_GET(inst), \ -

Check notice on line 666 in drivers/spi/spi_nrfx_spim.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/spi/spi_nrfx_spim.c:666 -#define SPI_NRFX_SPIM_DEFINE(inst) \ - NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ - NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ +#define SPI_NRFX_SPIM_DEFINE(inst) \ + NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(inst)); \ + NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(inst)); \ IF_ENABLED(SPI_BUFFER_IN_RAM, \ (static uint8_t spim_##inst##_tx_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ DMM_MEMORY_SECTION(DT_DRV_INST(inst)); \ static uint8_t spim_##inst##_rx_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ - DMM_MEMORY_SECTION(DT_DRV_INST(inst));)) \ - static struct spi_nrfx_data spi_##inst##_data = { \ - .spim = NRFX_SPIM_INSTANCE(DT_INST_REG_ADDR(inst)), \ + DMM_MEMORY_SECTION(DT_DRV_INST(inst));)) \ + static struct spi_nrfx_data spi_##inst##_data = { \ + .spim = NRFX_SPIM_INSTANCE(DT_INST_REG_ADDR(inst)), \ IF_ENABLED(CONFIG_MULTITHREADING, \ - (SPI_CONTEXT_INIT_LOCK(spi_##inst##_data, ctx),)) \ - IF_ENABLED(CONFIG_MULTITHREADING, \ - (SPI_CONTEXT_INIT_SYNC(spi_##inst##_data, ctx),)) \ - SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(inst), ctx) \ - IF_ENABLED(SPI_BUFFER_IN_RAM, \ + (SPI_CONTEXT_INIT_LOCK(spi_##inst##_data, ctx),)) \ + IF_ENABLED(CONFIG_MULTITHREADING, \ + (SPI_CONTEXT_INIT_SYNC(spi_##inst##_data, ctx),)) SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(inst), \ + ctx) \ + IF_ENABLED(SPI_BUFFER_IN_RAM, \ (.tx_buffer = spim_##inst##_tx_buffer, \ - .rx_buffer = spim_##inst##_rx_buffer,)) \ - .dev = DEVICE_DT_GET(DT_DRV_INST(inst)), \ - .busy = false, \ - }; \ - NRF_DT_INST_IRQ_DIRECT_DEFINE( \ - inst, \ - nrfx_spim_irq_handler, \ - &_CONCAT_3(spi_, inst, _data.spim) \ - ) \ - static void irq_connect##inst(void) \ - { \ - NRF_DT_INST_IRQ_CONNECT( \ - inst, \ - nrfx_spim_irq_handler, \ - &_CONCAT_3(spi_, inst, _data.spim) \ - ); \ - } \ - PINCTRL_DT_INST_DEFINE(inst); \ - static const struct spi_nrfx_config spi_##inst##z_config = { \ - .max_freq = DT_INST_PROP(inst, max_frequency), \ - .def_config = { \ - .skip_gpio_cfg = true, \ - .skip_psel_cfg = true, \ - .ss_pin = NRF_SPIM_PIN_NOT_CONNECTED, \ - .orc = DT_INST_PROP(inst, overrun_character), \ - SPI_NRFX_SPIM_EXTENDED_CONFIG(inst) \ - }, \ - .irq_connect = irq_connect##inst, \ - .max_chunk_len = BIT_MASK( \ - DT_INST_PROP(inst, easydma_maxcnt_bits)), \ - .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ - .wake_gpiote = WAKE_GPIOTE_NODE(DT_DRV_INST(inst)), \ - .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(DT_DRV_INST(inst), \ - wake_gpios, \ - WAKE_PIN_NOT_USED), \ - .mem_reg = DMM_DEV_TO_REG(DT_DRV_INST(inst)), \ - }; \ - BUILD_ASSERT(!DT_INST_NODE_HAS_PROP(inst, wake_gpios) || \ - !(DT_GPIO_FLAGS(DT_DRV_INST(inst), wake_gpios) & \ - GPIO_ACTIVE_LOW), \ - "WAKE line must be configured as active high"); \ - PM_DEVICE_DT_INST_DEFINE(inst, spim_nrfx_pm_action); \ - SPI_DEVICE_DT_INST_DEINIT_DEFINE(inst, \ - spi_nrfx_init, \ - spi_nrfx_deinit, \ - PM_DEVICE_DT_INST_GET(inst), \ -
DT_INST_FOREACH_STATUS_OKAY(SPI_NRFX_SPIM_DEFINE)
58 changes: 58 additions & 0 deletions soc/nordic/common/soc_nrf_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,64 @@
(0) \
)

/**
* @brief Utility macro to declare and define direct IRQ if required
*
* @param node_id Devicetree node identifier
* @param handler IRQ handler
* @param param Parameter passed to IRQ handler
*/
#define NRF_DT_IRQ_DIRECT_DEFINE(node_id, handler, param) \

Check warning on line 334 in soc/nordic/common/soc_nrf_common.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

MACRO_WITH_FLOW_CONTROL

soc/nordic/common/soc_nrf_common.h:334 Macros with flow control statements should be avoided

Check warning on line 334 in soc/nordic/common/soc_nrf_common.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

MACRO_WITH_FLOW_CONTROL

soc/nordic/common/soc_nrf_common.h:334 Macros with flow control statements should be avoided
COND_CODE_1( \

Check notice on line 335 in soc/nordic/common/soc_nrf_common.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

soc/nordic/common/soc_nrf_common.h:335 -#define NRF_DT_IRQ_DIRECT_DEFINE(node_id, handler, param) \ +#define NRF_DT_IRQ_DIRECT_DEFINE(node_id, handler, param) \

Check notice on line 335 in soc/nordic/common/soc_nrf_common.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

soc/nordic/common/soc_nrf_common.h:335 -#define NRF_DT_IRQ_DIRECT_DEFINE(node_id, handler, param) \ +#define NRF_DT_IRQ_DIRECT_DEFINE(node_id, handler, param) \
CONFIG_GEN_SW_ISR_TABLE, \
(), \
( \
ISR_DIRECT_DECLARE(_CONCAT_3(handler, _, DT_DEP_ORD(node_id))) \
{ \
handler(param); \
ISR_DIRECT_PM(); \
return 1; \
} \
) \
)

/** Device driver instance variant of NRF_DT_IRQ_DIRECT_DEFINE() */
#define NRF_DT_INST_IRQ_DIRECT_DEFINE(inst, handler, param) \
NRF_DT_IRQ_DIRECT_DEFINE(DT_DRV_INST(inst), handler, param)

Check notice on line 350 in soc/nordic/common/soc_nrf_common.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

soc/nordic/common/soc_nrf_common.h:350 -#define NRF_DT_INST_IRQ_DIRECT_DEFINE(inst, handler, param) \ +#define NRF_DT_INST_IRQ_DIRECT_DEFINE(inst, handler, param) \

Check notice on line 350 in soc/nordic/common/soc_nrf_common.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

soc/nordic/common/soc_nrf_common.h:350 -#define NRF_DT_INST_IRQ_DIRECT_DEFINE(inst, handler, param) \ +#define NRF_DT_INST_IRQ_DIRECT_DEFINE(inst, handler, param) \

/**
* @brief Utility macro to connect IRQ handler
*
* @param node_id Devicetree node identifier
* @param handler IRQ handler
* @param param Parameter passed to IRQ handler
*/
#define NRF_DT_IRQ_CONNECT(node_id, handler, param) \
COND_CODE_1( \

Check notice on line 360 in soc/nordic/common/soc_nrf_common.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

soc/nordic/common/soc_nrf_common.h:360 -#define NRF_DT_IRQ_CONNECT(node_id, handler, param) \ +#define NRF_DT_IRQ_CONNECT(node_id, handler, param) \

Check notice on line 360 in soc/nordic/common/soc_nrf_common.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

soc/nordic/common/soc_nrf_common.h:360 -#define NRF_DT_IRQ_CONNECT(node_id, handler, param) \ +#define NRF_DT_IRQ_CONNECT(node_id, handler, param) \
CONFIG_GEN_SW_ISR_TABLE, \
( \
IRQ_CONNECT( \
DT_IRQN(node_id), \
DT_IRQ(node_id, priority), \
handler, \
param, \
0 \
) \
), \
( \
IRQ_DIRECT_CONNECT( \
DT_IRQN(node_id), \
DT_IRQ(node_id, priority), \
_CONCAT_3(handler, _, DT_DEP_ORD(node_id)), \
0 \
) \
) \
)

/** Device driver instance variant of NRF_DT_IRQ_DIRECT_DEFINE() */
#define NRF_DT_INST_IRQ_CONNECT(inst, handler, param) \
NRF_DT_IRQ_CONNECT(DT_DRV_INST(inst), handler, param)

Check notice on line 383 in soc/nordic/common/soc_nrf_common.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

soc/nordic/common/soc_nrf_common.h:383 -#define NRF_DT_INST_IRQ_CONNECT(inst, handler, param) \ +#define NRF_DT_INST_IRQ_CONNECT(inst, handler, param) \

Check notice on line 383 in soc/nordic/common/soc_nrf_common.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

soc/nordic/common/soc_nrf_common.h:383 -#define NRF_DT_INST_IRQ_CONNECT(inst, handler, param) \ +#define NRF_DT_INST_IRQ_CONNECT(inst, handler, param) \

#endif /* !_ASMLANGUAGE */

#endif
Loading