mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
drivers: counter: mcux_qtmr: initialize timer devices at compile time
Initialize timer devices at compile time. This allows to constify the array of timer devices. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
committed by
Carles Cufí
parent
a0039a8134
commit
6b1e4baee4
@@ -98,13 +98,14 @@ static void mcux_qtmr_isr(const struct device *timers[])
|
||||
}
|
||||
}
|
||||
|
||||
#define ADD_TIMER(node_id, n) timers_##n[DT_PROP(node_id, channel)] = DEVICE_DT_GET(node_id);
|
||||
#define INIT_TIMER(node_id) [DT_PROP(node_id, channel)] = DEVICE_DT_GET(node_id),
|
||||
|
||||
#define QTMR_DEVICE_INIT_MCUX(n) \
|
||||
static const struct device *timers_##n[4]; \
|
||||
static const struct device *const timers_##n[4] = { \
|
||||
DT_FOREACH_CHILD_STATUS_OKAY(DT_DRV_INST(n), INIT_TIMER) \
|
||||
}; \
|
||||
static int init_irq_##n(const struct device *dev) \
|
||||
{ \
|
||||
DT_FOREACH_CHILD_STATUS_OKAY_VARGS(DT_DRV_INST(n), ADD_TIMER, n) \
|
||||
IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), mcux_qtmr_isr, \
|
||||
timers_##n, 0); \
|
||||
irq_enable(DT_INST_IRQN(n)); \
|
||||
|
||||
Reference in New Issue
Block a user