STM32 F7 Serial: Convert to use new interrupt argument interface.
This commit is contained in:
parent
17af125390
commit
61639c1aa3
@ -281,8 +281,6 @@ struct up_dev_s
|
|||||||
const unsigned int rxdma_channel; /* DMA channel assigned */
|
const unsigned int rxdma_channel; /* DMA channel assigned */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int (*const vector)(int irq, void *context, FAR void *arg); /* Interrupt handler */
|
|
||||||
|
|
||||||
/* RX DMA state */
|
/* RX DMA state */
|
||||||
|
|
||||||
#ifdef SERIAL_HAVE_DMA
|
#ifdef SERIAL_HAVE_DMA
|
||||||
@ -308,7 +306,7 @@ static int up_setup(struct uart_dev_s *dev);
|
|||||||
static void up_shutdown(struct uart_dev_s *dev);
|
static void up_shutdown(struct uart_dev_s *dev);
|
||||||
static int up_attach(struct uart_dev_s *dev);
|
static int up_attach(struct uart_dev_s *dev);
|
||||||
static void up_detach(struct uart_dev_s *dev);
|
static void up_detach(struct uart_dev_s *dev);
|
||||||
static int up_interrupt_common(struct up_dev_s *dev);
|
static int up_interrupt(int irq, void *context, FAR void *arg)
|
||||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
|
static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||||
#ifndef SERIAL_HAVE_ONLY_DMA
|
#ifndef SERIAL_HAVE_ONLY_DMA
|
||||||
static int up_receive(struct uart_dev_s *dev, unsigned int *status);
|
static int up_receive(struct uart_dev_s *dev, unsigned int *status);
|
||||||
@ -340,31 +338,6 @@ static int up_pm_prepare(struct pm_callback_s *cb, int domain,
|
|||||||
enum pm_state_e pmstate);
|
enum pm_state_e pmstate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_USART1
|
|
||||||
static int up_interrupt_usart1(int irq, void *context, FAR void *arg);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_STM32F7_USART2
|
|
||||||
static int up_interrupt_usart2(int irq, void *context, FAR void *arg);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_STM32F7_USART3
|
|
||||||
static int up_interrupt_usart3(int irq, void *context, FAR void *arg);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_STM32F7_UART4
|
|
||||||
static int up_interrupt_uart4(int irq, void *context, FAR void *arg);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_STM32F7_UART5
|
|
||||||
static int up_interrupt_uart5(int irq, void *context, FAR void *arg);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_STM32F7_USART6
|
|
||||||
static int up_interrupt_usart6(int irq, void *context, FAR void *arg);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_STM32F7_UART7
|
|
||||||
static int up_interrupt_uart7(int irq, void *context, FAR void *arg);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_STM32F7_UART8
|
|
||||||
static int up_interrupt_uart8(int irq, void *context, FAR void *arg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -554,7 +527,6 @@ static struct up_dev_s g_usart1priv =
|
|||||||
.rxdma_channel = DMAMAP_USART1_RX,
|
.rxdma_channel = DMAMAP_USART1_RX,
|
||||||
.rxfifo = g_usart1rxfifo,
|
.rxfifo = g_usart1rxfifo,
|
||||||
#endif
|
#endif
|
||||||
.vector = up_interrupt_usart1,
|
|
||||||
|
|
||||||
#ifdef CONFIG_USART1_RS485
|
#ifdef CONFIG_USART1_RS485
|
||||||
.rs485_dir_gpio = GPIO_USART1_RS485_DIR,
|
.rs485_dir_gpio = GPIO_USART1_RS485_DIR,
|
||||||
@ -616,7 +588,6 @@ static struct up_dev_s g_usart2priv =
|
|||||||
.rxdma_channel = DMAMAP_USART2_RX,
|
.rxdma_channel = DMAMAP_USART2_RX,
|
||||||
.rxfifo = g_usart2rxfifo,
|
.rxfifo = g_usart2rxfifo,
|
||||||
#endif
|
#endif
|
||||||
.vector = up_interrupt_usart2,
|
|
||||||
|
|
||||||
#ifdef CONFIG_USART2_RS485
|
#ifdef CONFIG_USART2_RS485
|
||||||
.rs485_dir_gpio = GPIO_USART2_RS485_DIR,
|
.rs485_dir_gpio = GPIO_USART2_RS485_DIR,
|
||||||
@ -678,7 +649,6 @@ static struct up_dev_s g_usart3priv =
|
|||||||
.rxdma_channel = DMAMAP_USART3_RX,
|
.rxdma_channel = DMAMAP_USART3_RX,
|
||||||
.rxfifo = g_usart3rxfifo,
|
.rxfifo = g_usart3rxfifo,
|
||||||
#endif
|
#endif
|
||||||
.vector = up_interrupt_usart3,
|
|
||||||
|
|
||||||
#ifdef CONFIG_USART3_RS485
|
#ifdef CONFIG_USART3_RS485
|
||||||
.rs485_dir_gpio = GPIO_USART3_RS485_DIR,
|
.rs485_dir_gpio = GPIO_USART3_RS485_DIR,
|
||||||
@ -744,7 +714,6 @@ static struct up_dev_s g_uart4priv =
|
|||||||
.rxdma_channel = DMAMAP_UART4_RX,
|
.rxdma_channel = DMAMAP_UART4_RX,
|
||||||
.rxfifo = g_uart4rxfifo,
|
.rxfifo = g_uart4rxfifo,
|
||||||
#endif
|
#endif
|
||||||
.vector = up_interrupt_uart4,
|
|
||||||
|
|
||||||
#ifdef CONFIG_UART4_RS485
|
#ifdef CONFIG_UART4_RS485
|
||||||
.rs485_dir_gpio = GPIO_UART4_RS485_DIR,
|
.rs485_dir_gpio = GPIO_UART4_RS485_DIR,
|
||||||
@ -810,7 +779,6 @@ static struct up_dev_s g_uart5priv =
|
|||||||
.rxdma_channel = DMAMAP_UART5_RX,
|
.rxdma_channel = DMAMAP_UART5_RX,
|
||||||
.rxfifo = g_uart5rxfifo,
|
.rxfifo = g_uart5rxfifo,
|
||||||
#endif
|
#endif
|
||||||
.vector = up_interrupt_uart5,
|
|
||||||
|
|
||||||
#ifdef CONFIG_UART5_RS485
|
#ifdef CONFIG_UART5_RS485
|
||||||
.rs485_dir_gpio = GPIO_UART5_RS485_DIR,
|
.rs485_dir_gpio = GPIO_UART5_RS485_DIR,
|
||||||
@ -872,7 +840,6 @@ static struct up_dev_s g_usart6priv =
|
|||||||
.rxdma_channel = DMAMAP_USART6_RX,
|
.rxdma_channel = DMAMAP_USART6_RX,
|
||||||
.rxfifo = g_usart6rxfifo,
|
.rxfifo = g_usart6rxfifo,
|
||||||
#endif
|
#endif
|
||||||
.vector = up_interrupt_usart6,
|
|
||||||
|
|
||||||
#ifdef CONFIG_USART6_RS485
|
#ifdef CONFIG_USART6_RS485
|
||||||
.rs485_dir_gpio = GPIO_USART6_RS485_DIR,
|
.rs485_dir_gpio = GPIO_USART6_RS485_DIR,
|
||||||
@ -934,7 +901,6 @@ static struct up_dev_s g_uart7priv =
|
|||||||
.rxdma_channel = DMAMAP_UART7_RX,
|
.rxdma_channel = DMAMAP_UART7_RX,
|
||||||
.rxfifo = g_uart7rxfifo,
|
.rxfifo = g_uart7rxfifo,
|
||||||
#endif
|
#endif
|
||||||
.vector = up_interrupt_uart7,
|
|
||||||
|
|
||||||
#ifdef CONFIG_UART7_RS485
|
#ifdef CONFIG_UART7_RS485
|
||||||
.rs485_dir_gpio = GPIO_UART7_RS485_DIR,
|
.rs485_dir_gpio = GPIO_UART7_RS485_DIR,
|
||||||
@ -996,7 +962,6 @@ static struct up_dev_s g_uart8priv =
|
|||||||
.rxdma_channel = DMAMAP_UART8_RX,
|
.rxdma_channel = DMAMAP_UART8_RX,
|
||||||
.rxfifo = g_uart8rxfifo,
|
.rxfifo = g_uart8rxfifo,
|
||||||
#endif
|
#endif
|
||||||
.vector = up_interrupt_uart8,
|
|
||||||
|
|
||||||
#ifdef CONFIG_UART8_RS485
|
#ifdef CONFIG_UART8_RS485
|
||||||
.rs485_dir_gpio = GPIO_UART8_RS485_DIR,
|
.rs485_dir_gpio = GPIO_UART8_RS485_DIR,
|
||||||
@ -1681,7 +1646,7 @@ static int up_attach(struct uart_dev_s *dev)
|
|||||||
|
|
||||||
/* Attach and enable the IRQ */
|
/* Attach and enable the IRQ */
|
||||||
|
|
||||||
ret = irq_attach(priv->irq, priv->vector, NULL);
|
ret = irq_attach(priv->irq, up_interrupt, priv);
|
||||||
if (ret == OK)
|
if (ret == OK)
|
||||||
{
|
{
|
||||||
/* Enable the interrupt (RX and TX interrupts are still disabled
|
/* Enable the interrupt (RX and TX interrupts are still disabled
|
||||||
@ -1711,7 +1676,7 @@ static void up_detach(struct uart_dev_s *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_interrupt_common
|
* Name: up_interrupt
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is the USART interrupt handler. It will be invoked when an
|
* This is the USART interrupt handler. It will be invoked when an
|
||||||
@ -1722,11 +1687,14 @@ static void up_detach(struct uart_dev_s *dev)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int up_interrupt_common(struct up_dev_s *priv)
|
static int up_interrupt(int irq, void *context, FAR void *arg)
|
||||||
{
|
{
|
||||||
|
struct up_dev_s *priv = (struct up_dev_s *)arg;
|
||||||
int passes;
|
int passes;
|
||||||
bool handled;
|
bool handled;
|
||||||
|
|
||||||
|
DEBUGASSERT(priv != NULL);
|
||||||
|
|
||||||
/* Report serial activity to the power management logic */
|
/* Report serial activity to the power management logic */
|
||||||
|
|
||||||
#if defined(CONFIG_PM) && CONFIG_PM_SERIAL_ACTIVITY > 0
|
#if defined(CONFIG_PM) && CONFIG_PM_SERIAL_ACTIVITY > 0
|
||||||
@ -2501,70 +2469,6 @@ static bool up_txready(struct uart_dev_s *dev)
|
|||||||
return ((up_serialin(priv, STM32_USART_ISR_OFFSET) & USART_ISR_TXE) != 0);
|
return ((up_serialin(priv, STM32_USART_ISR_OFFSET) & USART_ISR_TXE) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: up_interrupt_u[s]art[n]
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Interrupt handlers for U[S]ART[n] where n=1,..,6.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_USART1
|
|
||||||
static int up_interrupt_usart1(int irq, void *context, FAR void *arg)
|
|
||||||
{
|
|
||||||
return up_interrupt_common(&g_usart1priv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_USART2
|
|
||||||
static int up_interrupt_usart2(int irq, void *context, FAR void *arg)
|
|
||||||
{
|
|
||||||
return up_interrupt_common(&g_usart2priv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_USART3
|
|
||||||
static int up_interrupt_usart3(int irq, void *context, FAR void *arg)
|
|
||||||
{
|
|
||||||
return up_interrupt_common(&g_usart3priv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_UART4
|
|
||||||
static int up_interrupt_uart4(int irq, void *context, FAR void *arg)
|
|
||||||
{
|
|
||||||
return up_interrupt_common(&g_uart4priv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_UART5
|
|
||||||
static int up_interrupt_uart5(int irq, void *context, FAR void *arg)
|
|
||||||
{
|
|
||||||
return up_interrupt_common(&g_uart5priv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_USART6
|
|
||||||
static int up_interrupt_usart6(int irq, void *context, FAR void *arg)
|
|
||||||
{
|
|
||||||
return up_interrupt_common(&g_usart6priv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_UART7
|
|
||||||
static int up_interrupt_uart7(int irq, void *context, FAR void *arg)
|
|
||||||
{
|
|
||||||
return up_interrupt_common(&g_uart7priv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_UART8
|
|
||||||
static int up_interrupt_uart8(int irq, void *context, FAR void *arg)
|
|
||||||
{
|
|
||||||
return up_interrupt_common(&g_uart8priv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_dma_rxcallback
|
* Name: up_dma_rxcallback
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user