mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
irq_dispatch: Add argument pointer to irq_dispatch
Provide a user defined callback context for irq's, such that when registering a callback users can provide a pointer that will get passed back when the isr is called.
This commit is contained in:
committed by
Gregory Nutt
parent
f97a99e051
commit
b3222bbc8a
@@ -115,7 +115,7 @@ static inline void xtensa_attach_fromcpu0_interrupt(void)
|
||||
|
||||
/* Attach the inter-CPU interrupt. */
|
||||
|
||||
(void)irq_attach(ESP32_IRQ_CPU_CPU0, (xcpt_t)esp32_fromcpu0_interrupt);
|
||||
(void)irq_attach(ESP32_IRQ_CPU_CPU0, (xcpt_t)esp32_fromcpu0_interrupt, NULL);
|
||||
|
||||
/* Enable the inter 0 CPU interrupts. */
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ static void gpio_dispatch(int irq, uint32_t status, uint32_t *regs)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32_GPIO_IRQ
|
||||
static int gpio_interrupt(int irq, FAR void *context)
|
||||
static int gpio_interrupt(int irq, FAR void *context, FAR void *arg)
|
||||
{
|
||||
uint32_t status;
|
||||
|
||||
@@ -336,7 +336,7 @@ void esp32_gpioirqinitialize(void)
|
||||
|
||||
/* Attach and enable the interrupt handler */
|
||||
|
||||
DEBUGVERIFY(irq_attach(ESP32_IRQ_CPU_GPIO, gpio_interrupt));
|
||||
DEBUGVERIFY(irq_attach(ESP32_IRQ_CPU_GPIO, gpio_interrupt, NULL));
|
||||
up_enable_irq(g_gpio_cpuint);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -132,12 +132,12 @@ static int esp32_fromcpu_interrupt(int fromcpu)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_fromcpu0_interrupt(int irq, FAR void *context)
|
||||
int esp32_fromcpu0_interrupt(int irq, FAR void *context, FAR void *arg)
|
||||
{
|
||||
return esp32_fromcpu_interrupt(0);
|
||||
}
|
||||
|
||||
int esp32_fromcpu1_interrupt(int irq, FAR void *context)
|
||||
int esp32_fromcpu1_interrupt(int irq, FAR void *context, FAR void *arg)
|
||||
{
|
||||
return esp32_fromcpu_interrupt(1);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ static inline void xtensa_attach_fromcpu1_interrupt(void)
|
||||
|
||||
/* Attach the inter-CPU interrupt. */
|
||||
|
||||
(void)irq_attach(ESP32_IRQ_CPU_CPU1, (xcpt_t)esp32_fromcpu1_interrupt);
|
||||
(void)irq_attach(ESP32_IRQ_CPU_CPU1, (xcpt_t)esp32_fromcpu1_interrupt, NULL);
|
||||
|
||||
/* Enable the inter 0 CPU interrupt. */
|
||||
|
||||
|
||||
@@ -188,13 +188,13 @@ static int esp32_attach(struct uart_dev_s *dev);
|
||||
static void esp32_detach(struct uart_dev_s *dev);
|
||||
static int esp32_interrupt(struct uart_dev_s *dev);
|
||||
#ifdef CONFIG_ESP32_UART0
|
||||
static int esp32_uart0_interrupt(int cpuint, void *context);
|
||||
static int esp32_uart0_interrupt(int cpuint, void *context, FAR void *arg);
|
||||
#endif
|
||||
#ifdef CONFIG_ESP32_UART1
|
||||
static int esp32_uart1_interrupt(int cpuint, void *context);
|
||||
static int esp32_uart1_interrupt(int cpuint, void *context, FAR void *arg);
|
||||
#endif
|
||||
#ifdef CONFIG_ESP32_UART2
|
||||
static int esp32_uart2_interrupt(int cpuint, void *context);
|
||||
static int esp32_uart2_interrupt(int cpuint, void *context, FAR void *arg);
|
||||
#endif
|
||||
static int esp32_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
static int esp32_receive(struct uart_dev_s *dev, unsigned int *status);
|
||||
@@ -675,7 +675,7 @@ static int esp32_attach(struct uart_dev_s *dev)
|
||||
|
||||
/* Attach and enable the IRQ */
|
||||
|
||||
ret = irq_attach(priv->config->irq, priv->config->handler);
|
||||
ret = irq_attach(priv->config->irq, priv->config->handler, NULL);
|
||||
if (ret == OK)
|
||||
{
|
||||
/* Enable the CPU interrupt (RX and TX interrupts are still disabled
|
||||
@@ -815,19 +815,19 @@ static int esp32_interrupt(struct uart_dev_s *dev)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32_UART0
|
||||
static int esp32_uart0_interrupt(int cpuint, void *context)
|
||||
static int esp32_uart0_interrupt(int cpuint, void *context, FAR void *arg)
|
||||
{
|
||||
return esp32_interrupt(&g_uart0port);
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_ESP32_UART1
|
||||
static int esp32_uart1_interrupt(int cpuint, void *context)
|
||||
static int esp32_uart1_interrupt(int cpuint, void *context, FAR void *arg)
|
||||
{
|
||||
return esp32_interrupt(&g_uart1port);
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_ESP32_UART2
|
||||
static int esp32_uart2_interrupt(int cpuint, void *context)
|
||||
static int esp32_uart2_interrupt(int cpuint, void *context, FAR void *arg)
|
||||
{
|
||||
return esp32_interrupt(&g_uart2port);
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ extern uint32_t g_cpu1_idlestack[CPU1_IDLETHREAD_STACKWORDS];
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_fromcpu0_interrupt(int irq, FAR void *context);
|
||||
int esp32_fromcpu1_interrupt(int irq, FAR void *context);
|
||||
int esp32_fromcpu0_interrupt(int irq, FAR void *context, FAR void *arg);
|
||||
int esp32_fromcpu1_interrupt(int irq, FAR void *context, FAR void *arg);
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32_ESP32_SMP_H */
|
||||
|
||||
@@ -126,7 +126,7 @@ static inline void xtensa_setcompare(uint32_t compare)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32_timerisr(int irq, uint32_t *regs)
|
||||
static int esp32_timerisr(int irq, uint32_t *regs, FAR void *arg)
|
||||
{
|
||||
uint32_t divisor;
|
||||
uint32_t compare;
|
||||
@@ -192,7 +192,7 @@ void xtensa_timer_initialize(void)
|
||||
|
||||
/* Attach the timer interrupt */
|
||||
|
||||
(void)irq_attach(XTENSA_IRQ_TIMER0, (xcpt_t)esp32_timerisr);
|
||||
(void)irq_attach(XTENSA_IRQ_TIMER0, (xcpt_t)esp32_timerisr, NULL);
|
||||
|
||||
/* Enable the timer 0 CPU interrupt. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user