STM32 1wire: Convert to use new interrupt argument infrastructure.

This commit is contained in:
Gregory Nutt 2017-02-28 08:39:02 -06:00
parent efd11ebe35
commit 7d24f45c7e

View File

@ -117,7 +117,6 @@ struct stm32_1wire_config_s
const uint32_t apbclock; /* PCLK 1 or 2 frequency */
const uint32_t data_pin; /* GPIO configuration for DATA */
const uint8_t irq; /* IRQ associated with this USART */
int (*const vector)(int irq, void *context, void *arg); /* Interrupt handler */
};
/* 1-Wire device Private Data */
@ -161,33 +160,7 @@ static inline void stm32_1wire_sem_wait(FAR struct stm32_1wire_priv_s *priv);
static inline void stm32_1wire_sem_post(FAR struct stm32_1wire_priv_s *priv);
static int stm32_1wire_process(struct stm32_1wire_priv_s *priv,
FAR const struct stm32_1wire_msg_s *msgs, int count);
static int stm32_1wire_isr(struct stm32_1wire_priv_s *priv);
#ifdef CONFIG_STM32_USART1_1WIREDRIVER
static int stm32_interrupt_1wire1(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_USART2_1WIREDRIVER
static int stm32_interrupt_1wire2(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_USART3_1WIREDRIVER
static int stm32_interrupt_1wire3(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_UART4_1WIREDRIVER
static int stm32_interrupt_1wire4(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_UART5_1WIREDRIVER
static int stm32_interrupt_1wire5(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_USART6_1WIREDRIVER
static int stm32_interrupt_1wire6(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_UART7_1WIREDRIVER
static int stm32_interrupt_1wire7(int irq, void *context, FAR void *arg);
#endif
#ifdef CONFIG_STM32_UART8_1WIREDRIVER
static int stm32_interrupt_1wire8(int irq, void *context, FAR void *arg);
#endif
static int stm32_1wire_isr(int irq, void *context, void *arg);
static int stm32_1wire_reset(FAR struct onewire_dev_s *dev);
static int stm32_1wire_write(FAR struct onewire_dev_s *dev,
const uint8_t *buffer, int buflen);
@ -211,7 +184,6 @@ static const struct stm32_1wire_config_s stm32_1wire1_config =
.apbclock = STM32_PCLK2_FREQUENCY,
.data_pin = PIN_OPENDRAIN(GPIO_USART1_TX),
.irq = STM32_IRQ_USART1,
.vector = stm32_interrupt_1wire1,
};
static struct stm32_1wire_priv_s stm32_1wire1_priv =
@ -231,7 +203,6 @@ static const struct stm32_1wire_config_s stm32_1wire2_config =
.apbclock = STM32_PCLK1_FREQUENCY,
.data_pin = PIN_OPENDRAIN(GPIO_USART2_TX),
.irq = STM32_IRQ_USART2,
.vector = stm32_interrupt_1wire2,
};
static struct stm32_1wire_priv_s stm32_1wire2_priv =
@ -251,7 +222,6 @@ static const struct stm32_1wire_config_s stm32_1wire3_config =
.apbclock = STM32_PCLK1_FREQUENCY,
.data_pin = PIN_OPENDRAIN(GPIO_USART3_TX),
.irq = STM32_IRQ_USART3,
.vector = stm32_interrupt_1wire3,
};
static struct stm32_1wire_priv_s stm32_1wire3_priv =
@ -271,7 +241,6 @@ static const struct stm32_1wire_config_s stm32_1wire4_config =
.apbclock = STM32_PCLK1_FREQUENCY,
.data_pin = PIN_OPENDRAIN(GPIO_UART4_TX),
.irq = STM32_IRQ_UART4,
.vector = stm32_interrupt_1wire4,
};
static struct stm32_1wire_priv_s stm32_1wire4_priv =
@ -291,7 +260,6 @@ static const struct stm32_1wire_config_s stm32_1wire5_config =
.apbclock = STM32_PCLK1_FREQUENCY,
.data_pin = PIN_OPENDRAIN(GPIO_UART5_TX),
.irq = STM32_IRQ_UART5,
.vector = stm32_interrupt_1wire5,
};
static struct stm32_1wire_priv_s stm32_1wire5_priv =
@ -311,7 +279,6 @@ static const struct stm32_1wire_config_s stm32_1wire6_config =
.apbclock = STM32_PCLK2_FREQUENCY,
.data_pin = PIN_OPENDRAIN(GPIO_USART6_TX),
.irq = STM32_IRQ_USART6,
.vector = stm32_interrupt_1wire6,
};
static struct stm32_1wire_priv_s stm32_1wire6_priv =
@ -331,7 +298,6 @@ static const struct stm32_1wire_config_s stm32_1wire7_config =
.apbclock = STM32_PCLK1_FREQUENCY,
.data_pin = PIN_OPENDRAIN(GPIO_UART7_TX),
.irq = STM32_IRQ_UART7,
.vector = stm32_interrupt_1wire7,
};
static struct stm32_1wire_priv_s stm32_1wire7_priv =
@ -351,7 +317,6 @@ static const struct stm32_1wire_config_s stm32_1wire8_config =
.apbclock = STM32_PCLK1_FREQUENCY,
.data_pin = PIN_OPENDRAIN(GPIO_UART8_TX),
.irq = STM32_IRQ_UART8,
.vector = stm32_interrupt_1wire8,
};
static struct stm32_1wire_priv_s stm32_1wire8_priv =
@ -679,7 +644,7 @@ static int stm32_1wire_init(FAR struct stm32_1wire_priv_s *priv)
stm32_configgpio(config->data_pin);
ret = irq_attach(config->irq, config->vector, NULL);
ret = irq_attach(config->irq, stm32_1wire_isr, priv);
if (ret == OK)
{
up_enable_irq(config->irq);
@ -917,9 +882,13 @@ static int stm32_1wire_process(struct stm32_1wire_priv_s *priv,
* Common Interrupt Service Routine
****************************************************************************/
static int stm32_1wire_isr(struct stm32_1wire_priv_s *priv)
static int stm32_1wire_isr(int irq, void *context, void *arg)
{
uint32_t sr, dr;
struct stm32_1wire_priv_s *priv = (struct stm32_1wire_priv_s *)arg;
uint32_t sr;
uint32_t dr;
DEBUGASSERT(priv != NULL);
/* Get the masked USART status word. */
@ -1041,55 +1010,6 @@ static int stm32_1wire_isr(struct stm32_1wire_priv_s *priv)
return OK;
}
#ifdef CONFIG_STM32_USART1_1WIREDRIVER
static int stm32_interrupt_1wire1(int irq, void *context, FAR void *arg)
{
return stm32_1wire_isr(&stm32_1wire1_priv);
}
#endif
#ifdef CONFIG_STM32_USART2_1WIREDRIVER
static int stm32_interrupt_1wire2(int irq, void *context, FAR void *arg)
{
return stm32_1wire_isr(&stm32_1wire2_priv);
}
#endif
#ifdef CONFIG_STM32_USART3_1WIREDRIVER
static int stm32_interrupt_1wire3(int irq, void *context, FAR void *arg)
{
return stm32_1wire_isr(&stm32_1wire3_priv);
}
#endif
#ifdef CONFIG_STM32_UART4_1WIREDRIVER
static int stm32_interrupt_1wire4(int irq, void *context, FAR void *arg)
{
return stm32_1wire_isr(&stm32_1wire4_priv);
}
#endif
#ifdef CONFIG_STM32_UART5_1WIREDRIVER
static int stm32_interrupt_1wire5(int irq, void *context, FAR void *arg)
{
return stm32_1wire_isr(&stm32_1wire5_priv);
}
#endif
#ifdef CONFIG_STM32_USART6_1WIREDRIVER
static int stm32_interrupt_1wire6(int irq, void *context, FAR void *arg)
{
return stm32_1wire_isr(&stm32_1wire6_priv);
}
#endif
#ifdef CONFIG_STM32_UART7_1WIREDRIVER
static int stm32_interrupt_1wire7(int irq, void *context, FAR void *arg)
{
return stm32_1wire_isr(&stm32_1wire7_priv);
}
#endif
#ifdef CONFIG_STM32_UART8_1WIREDRIVER
static int stm32_interrupt_1wire8(int irq, void *context, FAR void *arg)
{
return stm32_1wire_isr(&stm32_1wire8_priv);
}
#endif
/****************************************************************************
* Name: stm32_1wire_reset
*