drivers: adc: adc_stm32: convert to DT_INST defines
Convert driver to use DT_INST_ defines. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
c44a4d84e0
commit
0c9b537edf
10 changed files with 11 additions and 72 deletions
|
@ -635,11 +635,11 @@ static const struct adc_driver_api api_stm32_driver_api = {
|
|||
static void adc_stm32_cfg_func_##index(void); \
|
||||
\
|
||||
static const struct adc_stm32_cfg adc_stm32_cfg_##index = { \
|
||||
.base = (ADC_TypeDef *)DT_ADC_##index##_BASE_ADDRESS, \
|
||||
.base = (ADC_TypeDef *)DT_INST_##index##_ST_STM32_ADC_BASE_ADDRESS,\
|
||||
.irq_cfg_func = adc_stm32_cfg_func_##index, \
|
||||
.pclken = { \
|
||||
.enr = DT_ADC_##index##_CLOCK_BITS, \
|
||||
.bus = DT_ADC_##index##_CLOCK_BUS, \
|
||||
.enr = DT_INST_##index##_ST_STM32_ADC_CLOCK_BITS, \
|
||||
.bus = DT_INST_##index##_ST_STM32_ADC_CLOCK_BUS, \
|
||||
}, \
|
||||
}; \
|
||||
static struct adc_stm32_data adc_stm32_data_##index = { \
|
||||
|
@ -648,18 +648,20 @@ static struct adc_stm32_data adc_stm32_data_##index = { \
|
|||
ADC_CONTEXT_INIT_SYNC(adc_stm32_data_##index, ctx), \
|
||||
}; \
|
||||
\
|
||||
DEVICE_AND_API_INIT(adc_##index, DT_ADC_##index##_NAME, &adc_stm32_init,\
|
||||
DEVICE_AND_API_INIT(adc_##index, DT_INST_##index##_ST_STM32_ADC_LABEL, \
|
||||
&adc_stm32_init, \
|
||||
&adc_stm32_data_##index, &adc_stm32_cfg_##index, \
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
|
||||
&api_stm32_driver_api); \
|
||||
\
|
||||
static void adc_stm32_cfg_func_##index(void) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_ADC_##index##_IRQ, DT_ADC_##index##_IRQ_PRI, \
|
||||
IRQ_CONNECT(DT_INST_##index##_ST_STM32_ADC_IRQ_0, \
|
||||
DT_INST_##index##_ST_STM32_ADC_IRQ_0_PRIORITY, \
|
||||
adc_stm32_isr, DEVICE_GET(adc_##index), 0); \
|
||||
irq_enable(DT_ADC_##index##_IRQ); \
|
||||
irq_enable(DT_INST_##index##_ST_STM32_ADC_IRQ_0); \
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ADC_1
|
||||
STM32_ADC_INIT(1)
|
||||
#endif /* CONFIG_ADC_1 */
|
||||
#ifdef DT_INST_0_ST_STM32_ADC
|
||||
STM32_ADC_INIT(0);
|
||||
#endif /* DT_INST_0_ST_STM32_ADC */
|
||||
|
|
|
@ -190,11 +190,4 @@
|
|||
|
||||
#define DT_WDT_0_NAME DT_INST_0_ST_STM32_WATCHDOG_LABEL
|
||||
|
||||
#define DT_ADC_1_BASE_ADDRESS DT_ST_STM32_ADC_40012400_BASE_ADDRESS
|
||||
#define DT_ADC_1_IRQ DT_ST_STM32_ADC_40012400_IRQ_0
|
||||
#define DT_ADC_1_IRQ_PRI DT_ST_STM32_ADC_40012400_IRQ_0_PRIORITY
|
||||
#define DT_ADC_1_NAME DT_ST_STM32_ADC_40012400_LABEL
|
||||
#define DT_ADC_1_CLOCK_BITS DT_ST_STM32_ADC_40012400_CLOCK_BITS_0
|
||||
#define DT_ADC_1_CLOCK_BUS DT_ST_STM32_ADC_40012400_CLOCK_BUS_0
|
||||
|
||||
/* End of SoC Level DTS fixup file */
|
||||
|
|
|
@ -211,13 +211,6 @@
|
|||
|
||||
#define DT_WDT_0_NAME DT_INST_0_ST_STM32_WATCHDOG_LABEL
|
||||
|
||||
#define DT_ADC_1_BASE_ADDRESS DT_ST_STM32_ADC_40012400_BASE_ADDRESS
|
||||
#define DT_ADC_1_IRQ DT_ST_STM32_ADC_40012400_IRQ_0
|
||||
#define DT_ADC_1_IRQ_PRI DT_ST_STM32_ADC_40012400_IRQ_0_PRIORITY
|
||||
#define DT_ADC_1_NAME DT_ST_STM32_ADC_40012400_LABEL
|
||||
#define DT_ADC_1_CLOCK_BITS DT_ST_STM32_ADC_40012400_CLOCK_BITS_0
|
||||
#define DT_ADC_1_CLOCK_BUS DT_ST_STM32_ADC_40012400_CLOCK_BUS_0
|
||||
|
||||
#define DT_CAN_1_BASE_ADDRESS DT_ST_STM32_CAN_40006400_BASE_ADDRESS
|
||||
#define DT_CAN_1_BUS_SPEED DT_ST_STM32_CAN_40006400_BUS_SPEED
|
||||
#define DT_CAN_1_NAME DT_ST_STM32_CAN_40006400_LABEL
|
||||
|
|
|
@ -150,11 +150,4 @@
|
|||
|
||||
#define DT_WDT_0_NAME DT_INST_0_ST_STM32_WATCHDOG_LABEL
|
||||
|
||||
#define DT_ADC_1_BASE_ADDRESS DT_ST_STM32_ADC_40012000_BASE_ADDRESS
|
||||
#define DT_ADC_1_IRQ DT_ST_STM32_ADC_40012000_IRQ_0
|
||||
#define DT_ADC_1_IRQ_PRI DT_ST_STM32_ADC_40012000_IRQ_0_PRIORITY
|
||||
#define DT_ADC_1_NAME DT_ST_STM32_ADC_40012000_LABEL
|
||||
#define DT_ADC_1_CLOCK_BITS DT_ST_STM32_ADC_40012000_CLOCK_BITS_0
|
||||
#define DT_ADC_1_CLOCK_BUS DT_ST_STM32_ADC_40012000_CLOCK_BUS_0
|
||||
|
||||
/* End of SoC Level DTS fixup file */
|
||||
|
|
|
@ -265,13 +265,6 @@
|
|||
|
||||
#define DT_WDT_0_NAME DT_INST_0_ST_STM32_WATCHDOG_LABEL
|
||||
|
||||
#define DT_ADC_1_BASE_ADDRESS DT_ST_STM32_ADC_50000000_BASE_ADDRESS
|
||||
#define DT_ADC_1_IRQ DT_ST_STM32_ADC_50000000_IRQ_0
|
||||
#define DT_ADC_1_IRQ_PRI DT_ST_STM32_ADC_50000000_IRQ_0_PRIORITY
|
||||
#define DT_ADC_1_NAME DT_ST_STM32_ADC_50000000_LABEL
|
||||
#define DT_ADC_1_CLOCK_BITS DT_ST_STM32_ADC_50000000_CLOCK_BITS_0
|
||||
#define DT_ADC_1_CLOCK_BUS DT_ST_STM32_ADC_50000000_CLOCK_BUS_0
|
||||
|
||||
#define DT_CAN_1_BASE_ADDRESS DT_ST_STM32_CAN_40006400_BASE_ADDRESS
|
||||
#define DT_CAN_1_BUS_SPEED DT_ST_STM32_CAN_40006400_BUS_SPEED
|
||||
#define DT_CAN_1_NAME DT_ST_STM32_CAN_40006400_LABEL
|
||||
|
|
|
@ -494,13 +494,6 @@
|
|||
|
||||
#define DT_WDT_0_NAME DT_INST_0_ST_STM32_WATCHDOG_LABEL
|
||||
|
||||
#define DT_ADC_1_BASE_ADDRESS DT_ST_STM32_ADC_40012000_BASE_ADDRESS
|
||||
#define DT_ADC_1_IRQ DT_ST_STM32_ADC_40012000_IRQ_0
|
||||
#define DT_ADC_1_IRQ_PRI DT_ST_STM32_ADC_40012000_IRQ_0_PRIORITY
|
||||
#define DT_ADC_1_NAME DT_ST_STM32_ADC_40012000_LABEL
|
||||
#define DT_ADC_1_CLOCK_BITS DT_ST_STM32_ADC_40012000_CLOCK_BITS_0
|
||||
#define DT_ADC_1_CLOCK_BUS DT_ST_STM32_ADC_40012000_CLOCK_BUS_0
|
||||
|
||||
#define DT_CAN_1_BASE_ADDRESS DT_ST_STM32_CAN_40006400_BASE_ADDRESS
|
||||
#define DT_CAN_1_BUS_SPEED DT_ST_STM32_CAN_40006400_BUS_SPEED
|
||||
#define DT_CAN_1_NAME DT_ST_STM32_CAN_40006400_LABEL
|
||||
|
|
|
@ -392,11 +392,4 @@
|
|||
|
||||
#define DT_WDT_0_NAME DT_INST_0_ST_STM32_WATCHDOG_LABEL
|
||||
|
||||
#define DT_ADC_1_BASE_ADDRESS DT_ST_STM32_ADC_40012000_BASE_ADDRESS
|
||||
#define DT_ADC_1_IRQ DT_ST_STM32_ADC_40012000_IRQ_0
|
||||
#define DT_ADC_1_IRQ_PRI DT_ST_STM32_ADC_40012000_IRQ_0_PRIORITY
|
||||
#define DT_ADC_1_NAME DT_ST_STM32_ADC_40012000_LABEL
|
||||
#define DT_ADC_1_CLOCK_BITS DT_ST_STM32_ADC_40012000_CLOCK_BITS_0
|
||||
#define DT_ADC_1_CLOCK_BUS DT_ST_STM32_ADC_40012000_CLOCK_BUS_0
|
||||
|
||||
/* End of SoC Level DTS fixup file */
|
||||
|
|
|
@ -135,11 +135,4 @@
|
|||
|
||||
#define DT_WDT_0_NAME DT_INST_0_ST_STM32_WATCHDOG_LABEL
|
||||
|
||||
#define DT_ADC_1_BASE_ADDRESS DT_ST_STM32_ADC_40012400_BASE_ADDRESS
|
||||
#define DT_ADC_1_IRQ DT_ST_STM32_ADC_40012400_IRQ_0
|
||||
#define DT_ADC_1_IRQ_PRI DT_ST_STM32_ADC_40012400_IRQ_0_PRIORITY
|
||||
#define DT_ADC_1_NAME DT_ST_STM32_ADC_40012400_LABEL
|
||||
#define DT_ADC_1_CLOCK_BITS DT_ST_STM32_ADC_40012400_CLOCK_BITS_0
|
||||
#define DT_ADC_1_CLOCK_BUS DT_ST_STM32_ADC_40012400_CLOCK_BUS_0
|
||||
|
||||
/* End of SoC Level DTS fixup file */
|
||||
|
|
|
@ -314,13 +314,6 @@
|
|||
|
||||
#define DT_WDT_0_NAME DT_INST_0_ST_STM32_WATCHDOG_LABEL
|
||||
|
||||
#define DT_ADC_1_BASE_ADDRESS DT_ST_STM32_ADC_50040000_BASE_ADDRESS
|
||||
#define DT_ADC_1_IRQ DT_ST_STM32_ADC_50040000_IRQ_0
|
||||
#define DT_ADC_1_IRQ_PRI DT_ST_STM32_ADC_50040000_IRQ_0_PRIORITY
|
||||
#define DT_ADC_1_NAME DT_ST_STM32_ADC_50040000_LABEL
|
||||
#define DT_ADC_1_CLOCK_BITS DT_ST_STM32_ADC_50040000_CLOCK_BITS_0
|
||||
#define DT_ADC_1_CLOCK_BUS DT_ST_STM32_ADC_50040000_CLOCK_BUS_0
|
||||
|
||||
#define DT_LPTIM_1_BASE_ADDRESS DT_ST_STM32_TIMERS_40007C00_BASE_ADDRESS
|
||||
#define DT_LPTIM_1_IRQ DT_ST_STM32_TIMERS_40007C00_IRQ_0
|
||||
#define DT_LPTIM_1_IRQ_PRI DT_ST_STM32_TIMERS_40007C00_IRQ_0_PRIORITY
|
||||
|
|
|
@ -148,13 +148,6 @@
|
|||
#define DT_TIM_STM32_17_CLOCK_BITS DT_ST_STM32_TIMERS_40014800_CLOCK_BITS
|
||||
#define DT_TIM_STM32_17_CLOCK_BUS DT_ST_STM32_TIMERS_40014800_CLOCK_BUS
|
||||
|
||||
#define DT_ADC_1_BASE_ADDRESS DT_ST_STM32_ADC_50040000_BASE_ADDRESS
|
||||
#define DT_ADC_1_IRQ DT_ST_STM32_ADC_50040000_IRQ_0
|
||||
#define DT_ADC_1_IRQ_PRI DT_ST_STM32_ADC_50040000_IRQ_0_PRIORITY
|
||||
#define DT_ADC_1_NAME DT_ST_STM32_ADC_50040000_LABEL
|
||||
#define DT_ADC_1_CLOCK_BITS DT_ST_STM32_ADC_50040000_CLOCK_BITS_0
|
||||
#define DT_ADC_1_CLOCK_BUS DT_ST_STM32_ADC_50040000_CLOCK_BUS_0
|
||||
|
||||
#define DT_WDT_0_NAME DT_INST_0_ST_STM32_WATCHDOG_LABEL
|
||||
|
||||
#define DT_LPTIM_1_BASE_ADDRESS DT_ST_STM32_TIMERS_40007C00_BASE_ADDRESS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue