From b3222bbc8a18af33eef38a147165ee1999124b21 Mon Sep 17 00:00:00 2001 From: Mark Schulte Date: Mon, 27 Feb 2017 06:27:56 -0600 Subject: [PATCH 01/38] 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. --- arch/arm/src/a1x/a1x_serial.c | 34 +++--- arch/arm/src/a1x/a1x_timerisr.c | 4 +- arch/arm/src/armv6-m/up_hardfault.c | 4 +- arch/arm/src/armv6-m/up_svcall.c | 2 +- arch/arm/src/armv7-a/arm_cpupause.c | 2 +- arch/arm/src/armv7-a/arm_cpustart.c | 2 +- arch/arm/src/armv7-a/arm_gicv2.c | 4 +- arch/arm/src/armv7-a/gic.h | 4 +- arch/arm/src/armv7-m/up_hardfault.c | 4 +- arch/arm/src/armv7-m/up_memfault.c | 2 +- arch/arm/src/armv7-m/up_svcall.c | 2 +- arch/arm/src/c5471/c5471_ethernet.c | 6 +- arch/arm/src/c5471/c5471_serial.c | 6 +- arch/arm/src/c5471/c5471_timerisr.c | 4 +- arch/arm/src/c5471/c5471_watchdog.c | 6 +- arch/arm/src/common/up_internal.h | 6 +- arch/arm/src/dm320/dm320_serial.c | 6 +- arch/arm/src/dm320/dm320_timerisr.c | 4 +- arch/arm/src/dm320/dm320_usbdev.c | 12 +-- arch/arm/src/efm32/efm32_adc.c | 6 +- arch/arm/src/efm32/efm32_dma.c | 4 +- arch/arm/src/efm32/efm32_gpioirq.c | 8 +- arch/arm/src/efm32/efm32_i2c.c | 12 +-- arch/arm/src/efm32/efm32_irq.c | 32 +++--- arch/arm/src/efm32/efm32_leserial.c | 10 +- arch/arm/src/efm32/efm32_pwm.c | 20 ++-- arch/arm/src/efm32/efm32_rtc_burtc.c | 4 +- arch/arm/src/efm32/efm32_serial.c | 44 ++++---- arch/arm/src/efm32/efm32_timerisr.c | 4 +- arch/arm/src/efm32/efm32_usbdev.c | 6 +- arch/arm/src/efm32/efm32_usbhost.c | 6 +- arch/arm/src/imx1/imx_serial.c | 10 +- arch/arm/src/imx1/imx_spi.c | 6 +- arch/arm/src/imx1/imx_timerisr.c | 4 +- arch/arm/src/imx6/imx_ecspi.c | 22 ++-- arch/arm/src/imx6/imx_serial.c | 22 ++-- arch/arm/src/imx6/imx_timerisr.c | 4 +- arch/arm/src/kinetis/kinetis_enet.c | 12 +-- arch/arm/src/kinetis/kinetis_i2c.c | 2 +- arch/arm/src/kinetis/kinetis_irq.c | 32 +++--- arch/arm/src/kinetis/kinetis_pinirq.c | 20 ++-- arch/arm/src/kinetis/kinetis_rtc.c | 4 +- arch/arm/src/kinetis/kinetis_sdhc.c | 6 +- arch/arm/src/kinetis/kinetis_serial.c | 12 +-- arch/arm/src/kinetis/kinetis_timerisr.c | 4 +- arch/arm/src/kinetis/kinetis_usbdev.c | 6 +- arch/arm/src/kl/kl_gpioirq.c | 8 +- arch/arm/src/kl/kl_irq.c | 16 +-- arch/arm/src/kl/kl_serial.c | 6 +- arch/arm/src/kl/kl_timerisr.c | 4 +- arch/arm/src/lpc11xx/lpc11_gpioint.c | 6 +- arch/arm/src/lpc11xx/lpc11_i2c.c | 6 +- arch/arm/src/lpc11xx/lpc11_irq.c | 16 +-- arch/arm/src/lpc11xx/lpc11_serial.c | 6 +- arch/arm/src/lpc11xx/lpc11_timerisr.c | 4 +- arch/arm/src/lpc17xx/lpc176x_rtc.c | 4 +- arch/arm/src/lpc17xx/lpc17_adc.c | 6 +- arch/arm/src/lpc17xx/lpc17_can.c | 6 +- arch/arm/src/lpc17xx/lpc17_ethernet.c | 8 +- arch/arm/src/lpc17xx/lpc17_gpdma.c | 4 +- arch/arm/src/lpc17xx/lpc17_gpioint.c | 6 +- arch/arm/src/lpc17xx/lpc17_i2c.c | 6 +- arch/arm/src/lpc17xx/lpc17_irq.c | 32 +++--- arch/arm/src/lpc17xx/lpc17_pwm.c | 2 +- arch/arm/src/lpc17xx/lpc17_sdcard.c | 6 +- arch/arm/src/lpc17xx/lpc17_serial.c | 6 +- arch/arm/src/lpc17xx/lpc17_timerisr.c | 4 +- arch/arm/src/lpc17xx/lpc17_usbdev.c | 6 +- arch/arm/src/lpc17xx/lpc17_usbhost.c | 6 +- arch/arm/src/lpc214x/lpc214x_serial.c | 6 +- arch/arm/src/lpc214x/lpc214x_timerisr.c | 4 +- arch/arm/src/lpc214x/lpc214x_usbdev.c | 6 +- arch/arm/src/lpc2378/lpc23xx_i2c.c | 6 +- arch/arm/src/lpc2378/lpc23xx_serial.c | 6 +- arch/arm/src/lpc2378/lpc23xx_timerisr.c | 4 +- arch/arm/src/lpc31xx/lpc31_ehci.c | 6 +- arch/arm/src/lpc31xx/lpc31_i2c.c | 6 +- arch/arm/src/lpc31xx/lpc31_serial.c | 6 +- arch/arm/src/lpc31xx/lpc31_timerisr.c | 4 +- arch/arm/src/lpc31xx/lpc31_usbdev.c | 6 +- arch/arm/src/lpc43xx/lpc43_adc.c | 6 +- arch/arm/src/lpc43xx/lpc43_dac.c | 4 +- arch/arm/src/lpc43xx/lpc43_ehci.c | 6 +- arch/arm/src/lpc43xx/lpc43_ethernet.c | 6 +- arch/arm/src/lpc43xx/lpc43_gpdma.c | 4 +- arch/arm/src/lpc43xx/lpc43_i2c.c | 6 +- arch/arm/src/lpc43xx/lpc43_irq.c | 32 +++--- arch/arm/src/lpc43xx/lpc43_rit.c | 4 +- arch/arm/src/lpc43xx/lpc43_serial.c | 6 +- arch/arm/src/lpc43xx/lpc43_tickless_rit.c | 4 +- arch/arm/src/lpc43xx/lpc43_timer.c | 6 +- arch/arm/src/lpc43xx/lpc43_timerisr.c | 4 +- arch/arm/src/lpc43xx/lpc43_usb0dev.c | 6 +- arch/arm/src/moxart/moxart_irq.c | 2 +- arch/arm/src/moxart/moxart_timer.c | 4 +- arch/arm/src/nuc1xx/nuc_irq.c | 16 +-- arch/arm/src/nuc1xx/nuc_serial.c | 6 +- arch/arm/src/nuc1xx/nuc_timerisr.c | 4 +- arch/arm/src/sam34/sam4cm_cpupause.c | 2 +- arch/arm/src/sam34/sam4cm_cpustart.c | 6 +- arch/arm/src/sam34/sam4cm_tc.c | 6 +- arch/arm/src/sam34/sam_dmac.c | 4 +- arch/arm/src/sam34/sam_emac.c | 6 +- arch/arm/src/sam34/sam_gpioirq.c | 24 ++--- arch/arm/src/sam34/sam_hsmci.c | 6 +- arch/arm/src/sam34/sam_irq.c | 32 +++--- arch/arm/src/sam34/sam_rtc.c | 4 +- arch/arm/src/sam34/sam_rtt.c | 6 +- arch/arm/src/sam34/sam_serial.c | 6 +- arch/arm/src/sam34/sam_tc.c | 6 +- arch/arm/src/sam34/sam_timerisr.c | 4 +- arch/arm/src/sam34/sam_twi.c | 2 +- arch/arm/src/sam34/sam_udp.c | 6 +- arch/arm/src/sam34/sam_wdt.c | 6 +- arch/arm/src/sama5/sam_adc.c | 6 +- arch/arm/src/sama5/sam_can.c | 10 +- arch/arm/src/sama5/sam_dbgu.c | 6 +- arch/arm/src/sama5/sam_dmac.c | 8 +- arch/arm/src/sama5/sam_ehci.c | 14 +-- arch/arm/src/sama5/sam_emaca.c | 6 +- arch/arm/src/sama5/sam_emacb.c | 10 +- arch/arm/src/sama5/sam_flexcom_serial.c | 22 ++-- arch/arm/src/sama5/sam_gmac.c | 6 +- arch/arm/src/sama5/sam_hsmci.c | 2 +- arch/arm/src/sama5/sam_nand.c | 6 +- arch/arm/src/sama5/sam_ohci.c | 4 +- arch/arm/src/sama5/sam_pioirq.c | 24 ++--- arch/arm/src/sama5/sam_pwm.c | 6 +- arch/arm/src/sama5/sam_rtc.c | 4 +- arch/arm/src/sama5/sam_serial.c | 42 ++++---- arch/arm/src/sama5/sam_tc.c | 14 +-- arch/arm/src/sama5/sam_timerisr.c | 4 +- arch/arm/src/sama5/sam_trng.c | 6 +- arch/arm/src/sama5/sam_twi.c | 18 ++-- arch/arm/src/sama5/sam_udphs.c | 6 +- arch/arm/src/sama5/sam_usbhost.h | 2 +- arch/arm/src/sama5/sam_wdt.c | 6 +- arch/arm/src/sama5/sam_xdmac.c | 8 +- arch/arm/src/samdl/sam_dmac.c | 6 +- arch/arm/src/samdl/sam_irq.c | 16 +-- arch/arm/src/samdl/sam_serial.c | 26 ++--- arch/arm/src/samdl/sam_spi.c | 26 ++--- arch/arm/src/samdl/sam_timerisr.c | 4 +- arch/arm/src/samv7/sam_dac.c | 6 +- arch/arm/src/samv7/sam_emac.c | 10 +- arch/arm/src/samv7/sam_gpioirq.c | 20 ++-- arch/arm/src/samv7/sam_hsmci.c | 2 +- arch/arm/src/samv7/sam_irq.c | 32 +++--- arch/arm/src/samv7/sam_mcan.c | 12 +-- arch/arm/src/samv7/sam_qspi.c | 4 +- arch/arm/src/samv7/sam_rswdt.c | 6 +- arch/arm/src/samv7/sam_serial.c | 34 +++--- arch/arm/src/samv7/sam_spi_slave.c | 10 +- arch/arm/src/samv7/sam_tc.c | 50 ++++----- arch/arm/src/samv7/sam_timerisr.c | 4 +- arch/arm/src/samv7/sam_trng.c | 6 +- arch/arm/src/samv7/sam_twihs.c | 14 +-- arch/arm/src/samv7/sam_usbdevhs.c | 6 +- arch/arm/src/samv7/sam_wdt.c | 6 +- arch/arm/src/samv7/sam_xdmac.c | 4 +- arch/arm/src/stm32/stm32_1wire.c | 36 +++---- arch/arm/src/stm32/stm32_adc.c | 22 ++-- arch/arm/src/stm32/stm32_can.c | 18 ++-- arch/arm/src/stm32/stm32_capture.c | 4 +- arch/arm/src/stm32/stm32_dac.c | 4 +- arch/arm/src/stm32/stm32_dma2d.c | 6 +- arch/arm/src/stm32/stm32_eth.c | 6 +- arch/arm/src/stm32/stm32_exti_alarm.c | 4 +- arch/arm/src/stm32/stm32_exti_gpio.c | 34 +++--- arch/arm/src/stm32/stm32_exti_pwr.c | 6 +- arch/arm/src/stm32/stm32_i2c.c | 18 ++-- arch/arm/src/stm32/stm32_i2c_alt.c | 18 ++-- arch/arm/src/stm32/stm32_irq.c | 32 +++--- arch/arm/src/stm32/stm32_ltdc.c | 6 +- arch/arm/src/stm32/stm32_otgfsdev.c | 6 +- arch/arm/src/stm32/stm32_otgfshost.c | 6 +- arch/arm/src/stm32/stm32_otghsdev.c | 6 +- arch/arm/src/stm32/stm32_otghshost.c | 6 +- arch/arm/src/stm32/stm32_pwm.c | 12 +-- arch/arm/src/stm32/stm32_qencoder.c | 26 ++--- arch/arm/src/stm32/stm32_rng.c | 6 +- arch/arm/src/stm32/stm32_rtcc.c | 2 +- arch/arm/src/stm32/stm32_rtcounter.c | 4 +- arch/arm/src/stm32/stm32_sdadc.c | 16 +-- arch/arm/src/stm32/stm32_sdio.c | 6 +- arch/arm/src/stm32/stm32_serial.c | 36 +++---- arch/arm/src/stm32/stm32_tim.c | 2 +- arch/arm/src/stm32/stm32_timerisr.c | 4 +- arch/arm/src/stm32/stm32_usbdev.c | 12 +-- arch/arm/src/stm32/stm32_wwdg.c | 6 +- arch/arm/src/stm32/stm32f10xxx_dma.c | 4 +- arch/arm/src/stm32/stm32f20xxx_dma.c | 4 +- arch/arm/src/stm32/stm32f30xxx_i2c.c | 18 ++-- arch/arm/src/stm32/stm32f40xxx_dma.c | 4 +- arch/arm/src/stm32/stm32f40xxx_i2c.c | 18 ++-- arch/arm/src/stm32f7/stm32_adc.c | 6 +- arch/arm/src/stm32f7/stm32_dma.c | 4 +- arch/arm/src/stm32f7/stm32_ethernet.c | 6 +- arch/arm/src/stm32f7/stm32_exti_alarm.c | 4 +- arch/arm/src/stm32f7/stm32_exti_gpio.c | 2 +- arch/arm/src/stm32f7/stm32_exti_pwr.c | 4 +- arch/arm/src/stm32f7/stm32_i2c.c | 22 ++-- arch/arm/src/stm32f7/stm32_irq.c | 32 +++--- arch/arm/src/stm32f7/stm32_otgdev.c | 6 +- arch/arm/src/stm32f7/stm32_otghost.c | 6 +- arch/arm/src/stm32f7/stm32_sdmmc.c | 10 +- arch/arm/src/stm32f7/stm32_serial.c | 36 +++---- arch/arm/src/stm32f7/stm32_tim.c | 2 +- arch/arm/src/stm32f7/stm32_timerisr.c | 4 +- arch/arm/src/stm32l4/stm32l4_can.c | 18 ++-- arch/arm/src/stm32l4/stm32l4_exti_alarm.c | 6 +- arch/arm/src/stm32l4/stm32l4_exti_gpio.c | 34 +++--- arch/arm/src/stm32l4/stm32l4_exti_pwr.c | 6 +- arch/arm/src/stm32l4/stm32l4_i2c.c | 18 ++-- arch/arm/src/stm32l4/stm32l4_irq.c | 32 +++--- arch/arm/src/stm32l4/stm32l4_otgfsdev.c | 6 +- arch/arm/src/stm32l4/stm32l4_otgfshost.c | 6 +- arch/arm/src/stm32l4/stm32l4_pwm.c | 12 +-- arch/arm/src/stm32l4/stm32l4_qencoder.c | 26 ++--- arch/arm/src/stm32l4/stm32l4_qspi.c | 6 +- arch/arm/src/stm32l4/stm32l4_rng.c | 6 +- arch/arm/src/stm32l4/stm32l4_rtcc.c | 2 +- arch/arm/src/stm32l4/stm32l4_serial.c | 24 ++--- arch/arm/src/stm32l4/stm32l4_tim.c | 2 +- arch/arm/src/stm32l4/stm32l4_timerisr.c | 4 +- arch/arm/src/stm32l4/stm32l4x6xx_dma.c | 4 +- arch/arm/src/str71x/str71x_serial.c | 6 +- arch/arm/src/str71x/str71x_timerisr.c | 4 +- arch/arm/src/str71x/str71x_xti.c | 4 +- arch/arm/src/tiva/lm3s_ethernet.c | 8 +- arch/arm/src/tiva/tiva_adclib.c | 2 +- arch/arm/src/tiva/tiva_gpioirq.c | 74 ++++++------- arch/arm/src/tiva/tiva_i2c.c | 44 ++++---- arch/arm/src/tiva/tiva_irq.c | 32 +++--- arch/arm/src/tiva/tiva_pwm.c | 24 ++--- arch/arm/src/tiva/tiva_serial.c | 6 +- arch/arm/src/tiva/tiva_ssi.c | 8 +- arch/arm/src/tiva/tiva_timerisr.c | 4 +- arch/arm/src/tiva/tiva_timerlib.c | 102 +++++++++--------- arch/arm/src/tiva/tm4c_ethernet.c | 8 +- arch/arm/src/tms570/tms570_esm.c | 2 +- arch/arm/src/tms570/tms570_esm.h | 2 +- arch/arm/src/tms570/tms570_gioirq.c | 4 +- arch/arm/src/tms570/tms570_irq.c | 4 +- arch/arm/src/tms570/tms570_serial.c | 10 +- arch/arm/src/tms570/tms570_timerisr.c | 4 +- arch/avr/src/at32uc3/at32uc3_gpioirq.c | 8 +- arch/avr/src/at32uc3/at32uc3_irq.c | 4 +- arch/avr/src/at32uc3/at32uc3_serial.c | 6 +- arch/avr/src/at32uc3/at32uc3_timerisr.c | 4 +- arch/avr/src/at90usb/at90usb_serial.c | 14 +-- arch/avr/src/at90usb/at90usb_timerisr.c | 4 +- arch/avr/src/at90usb/at90usb_usbdev.c | 12 +-- arch/avr/src/atmega/atmega_serial.c | 28 ++--- arch/avr/src/atmega/atmega_timerisr.c | 6 +- arch/hc/src/m9s12/m9s12_ethernet.c | 6 +- arch/hc/src/m9s12/m9s12_gpioirq.c | 12 +-- arch/hc/src/m9s12/m9s12_serial.c | 6 +- arch/hc/src/m9s12/m9s12_timerisr.c | 4 +- arch/mips/src/common/up_internal.h | 2 +- arch/mips/src/mips32/up_swint0.c | 2 +- arch/mips/src/pic32mx/pic32mx-ethernet.c | 8 +- arch/mips/src/pic32mx/pic32mx-irq.c | 2 +- arch/mips/src/pic32mx/pic32mx-serial.c | 6 +- arch/mips/src/pic32mx/pic32mx-spi.c | 2 +- arch/mips/src/pic32mx/pic32mx-timerisr.c | 4 +- arch/mips/src/pic32mx/pic32mx-usbdev.c | 6 +- arch/mips/src/pic32mz/pic32mz-ethernet.c | 8 +- arch/mips/src/pic32mz/pic32mz-gpioirq.c | 6 +- arch/mips/src/pic32mz/pic32mz-irq.c | 2 +- arch/mips/src/pic32mz/pic32mz-serial.c | 30 +++--- arch/mips/src/pic32mz/pic32mz-spi.c | 6 +- arch/mips/src/pic32mz/pic32mz-timerisr.c | 4 +- arch/misoc/src/common/misoc_net.c | 6 +- arch/misoc/src/common/misoc_serial.c | 6 +- arch/misoc/src/common/misoc_timerisr.c | 4 +- arch/misoc/src/lm32/lm32.h | 2 +- arch/misoc/src/lm32/lm32_irq.c | 2 +- arch/misoc/src/lm32/lm32_swint.c | 2 +- arch/renesas/src/m16c/m16c_serial.c | 12 +-- arch/renesas/src/m16c/m16c_timerisr.c | 4 +- arch/renesas/src/sh1/sh1_serial.c | 10 +- arch/renesas/src/sh1/sh1_timerisr.c | 4 +- arch/risc-v/src/common/up_internal.h | 2 +- arch/risc-v/src/nr5m100/nr5_irq.c | 6 +- arch/risc-v/src/nr5m100/nr5_serial.c | 8 +- arch/risc-v/src/nr5m100/nr5_timer.c | 2 +- arch/risc-v/src/nr5m100/nr5_timerisr.c | 4 +- arch/risc-v/src/nr5m100/nr5_uart.c | 2 +- arch/risc-v/src/rv32im/up_swint.c | 2 +- arch/x86/src/qemu/qemu_timerisr.c | 4 +- arch/xtensa/src/esp32/esp32_cpustart.c | 2 +- arch/xtensa/src/esp32/esp32_gpio.c | 4 +- .../src/esp32/esp32_intercpu_interrupt.c | 4 +- arch/xtensa/src/esp32/esp32_irq.c | 2 +- arch/xtensa/src/esp32/esp32_serial.c | 14 +-- arch/xtensa/src/esp32/esp32_smp.h | 4 +- arch/xtensa/src/esp32/esp32_timerisr.c | 4 +- arch/z16/src/z16f/z16f_serial.c | 12 +-- arch/z16/src/z16f/z16f_timerisr.c | 4 +- arch/z80/src/ez80/ez80_emac.c | 18 ++-- arch/z80/src/ez80/ez80_serial.c | 6 +- arch/z80/src/ez80/ez80_timerisr.c | 4 +- arch/z80/src/z180/z180_timerisr.c | 4 +- arch/z80/src/z8/z8_serial.c | 12 +-- arch/z80/src/z8/z8_timerisr.c | 4 +- configs/arduino-due/src/sam_touchscreen.c | 2 +- configs/bambino-200e/src/lpc43_buttons.c | 2 +- configs/dk-tm4c129x/src/tm4c_buttons.c | 2 +- configs/ez80f910200zco/src/ez80_buttons.c | 6 +- configs/hymini-stm32v/src/stm32_appinit.c | 2 +- .../launchxl-tms57004/src/tms570_buttons.c | 2 +- configs/lincoln60/src/lpc17_buttons.c | 2 +- configs/lpc4330-xplorer/src/lpc43_buttons.c | 2 +- configs/lpc4357-evb/src/lpc43_buttons.c | 2 +- configs/nucleo-f4x1re/src/stm32_ajoystick.c | 4 +- configs/nucleo-l476rg/src/stm32_ajoystick.c | 4 +- .../src/efm32_buttons.c | 2 +- configs/olimex-lpc1766stk/src/lpc17_buttons.c | 2 +- configs/olimex-lpc1766stk/src/lpc17_ssp.c | 2 +- configs/olimex-strp711/src/str71_enc28j60.c | 2 +- configs/open1788/src/lpc17_appinit.c | 4 +- configs/open1788/src/lpc17_buttons.c | 2 +- configs/open1788/src/lpc17_touchscreen.c | 2 +- configs/pcduino-a10/src/a1x_buttons.c | 2 +- configs/sam3u-ek/src/sam_buttons.c | 2 +- configs/sam3u-ek/src/sam_touchscreen.c | 2 +- configs/sam4e-ek/src/sam_ads7843e.c | 2 +- configs/sam4e-ek/src/sam_buttons.c | 2 +- configs/sam4e-ek/src/sam_ethernet.c | 2 +- configs/sam4e-ek/src/sam_hsmci.c | 4 +- configs/sam4l-xplained/src/sam_buttons.c | 2 +- configs/sam4s-xplained-pro/src/sam_buttons.c | 2 +- configs/sam4s-xplained-pro/src/sam_hsmci.c | 4 +- configs/sam4s-xplained/src/sam_buttons.c | 2 +- configs/sama5d2-xult/src/sam_buttons.c | 2 +- configs/sama5d3-xplained/src/sam_ajoystick.c | 6 +- configs/sama5d3-xplained/src/sam_buttons.c | 2 +- configs/sama5d3-xplained/src/sam_ethernet.c | 2 +- configs/sama5d3-xplained/src/sam_hsmci.c | 10 +- configs/sama5d3-xplained/src/sam_usb.c | 2 +- configs/sama5d3x-ek/src/sam_buttons.c | 2 +- configs/sama5d3x-ek/src/sam_ethernet.c | 2 +- configs/sama5d3x-ek/src/sam_hsmci.c | 10 +- configs/sama5d3x-ek/src/sam_usb.c | 2 +- configs/sama5d3x-ek/src/sam_wm8904.c | 4 +- configs/sama5d4-ek/src/sam_buttons.c | 2 +- configs/sama5d4-ek/src/sam_ethernet.c | 2 +- configs/sama5d4-ek/src/sam_hsmci.c | 6 +- configs/sama5d4-ek/src/sam_maxtouch.c | 4 +- configs/sama5d4-ek/src/sam_usb.c | 2 +- configs/sama5d4-ek/src/sam_wm8904.c | 4 +- configs/samd20-xplained/src/sam_buttons.c | 2 +- configs/samd21-xplained/src/sam_buttons.c | 2 +- configs/same70-xplained/src/sam_buttons.c | 2 +- configs/same70-xplained/src/sam_ethernet.c | 2 +- configs/same70-xplained/src/sam_hsmci.c | 6 +- configs/saml21-xplained/src/sam_buttons.c | 2 +- configs/samv71-xult/src/sam_buttons.c | 2 +- configs/samv71-xult/src/sam_ethernet.c | 2 +- configs/samv71-xult/src/sam_hsmci.c | 6 +- configs/samv71-xult/src/sam_maxtouch.c | 4 +- configs/samv71-xult/src/sam_wm8904.c | 4 +- configs/xtrs/src/xtr_irq.c | 2 +- configs/xtrs/src/xtr_timerisr.c | 2 +- configs/z80sim/src/z80_irq.c | 2 +- configs/z80sim/src/z80_timerisr.c | 2 +- configs/zkit-arm-1769/src/lpc17_buttons.c | 2 +- drivers/analog/ad5410.c | 2 +- drivers/analog/ads1255.c | 6 +- drivers/input/mxt.c | 4 +- drivers/ioexpander/skeleton.c | 2 +- drivers/net/cs89x0.c | 6 +- drivers/net/dm90x0.c | 6 +- drivers/net/ftmac100.c | 6 +- drivers/net/phy_notify.c | 16 +-- drivers/net/skeleton.c | 6 +- drivers/serial/uart_16550.c | 6 +- drivers/wireless/cc3000/cc3000.c | 6 +- include/nuttx/irq.h | 8 +- sched/irq/irq.h | 10 +- sched/irq/irq_attach.c | 6 +- sched/irq/irq_dispatch.c | 9 +- sched/irq/irq_initialize.c | 5 +- sched/irq/irq_unexpectedisr.c | 2 +- 385 files changed, 1636 insertions(+), 1624 deletions(-) diff --git a/arch/arm/src/a1x/a1x_serial.c b/arch/arm/src/a1x/a1x_serial.c index 7dae40aa997..656e55f2723 100644 --- a/arch/arm/src/a1x/a1x_serial.c +++ b/arch/arm/src/a1x/a1x_serial.c @@ -110,28 +110,28 @@ static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); static int uart_interrupt(struct uart_dev_s *dev); #ifdef CONFIG_A1X_UART0 -static int uart0_interrupt(int irq, void *context); +static int uart0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_A1X_UART1 -static int uart1_interrupt(int irq, void *context); +static int uart1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_A1X_UART2 -static int uart2_interrupt(int irq, void *context); +static int uart2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_A1X_UART3 -static int uart3_interrupt(int irq, void *context); +static int uart3_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_A1X_UART4 -static int uart4_interrupt(int irq, void *context); +static int uart4_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_A1X_UART5 -static int uart5_interrupt(int irq, void *context); +static int uart5_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_A1X_UART6 -static int uart6_interrupt(int irq, void *context); +static int uart6_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_A1X_UART7 -static int uart7_interrupt(int irq, void *context); +static int uart7_interrupt(int irq, void *context, FAR void *arg); #endif static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); @@ -1068,7 +1068,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler); + ret = irq_attach(priv->irq, priv->handler, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -1202,56 +1202,56 @@ static int uart_interrupt(struct uart_dev_s *dev) } #ifdef CONFIG_A1X_UART0 -static int uart0_interrupt(int irq, void *context) +static int uart0_interrupt(int irq, void *context, FAR void *arg) { return uart_interrupt(&g_uart0port); } #endif #ifdef CONFIG_A1X_UART1 -static int uart1_interrupt(int irq, void *context) +static int uart1_interrupt(int irq, void *context, FAR void *arg) { return uart_interrupt(&g_uart1port); } #endif #ifdef CONFIG_A1X_UART2 -static int uart2_interrupt(int irq, void *context) +static int uart2_interrupt(int irq, void *context, FAR void *arg) { return uart_interrupt(&g_uart2port); } #endif #ifdef CONFIG_A1X_UART3 -static int uart3_interrupt(int irq, void *context) +static int uart3_interrupt(int irq, void *context, FAR void *arg) { return uart_interrupt(&g_uart3port); } #endif #ifdef CONFIG_A1X_UART4 -static int uart4_interrupt(int irq, void *context) +static int uart4_interrupt(int irq, void *context, FAR void *arg) { return uart_interrupt(&g_uart4port); } #endif #ifdef CONFIG_A1X_UART5 -static int uart5_interrupt(int irq, void *context) +static int uart5_interrupt(int irq, void *context, FAR void *arg) { return uart_interrupt(&g_uart5port); } #endif #ifdef CONFIG_A1X_UART6 -static int uart6_interrupt(int irq, void *context) +static int uart6_interrupt(int irq, void *context, FAR void *arg) { return uart_interrupt(&g_uart6port); } #endif #ifdef CONFIG_A1X_UART7 -static int uart7_interrupt(int irq, void *context) +static int uart7_interrupt(int irq, void *context, FAR void *arg) { return uart_interrupt(&g_uart7port); } diff --git a/arch/arm/src/a1x/a1x_timerisr.c b/arch/arm/src/a1x/a1x_timerisr.c index 04407d10511..d5ef7508f41 100644 --- a/arch/arm/src/a1x/a1x_timerisr.c +++ b/arch/arm/src/a1x/a1x_timerisr.c @@ -82,7 +82,7 @@ * ****************************************************************************/ -static int a1x_timerisr(int irq, uint32_t *regs) +static int a1x_timerisr(int irq, uint32_t *regs, void *arg) { /* Only a TIMER0 interrupt is expected here */ @@ -138,7 +138,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(A1X_IRQ_TIMER0, (xcpt_t)a1x_timerisr); + (void)irq_attach(A1X_IRQ_TIMER0, (xcpt_t)a1x_timerisr, NULL); /* Enable interrupts from the TIMER 0 port */ diff --git a/arch/arm/src/armv6-m/up_hardfault.c b/arch/arm/src/armv6-m/up_hardfault.c index b3c24d88515..6b4f69760e1 100644 --- a/arch/arm/src/armv6-m/up_hardfault.c +++ b/arch/arm/src/armv6-m/up_hardfault.c @@ -75,7 +75,7 @@ * ****************************************************************************/ -int up_hardfault(int irq, FAR void *context) +int up_hardfault(int irq, FAR void *context, FAR void *arg) { uint32_t *regs = (uint32_t *)context; @@ -115,7 +115,7 @@ int up_hardfault(int irq, FAR void *context) if (insn == INSN_SVC0) { hfinfo("Forward SVCall\n"); - return up_svcall(irq, context); + return up_svcall(irq, context, NULL); } } diff --git a/arch/arm/src/armv6-m/up_svcall.c b/arch/arm/src/armv6-m/up_svcall.c index 1cd7e3a33b0..fd61de1906f 100644 --- a/arch/arm/src/armv6-m/up_svcall.c +++ b/arch/arm/src/armv6-m/up_svcall.c @@ -130,7 +130,7 @@ static void dispatch_syscall(void) * ****************************************************************************/ -int up_svcall(int irq, FAR void *context) +int up_svcall(int irq, FAR void *context, FAR void *arg) { uint32_t *regs = (uint32_t *)context; uint32_t cmd; diff --git a/arch/arm/src/armv7-a/arm_cpupause.c b/arch/arm/src/armv7-a/arm_cpupause.c index 6f92343c149..8a1499c2976 100644 --- a/arch/arm/src/armv7-a/arm_cpupause.c +++ b/arch/arm/src/armv7-a/arm_cpupause.c @@ -202,7 +202,7 @@ int up_cpu_paused(int cpu) * ****************************************************************************/ -int arm_pause_handler(int irq, FAR void *context) +int arm_pause_handler(int irq, FAR void *context, FAR void *arg) { int cpu = this_cpu(); diff --git a/arch/arm/src/armv7-a/arm_cpustart.c b/arch/arm/src/armv7-a/arm_cpustart.c index d63c035db68..3226153f5c1 100644 --- a/arch/arm/src/armv7-a/arm_cpustart.c +++ b/arch/arm/src/armv7-a/arm_cpustart.c @@ -103,7 +103,7 @@ static inline void arm_registerdump(FAR struct tcb_s *tcb) * ****************************************************************************/ -int arm_start_handler(int irq, FAR void *context) +int arm_start_handler(int irq, FAR void *context, FAR void *arg) { FAR struct tcb_s *tcb = this_task(); diff --git a/arch/arm/src/armv7-a/arm_gicv2.c b/arch/arm/src/armv7-a/arm_gicv2.c index dce0b621ed9..ec32fa52710 100644 --- a/arch/arm/src/armv7-a/arm_gicv2.c +++ b/arch/arm/src/armv7-a/arm_gicv2.c @@ -124,8 +124,8 @@ void arm_gic0_initialize(void) #ifdef CONFIG_SMP /* Attach SGI interrupt handlers. This attaches the handler for all CPUs. */ - DEBUGVERIFY(irq_attach(GIC_IRQ_SGI1, arm_start_handler)); - DEBUGVERIFY(irq_attach(GIC_IRQ_SGI2, arm_pause_handler)); + DEBUGVERIFY(irq_attach(GIC_IRQ_SGI1, arm_start_handler, NULL)); + DEBUGVERIFY(irq_attach(GIC_IRQ_SGI2, arm_pause_handler, NULL)); #endif arm_gic_dump("Exit arm_gic0_initialize", true, 0); diff --git a/arch/arm/src/armv7-a/gic.h b/arch/arm/src/armv7-a/gic.h index 87740651350..8c882ad6ddc 100644 --- a/arch/arm/src/armv7-a/gic.h +++ b/arch/arm/src/armv7-a/gic.h @@ -759,7 +759,7 @@ uint32_t *arm_decodeirq(uint32_t *regs); ****************************************************************************/ #ifdef CONFIG_SMP -int arm_start_handler(int irq, FAR void *context); +int arm_start_handler(int irq, FAR void *context, FAR void *arg); #endif /**************************************************************************** @@ -783,7 +783,7 @@ int arm_start_handler(int irq, FAR void *context); ****************************************************************************/ #ifdef CONFIG_SMP -int arm_pause_handler(int irq, FAR void *context); +int arm_pause_handler(int irq, FAR void *context, FAR void *arg); #endif /**************************************************************************** diff --git a/arch/arm/src/armv7-m/up_hardfault.c b/arch/arm/src/armv7-m/up_hardfault.c index fe133cc4f37..a68996836e1 100644 --- a/arch/arm/src/armv7-m/up_hardfault.c +++ b/arch/arm/src/armv7-m/up_hardfault.c @@ -80,7 +80,7 @@ * ****************************************************************************/ -int up_hardfault(int irq, FAR void *context) +int up_hardfault(int irq, FAR void *context, FAR void *arg) { #if defined(CONFIG_DEBUG_HARDFAULT) || !defined(CONFIG_ARMV7M_USEBASEPRI) uint32_t *regs = (uint32_t *)context; @@ -124,7 +124,7 @@ int up_hardfault(int irq, FAR void *context) if (insn == INSN_SVC0) { hfalert("Forward SVCall\n"); - return up_svcall(irq, context); + return up_svcall(irq, context, arg); } } #endif diff --git a/arch/arm/src/armv7-m/up_memfault.c b/arch/arm/src/armv7-m/up_memfault.c index f883209b769..f4f642e4def 100644 --- a/arch/arm/src/armv7-m/up_memfault.c +++ b/arch/arm/src/armv7-m/up_memfault.c @@ -77,7 +77,7 @@ * ****************************************************************************/ -int up_memfault(int irq, FAR void *context) +int up_memfault(int irq, FAR void *context, FAR void *arg) { /* Dump some memory management fault info */ diff --git a/arch/arm/src/armv7-m/up_svcall.c b/arch/arm/src/armv7-m/up_svcall.c index 8e78de3a432..e16a6f104c2 100644 --- a/arch/arm/src/armv7-m/up_svcall.c +++ b/arch/arm/src/armv7-m/up_svcall.c @@ -125,7 +125,7 @@ static void dispatch_syscall(void) * ****************************************************************************/ -int up_svcall(int irq, FAR void *context) +int up_svcall(int irq, FAR void *context, FAR void *arg) { uint32_t *regs = (uint32_t *)context; uint32_t cmd; diff --git a/arch/arm/src/c5471/c5471_ethernet.c b/arch/arm/src/c5471/c5471_ethernet.c index a163cecaabe..83259650c01 100644 --- a/arch/arm/src/c5471/c5471_ethernet.c +++ b/arch/arm/src/c5471/c5471_ethernet.c @@ -401,7 +401,7 @@ static void c5471_txstatus(struct c5471_driver_s *priv); static void c5471_txdone(struct c5471_driver_s *priv); static void c5471_interrupt_work(FAR void *arg); -static int c5471_interrupt(int irq, FAR void *context); +static int c5471_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -1634,7 +1634,7 @@ static void c5471_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int c5471_interrupt(int irq, FAR void *context) +static int c5471_interrupt(int irq, FAR void *context, FAR void *arg) { #if CONFIG_C5471_NET_NINTERFACES == 1 register struct c5471_driver_s *priv = &g_c5471[0]; @@ -2449,7 +2449,7 @@ void up_netinitialize(void) { /* Attach the IRQ to the driver */ - if (irq_attach(C5471_IRQ_ETHER, c5471_interrupt)) + if (irq_attach(C5471_IRQ_ETHER, c5471_interrupt, NULL)) { /* We could not attach the ISR to the ISR */ diff --git a/arch/arm/src/c5471/c5471_serial.c b/arch/arm/src/c5471/c5471_serial.c index 935bc46871d..adb654d63c4 100644 --- a/arch/arm/src/c5471/c5471_serial.c +++ b/arch/arm/src/c5471/c5471_serial.c @@ -108,7 +108,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, unsigned int *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -491,7 +491,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -534,7 +534,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/c5471/c5471_timerisr.c b/arch/arm/src/c5471/c5471_timerisr.c index 1720a13bf92..3933e5252bb 100644 --- a/arch/arm/src/c5471/c5471_timerisr.c +++ b/arch/arm/src/c5471/c5471_timerisr.c @@ -82,7 +82,7 @@ * ****************************************************************************/ -static int c5471_timerisr(int irq, uint32_t *regs) +static int c5471_timerisr(int irq, uint32_t *regs, FAR void *arg) { /* Process timer interrupt */ @@ -118,6 +118,6 @@ void arm_timer_initialize(void) /* Attach and enable the timer interrupt */ - irq_attach(C5471_IRQ_SYSTIMER, (xcpt_t)c5471_timerisr); + irq_attach(C5471_IRQ_SYSTIMER, (xcpt_t)c5471_timerisr, NULL); up_enable_irq(C5471_IRQ_SYSTIMER); } diff --git a/arch/arm/src/c5471/c5471_watchdog.c b/arch/arm/src/c5471/c5471_watchdog.c index d1381f45d46..baa7dd77496 100644 --- a/arch/arm/src/c5471/c5471_watchdog.c +++ b/arch/arm/src/c5471/c5471_watchdog.c @@ -95,7 +95,7 @@ static inline unsigned int wdt_prescaletoptv(unsigned int prescale); static int wdt_setusec(uint32_t usec); -static int wdt_interrupt(int irq, void *context); +static int wdt_interrupt(int irq, void *context, FAR void *arg); static int wdt_open(struct file *filep); static int wdt_close(struct file *filep); @@ -232,7 +232,7 @@ static int wdt_setusec(uint32_t usec) * Name: wdt_interrupt ****************************************************************************/ -static int wdt_interrupt(int irq, void *context) +static int wdt_interrupt(int irq, void *context, FAR void *arg) { wdinfo("expired\n"); @@ -382,7 +382,7 @@ int up_wdtinit(void) /* Request the interrupt. */ - ret = irq_attach(C5471_IRQ_WATCHDOG, wdt_interrupt); + ret = irq_attach(C5471_IRQ_WATCHDOG, wdt_interrupt, NULL); if (ret) { unregister_driver("/dev/wdt"); diff --git a/arch/arm/src/common/up_internal.h b/arch/arm/src/common/up_internal.h index a634c86df65..31d264828d3 100644 --- a/arch/arm/src/common/up_internal.h +++ b/arch/arm/src/common/up_internal.h @@ -374,13 +374,13 @@ uint32_t *up_doirq(int irq, uint32_t *regs); /* Exception Handlers */ -int up_svcall(int irq, FAR void *context); -int up_hardfault(int irq, FAR void *context); +int up_svcall(int irq, FAR void *context, FAR void *arg); +int up_hardfault(int irq, FAR void *context, FAR void *arg); # if defined(CONFIG_ARCH_CORTEXM3) || defined(CONFIG_ARCH_CORTEXM4) || \ defined(CONFIG_ARCH_CORTEXM7) -int up_memfault(int irq, FAR void *context); +int up_memfault(int irq, FAR void *context, FAR void *arg); # endif /* CONFIG_ARCH_CORTEXM3,4,7 */ diff --git a/arch/arm/src/dm320/dm320_serial.c b/arch/arm/src/dm320/dm320_serial.c index 19e5c9d7bdf..8b30fbdd952 100644 --- a/arch/arm/src/dm320/dm320_serial.c +++ b/arch/arm/src/dm320/dm320_serial.c @@ -89,7 +89,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -430,7 +430,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -472,7 +472,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/dm320/dm320_timerisr.c b/arch/arm/src/dm320/dm320_timerisr.c index 33ed932666c..735af0460da 100644 --- a/arch/arm/src/dm320/dm320_timerisr.c +++ b/arch/arm/src/dm320/dm320_timerisr.c @@ -109,7 +109,7 @@ * ****************************************************************************/ -static int dm320_timerisr(int irq, uint32_t *regs) +static int dm320_timerisr(int irq, uint32_t *regs, FAR void *arg) { /* Process timer interrupt */ @@ -147,7 +147,7 @@ void arm_timer_initialize(void) /* Attach and enable the timer interrupt */ - irq_attach(DM320_IRQ_SYSTIMER, (xcpt_t)dm320_timerisr); + irq_attach(DM320_IRQ_SYSTIMER, (xcpt_t)dm320_timerisr, NULL); up_enable_irq(DM320_IRQ_SYSTIMER); } diff --git a/arch/arm/src/dm320/dm320_usbdev.c b/arch/arm/src/dm320/dm320_usbdev.c index df25123b09e..18dce86dbf1 100644 --- a/arch/arm/src/dm320/dm320_usbdev.c +++ b/arch/arm/src/dm320/dm320_usbdev.c @@ -309,8 +309,8 @@ static void dm320_dispatchrequest(struct dm320_usbdev_s *priv, const struct usb_ctrlreq_s *ctrl); static inline void dm320_ep0setup(struct dm320_usbdev_s *priv); static inline uint32_t dm320_highestpriinterrupt(int intstatus); -static int dm320_ctlrinterrupt(int irq, FAR void *context); -static int dm320_attachinterrupt(int irq, FAR void *context); +static int dm320_ctlrinterrupt(int irq, FAR void *context, FAR void *arg); +static int dm320_attachinterrupt(int irq, FAR void *context, FAR void *arg); /* Initialization operations */ @@ -1513,7 +1513,7 @@ static inline uint32_t dm320_highestpriinterrupt(int intstatus) * ****************************************************************************/ -static int dm320_ctlrinterrupt(int irq, FAR void *context) +static int dm320_ctlrinterrupt(int irq, FAR void *context, FAR void *arg) { struct dm320_usbdev_s *priv = &g_usbdev; struct dm320_ep_s *privep ; @@ -1680,7 +1680,7 @@ static int dm320_ctlrinterrupt(int irq, FAR void *context) * ****************************************************************************/ -static int dm320_attachinterrupt(int irq, FAR void *context) +static int dm320_attachinterrupt(int irq, FAR void *context, FAR void *arg) { struct dm320_usbdev_s *priv = &g_usbdev; uint16_t gio; @@ -2438,7 +2438,7 @@ void up_usbinitialize(void) /* Attach host attach GIO interrupt */ - if (irq_attach(IRQ_USBATTACH, dm320_attachinterrupt) != 0) + if (irq_attach(IRQ_USBATTACH, dm320_attachinterrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(DM320_TRACEERR_ATTACHIRQREG), 0); goto errout; @@ -2448,7 +2448,7 @@ void up_usbinitialize(void) * enabled when the driver is bound */ - if (irq_attach(DM320_IRQ_USB1, dm320_ctlrinterrupt) != 0) + if (irq_attach(DM320_IRQ_USB1, dm320_ctlrinterrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(DM320_TRACEERR_COREIRQREG), 0); goto errout; diff --git a/arch/arm/src/efm32/efm32_adc.c b/arch/arm/src/efm32/efm32_adc.c index c9e339e6ea2..80e53f2c88f 100644 --- a/arch/arm/src/efm32/efm32_adc.c +++ b/arch/arm/src/efm32/efm32_adc.c @@ -123,7 +123,7 @@ static void adc_hw_reset(struct efm32_dev_s *priv, bool reset); /* ADC Interrupt Handler */ -static int adc_interrupt(FAR struct adc_dev_s *dev); +static int adc_interrupt(int irq, FAR void * context, FAR struct adc_dev_s *dev); /* ADC Driver Methods */ @@ -1072,7 +1072,7 @@ static int adc_setup(FAR struct adc_dev_s *dev) /* Attach the ADC interrupt */ - ret = irq_attach(priv->irq, priv->isr); + ret = irq_attach(priv->irq, priv->isr, dev); if (ret == OK) { /* Make sure that the ADC device is in the powered up, reset state */ @@ -1180,7 +1180,7 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg) * ****************************************************************************/ -static int adc_interrupt(FAR struct adc_dev_s *dev) +static int adc_interrupt(int irq, FAR void * context, FAR struct adc_dev_s *dev) { FAR struct efm32_dev_s *priv = (FAR struct efm32_dev_s *)dev->ad_priv; uint32_t adcsr; diff --git a/arch/arm/src/efm32/efm32_dma.c b/arch/arm/src/efm32/efm32_dma.c index 4bf901500b6..d568626b295 100644 --- a/arch/arm/src/efm32/efm32_dma.c +++ b/arch/arm/src/efm32/efm32_dma.c @@ -204,7 +204,7 @@ efm32_get_descriptor(struct dma_channel_s *dmach, bool alt) * ****************************************************************************/ -static int efm32_dmac_interrupt(int irq, void *context) +static int efm32_dmac_interrupt(int irq, void *context, FAR void *arg) { struct dma_channel_s *dmach; unsigned int chndx; @@ -297,7 +297,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(EFM32_IRQ_DMA, efm32_dmac_interrupt); + (void)irq_attach(EFM32_IRQ_DMA, efm32_dmac_interrupt, NULL); /* Enable the DMA controller */ diff --git a/arch/arm/src/efm32/efm32_gpioirq.c b/arch/arm/src/efm32/efm32_gpioirq.c index 8c3527e9f55..1b317582811 100644 --- a/arch/arm/src/efm32/efm32_gpioirq.c +++ b/arch/arm/src/efm32/efm32_gpioirq.c @@ -133,7 +133,7 @@ static int efm32_gpio_interrupt(uint32_t mask, void *context) * ************************************************************************************/ -static int efm32_even_interrupt(int irq, void *context) +static int efm32_even_interrupt(int irq, void *context, FAR void *arg) { return efm32_gpio_interrupt(0x00005555, context); } @@ -146,7 +146,7 @@ static int efm32_even_interrupt(int irq, void *context) * ************************************************************************************/ -static int efm32_odd_interrupt(int irq, void *context) +static int efm32_odd_interrupt(int irq, void *context, FAR void *arg) { return efm32_gpio_interrupt(0x0000aaaa, context); } @@ -173,8 +173,8 @@ void efm32_gpioirqinitialize(void) /* Attach the even and odd interrupt handlers */ - DEBUGVERIFY(irq_attach(EFM32_IRQ_GPIO_EVEN, efm32_even_interrupt)); - DEBUGVERIFY(irq_attach(EFM32_IRQ_GPIO_ODD, efm32_odd_interrupt)); + DEBUGVERIFY(irq_attach(EFM32_IRQ_GPIO_EVEN, efm32_even_interrupt, NULL)); + DEBUGVERIFY(irq_attach(EFM32_IRQ_GPIO_ODD, efm32_odd_interrupt, NULL)); /* Enable GPIO even and odd interrupts at the NVIC */ diff --git a/arch/arm/src/efm32/efm32_i2c.c b/arch/arm/src/efm32/efm32_i2c.c index 1c10e5b14c1..59ad3aa2f84 100644 --- a/arch/arm/src/efm32/efm32_i2c.c +++ b/arch/arm/src/efm32/efm32_i2c.c @@ -220,7 +220,7 @@ struct efm32_i2c_config_s uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ #ifndef CONFIG_I2C_POLLED - int (*isr) (int, void *); /* Interrupt handler */ + int (*isr) (int, void *, void *); /* Interrupt handler */ uint32_t irq; /* Event IRQ */ #endif }; @@ -298,10 +298,10 @@ static int efm32_i2c_isr(struct efm32_i2c_priv_s *priv); #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_EFM32_I2C0 -static int efm32_i2c0_isr(int irq, void *context); +static int efm32_i2c0_isr(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_EFM32_I2C1 -static int efm32_i2c1_isr(int irq, void *context); +static int efm32_i2c1_isr(int irq, void *context, FAR void *arg); #endif #endif /* !CONFIG_I2C_POLLED */ @@ -1290,7 +1290,7 @@ done: ****************************************************************************/ #ifdef CONFIG_EFM32_I2C0 -static int efm32_i2c0_isr(int irq, void *context) +static int efm32_i2c0_isr(int irq, void *context, FAR void *arg) { return efm32_i2c_isr(&efm32_i2c0_priv); } @@ -1305,7 +1305,7 @@ static int efm32_i2c0_isr(int irq, void *context) ****************************************************************************/ #ifdef CONFIG_EFM32_I2C1 -static int efm32_i2c1_isr(int irq, void *context) +static int efm32_i2c1_isr(int irq, void *context, FAR void *arg) { return efm32_i2c_isr(&efm32_i2c1_priv); } @@ -1389,7 +1389,7 @@ static int efm32_i2c_init(FAR struct efm32_i2c_priv_s *priv) /* Attach ISRs */ #ifndef CONFIG_I2C_POLLED - irq_attach(priv->config->irq, priv->config->isr); + irq_attach(priv->config->irq, priv->config->isr, NULL); up_enable_irq(priv->config->irq); #endif diff --git a/arch/arm/src/efm32/efm32_irq.c b/arch/arm/src/efm32/efm32_irq.c index db5992dea7b..859860d0725 100644 --- a/arch/arm/src/efm32/efm32_irq.c +++ b/arch/arm/src/efm32/efm32_irq.c @@ -163,7 +163,7 @@ static void efm32_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int efm32_nmi(int irq, FAR void *context) +static int efm32_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -171,7 +171,7 @@ static int efm32_nmi(int irq, FAR void *context) return 0; } -static int efm32_busfault(int irq, FAR void *context) +static int efm32_busfault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Bus fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -179,7 +179,7 @@ static int efm32_busfault(int irq, FAR void *context) return 0; } -static int efm32_usagefault(int irq, FAR void *context) +static int efm32_usagefault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Usage fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -187,7 +187,7 @@ static int efm32_usagefault(int irq, FAR void *context) return 0; } -static int efm32_pendsv(int irq, FAR void *context) +static int efm32_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -195,7 +195,7 @@ static int efm32_pendsv(int irq, FAR void *context) return 0; } -static int efm32_dbgmonitor(int irq, FAR void *context) +static int efm32_dbgmonitor(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Debug Monitor received\n"); @@ -203,7 +203,7 @@ static int efm32_dbgmonitor(int irq, FAR void *context) return 0; } -static int efm32_reserved(int irq, FAR void *context) +static int efm32_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -382,8 +382,8 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(EFM32_IRQ_SVCALL, up_svcall); - irq_attach(EFM32_IRQ_HARDFAULT, up_hardfault); + irq_attach(EFM32_IRQ_SVCALL, up_svcall, NULL); + irq_attach(EFM32_IRQ_HARDFAULT, up_hardfault, NULL); /* Set the priority of the SVCall interrupt */ @@ -396,22 +396,22 @@ void up_irqinitialize(void) */ #ifdef CONFIG_ARM_MPU - irq_attach(EFM32_IRQ_MEMFAULT, up_memfault); + irq_attach(EFM32_IRQ_MEMFAULT, up_memfault, NULL); up_enable_irq(EFM32_IRQ_MEMFAULT); #endif /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(EFM32_IRQ_NMI, efm32_nmi); + irq_attach(EFM32_IRQ_NMI, efm32_nmi, NULL); #ifndef CONFIG_ARM_MPU - irq_attach(EFM32_IRQ_MEMFAULT, up_memfault); + irq_attach(EFM32_IRQ_MEMFAULT, up_memfault, NULL); #endif - irq_attach(EFM32_IRQ_BUSFAULT, efm32_busfault); - irq_attach(EFM32_IRQ_USAGEFAULT, efm32_usagefault); - irq_attach(EFM32_IRQ_PENDSV, efm32_pendsv); - irq_attach(EFM32_IRQ_DBGMONITOR, efm32_dbgmonitor); - irq_attach(EFM32_IRQ_RESERVED, efm32_reserved); + irq_attach(EFM32_IRQ_BUSFAULT, efm32_busfault, NULL); + irq_attach(EFM32_IRQ_USAGEFAULT, efm32_usagefault, NULL); + irq_attach(EFM32_IRQ_PENDSV, efm32_pendsv, NULL); + irq_attach(EFM32_IRQ_DBGMONITOR, efm32_dbgmonitor, NULL); + irq_attach(EFM32_IRQ_RESERVED, efm32_reserved, NULL); #endif efm32_dumpnvic("initial", NR_VECTORS); diff --git a/arch/arm/src/efm32/efm32_leserial.c b/arch/arm/src/efm32/efm32_leserial.c index 8a5de937888..0a9e5e41a04 100644 --- a/arch/arm/src/efm32/efm32_leserial.c +++ b/arch/arm/src/efm32/efm32_leserial.c @@ -165,10 +165,10 @@ static int efm32_attach(struct uart_dev_s *dev); static void efm32_detach(struct uart_dev_s *dev); static int efm32_interrupt(struct uart_dev_s *dev); #if defined(CONFIG_EFM32_LEUART0) -static int efm32_leuart0_interrupt(int irq, void *context); +static int efm32_leuart0_interrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_EFM32_LEUART1) -static int efm32_leuart1_interrupt(int irq, void *context); +static int efm32_leuart1_interrupt(int irq, void *context, FAR void *arg); #endif static int efm32_ioctl(struct file *filep, int cmd, unsigned long arg); static int efm32_receive(struct uart_dev_s *dev, uint32_t *status); @@ -429,7 +429,7 @@ static int efm32_attach(struct uart_dev_s *dev) * disabled in the C2 register. */ - ret = irq_attach(config->irq, config->handler); + ret = irq_attach(config->irq, config->handler, NULL); if (ret >= 0) { up_enable_irq(config->irq); @@ -535,14 +535,14 @@ static int efm32_interrupt(struct uart_dev_s *dev) } #if defined(CONFIG_EFM32_LEUART0) -static int efm32_leuart0_interrupt(int irq, void *context) +static int efm32_leuart0_interrupt(int irq, void *context, FAR void *arg) { return efm32_interrupt(&g_leuart0port); } #endif #if defined(CONFIG_EFM32_LEUART1) -static int efm32_leuart1_interrupt(int irq, void *context) +static int efm32_leuart1_interrupt(int irq, void *context, FAR void *arg) { return efm32_interrupt(&g_leuart1port); } diff --git a/arch/arm/src/efm32/efm32_pwm.c b/arch/arm/src/efm32/efm32_pwm.c index f07a3eed4b7..adaa3edd670 100644 --- a/arch/arm/src/efm32/efm32_pwm.c +++ b/arch/arm/src/efm32/efm32_pwm.c @@ -135,16 +135,16 @@ static int pwm_timer(FAR struct efm32_pwmtimer_s *priv, ) static int pwm_interrupt(struct efm32_pwmtimer_s *priv); #if defined(CONFIG_EFM32_TIMER0_PWM) -static int pwm_timer0_interrupt(int irq, void *context); +static int pwm_timer0_interrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_EFM32_TIMER1_PWM) static int pwm_timer1_interrupt(int irq, void *context); #endif #if defined(CONFIG_EFM32_TIMER2_PWM) -static int pwm_timer2_interrupt(int irq, void *context); +static int pwm_timer2_interrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_EFM32_TIMER3_PWM) -static int pwm_timer3_interrupt(int irq, void *context); +static int pwm_timer3_interrupt(int irq, void *context, FAR void *arg); #endif static uint8_t pwm_pulsecount(uint32_t count); @@ -547,7 +547,7 @@ static int pwm_interrupt(struct efm32_pwmtimer_s *priv) ****************************************************************************/ #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_EFM32_TIMER0_PWM) -static int pwm_timer0_interrupt(int irq, void *context) +static int pwm_timer0_interrupt(int irq, void *context, FAR void *arg) { return pwm_interrupt(&g_pwm0dev); } @@ -561,14 +561,14 @@ static int pwm_timer1_interrupt(int irq, void *context) #endif #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_EFM32_TIMER2_PWM) -static int pwm_timer2_interrupt(int irq, void *context) +static int pwm_timer2_interrupt(int irq, void *context, FAR void *arg) { return pwm_interrupt(&g_pwm2dev); } #endif #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_EFM32_TIMER3_PWM) -static int pwm_timer3_interrupt(int irq, void *context) +static int pwm_timer3_interrupt(int irq, void *context, FAR void *arg) { return pwm_interrupt(&g_pwm3dev); } @@ -870,7 +870,7 @@ FAR struct pwm_lowerhalf_s *efm32_pwminitialize(int timer) /* Attach but disable the TIM1 update interrupt */ #ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, pwm_timer0_interrupt); + irq_attach(lower->irq, pwm_timer0_interrupt, NULL); up_disable_irq(lower->irq); #endif break; @@ -883,7 +883,7 @@ FAR struct pwm_lowerhalf_s *efm32_pwminitialize(int timer) /* Attach but disable the TIM1 update interrupt */ #ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, pwm_timer0_interrupt); + irq_attach(lower->irq, pwm_timer0_interrupt, NULL); up_disable_irq(lower->irq); #endif break; @@ -895,7 +895,7 @@ FAR struct pwm_lowerhalf_s *efm32_pwminitialize(int timer) /* Attach but disable the TIM1 update interrupt */ #ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, pwm_timer2_interrupt); + irq_attach(lower->irq, pwm_timer2_interrupt, NULL); up_disable_irq(lower->irq); #endif break; @@ -907,7 +907,7 @@ FAR struct pwm_lowerhalf_s *efm32_pwminitialize(int timer) /* Attach but disable the TIM1 update interrupt */ #ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, pwm_timer3_interrupt); + irq_attach(lower->irq, pwm_timer3_interrupt, NULL); up_disable_irq(lower->irq); #endif break; diff --git a/arch/arm/src/efm32/efm32_rtc_burtc.c b/arch/arm/src/efm32/efm32_rtc_burtc.c index 52c8811ae50..d0028b6a11f 100644 --- a/arch/arm/src/efm32/efm32_rtc_burtc.c +++ b/arch/arm/src/efm32/efm32_rtc_burtc.c @@ -175,7 +175,7 @@ volatile bool g_rtc_enabled = false; * ************************************************************************************/ -static int efm32_rtc_burtc_interrupt(int irq, void *context) +static int efm32_rtc_burtc_interrupt(int irq, void *context, FAR void *arg) { uint32_t source = getreg32(EFM32_BURTC_IF); @@ -378,7 +378,7 @@ int up_rtc_initialize(void) /* Configure RTC interrupt to catch overflow and alarm interrupts. */ - irq_attach(EFM32_IRQ_BURTC, efm32_rtc_burtc_interrupt); + irq_attach(EFM32_IRQ_BURTC, efm32_rtc_burtc_interrupt, NULL); up_enable_irq(EFM32_IRQ_BURTC); g_rtc_enabled = true; diff --git a/arch/arm/src/efm32/efm32_serial.c b/arch/arm/src/efm32/efm32_serial.c index 52848fcd03d..d179b906926 100644 --- a/arch/arm/src/efm32/efm32_serial.c +++ b/arch/arm/src/efm32/efm32_serial.c @@ -259,35 +259,35 @@ static int efm32_attach(struct uart_dev_s *dev); static void efm32_detach(struct uart_dev_s *dev); static int efm32_rxinterrupt(struct uart_dev_s *dev); #if defined(CONFIG_EFM32_USART0_ISUART) -static int efm32_usart0_rxinterrupt(int irq, void *context); +static int efm32_usart0_rxinterrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_EFM32_USART1_ISUART) -static int efm32_usart1_rxinterrupt(int irq, void *context); +static int efm32_usart1_rxinterrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_EFM32_USART2_ISUART) -static int efm32_usart2_rxinterrupt(int irq, void *context); +static int efm32_usart2_rxinterrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_EFM32_UART0) -static int efm32_uart0_rxinterrupt(int irq, void *context); +static int efm32_uart0_rxinterrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_EFM32_UART1) -static int efm32_uart1_rxinterrupt(int irq, void *context); +static int efm32_uart1_rxinterrupt(int irq, void *context, FAR void *arg); #endif static int efm32_txinterrupt(struct uart_dev_s *dev); #if defined(CONFIG_EFM32_USART0_ISUART) -static int efm32_usart0_txinterrupt(int irq, void *context); +static int efm32_usart0_txinterrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_EFM32_USART1_ISUART) -static int efm32_usart1_txinterrupt(int irq, void *context); +static int efm32_usart1_txinterrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_EFM32_USART2_ISUART) -static int efm32_usart2_txinterrupt(int irq, void *context); +static int efm32_usart2_txinterrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_EFM32_UART0) -static int efm32_uart0_txinterrupt(int irq, void *context); +static int efm32_uart0_txinterrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_EFM32_UART1) -static int efm32_uart1_txinterrupt(int irq, void *context); +static int efm32_uart1_txinterrupt(int irq, void *context, FAR void *arg); #endif static int efm32_ioctl(struct file *filep, int cmd, unsigned long arg); static int efm32_receive(struct uart_dev_s *dev, uint32_t *status); @@ -689,13 +689,13 @@ static int efm32_attach(struct uart_dev_s *dev) * disabled in the C2 register. */ - ret = irq_attach(config->rxirq, config->rxhandler); + ret = irq_attach(config->rxirq, config->rxhandler, NULL); if (ret < 0) { return ret; } - ret = irq_attach(config->txirq, config->txhandler); + ret = irq_attach(config->txirq, config->txhandler, NULL); if (ret < 0) { irq_detach(config->rxirq); @@ -788,35 +788,35 @@ static int efm32_rxinterrupt(struct uart_dev_s *dev) } #if defined(CONFIG_EFM32_USART0_ISUART) -static int efm32_usart0_rxinterrupt(int irq, void *context) +static int efm32_usart0_rxinterrupt(int irq, void *context, FAR void *arg) { return efm32_rxinterrupt(&g_usart0port); } #endif #if defined(CONFIG_EFM32_USART1_ISUART) -static int efm32_usart1_rxinterrupt(int irq, void *context) +static int efm32_usart1_rxinterrupt(int irq, void *context, FAR void *arg) { return efm32_rxinterrupt(&g_usart1port); } #endif #if defined(CONFIG_EFM32_USART2_ISUART) -static int efm32_usart2_rxinterrupt(int irq, void *context) +static int efm32_usart2_rxinterrupt(int irq, void *context, FAR void *arg) { return efm32_rxinterrupt(&g_usart2port); } #endif #if defined(CONFIG_EFM32_UART0) -static int efm32_uart0_rxinterrupt(int irq, void *context) +static int efm32_uart0_rxinterrupt(int irq, void *context, FAR void *arg) { return efm32_rxinterrupt(&g_uart0port); } #endif #if defined(CONFIG_EFM32_UART1) -static int efm32_uart1_rxinterrupt(int irq, void *context) +static int efm32_uart1_rxinterrupt(int irq, void *context, FAR void *arg) { return efm32_rxinterrupt(&g_uart1port); } @@ -871,35 +871,35 @@ static int efm32_txinterrupt(struct uart_dev_s *dev) } #if defined(CONFIG_EFM32_USART0_ISUART) -static int efm32_usart0_txinterrupt(int irq, void *context) +static int efm32_usart0_txinterrupt(int irq, void *context, FAR void *arg) { return efm32_txinterrupt(&g_usart0port); } #endif #if defined(CONFIG_EFM32_USART1_ISUART) -static int efm32_usart1_txinterrupt(int irq, void *context) +static int efm32_usart1_txinterrupt(int irq, void *context, FAR void *arg) { return efm32_txinterrupt(&g_usart1port); } #endif #if defined(CONFIG_EFM32_USART2_ISUART) -static int efm32_usart2_txinterrupt(int irq, void *context) +static int efm32_usart2_txinterrupt(int irq, void *context, FAR void *arg) { return efm32_txinterrupt(&g_usart2port); } #endif #if defined(CONFIG_EFM32_UART0) -static int efm32_uart0_txinterrupt(int irq, void *context) +static int efm32_uart0_txinterrupt(int irq, void *context, FAR void *arg) { return efm32_txinterrupt(&g_uart0port); } #endif #if defined(CONFIG_EFM32_UART1) -static int efm32_uart1_txinterrupt(int irq, void *context) +static int efm32_uart1_txinterrupt(int irq, void *context, FAR void *arg) { return efm32_txinterrupt(&g_uart1port); } diff --git a/arch/arm/src/efm32/efm32_timerisr.c b/arch/arm/src/efm32/efm32_timerisr.c index 095143482b7..2fdd5a6661f 100644 --- a/arch/arm/src/efm32/efm32_timerisr.c +++ b/arch/arm/src/efm32/efm32_timerisr.c @@ -86,7 +86,7 @@ * ****************************************************************************/ -static int efm32_timerisr(int irq, uint32_t *regs) +static int efm32_timerisr(int irq, uint32_t *regs, FAR void *arg) { /* Process timer interrupt */ @@ -125,7 +125,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(EFM32_IRQ_SYSTICK, (xcpt_t)efm32_timerisr); + (void)irq_attach(EFM32_IRQ_SYSTICK, (xcpt_t)efm32_timerisr, NULL); /* Enable SysTick interrupts */ diff --git a/arch/arm/src/efm32/efm32_usbdev.c b/arch/arm/src/efm32/efm32_usbdev.c index 26753dd3ff4..8f598342806 100644 --- a/arch/arm/src/efm32/efm32_usbdev.c +++ b/arch/arm/src/efm32/efm32_usbdev.c @@ -574,7 +574,7 @@ static inline void efm32_otginterrupt(FAR struct efm32_usbdev_s *priv); /* First level interrupt processing */ -static int efm32_usbinterrupt(int irq, FAR void *context); +static int efm32_usbinterrupt(int irq, FAR void *context, FAR void *arg); /* Endpoint operations *********************************************************/ /* Global OUT NAK controls */ @@ -3498,7 +3498,7 @@ static inline void efm32_otginterrupt(FAR struct efm32_usbdev_s *priv) * ****************************************************************************/ -static int efm32_usbinterrupt(int irq, FAR void *context) +static int efm32_usbinterrupt(int irq, FAR void *context, FAR void *arg) { /* At present, there is only a single OTG FS device support. Hence it is * pre-allocated as g_otgfsdev. However, in most code, the private data @@ -5485,7 +5485,7 @@ void up_usbinitialize(void) /* Attach the OTG FS interrupt handler */ - ret = irq_attach(EFM32_IRQ_USB, efm32_usbinterrupt); + ret = irq_attach(EFM32_IRQ_USB, efm32_usbinterrupt, NULL); if (ret < 0) { uerr("ERROR: irq_attach failed\n", ret); diff --git a/arch/arm/src/efm32/efm32_usbhost.c b/arch/arm/src/efm32/efm32_usbhost.c index be9bbccf23f..3d5a6888baa 100644 --- a/arch/arm/src/efm32/efm32_usbhost.c +++ b/arch/arm/src/efm32/efm32_usbhost.c @@ -417,7 +417,7 @@ static inline void efm32_gint_ipxfrisr(FAR struct efm32_usbhost_s *priv); /* First level, global interrupt handler */ -static int efm32_gint_isr(int irq, FAR void *context); +static int efm32_gint_isr(int irq, FAR void *context, FAR void *arg); /* Interrupt controls */ @@ -3495,7 +3495,7 @@ static inline void efm32_gint_ipxfrisr(FAR struct efm32_usbhost_s *priv) * ****************************************************************************/ -static int efm32_gint_isr(int irq, FAR void *context) +static int efm32_gint_isr(int irq, FAR void *context, FAR void *arg) { /* At present, there is only support for a single OTG FS host. Hence it is * pre-allocated as g_usbhost. However, in most code, the private data @@ -5374,7 +5374,7 @@ FAR struct usbhost_connection_s *efm32_usbhost_initialize(int controller) /* Attach USB host controller interrupt handler */ - if (irq_attach(EFM32_IRQ_USB, efm32_gint_isr) != 0) + if (irq_attach(EFM32_IRQ_USB, efm32_gint_isr, NULL) != 0) { usbhost_trace1(USBHOST_TRACE1_IRQATTACH, 0); return NULL; diff --git a/arch/arm/src/imx1/imx_serial.c b/arch/arm/src/imx1/imx_serial.c index e3826192b22..ebe996e81b4 100644 --- a/arch/arm/src/imx1/imx_serial.c +++ b/arch/arm/src/imx1/imx_serial.c @@ -112,7 +112,7 @@ static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); static inline struct uart_dev_s *up_mapirq(int irq); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -753,13 +753,13 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ #if defined(CONFIG_ARCH_CHIP_IMX1) || defined(CONFIG_ARCH_CHIP_IMXL) - ret = irq_attach(priv->rxirq, up_interrupt); + ret = irq_attach(priv->rxirq, up_interrupt, NULL); if (ret < 0) { return ret; } - ret = irq_attach(priv->txirq, up_interrupt); + ret = irq_attach(priv->txirq, up_interrupt, NULL); if (ret < 0) { irq_detach(priv->rxirq); @@ -772,7 +772,7 @@ static int up_attach(struct uart_dev_s *dev) up_enable_irq(priv->txirq); #else - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -877,7 +877,7 @@ static inline struct uart_dev_s *up_mapirq(int irq) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev; struct up_dev_s *priv; diff --git a/arch/arm/src/imx1/imx_spi.c b/arch/arm/src/imx1/imx_spi.c index d63c65ed2ea..695d6b358f8 100644 --- a/arch/arm/src/imx1/imx_spi.c +++ b/arch/arm/src/imx1/imx_spi.c @@ -165,7 +165,7 @@ static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer, #ifndef CONFIG_SPI_POLLWAIT static inline struct imx_spidev_s *spi_mapirq(int irq); -static int spi_interrupt(int irq, void *context); +static int spi_interrupt(int irq, void *context, FAR void *arg, FAR void *arg); #endif /* SPI methods */ @@ -653,7 +653,7 @@ static inline struct imx_spidev_s *spi_mapirq(int irq) ****************************************************************************/ #ifndef CONFIG_SPI_POLLWAIT -static int spi_interrupt(int irq, void *context) +static int spi_interrupt(int irq, void *context, FAR void *arg, FAR void *arg) { struct imx_spidev_s *priv = spi_mapirq(irq); int ntxd; @@ -1168,7 +1168,7 @@ FAR struct spi_dev_s *imx_spibus_initialize(int port) /* Attach the interrupt */ #ifndef CONFIG_SPI_POLLWAIT - irq_attach(priv->irq, (xcpt_t)spi_interrupt); + irq_attach(priv->irq, (xcpt_t)spi_interrupt, NULL); #endif /* Enable SPI */ diff --git a/arch/arm/src/imx1/imx_timerisr.c b/arch/arm/src/imx1/imx_timerisr.c index c18f72efabd..2b021e08565 100644 --- a/arch/arm/src/imx1/imx_timerisr.c +++ b/arch/arm/src/imx1/imx_timerisr.c @@ -64,7 +64,7 @@ * ****************************************************************************/ -static int imx_timerisr(int irq, uint32_t *regs) +static int imx_timerisr(int irq, uint32_t *regs, FAR void *arg) { uint32_t tstat; int ret = -EIO; @@ -150,7 +150,7 @@ void arm_timer_initialize(void) /* Attach and enable the timer interrupt */ - irq_attach(IMX_IRQ_SYSTIMER, (xcpt_t)imx_timerisr); + irq_attach(IMX_IRQ_SYSTIMER, (xcpt_t)imx_timerisr, NULL); up_enable_irq(IMX_IRQ_SYSTIMER); } diff --git a/arch/arm/src/imx6/imx_ecspi.c b/arch/arm/src/imx6/imx_ecspi.c index 15c602a7c96..328b72a2e5b 100644 --- a/arch/arm/src/imx6/imx_ecspi.c +++ b/arch/arm/src/imx6/imx_ecspi.c @@ -225,19 +225,19 @@ static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer, #ifndef CONFIG_SPI_POLLWAIT static int spi_interrupt(struct imx_spidev_s *priv); #ifdef CONFIG_IMX6_ECSPI1 -static int ecspi1_interrupt(int irq, void *context); +static int ecspi1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_IMX6_ECSPI2 -static int ecspi2_interrupt(int irq, void *context); +static int ecspi2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_IMX6_ECSPI3 -static int ecspi3_interrupt(int irq, void *context); +static int ecspi3_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_IMX6_ECSPI4 -static int ecspi4_interrupt(int irq, void *context); +static int ecspi4_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_IMX6_ECSPI5 -static int ecspi5_interrupt(int irq, void *context); +static int ecspi5_interrupt(int irq, void *context, FAR void *arg); #endif #endif @@ -806,35 +806,35 @@ static int spi_interrupt(struct imx_spidev_s *priv) #ifndef CONFIG_SPI_POLLWAIT #ifdef CONFIG_IMX6_ECSPI1 -static int ecspi1_interrupt(int irq, void *context) +static int ecspi1_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spidev[SPI1_NDX]); } #endif #ifdef CONFIG_IMX6_ECSPI2 -static int ecspi2_interrupt(int irq, void *context) +static int ecspi2_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spidev[SPI2_NDX]); } #endif #ifdef CONFIG_IMX6_ECSPI3 -static int ecspi3_interrupt(int irq, void *context) +static int ecspi3_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spidev[SPI3_NDX]); } #endif #ifdef CONFIG_IMX6_ECSPI4 -static int ecspi4_interrupt(int irq, void *context) +static int ecspi4_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spidev[SPI4_NDX]); } #endif #ifdef CONFIG_IMX6_ECSPI5 -static int ecspi5_interrupt(int irq, void *context) +static int ecspi5_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spidev[SPI5_NDX]); } @@ -1425,7 +1425,7 @@ FAR struct spi_dev_s *imx_spibus_initialize(int port) /* Attach the interrupt */ #ifndef CONFIG_SPI_POLLWAIT - DEBUGVERIFY(irq_attach(priv->irq, priv->handler)); + DEBUGVERIFY(irq_attach(priv->irq, priv->handler, NULL)); #endif /* Enable SPI */ diff --git a/arch/arm/src/imx6/imx_serial.c b/arch/arm/src/imx6/imx_serial.c index a34d2f988ad..cfae168cd2d 100644 --- a/arch/arm/src/imx6/imx_serial.c +++ b/arch/arm/src/imx6/imx_serial.c @@ -232,19 +232,19 @@ static void imx_detach(struct uart_dev_s *dev); static int imx_interrupt(struct uart_dev_s *dev); #ifdef CONFIG_IMX6_UART1 -static int imx_uart1_interrupt(int irq, void *context); +static int imx_uart1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_IMX6_UART2 -static int imx_uart2_interrupt(int irq, void *context); +static int imx_uart2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_IMX6_UART3 -static int imx_uart3_interrupt(int irq, void *context); +static int imx_uart3_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_IMX6_UART4 -static int imx_uart4_interrupt(int irq, void *context); +static int imx_uart4_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_IMX6_UART5 -static int imx_uart5_interrupt(int irq, void *context); +static int imx_uart5_interrupt(int irq, void *context, FAR void *arg); #endif static int imx_ioctl(struct file *filep, int cmd, unsigned long arg); @@ -618,7 +618,7 @@ static int imx_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler); + ret = irq_attach(priv->irq, priv->handler, NULL); if (ret == OK) { /* Configure as a (high) level interrupt */ @@ -720,31 +720,31 @@ static int imx_interrupt(struct uart_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_IMX6_UART1 -static int imx_uart1_interrupt(int irq, void *context) +static int imx_uart1_interrupt(int irq, void *context, FAR void *arg) { return imx_interrupt(&g_uart1port); } #endif #ifdef CONFIG_IMX6_UART2 -static int imx_uart2_interrupt(int irq, void *context) +static int imx_uart2_interrupt(int irq, void *context, FAR void *arg) { return imx_interrupt(&g_uart2port); } #endif #ifdef CONFIG_IMX6_UART3 -static int imx_uart3_interrupt(int irq, void *context) +static int imx_uart3_interrupt(int irq, void *context, FAR void *arg) { return imx_interrupt(&g_uart3port); } #endif #ifdef CONFIG_IMX6_UART4 -static int imx_uart4_interrupt(int irq, void *context) +static int imx_uart4_interrupt(int irq, void *context, FAR void *arg) { return imx_interrupt(&g_uart4port); } #endif #ifdef CONFIG_IMX6_UART5 -static int imx_uart5_interrupt(int irq, void *context) +static int imx_uart5_interrupt(int irq, void *context, FAR void *arg) { return imx_interrupt(&g_uart5port); } diff --git a/arch/arm/src/imx6/imx_timerisr.c b/arch/arm/src/imx6/imx_timerisr.c index dbfc878eb89..36cd8cced00 100644 --- a/arch/arm/src/imx6/imx_timerisr.c +++ b/arch/arm/src/imx6/imx_timerisr.c @@ -130,7 +130,7 @@ static void imx_output_compare(uint32_t sr, uint32_t of) * ****************************************************************************/ -static int imx_timerisr(int irq, uint32_t *regs) +static int imx_timerisr(int irq, uint32_t *regs, FAR void *arg) { /* Sample the SR (once) */ @@ -260,7 +260,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(IMX_IRQ_GPT, (xcpt_t)imx_timerisr); + (void)irq_attach(IMX_IRQ_GPT, (xcpt_t)imx_timerisr, NULL); /* Enable all three GPT output compare interrupts */ diff --git a/arch/arm/src/kinetis/kinetis_enet.c b/arch/arm/src/kinetis/kinetis_enet.c index e688212ee30..ac39c53cc91 100644 --- a/arch/arm/src/kinetis/kinetis_enet.c +++ b/arch/arm/src/kinetis/kinetis_enet.c @@ -284,7 +284,7 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv); static void kinetis_txdone(FAR struct kinetis_driver_s *priv); static void kinetis_interrupt_work(FAR void *arg); -static int kinetis_interrupt(int irq, FAR void *context); +static int kinetis_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -921,7 +921,7 @@ static void kinetis_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int kinetis_interrupt(int irq, FAR void *context) +static int kinetis_interrupt(int irq, FAR void *context, FAR void *arg) { register FAR struct kinetis_driver_s *priv = &g_enet[0]; @@ -2097,7 +2097,7 @@ int kinetis_netinitialize(int intf) /* Attach the Ethernet MAC IEEE 1588 timer interrupt handler */ #if 0 - if (irq_attach(KINETIS_IRQ_EMACTMR, kinetis_tmrinterrupt)) + if (irq_attach(KINETIS_IRQ_EMACTMR, kinetis_tmrinterrupt, NULL)) { /* We could not attach the ISR to the interrupt */ @@ -2108,7 +2108,7 @@ int kinetis_netinitialize(int intf) /* Attach the Ethernet MAC transmit interrupt handler */ - if (irq_attach(KINETIS_IRQ_EMACTX, kinetis_interrupt)) + if (irq_attach(KINETIS_IRQ_EMACTX, kinetis_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ @@ -2118,7 +2118,7 @@ int kinetis_netinitialize(int intf) /* Attach the Ethernet MAC receive interrupt handler */ - if (irq_attach(KINETIS_IRQ_EMACRX, kinetis_interrupt)) + if (irq_attach(KINETIS_IRQ_EMACRX, kinetis_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ @@ -2128,7 +2128,7 @@ int kinetis_netinitialize(int intf) /* Attach the Ethernet MAC error and misc interrupt handler */ - if (irq_attach(KINETIS_IRQ_EMACMISC, kinetis_interrupt)) + if (irq_attach(KINETIS_IRQ_EMACMISC, kinetis_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ diff --git a/arch/arm/src/kinetis/kinetis_i2c.c b/arch/arm/src/kinetis/kinetis_i2c.c index 337e24b4d39..0edcab92696 100644 --- a/arch/arm/src/kinetis/kinetis_i2c.c +++ b/arch/arm/src/kinetis/kinetis_i2c.c @@ -1124,7 +1124,7 @@ struct i2c_master_s *kinetis_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, handler); + irq_attach(priv->irqid, handler, NULL); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/kinetis/kinetis_irq.c b/arch/arm/src/kinetis/kinetis_irq.c index 5241f2a7f01..f75085d7b55 100644 --- a/arch/arm/src/kinetis/kinetis_irq.c +++ b/arch/arm/src/kinetis/kinetis_irq.c @@ -170,7 +170,7 @@ static void kinetis_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int kinetis_nmi(int irq, FAR void *context) +static int kinetis_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -178,7 +178,7 @@ static int kinetis_nmi(int irq, FAR void *context) return 0; } -static int kinetis_busfault(int irq, FAR void *context) +static int kinetis_busfault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Bus fault recived\n"); @@ -186,7 +186,7 @@ static int kinetis_busfault(int irq, FAR void *context) return 0; } -static int kinetis_usagefault(int irq, FAR void *context) +static int kinetis_usagefault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Usage fault received\n"); @@ -194,7 +194,7 @@ static int kinetis_usagefault(int irq, FAR void *context) return 0; } -static int kinetis_pendsv(int irq, FAR void *context) +static int kinetis_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -202,7 +202,7 @@ static int kinetis_pendsv(int irq, FAR void *context) return 0; } -static int kinetis_dbgmonitor(int irq, FAR void *context) +static int kinetis_dbgmonitor(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Debug Monitor received\n"); @@ -210,7 +210,7 @@ static int kinetis_dbgmonitor(int irq, FAR void *context) return 0; } -static int kinetis_reserved(int irq, FAR void *context) +static int kinetis_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -398,8 +398,8 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(KINETIS_IRQ_SVCALL, up_svcall); - irq_attach(KINETIS_IRQ_HARDFAULT, up_hardfault); + irq_attach(KINETIS_IRQ_SVCALL, up_svcall, NULL); + irq_attach(KINETIS_IRQ_HARDFAULT, up_hardfault, NULL); /* Set the priority of the SVCall interrupt */ @@ -415,22 +415,22 @@ void up_irqinitialize(void) */ #ifdef CONFIG_ARM_MPU - irq_attach(KINETIS_IRQ_MEMFAULT, up_memfault); + irq_attach(KINETIS_IRQ_MEMFAULT, up_memfault, NULL); up_enable_irq(KINETIS_IRQ_MEMFAULT); #endif /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(KINETIS_IRQ_NMI, kinetis_nmi); + irq_attach(KINETIS_IRQ_NMI, kinetis_nmi, NULL); #ifndef CONFIG_ARM_MPU - irq_attach(KINETIS_IRQ_MEMFAULT, up_memfault); + irq_attach(KINETIS_IRQ_MEMFAULT, up_memfault, NULL); #endif - irq_attach(KINETIS_IRQ_BUSFAULT, kinetis_busfault); - irq_attach(KINETIS_IRQ_USAGEFAULT, kinetis_usagefault); - irq_attach(KINETIS_IRQ_PENDSV, kinetis_pendsv); - irq_attach(KINETIS_IRQ_DBGMONITOR, kinetis_dbgmonitor); - irq_attach(KINETIS_IRQ_RESERVED, kinetis_reserved); + irq_attach(KINETIS_IRQ_BUSFAULT, kinetis_busfault, NULL); + irq_attach(KINETIS_IRQ_USAGEFAULT, kinetis_usagefault, NULL); + irq_attach(KINETIS_IRQ_PENDSV, kinetis_pendsv, NULL); + irq_attach(KINETIS_IRQ_DBGMONITOR, kinetis_dbgmonitor, NULL); + irq_attach(KINETIS_IRQ_RESERVED, kinetis_reserved, NULL); #endif kinetis_dumpnvic("initial", NR_IRQS); diff --git a/arch/arm/src/kinetis/kinetis_pinirq.c b/arch/arm/src/kinetis/kinetis_pinirq.c index cc5933e715a..81b63bd78ae 100644 --- a/arch/arm/src/kinetis/kinetis_pinirq.c +++ b/arch/arm/src/kinetis/kinetis_pinirq.c @@ -169,31 +169,31 @@ static int kinetis_portinterrupt(int irq, FAR void *context, ****************************************************************************/ #ifdef CONFIG_KINETIS_PORTAINTS -static int kinetis_portainterrupt(int irq, FAR void *context) +static int kinetis_portainterrupt(int irq, FAR void *context, FAR void *arg) { return kinetis_portinterrupt(irq, context, KINETIS_PORTA_ISFR, g_portaisrs); } #endif #ifdef CONFIG_KINETIS_PORTBINTS -static int kinetis_portbinterrupt(int irq, FAR void *context) +static int kinetis_portbinterrupt(int irq, FAR void *context, FAR void *arg) { return kinetis_portinterrupt(irq, context, KINETIS_PORTB_ISFR, g_portbisrs); } #endif #ifdef CONFIG_KINETIS_PORTCINTS -static int kinetis_portcinterrupt(int irq, FAR void *context) +static int kinetis_portcinterrupt(int irq, FAR void *context, FAR void *arg) { return kinetis_portinterrupt(irq, context, KINETIS_PORTC_ISFR, g_portcisrs); } #endif #ifdef CONFIG_KINETIS_PORTDINTS -static int kinetis_portdinterrupt(int irq, FAR void *context) +static int kinetis_portdinterrupt(int irq, FAR void *context, FAR void *arg) { return kinetis_portinterrupt(irq, context, KINETIS_PORTD_ISFR, g_portdisrs); } #endif #ifdef CONFIG_KINETIS_PORTEINTS -static int kinetis_porteinterrupt(int irq, FAR void *context) +static int kinetis_porteinterrupt(int irq, FAR void *context, FAR void *arg) { return kinetis_portinterrupt(irq, context, KINETIS_PORTE_ISFR, g_porteisrs); } @@ -215,27 +215,27 @@ static int kinetis_porteinterrupt(int irq, FAR void *context) void kinetis_pinirqinitialize(void) { #ifdef CONFIG_KINETIS_PORTAINTS - (void)irq_attach(KINETIS_IRQ_PORTA, kinetis_portainterrupt); + (void)irq_attach(KINETIS_IRQ_PORTA, kinetis_portainterrupt, NULL); putreg32(0xffffffff, KINETIS_PORTA_ISFR); up_enable_irq(KINETIS_IRQ_PORTA); #endif #ifdef CONFIG_KINETIS_PORTBINTS - (void)irq_attach(KINETIS_IRQ_PORTB, kinetis_portbinterrupt); + (void)irq_attach(KINETIS_IRQ_PORTB, kinetis_portbinterrupt, NULL); putreg32(0xffffffff, KINETIS_PORTB_ISFR); up_enable_irq(KINETIS_IRQ_PORTB); #endif #ifdef CONFIG_KINETIS_PORTCINTS - (void)irq_attach(KINETIS_IRQ_PORTC, kinetis_portcinterrupt); + (void)irq_attach(KINETIS_IRQ_PORTC, kinetis_portcinterrupt, NULL); putreg32(0xffffffff, KINETIS_PORTC_ISFR); up_enable_irq(KINETIS_IRQ_PORTC); #endif #ifdef CONFIG_KINETIS_PORTDINTS - (void)irq_attach(KINETIS_IRQ_PORTD, kinetis_portdinterrupt); + (void)irq_attach(KINETIS_IRQ_PORTD, kinetis_portdinterrupt, NULL); putreg32(0xffffffff, KINETIS_PORTD_ISFR); up_enable_irq(KINETIS_IRQ_PORTD); #endif #ifdef CONFIG_KINETIS_PORTEINTS - (void)irq_attach(KINETIS_IRQ_PORTE, kinetis_porteinterrupt); + (void)irq_attach(KINETIS_IRQ_PORTE, kinetis_porteinterrupt, NULL); putreg32(0xffffffff, KINETIS_PORTE_ISFR); up_enable_irq(KINETIS_IRQ_PORTE); #endif diff --git a/arch/arm/src/kinetis/kinetis_rtc.c b/arch/arm/src/kinetis/kinetis_rtc.c index 19db2796b44..824a72245d6 100644 --- a/arch/arm/src/kinetis/kinetis_rtc.c +++ b/arch/arm/src/kinetis/kinetis_rtc.c @@ -172,7 +172,7 @@ static void rtc_dumptime(FAR struct tm *tp, FAR const char *msg) ****************************************************************************/ #if defined(CONFIG_RTC_ALARM) -static int kinetis_rtc_interrupt(int irq, void *context) +static int kinetis_rtc_interrupt(int irq, void *context, FAR void *arg) { uint16_t rtc_sr; @@ -279,7 +279,7 @@ int up_rtc_irq_attach(void) * KINETIS_IRQ_RTCS is a separate interrupt for seconds if needed */ - irq_attach(KINETIS_IRQ_RTC, kinetis_rtc_interrupt); + irq_attach(KINETIS_IRQ_RTC, kinetis_rtc_interrupt, NULL); up_enable_irq(KINETIS_IRQ_RTC); } diff --git a/arch/arm/src/kinetis/kinetis_sdhc.c b/arch/arm/src/kinetis/kinetis_sdhc.c index f9708256c62..a1d1e847c5e 100644 --- a/arch/arm/src/kinetis/kinetis_sdhc.c +++ b/arch/arm/src/kinetis/kinetis_sdhc.c @@ -271,7 +271,7 @@ static void kinetis_endtransfer(struct kinetis_dev_s *priv, sdio_eventset_t wkup /* Interrupt Handling *******************************************************/ -static int kinetis_interrupt(int irq, void *context); +static int kinetis_interrupt(int irq, void *context, FAR void *arg); /* SDIO interface methods ***************************************************/ @@ -1065,7 +1065,7 @@ static void kinetis_endtransfer(struct kinetis_dev_s *priv, sdio_eventset_t wkup * ****************************************************************************/ -static int kinetis_interrupt(int irq, void *context) +static int kinetis_interrupt(int irq, void *context, FAR void *arg) { struct kinetis_dev_s *priv = &g_sdhcdev; uint32_t enabled; @@ -1681,7 +1681,7 @@ static int kinetis_attach(FAR struct sdio_dev_s *dev) /* Attach the SDIO interrupt handler */ - ret = irq_attach(KINETIS_IRQ_SDHC, kinetis_interrupt); + ret = irq_attach(KINETIS_IRQ_SDHC, kinetis_interrupt, NULL); if (ret == OK) { diff --git a/arch/arm/src/kinetis/kinetis_serial.c b/arch/arm/src/kinetis/kinetis_serial.c index 449cb21bc96..4c8ed38fbb6 100644 --- a/arch/arm/src/kinetis/kinetis_serial.c +++ b/arch/arm/src/kinetis/kinetis_serial.c @@ -253,9 +253,9 @@ static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); #ifdef CONFIG_DEBUG_FEATURES -static int up_interrupt(int irq, void *context); +static int up_interrupt(int irq, void *context, FAR void *arg); #endif -static int up_interrupts(int irq, void *context); +static int up_interrupts(int irq, void *context, FAR void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -688,11 +688,11 @@ static int up_attach(struct uart_dev_s *dev) * disabled in the C2 register. */ - ret = irq_attach(priv->irqs, up_interrupts); + ret = irq_attach(priv->irqs, up_interrupts, NULL); #ifdef CONFIG_DEBUG_FEATURES if (ret == OK) { - ret = irq_attach(priv->irqe, up_interrupt); + ret = irq_attach(priv->irqe, up_interrupt, NULL); } #endif @@ -747,7 +747,7 @@ static void up_detach(struct uart_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; @@ -835,7 +835,7 @@ static int up_interrupt(int irq, void *context) * ****************************************************************************/ -static int up_interrupts(int irq, void *context) +static int up_interrupts(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/kinetis/kinetis_timerisr.c b/arch/arm/src/kinetis/kinetis_timerisr.c index 48e411dcf5a..44f7e3e9be5 100644 --- a/arch/arm/src/kinetis/kinetis_timerisr.c +++ b/arch/arm/src/kinetis/kinetis_timerisr.c @@ -90,7 +90,7 @@ * ****************************************************************************/ -static int kinetis_timerisr(int irq, uint32_t *regs) +static int kinetis_timerisr(int irq, uint32_t *regs, FAR void *arg) { /* Process timer interrupt */ @@ -139,7 +139,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(KINETIS_IRQ_SYSTICK, (xcpt_t)kinetis_timerisr); + (void)irq_attach(KINETIS_IRQ_SYSTICK, (xcpt_t)kinetis_timerisr, NULL); /* Enable SysTick interrupts */ diff --git a/arch/arm/src/kinetis/kinetis_usbdev.c b/arch/arm/src/kinetis/kinetis_usbdev.c index 8c126f2ef70..b6c2fc59bcc 100644 --- a/arch/arm/src/kinetis/kinetis_usbdev.c +++ b/arch/arm/src/kinetis/kinetis_usbdev.c @@ -562,7 +562,7 @@ static void khci_ep0outcomplete(struct khci_usbdev_s *priv); static void khci_ep0incomplete(struct khci_usbdev_s *priv); static void khci_ep0transfer(struct khci_usbdev_s *priv, uint16_t ustat); -static int khci_interrupt(int irq, void *context); +static int khci_interrupt(int irq, void *context, FAR void *arg); /* Endpoint helpers *********************************************************/ @@ -2713,7 +2713,7 @@ static void khci_ep0transfer(struct khci_usbdev_s *priv, uint16_t ustat) * Name: khci_interrupt ****************************************************************************/ -static int khci_interrupt(int irq, void *context) +static int khci_interrupt(int irq, void *context, FAR void *arg) { /* For now there is only one USB controller, but we will always refer to * it using a pointer to make any future ports to multiple USB controllers @@ -4444,7 +4444,7 @@ void up_usbinitialize(void) * them when we need them later. */ - if (irq_attach(KINETIS_IRQ_USBOTG, khci_interrupt) != 0) + if (irq_attach(KINETIS_IRQ_USBOTG, khci_interrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(KHCI_TRACEERR_IRQREGISTRATION), (uint16_t)KINETIS_IRQ_USBOTG); diff --git a/arch/arm/src/kl/kl_gpioirq.c b/arch/arm/src/kl/kl_gpioirq.c index 61331343ccd..7db288321fe 100644 --- a/arch/arm/src/kl/kl_gpioirq.c +++ b/arch/arm/src/kl/kl_gpioirq.c @@ -164,14 +164,14 @@ static int kl_portinterrupt(int irq, FAR void *context, ****************************************************************************/ #ifdef CONFIG_KL_PORTAINTS -static int kl_portainterrupt(int irq, FAR void *context) +static int kl_portainterrupt(int irq, FAR void *context, FAR void *arg) { return kl_portinterrupt(irq, context, KL_PORTA_ISFR, g_portaisrs); } #endif #ifdef CONFIG_KL_PORTDINTS -static int kl_portdinterrupt(int irq, FAR void *context) +static int kl_portdinterrupt(int irq, FAR void *context, FAR void *arg) { return kl_portinterrupt(irq, context, KL_PORTD_ISFR, g_portdisrs); } @@ -193,13 +193,13 @@ static int kl_portdinterrupt(int irq, FAR void *context) void kl_gpioirqinitialize(void) { #ifdef CONFIG_KL_PORTAINTS - (void)irq_attach(KL_IRQ_PORTA, kl_portainterrupt); + (void)irq_attach(KL_IRQ_PORTA, kl_portainterrupt, NULL); putreg32(0xffffffff, KL_PORTA_ISFR); up_enable_irq(KL_IRQ_PORTA); #endif #ifdef CONFIG_KL_PORTDINTS - (void)irq_attach(KL_IRQ_PORTD, kl_portdinterrupt); + (void)irq_attach(KL_IRQ_PORTD, kl_portdinterrupt, NULL); putreg32(0xffffffff, KL_PORTD_ISFR); up_enable_irq(KL_IRQ_PORTD); #endif diff --git a/arch/arm/src/kl/kl_irq.c b/arch/arm/src/kl/kl_irq.c index 94628f26bf7..f8466ac4f50 100644 --- a/arch/arm/src/kl/kl_irq.c +++ b/arch/arm/src/kl/kl_irq.c @@ -138,7 +138,7 @@ static void kl_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int kl_nmi(int irq, FAR void *context) +static int kl_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -146,7 +146,7 @@ static int kl_nmi(int irq, FAR void *context) return 0; } -static int kl_pendsv(int irq, FAR void *context) +static int kl_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -154,7 +154,7 @@ static int kl_pendsv(int irq, FAR void *context) return 0; } -static int kl_reserved(int irq, FAR void *context) +static int kl_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -231,15 +231,15 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(KL_IRQ_SVCALL, up_svcall); - irq_attach(KL_IRQ_HARDFAULT, up_hardfault); + irq_attach(KL_IRQ_SVCALL, up_svcall, NULL); + irq_attach(KL_IRQ_HARDFAULT, up_hardfault, NULL); /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(KL_IRQ_NMI, kl_nmi); - irq_attach(KL_IRQ_PENDSV, kl_pendsv); - irq_attach(KL_IRQ_RESERVED, kl_reserved); + irq_attach(KL_IRQ_NMI, kl_nmi, NULL); + irq_attach(KL_IRQ_PENDSV, kl_pendsv, NULL); + irq_attach(KL_IRQ_RESERVED, kl_reserved, NULL); #endif kl_dumpnvic("initial", NR_IRQS); diff --git a/arch/arm/src/kl/kl_serial.c b/arch/arm/src/kl/kl_serial.c index fab56a34d5e..8849c585a8b 100644 --- a/arch/arm/src/kl/kl_serial.c +++ b/arch/arm/src/kl/kl_serial.c @@ -171,7 +171,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupts(int irq, void *context); +static int up_interrupts(int irq, void *context, FAR void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -455,7 +455,7 @@ static int up_attach(struct uart_dev_s *dev) * disabled in the C2 register. */ - ret = irq_attach(priv->irq, up_interrupts); + ret = irq_attach(priv->irq, up_interrupts, NULL); if (ret == OK) { up_enable_irq(priv->irq); @@ -500,7 +500,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupts(int irq, void *context) +static int up_interrupts(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/kl/kl_timerisr.c b/arch/arm/src/kl/kl_timerisr.c index bf406102753..eed3f5d9baf 100644 --- a/arch/arm/src/kl/kl_timerisr.c +++ b/arch/arm/src/kl/kl_timerisr.c @@ -105,7 +105,7 @@ * ****************************************************************************/ -static int kl_timerisr(int irq, uint32_t *regs) +static int kl_timerisr(int irq, uint32_t *regs, FAR void *arg) { /* Process timer interrupt */ @@ -143,7 +143,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(KL_IRQ_SYSTICK, (xcpt_t)kl_timerisr); + (void)irq_attach(KL_IRQ_SYSTICK, (xcpt_t)kl_timerisr, NULL); /* Enable SysTick interrupts. "The CLKSOURCE bit in SysTick Control and * Status register selects either the core clock (when CLKSOURCE = 1) or diff --git a/arch/arm/src/lpc11xx/lpc11_gpioint.c b/arch/arm/src/lpc11xx/lpc11_gpioint.c index 8aaefed1497..5327b9e9ff8 100644 --- a/arch/arm/src/lpc11xx/lpc11_gpioint.c +++ b/arch/arm/src/lpc11xx/lpc11_gpioint.c @@ -402,7 +402,7 @@ static void lpc11_gpiodemux(uint32_t intbase, uint32_t intmask, * ****************************************************************************/ -static int lpc11_gpiointerrupt(int irq, void *context) +static int lpc11_gpiointerrupt(int irq, void *context, FAR void *arg) { /* Get the GPIO interrupt status */ @@ -468,7 +468,7 @@ void lpc11_gpioirqinitialize(void) * position in the NVIC with External Interrupt 3 */ - (void)irq_attach(LPC11_IRQ_EINT3, lpc11_gpiointerrupt); + (void)irq_attach(LPC11_IRQ_EINT3, lpc11_gpiointerrupt, NULL); up_enable_irq(LPC11_IRQ_EINT3); #elif defined(LPC178x) @@ -476,7 +476,7 @@ void lpc11_gpioirqinitialize(void) * GPIO2. */ - (void)irq_attach(LPC11_IRQ_GPIO, lpc11_gpiointerrupt); + (void)irq_attach(LPC11_IRQ_GPIO, lpc11_gpiointerrupt, NULL); up_enable_irq(LPC11_IRQ_GPIO); #endif diff --git a/arch/arm/src/lpc11xx/lpc11_i2c.c b/arch/arm/src/lpc11xx/lpc11_i2c.c index b8f91daee71..e5e0c69bc3c 100644 --- a/arch/arm/src/lpc11xx/lpc11_i2c.c +++ b/arch/arm/src/lpc11xx/lpc11_i2c.c @@ -129,7 +129,7 @@ struct lpc11_i2cdev_s static int lpc11_i2c_start(struct lpc11_i2cdev_s *priv); static void lpc11_i2c_stop(struct lpc11_i2cdev_s *priv); -static int lpc11_i2c_interrupt(int irq, FAR void *context); +static int lpc11_i2c_interrupt(int irq, FAR void *context, FAR void *arg); static void lpc11_i2c_timeout(int argc, uint32_t arg, ...); static void lpc11_i2c_setfrequency(struct lpc11_i2cdev_s *priv, uint32_t frequency); @@ -334,7 +334,7 @@ static void lpc11_stopnext(struct lpc11_i2cdev_s *priv) * ****************************************************************************/ -static int lpc11_i2c_interrupt(int irq, FAR void *context) +static int lpc11_i2c_interrupt(int irq, FAR void *context, FAR void *arg) { struct lpc11_i2cdev_s *priv; struct i2c_msg_s *msg; @@ -603,7 +603,7 @@ struct i2c_master_s *lpc11_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, lpc11_i2c_interrupt); + irq_attach(priv->irqid, lpc11_i2c_interrupt, NULL); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/lpc11xx/lpc11_irq.c b/arch/arm/src/lpc11xx/lpc11_irq.c index 4399c582003..df2fde8405c 100644 --- a/arch/arm/src/lpc11xx/lpc11_irq.c +++ b/arch/arm/src/lpc11xx/lpc11_irq.c @@ -134,7 +134,7 @@ static void lpc11_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int lpc11_nmi(int irq, FAR void *context) +static int lpc11_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -142,7 +142,7 @@ static int lpc11_nmi(int irq, FAR void *context) return 0; } -static int lpc11_pendsv(int irq, FAR void *context) +static int lpc11_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -150,7 +150,7 @@ static int lpc11_pendsv(int irq, FAR void *context) return 0; } -static int lpc11_reserved(int irq, FAR void *context) +static int lpc11_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -227,15 +227,15 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(LPC11_IRQ_SVCALL, up_svcall); - irq_attach(LPC11_IRQ_HARDFAULT, up_hardfault); + irq_attach(LPC11_IRQ_SVCALL, up_svcall, NULL); + irq_attach(LPC11_IRQ_HARDFAULT, up_hardfault, NULL); /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(LPC11_IRQ_NMI, lpc11_nmi); - irq_attach(LPC11_IRQ_PENDSV, lpc11_pendsv); - irq_attach(LPC11_IRQ_RESERVED, lpc11_reserved); + irq_attach(LPC11_IRQ_NMI, lpc11_nmi, NULL); + irq_attach(LPC11_IRQ_PENDSV, lpc11_pendsv, NULL); + irq_attach(LPC11_IRQ_RESERVED, lpc11_reserved, NULL); #endif lpc11_dumpnvic("initial", NR_IRQS); diff --git a/arch/arm/src/lpc11xx/lpc11_serial.c b/arch/arm/src/lpc11xx/lpc11_serial.c index 55c05ac5172..4d23438b11a 100644 --- a/arch/arm/src/lpc11xx/lpc11_serial.c +++ b/arch/arm/src/lpc11xx/lpc11_serial.c @@ -104,7 +104,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -515,7 +515,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -557,7 +557,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/lpc11xx/lpc11_timerisr.c b/arch/arm/src/lpc11xx/lpc11_timerisr.c index b5054c79ca2..f334b625820 100644 --- a/arch/arm/src/lpc11xx/lpc11_timerisr.c +++ b/arch/arm/src/lpc11xx/lpc11_timerisr.c @@ -105,7 +105,7 @@ * ****************************************************************************/ -static int lpc11_timerisr(int irq, uint32_t *regs) +static int lpc11_timerisr(int irq, uint32_t *regs, FAR void *arg) { /* Process timer interrupt */ @@ -143,7 +143,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(LPC11_IRQ_SYSTICK, (xcpt_t)lpc11_timerisr); + (void)irq_attach(LPC11_IRQ_SYSTICK, (xcpt_t)lpc11_timerisr, NULL); /* Enable SysTick interrupts. "The CLKSOURCE bit in SysTick Control and * Status register selects either the core clock (when CLKSOURCE = 1) or diff --git a/arch/arm/src/lpc17xx/lpc176x_rtc.c b/arch/arm/src/lpc17xx/lpc176x_rtc.c index 8e04d2f2eba..82549159685 100644 --- a/arch/arm/src/lpc17xx/lpc176x_rtc.c +++ b/arch/arm/src/lpc17xx/lpc176x_rtc.c @@ -227,7 +227,7 @@ static int rtc_resume(void) ************************************************************************************/ #ifdef CONFIG_RTC_ALARM -static int rtc_interrupt(int irq, void *context) +static int rtc_interrupt(int irq, void *context, FAR void *arg) { #warning "Missing logic" return OK; @@ -262,7 +262,7 @@ int up_rtc_initialize(void) /* Attach the RTC interrupt handler */ #ifdef CONFIG_RTC_ALARM - ret = irq_attach(LPC17_IRQ_RTC, rtc_interrupt); + ret = irq_attach(LPC17_IRQ_RTC, rtc_interrupt, NULL); if (ret == OK) { up_enable_irq(LPC17_IRQ_RTC); diff --git a/arch/arm/src/lpc17xx/lpc17_adc.c b/arch/arm/src/lpc17xx/lpc17_adc.c index 490b25bf800..54d05933152 100644 --- a/arch/arm/src/lpc17xx/lpc17_adc.c +++ b/arch/arm/src/lpc17xx/lpc17_adc.c @@ -112,7 +112,7 @@ static int adc_setup(FAR struct adc_dev_s *dev); static void adc_shutdown(FAR struct adc_dev_s *dev); static void adc_rxint(FAR struct adc_dev_s *dev, bool enable); static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg); -static int adc_interrupt(int irq, void *context); +static int adc_interrupt(int irq, void *context, FAR void *arg); /**************************************************************************** * Private Data @@ -304,7 +304,7 @@ static int adc_setup(FAR struct adc_dev_s *dev) FAR struct up_dev_s *priv = (FAR struct up_dev_s *)dev->ad_priv; int i; - int ret = irq_attach(priv->irq, adc_interrupt); + int ret = irq_attach(priv->irq, adc_interrupt, NULL); if (ret == OK) { for (i = 0; i < 8; i++) @@ -406,7 +406,7 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg) * ****************************************************************************/ -static int adc_interrupt(int irq, void *context) +static int adc_interrupt(int irq, void *context, FAR void *arg) { #ifndef CONFIG_ADC_BURSTMODE #ifdef CONFIG_ADC_CHANLIST diff --git a/arch/arm/src/lpc17xx/lpc17_can.c b/arch/arm/src/lpc17xx/lpc17_can.c index f961bef5493..11ac88cc04d 100644 --- a/arch/arm/src/lpc17xx/lpc17_can.c +++ b/arch/arm/src/lpc17xx/lpc17_can.c @@ -217,7 +217,7 @@ static bool can_txempty(FAR struct can_dev_s *dev); /* CAN interrupts */ static void can_interrupt(FAR struct can_dev_s *dev); -static int can12_interrupt(int irq, void *context); +static int can12_interrupt(int irq, void *context, FAR void *arg); /* Initialization */ @@ -543,7 +543,7 @@ static int can_setup(FAR struct can_dev_s *dev) caninfo("CAN%d\n", priv->port); - ret = irq_attach(LPC17_IRQ_CAN, can12_interrupt); + ret = irq_attach(LPC17_IRQ_CAN, can12_interrupt, NULL); if (ret == OK) { up_enable_irq(LPC17_IRQ_CAN); @@ -1045,7 +1045,7 @@ static void can_interrupt(FAR struct can_dev_s *dev) * ****************************************************************************/ -static int can12_interrupt(int irq, void *context) +static int can12_interrupt(int irq, void *context, FAR void *arg) { /* Handle CAN1/2 interrupts */ diff --git a/arch/arm/src/lpc17xx/lpc17_ethernet.c b/arch/arm/src/lpc17xx/lpc17_ethernet.c index 9a91d0af1fc..897acb237f7 100644 --- a/arch/arm/src/lpc17xx/lpc17_ethernet.c +++ b/arch/arm/src/lpc17xx/lpc17_ethernet.c @@ -335,7 +335,7 @@ static void lpc17_response(struct lpc17_driver_s *priv); static void lpc17_txdone_work(FAR void *arg); static void lpc17_rxdone_work(FAR void *arg); -static int lpc17_interrupt(int irq, void *context); +static int lpc17_interrupt(int irq, void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -1123,7 +1123,7 @@ static void lpc17_txdone_work(FAR void *arg) * ****************************************************************************/ -static int lpc17_interrupt(int irq, void *context) +static int lpc17_interrupt(int irq, void *context, FAR void *arg) { register struct lpc17_driver_s *priv; uint32_t status; @@ -3111,9 +3111,9 @@ static inline int lpc17_ethinitialize(int intf) /* Attach the IRQ to the driver */ #if CONFIG_LPC17_NINTERFACES > 1 - ret = irq_attach(priv->irq, lpc17_interrupt); + ret = irq_attach(priv->irq, lpc17_interrupt, NULL); #else - ret = irq_attach(LPC17_IRQ_ETH, lpc17_interrupt); + ret = irq_attach(LPC17_IRQ_ETH, lpc17_interrupt, NULL); #endif if (ret != 0) { diff --git a/arch/arm/src/lpc17xx/lpc17_gpdma.c b/arch/arm/src/lpc17xx/lpc17_gpdma.c index 2eb2edf16ab..8fba6cbaad4 100644 --- a/arch/arm/src/lpc17xx/lpc17_gpdma.c +++ b/arch/arm/src/lpc17xx/lpc17_gpdma.c @@ -190,7 +190,7 @@ static void lpc17_dmadone(struct lpc17_dmach_s *dmach) * ****************************************************************************/ -static int gpdma_interrupt(int irq, FAR void *context) +static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg) { struct lpc17_dmach_s *dmach; uint32_t regval; @@ -315,7 +315,7 @@ void weak_function up_dmainitialize(void) /* Attach and enable the common interrupt handler */ - ret = irq_attach(LPC17_IRQ_GPDMA, gpdma_interrupt); + ret = irq_attach(LPC17_IRQ_GPDMA, gpdma_interrupt, NULL); if (ret == OK) { up_enable_irq(LPC17_IRQ_GPDMA); diff --git a/arch/arm/src/lpc17xx/lpc17_gpioint.c b/arch/arm/src/lpc17xx/lpc17_gpioint.c index 0c1ca613625..fded5b5b51c 100644 --- a/arch/arm/src/lpc17xx/lpc17_gpioint.c +++ b/arch/arm/src/lpc17xx/lpc17_gpioint.c @@ -402,7 +402,7 @@ static void lpc17_gpiodemux(uint32_t intbase, uint32_t intmask, * ****************************************************************************/ -static int lpc17_gpiointerrupt(int irq, void *context) +static int lpc17_gpiointerrupt(int irq, void *context, FAR void *arg) { /* Get the GPIO interrupt status */ @@ -468,7 +468,7 @@ void lpc17_gpioirqinitialize(void) * position in the NVIC with External Interrupt 3 */ - (void)irq_attach(LPC17_IRQ_EINT3, lpc17_gpiointerrupt); + (void)irq_attach(LPC17_IRQ_EINT3, lpc17_gpiointerrupt, NULL); up_enable_irq(LPC17_IRQ_EINT3); #elif defined(LPC178x) @@ -476,7 +476,7 @@ void lpc17_gpioirqinitialize(void) * GPIO2. */ - (void)irq_attach(LPC17_IRQ_GPIO, lpc17_gpiointerrupt); + (void)irq_attach(LPC17_IRQ_GPIO, lpc17_gpiointerrupt, NULL); up_enable_irq(LPC17_IRQ_GPIO); #endif diff --git a/arch/arm/src/lpc17xx/lpc17_i2c.c b/arch/arm/src/lpc17xx/lpc17_i2c.c index 554659818f5..0bd34e36b59 100644 --- a/arch/arm/src/lpc17xx/lpc17_i2c.c +++ b/arch/arm/src/lpc17xx/lpc17_i2c.c @@ -129,7 +129,7 @@ struct lpc17_i2cdev_s static int lpc17_i2c_start(struct lpc17_i2cdev_s *priv); static void lpc17_i2c_stop(struct lpc17_i2cdev_s *priv); -static int lpc17_i2c_interrupt(int irq, FAR void *context); +static int lpc17_i2c_interrupt(int irq, FAR void *context, FAR void *arg); static void lpc17_i2c_timeout(int argc, uint32_t arg, ...); static void lpc17_i2c_setfrequency(struct lpc17_i2cdev_s *priv, uint32_t frequency); @@ -334,7 +334,7 @@ static void lpc17_stopnext(struct lpc17_i2cdev_s *priv) * ****************************************************************************/ -static int lpc17_i2c_interrupt(int irq, FAR void *context) +static int lpc17_i2c_interrupt(int irq, FAR void *context, FAR void *arg) { struct lpc17_i2cdev_s *priv; struct i2c_msg_s *msg; @@ -608,7 +608,7 @@ struct i2c_master_s *lpc17_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, lpc17_i2c_interrupt); + irq_attach(priv->irqid, lpc17_i2c_interrupt, NULL); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/lpc17xx/lpc17_irq.c b/arch/arm/src/lpc17xx/lpc17_irq.c index ac8fb8855cd..01475fe5722 100644 --- a/arch/arm/src/lpc17xx/lpc17_irq.c +++ b/arch/arm/src/lpc17xx/lpc17_irq.c @@ -149,7 +149,7 @@ static void lpc17_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int lpc17_nmi(int irq, FAR void *context) +static int lpc17_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -157,7 +157,7 @@ static int lpc17_nmi(int irq, FAR void *context) return 0; } -static int lpc17_busfault(int irq, FAR void *context) +static int lpc17_busfault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Bus fault recived\n"); @@ -165,7 +165,7 @@ static int lpc17_busfault(int irq, FAR void *context) return 0; } -static int lpc17_usagefault(int irq, FAR void *context) +static int lpc17_usagefault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Usage fault received\n"); @@ -173,7 +173,7 @@ static int lpc17_usagefault(int irq, FAR void *context) return 0; } -static int lpc17_pendsv(int irq, FAR void *context) +static int lpc17_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -181,7 +181,7 @@ static int lpc17_pendsv(int irq, FAR void *context) return 0; } -static int lpc17_dbgmonitor(int irq, FAR void *context) +static int lpc17_dbgmonitor(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Debug Monitor received\n"); @@ -189,7 +189,7 @@ static int lpc17_dbgmonitor(int irq, FAR void *context) return 0; } -static int lpc17_reserved(int irq, FAR void *context) +static int lpc17_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -371,8 +371,8 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(LPC17_IRQ_SVCALL, up_svcall); - irq_attach(LPC17_IRQ_HARDFAULT, up_hardfault); + irq_attach(LPC17_IRQ_SVCALL, up_svcall, NULL); + irq_attach(LPC17_IRQ_HARDFAULT, up_hardfault, NULL); /* Set the priority of the SVCall interrupt */ @@ -388,22 +388,22 @@ void up_irqinitialize(void) */ #ifdef CONFIG_ARM_MPU - irq_attach(LPC17_IRQ_MEMFAULT, up_memfault); + irq_attach(LPC17_IRQ_MEMFAULT, up_memfault, NULL); up_enable_irq(LPC17_IRQ_MEMFAULT); #endif /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(LPC17_IRQ_NMI, lpc17_nmi); + irq_attach(LPC17_IRQ_NMI, lpc17_nmi, NULL); #ifndef CONFIG_ARM_MPU - irq_attach(LPC17_IRQ_MEMFAULT, up_memfault); + irq_attach(LPC17_IRQ_MEMFAULT, up_memfault, NULL); #endif - irq_attach(LPC17_IRQ_BUSFAULT, lpc17_busfault); - irq_attach(LPC17_IRQ_USAGEFAULT, lpc17_usagefault); - irq_attach(LPC17_IRQ_PENDSV, lpc17_pendsv); - irq_attach(LPC17_IRQ_DBGMONITOR, lpc17_dbgmonitor); - irq_attach(LPC17_IRQ_RESERVED, lpc17_reserved); + irq_attach(LPC17_IRQ_BUSFAULT, lpc17_busfault, NULL); + irq_attach(LPC17_IRQ_USAGEFAULT, lpc17_usagefault, NULL); + irq_attach(LPC17_IRQ_PENDSV, lpc17_pendsv, NULL); + irq_attach(LPC17_IRQ_DBGMONITOR, lpc17_dbgmonitor, NULL); + irq_attach(LPC17_IRQ_RESERVED, lpc17_reserved, NULL); #endif lpc17_dumpnvic("initial", LPC17_IRQ_NIRQS); diff --git a/arch/arm/src/lpc17xx/lpc17_pwm.c b/arch/arm/src/lpc17xx/lpc17_pwm.c index c284934570c..df3be30a74a 100644 --- a/arch/arm/src/lpc17xx/lpc17_pwm.c +++ b/arch/arm/src/lpc17xx/lpc17_pwm.c @@ -350,7 +350,7 @@ static int pwm_interrupt(struct lpc17_pwmtimer_s *priv) * ****************************************************************************/ -static int pwm_tim1interrupt(int irq, void *context) +static int pwm_tim1interrupt(int irq, void *context, FAR void *arg) { return pwm_interrupt(&g_pwm1dev); } diff --git a/arch/arm/src/lpc17xx/lpc17_sdcard.c b/arch/arm/src/lpc17xx/lpc17_sdcard.c index adf268f9d47..56ab0965780 100644 --- a/arch/arm/src/lpc17xx/lpc17_sdcard.c +++ b/arch/arm/src/lpc17xx/lpc17_sdcard.c @@ -345,7 +345,7 @@ static void lpc17_endtransfer(struct lpc17_dev_s *priv, sdio_eventset_t wkupeven /* Interrupt Handling *******************************************************/ -static int lpc17_interrupt(int irq, void *context); +static int lpc17_interrupt(int irq, void *context, FAR void *arg); /* SD Card Interface Methods ************************************************/ @@ -1203,7 +1203,7 @@ static void lpc17_endtransfer(struct lpc17_dev_s *priv, sdio_eventset_t wkupeven * ****************************************************************************/ -static int lpc17_interrupt(int irq, void *context) +static int lpc17_interrupt(int irq, void *context, FAR void *arg) { struct lpc17_dev_s *priv = &g_scard_dev; uint32_t enabled; @@ -1642,7 +1642,7 @@ static int lpc17_attach(FAR struct sdio_dev_s *dev) /* Attach the SD card interrupt handler */ - ret = irq_attach(LPC17_IRQ_MCI, lpc17_interrupt); + ret = irq_attach(LPC17_IRQ_MCI, lpc17_interrupt, NULL); if (ret == OK) { diff --git a/arch/arm/src/lpc17xx/lpc17_serial.c b/arch/arm/src/lpc17xx/lpc17_serial.c index 7062c521f48..14c7602d24c 100644 --- a/arch/arm/src/lpc17xx/lpc17_serial.c +++ b/arch/arm/src/lpc17xx/lpc17_serial.c @@ -104,7 +104,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -999,7 +999,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -1041,7 +1041,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/lpc17xx/lpc17_timerisr.c b/arch/arm/src/lpc17xx/lpc17_timerisr.c index 4f6d318642b..bb98e712ae3 100644 --- a/arch/arm/src/lpc17xx/lpc17_timerisr.c +++ b/arch/arm/src/lpc17xx/lpc17_timerisr.c @@ -91,7 +91,7 @@ * ****************************************************************************/ -static int lpc17_timerisr(int irq, uint32_t *regs) +static int lpc17_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -135,7 +135,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(LPC17_IRQ_SYSTICK, (xcpt_t)lpc17_timerisr); + (void)irq_attach(LPC17_IRQ_SYSTICK, (xcpt_t)lpc17_timerisr, NULL); /* Enable SysTick interrupts */ diff --git a/arch/arm/src/lpc17xx/lpc17_usbdev.c b/arch/arm/src/lpc17xx/lpc17_usbdev.c index ca4d5f90d80..5bcf3735b70 100644 --- a/arch/arm/src/lpc17xx/lpc17_usbdev.c +++ b/arch/arm/src/lpc17xx/lpc17_usbdev.c @@ -421,7 +421,7 @@ static void lpc17_dispatchrequest(struct lpc17_usbdev_s *priv, static inline void lpc17_ep0setup(struct lpc17_usbdev_s *priv); static inline void lpc17_ep0dataoutinterrupt(struct lpc17_usbdev_s *priv); static inline void lpc17_ep0dataininterrupt(struct lpc17_usbdev_s *priv); -static int lpc17_usbinterrupt(int irq, FAR void *context); +static int lpc17_usbinterrupt(int irq, FAR void *context, FAR void *arg); #ifdef CONFIG_LPC17_USBDEV_DMA static int lpc17_dmasetup(struct lpc17_usbdev_s *priv, uint8_t epphy, @@ -2051,7 +2051,7 @@ static inline void lpc17_ep0dataininterrupt(struct lpc17_usbdev_s *priv) * ****************************************************************************/ -static int lpc17_usbinterrupt(int irq, FAR void *context) +static int lpc17_usbinterrupt(int irq, FAR void *context, FAR void *arg) { struct lpc17_usbdev_s *priv = &g_usbdev; struct lpc17_ep_s *privep ; @@ -3321,7 +3321,7 @@ void up_usbinitialize(void) /* Attach USB controller interrupt handler */ - if (irq_attach(LPC17_IRQ_USB, lpc17_usbinterrupt) != 0) + if (irq_attach(LPC17_IRQ_USB, lpc17_usbinterrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(LPC17_TRACEERR_IRQREGISTRATION), (uint16_t)LPC17_IRQ_USB); diff --git a/arch/arm/src/lpc17xx/lpc17_usbhost.c b/arch/arm/src/lpc17xx/lpc17_usbhost.c index e81f9f676ef..42825b02132 100644 --- a/arch/arm/src/lpc17xx/lpc17_usbhost.c +++ b/arch/arm/src/lpc17xx/lpc17_usbhost.c @@ -347,7 +347,7 @@ static int lpc17_ctrltd(struct lpc17_usbhost_s *priv, struct lpc17_ed_s *ed, /* Interrupt handling **********************************************************/ -static int lpc17_usbinterrupt(int irq, void *context); +static int lpc17_usbinterrupt(int irq, void *context, FAR void *arg); /* USB host controller operations **********************************************/ @@ -1633,7 +1633,7 @@ errout_with_xfrinfo: * ****************************************************************************/ -static int lpc17_usbinterrupt(int irq, void *context) +static int lpc17_usbinterrupt(int irq, void *context, FAR void *arg) { struct lpc17_usbhost_s *priv = &g_usbhost; struct lpc17_ed_s *ed; @@ -3844,7 +3844,7 @@ struct usbhost_connection_s *lpc17_usbhost_initialize(int controller) /* Attach USB host controller interrupt handler */ - if (irq_attach(LPC17_IRQ_USB, lpc17_usbinterrupt) != 0) + if (irq_attach(LPC17_IRQ_USB, lpc17_usbinterrupt, NULL) != 0) { uerr("ERROR: Failed to attach IRQ\n"); return NULL; diff --git a/arch/arm/src/lpc214x/lpc214x_serial.c b/arch/arm/src/lpc214x/lpc214x_serial.c index e1b3511f9ca..47d0e8e47a7 100644 --- a/arch/arm/src/lpc214x/lpc214x_serial.c +++ b/arch/arm/src/lpc214x/lpc214x_serial.c @@ -88,7 +88,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -413,7 +413,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -456,7 +456,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/lpc214x/lpc214x_timerisr.c b/arch/arm/src/lpc214x/lpc214x_timerisr.c index 027dfa6e7e6..1d756d37d64 100644 --- a/arch/arm/src/lpc214x/lpc214x_timerisr.c +++ b/arch/arm/src/lpc214x/lpc214x_timerisr.c @@ -87,7 +87,7 @@ #ifdef CONFIG_VECTORED_INTERRUPTS static int lpc214x_timerisr(uint32_t *regs) #else -static int lpc214x_timerisr(int irq, uint32_t *regs) +static int lpc214x_timerisr(int irq, uint32_t *regs, void *arg) #endif { /* Process timer interrupt */ @@ -157,7 +157,7 @@ void arm_timer_initialize(void) up_attach_vector(LPC214X_IRQ_SYSTIMER, LPC214X_SYSTIMER_VEC, (vic_vector_t)lpc214x_timerisr); #else - (void)irq_attach(LPC214X_IRQ_SYSTIMER, (xcpt_t)lpc214x_timerisr); + (void)irq_attach(LPC214X_IRQ_SYSTIMER, (xcpt_t)lpc214x_timerisr, NULL); #endif /* And enable the timer interrupt */ diff --git a/arch/arm/src/lpc214x/lpc214x_usbdev.c b/arch/arm/src/lpc214x/lpc214x_usbdev.c index 636c7391251..c39324dc5ae 100644 --- a/arch/arm/src/lpc214x/lpc214x_usbdev.c +++ b/arch/arm/src/lpc214x/lpc214x_usbdev.c @@ -428,7 +428,7 @@ static void lpc214x_dispatchrequest(struct lpc214x_usbdev_s *priv, static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv); static inline void lpc214x_ep0dataoutinterrupt(struct lpc214x_usbdev_s *priv); static inline void lpc214x_ep0dataininterrupt(struct lpc214x_usbdev_s *priv); -static int lpc214x_usbinterrupt(int irq, FAR void *context); +static int lpc214x_usbinterrupt(int irq, FAR void *context, FAR void *arg); #ifdef CONFIG_LPC214X_USBDEV_DMA static int lpc214x_dmasetup(struct lpc214x_usbdev_s *priv, uint8_t epphy, @@ -2014,7 +2014,7 @@ static inline void lpc214x_ep0dataininterrupt(struct lpc214x_usbdev_s *priv) * ****************************************************************************/ -static int lpc214x_usbinterrupt(int irq, FAR void *context) +static int lpc214x_usbinterrupt(int irq, FAR void *context, FAR void *arg) { struct lpc214x_usbdev_s *priv = &g_usbdev; struct lpc214x_ep_s *privep ; @@ -3235,7 +3235,7 @@ void up_usbinitialize(void) /* Attach USB controller interrupt handler */ - if (irq_attach(LPC214X_USB_IRQ, lpc214x_usbinterrupt) != 0) + if (irq_attach(LPC214X_USB_IRQ, lpc214x_usbinterrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(LPC214X_TRACEERR_IRQREGISTRATION), (uint16_t)LPC214X_USB_IRQ); diff --git a/arch/arm/src/lpc2378/lpc23xx_i2c.c b/arch/arm/src/lpc2378/lpc23xx_i2c.c index 5de046a39f9..b877d56279a 100644 --- a/arch/arm/src/lpc2378/lpc23xx_i2c.c +++ b/arch/arm/src/lpc2378/lpc23xx_i2c.c @@ -134,7 +134,7 @@ struct lpc2378_i2cdev_s static int lpc2378_i2c_start(struct lpc2378_i2cdev_s *priv); static void lpc2378_i2c_stop(struct lpc2378_i2cdev_s *priv); -static int lpc2378_i2c_interrupt(int irq, FAR void *context); +static int lpc2378_i2c_interrupt(int irq, FAR void *context, FAR void *arg); static void lpc2378_i2c_timeout(int argc, uint32_t arg, ...); static void lpc2378_i2c_setfrequency(struct lpc2378_i2cdev_s *priv, uint32_t frequency); @@ -296,7 +296,7 @@ static void lpc2378_stopnext(struct lpc2378_i2cdev_s *priv) * ****************************************************************************/ -static int lpc2378_i2c_interrupt(int irq, FAR void *context) +static int lpc2378_i2c_interrupt(int irq, FAR void *context, FAR void *arg) { struct lpc2378_i2cdev_s *priv; struct i2c_msg_s *msg; @@ -619,7 +619,7 @@ struct i2c_master_s *lpc2378_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, lpc2378_i2c_interrupt); + irq_attach(priv->irqid, lpc2378_i2c_interrupt, NULL); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/lpc2378/lpc23xx_serial.c b/arch/arm/src/lpc2378/lpc23xx_serial.c index 48e322ec15a..c74b0594f50 100644 --- a/arch/arm/src/lpc2378/lpc23xx_serial.c +++ b/arch/arm/src/lpc2378/lpc23xx_serial.c @@ -96,7 +96,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t * status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -533,7 +533,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled in the @@ -581,7 +581,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/lpc2378/lpc23xx_timerisr.c b/arch/arm/src/lpc2378/lpc23xx_timerisr.c index 6d85b07c0f2..1cbd4b650de 100644 --- a/arch/arm/src/lpc2378/lpc23xx_timerisr.c +++ b/arch/arm/src/lpc2378/lpc23xx_timerisr.c @@ -96,7 +96,7 @@ #ifdef CONFIG_VECTORED_INTERRUPTS static int lpc23xx_timerisr(uint32_t * regs) #else -static int lpc23xx_timerisr(int irq, uint32_t * regs) +static int lpc23xx_timerisr(int irq, uint32_t * regs, FAR void *arg) #endif { static uint32_t tick; @@ -189,7 +189,7 @@ void arm_timer_initialize(void) #ifdef CONFIG_VECTORED_INTERRUPTS up_attach_vector(IRQ_SYSTIMER, ???, (vic_vector_t) lpc23xx_timerisr); #else - (void)irq_attach(IRQ_SYSTIMER, (xcpt_t)lpc23xx_timerisr); + (void)irq_attach(IRQ_SYSTIMER, (xcpt_t)lpc23xx_timerisr, NULL); #ifdef CONFIG_ARCH_IRQPRIO up_prioritize_irq(IRQ_SYSTIMER, PRIORITY_HIGHEST); #endif diff --git a/arch/arm/src/lpc31xx/lpc31_ehci.c b/arch/arm/src/lpc31xx/lpc31_ehci.c index 345ec24dc63..475c4dea89d 100644 --- a/arch/arm/src/lpc31xx/lpc31_ehci.c +++ b/arch/arm/src/lpc31xx/lpc31_ehci.c @@ -514,7 +514,7 @@ static inline void lpc31_portsc_bottomhalf(void); static inline void lpc31_syserr_bottomhalf(void); static inline void lpc31_async_advance_bottomhalf(void); static void lpc31_ehci_bottomhalf(FAR void *arg); -static int lpc31_ehci_interrupt(int irq, FAR void *context); +static int lpc31_ehci_interrupt(int irq, FAR void *context, FAR void *arg); /* USB Host Controller Operations **********************************************/ @@ -3357,7 +3357,7 @@ static void lpc31_ehci_bottomhalf(FAR void *arg) * ****************************************************************************/ -static int lpc31_ehci_interrupt(int irq, FAR void *context) +static int lpc31_ehci_interrupt(int irq, FAR void *context, FAR void *arg) { uint32_t usbsts; uint32_t pending; @@ -5282,7 +5282,7 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller) /* Interrupt Configuration ***************************************************/ - ret = irq_attach(LPC31_IRQ_USBOTG, lpc31_ehci_interrupt); + ret = irq_attach(LPC31_IRQ_USBOTG, lpc31_ehci_interrupt, NULL); if (ret != 0) { usbhost_trace1(EHCI_TRACE1_IRQATTACH_FAILED, LPC31_IRQ_USBOTG); diff --git a/arch/arm/src/lpc31xx/lpc31_i2c.c b/arch/arm/src/lpc31xx/lpc31_i2c.c index 1f27c4d1ff2..0e4ff893278 100644 --- a/arch/arm/src/lpc31xx/lpc31_i2c.c +++ b/arch/arm/src/lpc31xx/lpc31_i2c.c @@ -112,7 +112,7 @@ static struct lpc31_i2cdev_s i2cdevices[2]; * Private Function Prototypes ****************************************************************************/ -static int i2c_interrupt(int irq, FAR void *context); +static int i2c_interrupt(int irq, FAR void *context, FAR void *arg); static void i2c_progress(struct lpc31_i2cdev_s *priv); static void i2c_timeout(int argc, uint32_t arg, ...); static void i2c_hwreset(struct lpc31_i2cdev_s *priv); @@ -184,7 +184,7 @@ static void i2c_setfrequency(struct lpc31_i2cdev_s *priv, uint32_t frequency) * ****************************************************************************/ -static int i2c_interrupt(int irq, FAR void *context) +static int i2c_interrupt(int irq, FAR void *context, FAR void *arg) { if (irq == LPC31_IRQ_I2C0) { @@ -585,7 +585,7 @@ struct i2c_master_s *lpc31_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, i2c_interrupt); + irq_attach(priv->irqid, i2c_interrupt, NULL); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/lpc31xx/lpc31_serial.c b/arch/arm/src/lpc31xx/lpc31_serial.c index bf5ac8cd586..fa5f3b4563f 100644 --- a/arch/arm/src/lpc31xx/lpc31_serial.c +++ b/arch/arm/src/lpc31xx/lpc31_serial.c @@ -88,7 +88,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -444,7 +444,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(LPC31_IRQ_UART, up_interrupt); + ret = irq_attach(LPC31_IRQ_UART, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -482,7 +482,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = &g_uartport; uint8_t status; diff --git a/arch/arm/src/lpc31xx/lpc31_timerisr.c b/arch/arm/src/lpc31xx/lpc31_timerisr.c index ab01f01ced3..9a4932b7a69 100644 --- a/arch/arm/src/lpc31xx/lpc31_timerisr.c +++ b/arch/arm/src/lpc31xx/lpc31_timerisr.c @@ -66,7 +66,7 @@ * ****************************************************************************/ -static int lpc31_timerisr(int irq, uint32_t *regs) +static int lpc31_timerisr(int irq, uint32_t *regs, void *arg) { /* Clear the lattched timer interrupt (Writing any value to the CLEAR register * clears the interrupt generated by the counter timer @@ -135,7 +135,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(LPC31_IRQ_TMR0, (xcpt_t)lpc31_timerisr); + (void)irq_attach(LPC31_IRQ_TMR0, (xcpt_t)lpc31_timerisr, NULL); /* Clear any latched timer interrupt (Writing any value to the CLEAR register * clears the latched interrupt generated by the counter timer) diff --git a/arch/arm/src/lpc31xx/lpc31_usbdev.c b/arch/arm/src/lpc31xx/lpc31_usbdev.c index 1cc9ec0d38b..90f877a1897 100644 --- a/arch/arm/src/lpc31xx/lpc31_usbdev.c +++ b/arch/arm/src/lpc31xx/lpc31_usbdev.c @@ -396,7 +396,7 @@ static void lpc31_ep0complete(struct lpc31_usbdev_s *priv, uint8_t epphy) static void lpc31_ep0nak(struct lpc31_usbdev_s *priv, uint8_t epphy); static bool lpc31_epcomplete(struct lpc31_usbdev_s *priv, uint8_t epphy); -static int lpc31_usbinterrupt(int irq, FAR void *context); +static int lpc31_usbinterrupt(int irq, FAR void *context, FAR void *arg); /* Endpoint operations *********************************************************/ @@ -1677,7 +1677,7 @@ bool lpc31_epcomplete(struct lpc31_usbdev_s *priv, uint8_t epphy) * ****************************************************************************/ -static int lpc31_usbinterrupt(int irq, FAR void *context) +static int lpc31_usbinterrupt(int irq, FAR void *context, FAR void *arg) { struct lpc31_usbdev_s *priv = &g_usbdev; uint32_t disr, portsc1, n; @@ -2572,7 +2572,7 @@ void up_usbinitialize(void) /* Attach USB controller interrupt handler */ - if (irq_attach(LPC31_IRQ_USBOTG, lpc31_usbinterrupt) != 0) + if (irq_attach(LPC31_IRQ_USBOTG, lpc31_usbinterrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(LPC31_TRACEERR_IRQREGISTRATION), (uint16_t)LPC31_IRQ_USBOTG); diff --git a/arch/arm/src/lpc43xx/lpc43_adc.c b/arch/arm/src/lpc43xx/lpc43_adc.c index 2a9db4297d9..42bfbac817b 100644 --- a/arch/arm/src/lpc43xx/lpc43_adc.c +++ b/arch/arm/src/lpc43xx/lpc43_adc.c @@ -141,7 +141,7 @@ static int adc_setup(FAR struct adc_dev_s *dev); static void adc_shutdown(FAR struct adc_dev_s *dev); static void adc_rxint(FAR struct adc_dev_s *dev, bool enable); static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg); -static int adc_interrupt(int irq, void *context); +static int adc_interrupt(int irq, void *context, FAR void *arg); /**************************************************************************** * Private Data @@ -351,7 +351,7 @@ static int adc_setup(FAR struct adc_dev_s *dev) { FAR struct up_dev_s *priv = (FAR struct up_dev_s *)dev->ad_priv; - int ret = irq_attach(priv->irq, adc_interrupt); + int ret = irq_attach(priv->irq, adc_interrupt, NULL); if (ret == OK) { up_enable_irq(priv->irq); @@ -457,7 +457,7 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg) * ****************************************************************************/ -static int adc_interrupt(int irq, void *context) +static int adc_interrupt(int irq, void *context, FAR void *arg) { FAR struct up_dev_s *priv = (FAR struct up_dev_s *)g_adcdev.ad_priv; diff --git a/arch/arm/src/lpc43xx/lpc43_dac.c b/arch/arm/src/lpc43xx/lpc43_dac.c index 51b7000def9..0a81e41b2c5 100644 --- a/arch/arm/src/lpc43xx/lpc43_dac.c +++ b/arch/arm/src/lpc43xx/lpc43_dac.c @@ -89,7 +89,7 @@ static void dac_shutdown(FAR struct dac_dev_s *dev); static void dac_txint(FAR struct dac_dev_s *dev, bool enable); static int dac_send(FAR struct dac_dev_s *dev, FAR struct dac_msg_s *msg); static int dac_ioctl(FAR struct dac_dev_s *dev, int cmd, unsigned long arg); -static int dac_interrupt(int irq, void *context); +static int dac_interrupt(int irq, void *context, FAR void *arg); /**************************************************************************** * Private Data @@ -177,7 +177,7 @@ static int dac_ioctl(FAR struct dac_dev_s *dev, int cmd, unsigned long arg) return 0; } -static int dac_interrupt(int irq, void *context) +static int dac_interrupt(int irq, void *context, FAR void *arg) { } diff --git a/arch/arm/src/lpc43xx/lpc43_ehci.c b/arch/arm/src/lpc43xx/lpc43_ehci.c index 2893369cede..5af61fa9394 100644 --- a/arch/arm/src/lpc43xx/lpc43_ehci.c +++ b/arch/arm/src/lpc43xx/lpc43_ehci.c @@ -505,7 +505,7 @@ static inline void lpc43_portsc_bottomhalf(void); static inline void lpc43_syserr_bottomhalf(void); static inline void lpc43_async_advance_bottomhalf(void); static void lpc43_ehci_bottomhalf(FAR void *arg); -static int lpc43_ehci_interrupt(int irq, FAR void *context); +static int lpc43_ehci_interrupt(int irq, FAR void *context, FAR void *arg); /* USB Host Controller Operations **********************************************/ @@ -3194,7 +3194,7 @@ static void lpc43_ehci_bottomhalf(FAR void *arg) * ****************************************************************************/ -static int lpc43_ehci_interrupt(int irq, FAR void *context) +static int lpc43_ehci_interrupt(int irq, FAR void *context, FAR void *arg) { uint32_t usbsts; uint32_t pending; @@ -5089,7 +5089,7 @@ FAR struct usbhost_connection_s *lpc43_ehci_initialize(int controller) /* Interrupt Configuration ***************************************************/ - ret = irq_attach(LPC43M4_IRQ_USB0, lpc43_ehci_interrupt); + ret = irq_attach(LPC43M4_IRQ_USB0, lpc43_ehci_interrupt, NULL); if (ret != 0) { usbhost_trace1(EHCI_TRACE1_IRQATTACH_FAILED, LPC43M4_IRQ_USB0); diff --git a/arch/arm/src/lpc43xx/lpc43_ethernet.c b/arch/arm/src/lpc43xx/lpc43_ethernet.c index e54e4e666ca..425c8a867b0 100644 --- a/arch/arm/src/lpc43xx/lpc43_ethernet.c +++ b/arch/arm/src/lpc43xx/lpc43_ethernet.c @@ -594,7 +594,7 @@ static void lpc43_freeframe(FAR struct lpc43_ethmac_s *priv); static void lpc43_txdone(FAR struct lpc43_ethmac_s *priv); static void lpc43_interrupt_work(FAR void *arg); -static int lpc43_interrupt(int irq, FAR void *context); +static int lpc43_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -2019,7 +2019,7 @@ static void lpc43_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int lpc43_interrupt(int irq, FAR void *context) +static int lpc43_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct lpc43_ethmac_s *priv = &g_lpc43ethmac; uint32_t dmasr; @@ -3876,7 +3876,7 @@ static inline int lpc43_ethinitialize(void) /* Attach the IRQ to the driver */ - if (irq_attach(LPC43M4_IRQ_ETHERNET, lpc43_interrupt)) + if (irq_attach(LPC43M4_IRQ_ETHERNET, lpc43_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ diff --git a/arch/arm/src/lpc43xx/lpc43_gpdma.c b/arch/arm/src/lpc43xx/lpc43_gpdma.c index ab2942189cd..22c5213c2ef 100644 --- a/arch/arm/src/lpc43xx/lpc43_gpdma.c +++ b/arch/arm/src/lpc43xx/lpc43_gpdma.c @@ -190,7 +190,7 @@ static void lpc43_dmadone(struct lpc43_dmach_s *dmach) * ****************************************************************************/ -static int gpdma_interrupt(int irq, FAR void *context) +static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg) { struct lpc43_dmach_s *dmach; uint32_t regval; @@ -315,7 +315,7 @@ void weak_function up_dmainitialize(void) /* Attach and enable the common interrupt handler */ - ret = irq_attach(LPC43M4_IRQ_DMA, gpdma_interrupt); + ret = irq_attach(LPC43M4_IRQ_DMA, gpdma_interrupt, NULL); if (ret == OK) { up_enable_irq(LPC43M4_IRQ_DMA); diff --git a/arch/arm/src/lpc43xx/lpc43_i2c.c b/arch/arm/src/lpc43xx/lpc43_i2c.c index 49a77bb8b51..15a23fe1ddb 100644 --- a/arch/arm/src/lpc43xx/lpc43_i2c.c +++ b/arch/arm/src/lpc43xx/lpc43_i2c.c @@ -130,7 +130,7 @@ static struct lpc43_i2cdev_s g_i2c1dev; static int lpc43_i2c_start(struct lpc43_i2cdev_s *priv); static void lpc43_i2c_stop(struct lpc43_i2cdev_s *priv); -static int lpc43_i2c_interrupt(int irq, FAR void *context); +static int lpc43_i2c_interrupt(int irq, FAR void *context, FAR void *arg); static void lpc43_i2c_timeout(int argc, uint32_t arg, ...); static void lpc43_i2c_setfrequency(struct lpc43_i2cdev_s *priv, uint32_t frequency); @@ -277,7 +277,7 @@ void lpc32_i2c_nextmsg(struct lpc43_i2cdev_s *priv) * ****************************************************************************/ -static int lpc43_i2c_interrupt(int irq, FAR void *context) +static int lpc43_i2c_interrupt(int irq, FAR void *context, FAR void *arg) { struct lpc43_i2cdev_s *priv; struct i2c_msg_s *msg; @@ -558,7 +558,7 @@ struct i2c_master_s *lpc43_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, lpc43_i2c_interrupt); + irq_attach(priv->irqid, lpc43_i2c_interrupt, NULL); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/lpc43xx/lpc43_irq.c b/arch/arm/src/lpc43xx/lpc43_irq.c index 09680bd9e91..d51a8e48f71 100644 --- a/arch/arm/src/lpc43xx/lpc43_irq.c +++ b/arch/arm/src/lpc43xx/lpc43_irq.c @@ -154,7 +154,7 @@ static void lpc43_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int lpc43_nmi(int irq, FAR void *context) +static int lpc43_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -162,7 +162,7 @@ static int lpc43_nmi(int irq, FAR void *context) return 0; } -static int lpc43_busfault(int irq, FAR void *context) +static int lpc43_busfault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Bus fault recived\n"); @@ -170,7 +170,7 @@ static int lpc43_busfault(int irq, FAR void *context) return 0; } -static int lpc43_usagefault(int irq, FAR void *context) +static int lpc43_usagefault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Usage fault received\n"); @@ -178,7 +178,7 @@ static int lpc43_usagefault(int irq, FAR void *context) return 0; } -static int lpc43_pendsv(int irq, FAR void *context) +static int lpc43_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -186,7 +186,7 @@ static int lpc43_pendsv(int irq, FAR void *context) return 0; } -static int lpc43_dbgmonitor(int irq, FAR void *context) +static int lpc43_dbgmonitor(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Debug Monitor received\n"); @@ -194,7 +194,7 @@ static int lpc43_dbgmonitor(int irq, FAR void *context) return 0; } -static int lpc43_reserved(int irq, FAR void *context) +static int lpc43_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -364,8 +364,8 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(LPC43_IRQ_SVCALL, up_svcall); - irq_attach(LPC43_IRQ_HARDFAULT, up_hardfault); + irq_attach(LPC43_IRQ_SVCALL, up_svcall, NULL); + irq_attach(LPC43_IRQ_HARDFAULT, up_hardfault, NULL); /* Set the priority of the SVCall interrupt */ @@ -381,22 +381,22 @@ void up_irqinitialize(void) */ #ifdef CONFIG_ARM_MPU - irq_attach(LPC43_IRQ_MEMFAULT, up_memfault); + irq_attach(LPC43_IRQ_MEMFAULT, up_memfault, NULL); up_enable_irq(LPC43_IRQ_MEMFAULT); #endif /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(LPC43_IRQ_NMI, lpc43_nmi); + irq_attach(LPC43_IRQ_NMI, lpc43_nmi, NULL); #ifndef CONFIG_ARM_MPU - irq_attach(LPC43_IRQ_MEMFAULT, up_memfault); + irq_attach(LPC43_IRQ_MEMFAULT, up_memfault, NULL); #endif - irq_attach(LPC43_IRQ_BUSFAULT, lpc43_busfault); - irq_attach(LPC43_IRQ_USAGEFAULT, lpc43_usagefault); - irq_attach(LPC43_IRQ_PENDSV, lpc43_pendsv); - irq_attach(LPC43_IRQ_DBGMONITOR, lpc43_dbgmonitor); - irq_attach(LPC43_IRQ_RESERVED, lpc43_reserved); + irq_attach(LPC43_IRQ_BUSFAULT, lpc43_busfault, NULL); + irq_attach(LPC43_IRQ_USAGEFAULT, lpc43_usagefault, NULL); + irq_attach(LPC43_IRQ_PENDSV, lpc43_pendsv, NULL); + irq_attach(LPC43_IRQ_DBGMONITOR, lpc43_dbgmonitor, NULL); + irq_attach(LPC43_IRQ_RESERVED, lpc43_reserved, NULL); #endif lpc43_dumpnvic("initial", LPC43M4_IRQ_NIRQS); diff --git a/arch/arm/src/lpc43xx/lpc43_rit.c b/arch/arm/src/lpc43xx/lpc43_rit.c index c0bf633256f..c39e4b7a383 100644 --- a/arch/arm/src/lpc43xx/lpc43_rit.c +++ b/arch/arm/src/lpc43xx/lpc43_rit.c @@ -86,7 +86,7 @@ struct timespec g_ts; * Private Functions ****************************************************************************/ -static int lpc43_RIT_isr(int irq, FAR void *context) +static int lpc43_RIT_isr(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; @@ -166,7 +166,7 @@ void arm_timer_initialize(void) /* Set up the IRQ here */ - irq_attach(LPC43M4_IRQ_RITIMER, lpc43_RIT_isr); + irq_attach(LPC43M4_IRQ_RITIMER, lpc43_RIT_isr, NULL); /* Compute how many seconds per tick we have on the main clock. If it is * 204MHz for example, then there should be about 4.90ns per tick diff --git a/arch/arm/src/lpc43xx/lpc43_serial.c b/arch/arm/src/lpc43xx/lpc43_serial.c index 7fb42ee0353..151c17ba29d 100644 --- a/arch/arm/src/lpc43xx/lpc43_serial.c +++ b/arch/arm/src/lpc43xx/lpc43_serial.c @@ -106,7 +106,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +static int up_interrupt(int irq, void *context, FAR void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); #ifdef HAVE_RS485 static inline int up_set_rs485_mode(struct up_dev_s *priv, @@ -661,7 +661,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -702,7 +702,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/lpc43xx/lpc43_tickless_rit.c b/arch/arm/src/lpc43xx/lpc43_tickless_rit.c index ce0f7d63759..cacfb47c91b 100644 --- a/arch/arm/src/lpc43xx/lpc43_tickless_rit.c +++ b/arch/arm/src/lpc43xx/lpc43_tickless_rit.c @@ -536,7 +536,7 @@ static inline void lpc43_tl_alarm(uint32_t curr) /* Interrupt handler */ -static int lpc43_tl_isr(int irq, FAR void *context) +static int lpc43_tl_isr(int irq, FAR void *context, FAR void *arg) { lpc43_tl_sync_up(); @@ -624,7 +624,7 @@ void arm_timer_initialize(void) lpc43_tl_set_reset_on_match(false); lpc43_tl_clear_interrupt(); - irq_attach(LPC43M4_IRQ_RITIMER, lpc43_tl_isr); + irq_attach(LPC43M4_IRQ_RITIMER, lpc43_tl_isr, NULL); up_enable_irq(LPC43M4_IRQ_RITIMER); lpc43_tl_init_timer_vars(); diff --git a/arch/arm/src/lpc43xx/lpc43_timer.c b/arch/arm/src/lpc43xx/lpc43_timer.c index 0d8b35c9110..decc110dd49 100644 --- a/arch/arm/src/lpc43xx/lpc43_timer.c +++ b/arch/arm/src/lpc43xx/lpc43_timer.c @@ -113,7 +113,7 @@ static void lpc43_putreg(uint32_t val, uint32_t addr); /* Interrupt handling *******************************************************/ -static int lpc43_interrupt(int irq, FAR void *context); +static int lpc43_interrupt(int irq, FAR void *context, FAR void *arg); /* "Lower half" driver methods **********************************************/ @@ -336,7 +336,7 @@ void tmr_clk_disable(uint16_t tmrid) * ****************************************************************************/ -static int lpc43_interrupt(int irq, FAR void *context) +static int lpc43_interrupt(int irq, FAR void *context, FAR void *arg) { uint8_t chan_int = 0x0f; FAR struct lpc43_lowerhalf_s *priv = &g_tmrdevs[irq-LPC43M4_IRQ_TIMER0]; @@ -757,7 +757,7 @@ void lpc43_tmrinitialize(FAR const char *devpath, int irq) priv->ops = &g_tmrops; - (void)irq_attach(irq, lpc43_interrupt); + (void)irq_attach(irq, lpc43_interrupt, NULL); /* Enable NVIC interrupt. */ diff --git a/arch/arm/src/lpc43xx/lpc43_timerisr.c b/arch/arm/src/lpc43xx/lpc43_timerisr.c index 8b02b4c0991..a76cd54dc36 100644 --- a/arch/arm/src/lpc43xx/lpc43_timerisr.c +++ b/arch/arm/src/lpc43xx/lpc43_timerisr.c @@ -90,7 +90,7 @@ * ****************************************************************************/ -static int lpc43_timerisr(int irq, uint32_t *regs) +static int lpc43_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -134,7 +134,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(LPC43_IRQ_SYSTICK, (xcpt_t)lpc43_timerisr); + (void)irq_attach(LPC43_IRQ_SYSTICK, (xcpt_t)lpc43_timerisr, NULL); /* Enable SysTick interrupts */ diff --git a/arch/arm/src/lpc43xx/lpc43_usb0dev.c b/arch/arm/src/lpc43xx/lpc43_usb0dev.c index c583dd30a18..26bb600270b 100644 --- a/arch/arm/src/lpc43xx/lpc43_usb0dev.c +++ b/arch/arm/src/lpc43xx/lpc43_usb0dev.c @@ -415,7 +415,7 @@ static void lpc43_ep0complete(struct lpc43_usbdev_s *priv, uint8_t epphy) static void lpc43_ep0nak(struct lpc43_usbdev_s *priv, uint8_t epphy); static bool lpc43_epcomplete(struct lpc43_usbdev_s *priv, uint8_t epphy); -static int lpc43_usbinterrupt(int irq, FAR void *context); +static int lpc43_usbinterrupt(int irq, FAR void *context, FAR void *arg); /* Endpoint operations *********************************************************/ @@ -1766,7 +1766,7 @@ bool lpc43_epcomplete(struct lpc43_usbdev_s *priv, uint8_t epphy) * ****************************************************************************/ -static int lpc43_usbinterrupt(int irq, FAR void *context) +static int lpc43_usbinterrupt(int irq, FAR void *context, FAR void *arg) { struct lpc43_usbdev_s *priv = &g_usbdev; uint32_t disr, portsc1, n; @@ -2722,7 +2722,7 @@ void up_usbinitialize(void) /* Attach USB controller interrupt handler */ - irq_attach(LPC43M4_IRQ_USB0, lpc43_usbinterrupt); + irq_attach(LPC43M4_IRQ_USB0, lpc43_usbinterrupt, NULL); up_enable_irq(LPC43M4_IRQ_USB0); leave_critical_section(flags); diff --git a/arch/arm/src/moxart/moxart_irq.c b/arch/arm/src/moxart/moxart_irq.c index 31ed83c80fb..b81baeab21b 100644 --- a/arch/arm/src/moxart/moxart_irq.c +++ b/arch/arm/src/moxart/moxart_irq.c @@ -138,7 +138,7 @@ void up_irqinitialize(void) /* Setup UART shared interrupt */ - irq_attach(CONFIG_UART_MOXA_SHARED_IRQ, uart_decodeirq); + irq_attach(CONFIG_UART_MOXA_SHARED_IRQ, uart_decodeirq, NULL); up_enable_irq(CONFIG_UART_MOXA_SHARED_IRQ); /* And finally, enable interrupts */ diff --git a/arch/arm/src/moxart/moxart_timer.c b/arch/arm/src/moxart/moxart_timer.c index 1b281f05dd0..afc79e4d513 100644 --- a/arch/arm/src/moxart/moxart_timer.c +++ b/arch/arm/src/moxart/moxart_timer.c @@ -98,7 +98,7 @@ static uint32_t cmp = BOARD_32KOSC_FREQUENCY / 100; * ****************************************************************************/ -static int moxart_timerisr(int irq, uint32_t *regs) +static int moxart_timerisr(int irq, uint32_t *regs, void *arg) { uint32_t state; @@ -148,7 +148,7 @@ void arm_timer_initialize(void) /* Attach and enable the timer interrupt */ - irq_attach(IRQ_SYSTIMER, (xcpt_t)moxart_timerisr); + irq_attach(IRQ_SYSTIMER, (xcpt_t)moxart_timerisr, NULL); up_enable_irq(IRQ_SYSTIMER); ftintc010_set_trig_mode(IRQ_SYSTIMER, 1); ftintc010_set_trig_level(IRQ_SYSTIMER, 0); diff --git a/arch/arm/src/nuc1xx/nuc_irq.c b/arch/arm/src/nuc1xx/nuc_irq.c index 66f6d78044d..6fc6db1d2f5 100644 --- a/arch/arm/src/nuc1xx/nuc_irq.c +++ b/arch/arm/src/nuc1xx/nuc_irq.c @@ -138,7 +138,7 @@ static void nuc_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int nuc_nmi(int irq, FAR void *context) +static int nuc_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -146,7 +146,7 @@ static int nuc_nmi(int irq, FAR void *context) return 0; } -static int nuc_pendsv(int irq, FAR void *context) +static int nuc_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -154,7 +154,7 @@ static int nuc_pendsv(int irq, FAR void *context) return 0; } -static int nuc_reserved(int irq, FAR void *context) +static int nuc_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -231,15 +231,15 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(NUC_IRQ_SVCALL, up_svcall); - irq_attach(NUC_IRQ_HARDFAULT, up_hardfault); + irq_attach(NUC_IRQ_SVCALL, up_svcall, NULL); + irq_attach(NUC_IRQ_HARDFAULT, up_hardfault, NULL); /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(NUC_IRQ_NMI, nuc_nmi); - irq_attach(NUC_IRQ_PENDSV, nuc_pendsv); - irq_attach(NUC_IRQ_RESERVED, nuc_reserved); + irq_attach(NUC_IRQ_NMI, nuc_nmi, NULL); + irq_attach(NUC_IRQ_PENDSV, nuc_pendsv, NULL); + irq_attach(NUC_IRQ_RESERVED, nuc_reserved, NULL); #endif nuc_dumpnvic("initial", NR_IRQS); diff --git a/arch/arm/src/nuc1xx/nuc_serial.c b/arch/arm/src/nuc1xx/nuc_serial.c index a098db77ce3..1adb0ce8315 100644 --- a/arch/arm/src/nuc1xx/nuc_serial.c +++ b/arch/arm/src/nuc1xx/nuc_serial.c @@ -101,7 +101,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -568,7 +568,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -610,7 +610,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct nuc_dev_s *priv; diff --git a/arch/arm/src/nuc1xx/nuc_timerisr.c b/arch/arm/src/nuc1xx/nuc_timerisr.c index c32dcc66c03..02b99ba9ae7 100644 --- a/arch/arm/src/nuc1xx/nuc_timerisr.c +++ b/arch/arm/src/nuc1xx/nuc_timerisr.c @@ -156,7 +156,7 @@ static inline void nuc_lock(void) * ****************************************************************************/ -static int nuc_timerisr(int irq, uint32_t *regs) +static int nuc_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -226,7 +226,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(NUC_IRQ_SYSTICK, (xcpt_t)nuc_timerisr); + (void)irq_attach(NUC_IRQ_SYSTICK, (xcpt_t)nuc_timerisr, NULL); /* Enable SysTick interrupts. We need to select the core clock here if * we are not using one of the alternative clock sources above. diff --git a/arch/arm/src/sam34/sam4cm_cpupause.c b/arch/arm/src/sam34/sam4cm_cpupause.c index daf6fd76b4e..f2587811276 100644 --- a/arch/arm/src/sam34/sam4cm_cpupause.c +++ b/arch/arm/src/sam34/sam4cm_cpupause.c @@ -203,7 +203,7 @@ int up_cpu_paused(int cpu) * ****************************************************************************/ -int arm_pause_handler(int irq, void *c) +int arm_pause_handler(int irq, void *c, FAR void *arg) { int cpu = up_cpu_index(); diff --git a/arch/arm/src/sam34/sam4cm_cpustart.c b/arch/arm/src/sam34/sam4cm_cpustart.c index f8544abf7fc..3f6a4c6a194 100644 --- a/arch/arm/src/sam34/sam4cm_cpustart.c +++ b/arch/arm/src/sam34/sam4cm_cpustart.c @@ -80,7 +80,7 @@ ****************************************************************************/ volatile static spinlock_t g_cpu1_boot; -extern int arm_pause_handler(int irq, void *c); +extern int arm_pause_handler(int irq, void *c, FAR void *arg); /**************************************************************************** * Name: cpu1_boot @@ -120,7 +120,7 @@ static void cpu1_boot(void) /* Enable : write-only */ putreg32(0x1, SAM_IPC1_IECR); - irq_attach(SAM_IRQ_IPC1, arm_pause_handler); + irq_attach(SAM_IRQ_IPC1, arm_pause_handler, NULL); up_enable_irq(SAM_IRQ_IPC1); } @@ -229,7 +229,7 @@ int up_cpu_start(int cpu) sam_ipc0_enableclk(); putreg32(0x1, SAM_IPC0_ICCR); /* clear : write-only */ putreg32(0x1, SAM_IPC0_IECR); /* enable : write-only */ - irq_attach(SAM_IRQ_IPC0, arm_pause_handler); + irq_attach(SAM_IRQ_IPC0, arm_pause_handler, NULL); up_enable_irq(SAM_IRQ_IPC0); spin_lock(&g_cpu1_boot); diff --git a/arch/arm/src/sam34/sam4cm_tc.c b/arch/arm/src/sam34/sam4cm_tc.c index d10ac331012..330f9382b66 100644 --- a/arch/arm/src/sam34/sam4cm_tc.c +++ b/arch/arm/src/sam34/sam4cm_tc.c @@ -148,7 +148,7 @@ static inline void sam_chan_putreg(struct sam_chan_s *chan, /* Interrupt Handling *******************************************************/ static int sam_tc_interrupt(struct sam_chan_s *tc); -static int sam_raw_interrupt(int irq, void *context); +static int sam_raw_interrupt(int irq, void *context, FAR void *arg); /* Initialization ***********************************************************/ @@ -589,7 +589,7 @@ static int sam_tc_interrupt(struct sam_chan_s *chan) * ****************************************************************************/ -static int sam_raw_interrupt(int irq, void *context) +static int sam_raw_interrupt(int irq, void *context, FAR void *arg) { int i; struct sam_chan_s *chan; @@ -816,7 +816,7 @@ static inline struct sam_chan_s *sam_tc_initialize(int channel) /* Attach the timer interrupt handler and enable the timer interrupts */ - (void)irq_attach(chan->irq, sam_raw_interrupt); + (void)irq_attach(chan->irq, sam_raw_interrupt, NULL); up_enable_irq(chan->irq); /* Now the channel is initialized */ diff --git a/arch/arm/src/sam34/sam_dmac.c b/arch/arm/src/sam34/sam_dmac.c index 7cf1cff3499..6cd36cacf82 100644 --- a/arch/arm/src/sam34/sam_dmac.c +++ b/arch/arm/src/sam34/sam_dmac.c @@ -1276,7 +1276,7 @@ static void sam_dmaterminate(struct sam_dma_s *dmach, int result) * ****************************************************************************/ -static int sam_dmainterrupt(int irq, void *context) +static int sam_dmainterrupt(int irq, void *context, FAR void *arg) { struct sam_dma_s *dmach; unsigned int chndx; @@ -1370,7 +1370,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(SAM_IRQ_DMAC, sam_dmainterrupt); + (void)irq_attach(SAM_IRQ_DMAC, sam_dmainterrupt, NULL); /* Enable the IRQ at the NVIC (still disabled at the DMA controller) */ diff --git a/arch/arm/src/sam34/sam_emac.c b/arch/arm/src/sam34/sam_emac.c index 9afcc865ee3..e00fa8c6d99 100644 --- a/arch/arm/src/sam34/sam_emac.c +++ b/arch/arm/src/sam34/sam_emac.c @@ -381,7 +381,7 @@ static void sam_receive(struct sam_emac_s *priv); static void sam_txdone(struct sam_emac_s *priv); static void sam_interrupt_work(FAR void *arg); -static int sam_emac_interrupt(int irq, void *context); +static int sam_emac_interrupt(int irq, void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -1614,7 +1614,7 @@ static void sam_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int sam_emac_interrupt(int irq, void *context) +static int sam_emac_interrupt(int irq, void *context, FAR void *arg) { struct sam_emac_s *priv = &g_emac; @@ -3715,7 +3715,7 @@ void up_netinitialize(void) * the interface is in the 'up' state. */ - ret = irq_attach(SAM_IRQ_EMAC, sam_emac_interrupt); + ret = irq_attach(SAM_IRQ_EMAC, sam_emac_interrupt, NULL); if (ret < 0) { nerr("ERROR: Failed to attach the handler to the IRQ%d\n", SAM_IRQ_EMAC); diff --git a/arch/arm/src/sam34/sam_gpioirq.c b/arch/arm/src/sam34/sam_gpioirq.c index 4367e814634..e6091ee5110 100644 --- a/arch/arm/src/sam34/sam_gpioirq.c +++ b/arch/arm/src/sam34/sam_gpioirq.c @@ -210,42 +210,42 @@ static int sam_gpiointerrupt(uint32_t base, int irq0, void *context) } #ifdef CONFIG_SAM34_GPIOA_IRQ -static int sam_gpioainterrupt(int irq, void *context) +static int sam_gpioainterrupt(int irq, void *context, FAR void *arg) { return sam_gpiointerrupt(SAM_PIOA_BASE, SAM_IRQ_PA0, context); } #endif #ifdef CONFIG_SAM34_GPIOB_IRQ -static int sam_gpiobinterrupt(int irq, void *context) +static int sam_gpiobinterrupt(int irq, void *context, FAR void *arg) { return sam_gpiointerrupt(SAM_PIOB_BASE, SAM_IRQ_PB0, context); } #endif #ifdef CONFIG_SAM34_GPIOC_IRQ -static int sam_gpiocinterrupt(int irq, void *context) +static int sam_gpiocinterrupt(int irq, void *context, FAR void *arg) { return sam_gpiointerrupt(SAM_PIOC_BASE, SAM_IRQ_PC0, context); } #endif #ifdef CONFIG_SAM34_GPIOD_IRQ -static int sam_gpiodinterrupt(int irq, void *context) +static int sam_gpiodinterrupt(int irq, void *context, FAR void *arg) { return sam_gpiointerrupt(SAM_PIOD_BASE, SAM_IRQ_PD0, context); } #endif #ifdef CONFIG_SAM34_GPIOE_IRQ -static int sam_gpioeinterrupt(int irq, void *context) +static int sam_gpioeinterrupt(int irq, void *context, FAR void *arg) { return sam_gpiointerrupt(SAM_PIOE_BASE, SAM_IRQ_PE0, context); } #endif #ifdef CONFIG_SAM34_GPIOF_IRQ -static int sam_gpiofinterrupt(int irq, void *context) +static int sam_gpiofinterrupt(int irq, void *context, FAR void *arg) { return sam_gpiointerrupt(SAM_PIOF_BASE, SAM_IRQ_PF0, context); } @@ -280,7 +280,7 @@ void sam_gpioirqinitialize(void) /* Attach and enable the GPIOA IRQ */ - (void)irq_attach(SAM_IRQ_PIOA, sam_gpioainterrupt); + (void)irq_attach(SAM_IRQ_PIOA, sam_gpioainterrupt, NULL); up_enable_irq(SAM_IRQ_PIOA); #endif @@ -298,7 +298,7 @@ void sam_gpioirqinitialize(void) /* Attach and enable the GPIOB IRQ */ - (void)irq_attach(SAM_IRQ_PIOB, sam_gpiobinterrupt); + (void)irq_attach(SAM_IRQ_PIOB, sam_gpiobinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOB); #endif @@ -316,7 +316,7 @@ void sam_gpioirqinitialize(void) /* Attach and enable the GPIOC IRQ */ - (void)irq_attach(SAM_IRQ_PIOC, sam_gpiocinterrupt); + (void)irq_attach(SAM_IRQ_PIOC, sam_gpiocinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOC); #endif @@ -334,7 +334,7 @@ void sam_gpioirqinitialize(void) /* Attach and enable the GPIOC IRQ */ - (void)irq_attach(SAM_IRQ_PIOD, sam_gpiodinterrupt); + (void)irq_attach(SAM_IRQ_PIOD, sam_gpiodinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOD); #endif @@ -352,7 +352,7 @@ void sam_gpioirqinitialize(void) /* Attach and enable the GPIOE IRQ */ - (void)irq_attach(SAM_IRQ_PIOE, sam_gpioeinterrupt); + (void)irq_attach(SAM_IRQ_PIOE, sam_gpioeinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOE); #endif @@ -370,7 +370,7 @@ void sam_gpioirqinitialize(void) /* Attach and enable the GPIOF IRQ */ - (void)irq_attach(SAM_IRQ_PIOF, sam_gpiofinterrupt); + (void)irq_attach(SAM_IRQ_PIOF, sam_gpiofinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOF); #endif } diff --git a/arch/arm/src/sam34/sam_hsmci.c b/arch/arm/src/sam34/sam_hsmci.c index 2e831c0cb97..e59d558fe4e 100644 --- a/arch/arm/src/sam34/sam_hsmci.c +++ b/arch/arm/src/sam34/sam_hsmci.c @@ -463,7 +463,7 @@ static void sam_notransfer(struct sam_dev_s *priv); /* Interrupt Handling *******************************************************/ -static int sam_interrupt(int irq, void *context); +static int sam_interrupt(int irq, void *context, FAR void *arg); /* SDIO interface methods ***************************************************/ @@ -1248,7 +1248,7 @@ static void sam_notransfer(struct sam_dev_s *priv) * ****************************************************************************/ -static int sam_interrupt(int irq, void *context) +static int sam_interrupt(int irq, void *context, FAR void *arg) { struct sam_dev_s *priv = &g_sdiodev; uint32_t sr; @@ -1638,7 +1638,7 @@ static int sam_attach(FAR struct sdio_dev_s *dev) /* Attach the HSMCI interrupt handler */ - ret = irq_attach(SAM_IRQ_HSMCI, sam_interrupt); + ret = irq_attach(SAM_IRQ_HSMCI, sam_interrupt, NULL); if (ret == OK) { diff --git a/arch/arm/src/sam34/sam_irq.c b/arch/arm/src/sam34/sam_irq.c index 0b3286d0cac..eb6b1747059 100644 --- a/arch/arm/src/sam34/sam_irq.c +++ b/arch/arm/src/sam34/sam_irq.c @@ -178,7 +178,7 @@ static void sam_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int sam_nmi(int irq, FAR void *context) +static int sam_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -186,7 +186,7 @@ static int sam_nmi(int irq, FAR void *context) return 0; } -static int sam_busfault(int irq, FAR void *context) +static int sam_busfault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Bus fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -194,7 +194,7 @@ static int sam_busfault(int irq, FAR void *context) return 0; } -static int sam_usagefault(int irq, FAR void *context) +static int sam_usagefault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Usage fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -202,7 +202,7 @@ static int sam_usagefault(int irq, FAR void *context) return 0; } -static int sam_pendsv(int irq, FAR void *context) +static int sam_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -210,7 +210,7 @@ static int sam_pendsv(int irq, FAR void *context) return 0; } -static int sam_dbgmonitor(int irq, FAR void *context) +static int sam_dbgmonitor(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Debug Monitor received\n"); @@ -218,7 +218,7 @@ static int sam_dbgmonitor(int irq, FAR void *context) return 0; } -static int sam_reserved(int irq, FAR void *context) +static int sam_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -439,8 +439,8 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(SAM_IRQ_SVCALL, up_svcall); - irq_attach(SAM_IRQ_HARDFAULT, up_hardfault); + irq_attach(SAM_IRQ_SVCALL, up_svcall, NULL); + irq_attach(SAM_IRQ_HARDFAULT, up_hardfault, NULL); /* Set the priority of the SVCall interrupt */ @@ -456,22 +456,22 @@ void up_irqinitialize(void) */ #ifdef CONFIG_ARM_MPU - irq_attach(SAM_IRQ_MEMFAULT, up_memfault); + irq_attach(SAM_IRQ_MEMFAULT, up_memfault, NULL); up_enable_irq(SAM_IRQ_MEMFAULT); #endif /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(SAM_IRQ_NMI, sam_nmi); + irq_attach(SAM_IRQ_NMI, sam_nmi, NULL); #ifndef CONFIG_ARM_MPU - irq_attach(SAM_IRQ_MEMFAULT, up_memfault); + irq_attach(SAM_IRQ_MEMFAULT, up_memfault, NULL); #endif - irq_attach(SAM_IRQ_BUSFAULT, sam_busfault); - irq_attach(SAM_IRQ_USAGEFAULT, sam_usagefault); - irq_attach(SAM_IRQ_PENDSV, sam_pendsv); - irq_attach(SAM_IRQ_DBGMONITOR, sam_dbgmonitor); - irq_attach(SAM_IRQ_RESERVED, sam_reserved); + irq_attach(SAM_IRQ_BUSFAULT, sam_busfault, NULL); + irq_attach(SAM_IRQ_USAGEFAULT, sam_usagefault, NULL); + irq_attach(SAM_IRQ_PENDSV, sam_pendsv, NULL); + irq_attach(SAM_IRQ_DBGMONITOR, sam_dbgmonitor, NULL); + irq_attach(SAM_IRQ_RESERVED, sam_reserved, NULL); #endif sam_dumpnvic("initial", SAM_IRQ_NIRQS); diff --git a/arch/arm/src/sam34/sam_rtc.c b/arch/arm/src/sam34/sam_rtc.c index c4c548cc9f9..83739923ce8 100644 --- a/arch/arm/src/sam34/sam_rtc.c +++ b/arch/arm/src/sam34/sam_rtc.c @@ -264,7 +264,7 @@ static void rtc_worker(FAR void *arg) ************************************************************************************/ #ifdef CONFIG_RTC_ALARM -static int rtc_interrupt(int irq, void *context) +static int rtc_interrupt(int irq, void *context, FAR void *arg) { int ret; @@ -364,7 +364,7 @@ int up_rtc_initialize(void) #ifdef CONFIG_RTC_ALARM /* Then attach the ALARM interrupt handler */ - irq_attach(SAM_IRQ_RTC, rtc_interrupt); + irq_attach(SAM_IRQ_RTC, rtc_interrupt, NULL); /* Should RTC alarm interrupt be enabled at the peripheral? Let's assume so * for now. Let's say yes if the time is valid and a valid alarm has been diff --git a/arch/arm/src/sam34/sam_rtt.c b/arch/arm/src/sam34/sam_rtt.c index f29e7ac8ee7..8b7120cfc32 100644 --- a/arch/arm/src/sam34/sam_rtt.c +++ b/arch/arm/src/sam34/sam_rtt.c @@ -116,7 +116,7 @@ static void sam34_putreg(uint32_t val, uint32_t addr); /* Interrupt handling *******************************************************/ -static int sam34_interrupt(int irq, FAR void *context); +static int sam34_interrupt(int irq, FAR void *context, FAR void *arg); /* "Lower half" driver methods **********************************************/ @@ -275,7 +275,7 @@ static void sam34_putreg(uint32_t val, uint32_t addr) * ****************************************************************************/ -static int sam34_interrupt(int irq, FAR void *context) +static int sam34_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct sam34_lowerhalf_s *priv = &g_tcdev; @@ -650,7 +650,7 @@ void sam_rttinitialize(FAR const char *devpath) priv->ops = &g_tcops; - (void)irq_attach(SAM_IRQ_RTT, sam34_interrupt); + (void)irq_attach(SAM_IRQ_RTT, sam34_interrupt, NULL); /* Enable NVIC interrupt. */ diff --git a/arch/arm/src/sam34/sam_serial.c b/arch/arm/src/sam34/sam_serial.c index 36043e9deb8..b3b5854878a 100644 --- a/arch/arm/src/sam34/sam_serial.c +++ b/arch/arm/src/sam34/sam_serial.c @@ -370,7 +370,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -872,7 +872,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -913,7 +913,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/sam34/sam_tc.c b/arch/arm/src/sam34/sam_tc.c index 4a1b2abf79d..1faab8b159f 100644 --- a/arch/arm/src/sam34/sam_tc.c +++ b/arch/arm/src/sam34/sam_tc.c @@ -115,7 +115,7 @@ static void sam34_putreg(uint32_t val, uint32_t addr); /* Interrupt handling *******************************************************/ -static int sam34_interrupt(int irq, FAR void *context); +static int sam34_interrupt(int irq, FAR void *context, FAR void *arg); /* "Lower half" driver methods **********************************************/ @@ -255,7 +255,7 @@ static void sam34_putreg(uint32_t val, uint32_t addr) * ****************************************************************************/ -static int sam34_interrupt(int irq, FAR void *context) +static int sam34_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct sam34_lowerhalf_s *priv = &g_tcdevs[irq-SAM_IRQ_TC0]; @@ -647,7 +647,7 @@ void sam_tcinitialize(FAR const char *devpath, int irq) priv->ops = &g_tcops; - (void)irq_attach(irq, sam34_interrupt); + (void)irq_attach(irq, sam34_interrupt, NULL); /* Enable NVIC interrupt. */ diff --git a/arch/arm/src/sam34/sam_timerisr.c b/arch/arm/src/sam34/sam_timerisr.c index 00dde9aa7cf..46661de57b5 100644 --- a/arch/arm/src/sam34/sam_timerisr.c +++ b/arch/arm/src/sam34/sam_timerisr.c @@ -112,7 +112,7 @@ * ****************************************************************************/ -static int sam_timerisr(int irq, uint32_t *regs) +static int sam_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -163,7 +163,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(SAM_IRQ_SYSTICK, (xcpt_t)sam_timerisr); + (void)irq_attach(SAM_IRQ_SYSTICK, (xcpt_t)sam_timerisr, NULL); /* Enable SysTick interrupts */ diff --git a/arch/arm/src/sam34/sam_twi.c b/arch/arm/src/sam34/sam_twi.c index 1ed9c03f647..611be3be7f4 100644 --- a/arch/arm/src/sam34/sam_twi.c +++ b/arch/arm/src/sam34/sam_twi.c @@ -1006,7 +1006,7 @@ struct i2c_master_s *sam_i2cbus_initialize(int bus) /* Attach Interrupt Handler */ - irq_attach(priv->irq, handler); + irq_attach(priv->irq, handler, NULL); /* Enable Interrupts */ diff --git a/arch/arm/src/sam34/sam_udp.c b/arch/arm/src/sam34/sam_udp.c index 9e644c7631e..839a7bfdbad 100644 --- a/arch/arm/src/sam34/sam_udp.c +++ b/arch/arm/src/sam34/sam_udp.c @@ -395,7 +395,7 @@ static void sam_ep0_setup(struct sam_usbdev_s *priv); static void sam_ep_bankinterrupt(struct sam_usbdev_s *priv, struct sam_ep_s *privep, uint32_t csr, int bank); static void sam_ep_interrupt(struct sam_usbdev_s *priv, int epno); -static int sam_udp_interrupt(int irq, void *context); +static int sam_udp_interrupt(int irq, void *context, FAR void *arg); /* Endpoint helpers *********************************************************/ @@ -2218,7 +2218,7 @@ static void sam_ep_interrupt(struct sam_usbdev_s *priv, int epno) * ****************************************************************************/ -static int sam_udp_interrupt(int irq, void *context) +static int sam_udp_interrupt(int irq, void *context, FAR void *arg) { /* For now there is only one USB controller, but we will always refer to * it using a pointer to make any future ports to multiple UDP controllers @@ -3915,7 +3915,7 @@ void up_usbinitialize(void) * them when we need them later. */ - if (irq_attach(SAM_IRQ_UDP, sam_udp_interrupt) != 0) + if (irq_attach(SAM_IRQ_UDP, sam_udp_interrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(SAM_TRACEERR_IRQREGISTRATION), (uint16_t)SAM_IRQ_UDP); diff --git a/arch/arm/src/sam34/sam_wdt.c b/arch/arm/src/sam34/sam_wdt.c index a75f63097bd..12ed956f514 100644 --- a/arch/arm/src/sam34/sam_wdt.c +++ b/arch/arm/src/sam34/sam_wdt.c @@ -118,7 +118,7 @@ static void sam34_putreg(uint32_t val, uint32_t addr); /* Interrupt handling *******************************************************/ -static int sam34_interrupt(int irq, FAR void *context); +static int sam34_interrupt(int irq, FAR void *context, FAR void *arg); /* "Lower half" driver methods **********************************************/ @@ -256,7 +256,7 @@ static void sam34_putreg(uint32_t val, uint32_t addr) * ****************************************************************************/ -static int sam34_interrupt(int irq, FAR void *context) +static int sam34_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct sam34_lowerhalf_s *priv = &g_wdgdev; uint16_t regval; @@ -681,7 +681,7 @@ void sam_wdtinitialize(FAR const char *devpath) /* Attach our EWI interrupt handler (But don't enable it yet) */ - (void)irq_attach(SAM_IRQ_WDT, sam34_interrupt); + (void)irq_attach(SAM_IRQ_WDT, sam34_interrupt, NULL); /* Select an arbitrary initial timeout value. But don't start the watchdog * yet. NOTE: If the "Hardware watchdog" feature is enabled through the diff --git a/arch/arm/src/sama5/sam_adc.c b/arch/arm/src/sama5/sam_adc.c index 784b3d3c50f..2f9e4ee406e 100644 --- a/arch/arm/src/sama5/sam_adc.c +++ b/arch/arm/src/sama5/sam_adc.c @@ -448,7 +448,7 @@ static void sam_adc_dmastart(struct sam_adc_s *priv); static void sam_adc_endconversion(void *arg); #endif -static int sam_adc_interrupt(int irq, void *context); +static int sam_adc_interrupt(int irq, void *context, FAR void *arg); /* ADC methods */ @@ -907,7 +907,7 @@ static void sam_adc_endconversion(void *arg) * ****************************************************************************/ -static int sam_adc_interrupt(int irq, void *context) +static int sam_adc_interrupt(int irq, void *context, FAR void *arg) { struct sam_adc_s *priv = &g_adcpriv; uint32_t isr; @@ -2110,7 +2110,7 @@ struct adc_dev_s *sam_adc_initialize(void) /* Attach the ADC interrupt */ - ret = irq_attach(SAM_IRQ_ADC, sam_adc_interrupt); + ret = irq_attach(SAM_IRQ_ADC, sam_adc_interrupt, NULL); if (ret < 0) { aerr("ERROR: Failed to attach IRQ %d: %d\n", SAM_IRQ_ADC, ret); diff --git a/arch/arm/src/sama5/sam_can.c b/arch/arm/src/sama5/sam_can.c index f801e6e8341..09559c3e8eb 100644 --- a/arch/arm/src/sama5/sam_can.c +++ b/arch/arm/src/sama5/sam_can.c @@ -227,10 +227,10 @@ static inline void can_txinterrupt(FAR struct can_dev_s *dev, int mbndx); static inline void can_mbinterrupt(FAR struct can_dev_s *dev, int mbndx); static void can_interrupt(FAR struct can_dev_s *dev); #ifdef CONFIG_SAMA5_CAN0 -static int can0_interrupt(int irq, void *context); +static int can0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMA5_CAN1 -static int can1_interrupt(int irq, void *context); +static int can1_interrupt(int irq, void *context, FAR void *arg); #endif /* Hardware initialization */ @@ -860,7 +860,7 @@ static int can_setup(FAR struct can_dev_s *dev) /* Attach the CAN interrupt handler */ - ret = irq_attach(config->pid, config->handler); + ret = irq_attach(config->pid, config->handler, NULL); if (ret < 0) { canerr("ERROR: Failed to attach CAN%d IRQ (%d)", config->port, config->pid); @@ -1536,7 +1536,7 @@ static void can_interrupt(FAR struct can_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_SAMA5_CAN0 -static int can0_interrupt(int irq, void *context) +static int can0_interrupt(int irq, void *context, FAR void *arg) { can_interrupt(&g_can0dev); return OK; @@ -1559,7 +1559,7 @@ static int can0_interrupt(int irq, void *context) ****************************************************************************/ #ifdef CONFIG_SAMA5_CAN1 -static int can1_interrupt(int irq, void *context) +static int can1_interrupt(int irq, void *context, FAR void *arg) { can_interrupt(&g_can1dev); return OK; diff --git a/arch/arm/src/sama5/sam_dbgu.c b/arch/arm/src/sama5/sam_dbgu.c index 877e1db82dc..65242b88188 100644 --- a/arch/arm/src/sama5/sam_dbgu.c +++ b/arch/arm/src/sama5/sam_dbgu.c @@ -91,7 +91,7 @@ static int dbgu_setup(struct uart_dev_s *dev); static void dbgu_shutdown(struct uart_dev_s *dev); static int dbgu_attach(struct uart_dev_s *dev); static void dbgu_detach(struct uart_dev_s *dev); -static int dbgu_interrupt(int irq, void *context); +static int dbgu_interrupt(int irq, void *context, FAR void *arg); static int dbgu_ioctl(struct file *filep, int cmd, unsigned long arg); static int dbgu_receive(struct uart_dev_s *dev, uint32_t *status); static void dbgu_rxint(struct uart_dev_s *dev, bool enable); @@ -287,7 +287,7 @@ static int dbgu_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(SAM_IRQ_DBGU, dbgu_interrupt); + ret = irq_attach(SAM_IRQ_DBGU, dbgu_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -328,7 +328,7 @@ static void dbgu_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int dbgu_interrupt(int irq, void *context) +static int dbgu_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = &g_dbgu_port; struct dbgu_dev_s *priv = (struct dbgu_dev_s *)dev->priv; diff --git a/arch/arm/src/sama5/sam_dmac.c b/arch/arm/src/sama5/sam_dmac.c index e3a813c1b21..0cc3c60cb19 100644 --- a/arch/arm/src/sama5/sam_dmac.c +++ b/arch/arm/src/sama5/sam_dmac.c @@ -1858,14 +1858,14 @@ static int sam_dmac_interrupt(struct sam_dmac_s *dmac) ****************************************************************************/ #ifdef CONFIG_SAMA5_DMAC0 -static int sam_dmac0_interrupt(int irq, void *context) +static int sam_dmac0_interrupt(int irq, void *context, FAR void *arg) { return sam_dmac_interrupt(&g_dmac0); } #endif #ifdef CONFIG_SAMA5_DMAC1 -static int sam_dmac1_interrupt(int irq, void *context) +static int sam_dmac1_interrupt(int irq, void *context, FAR void *arg) { return sam_dmac_interrupt(&g_dmac1); } @@ -1928,7 +1928,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(SAM_IRQ_DMAC0, sam_dmac0_interrupt); + (void)irq_attach(SAM_IRQ_DMAC0, sam_dmac0_interrupt, NULL); /* Initialize the controller */ @@ -1948,7 +1948,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(SAM_IRQ_DMAC1, sam_dmac1_interrupt); + (void)irq_attach(SAM_IRQ_DMAC1, sam_dmac1_interrupt, NULL); /* Initialize the controller */ diff --git a/arch/arm/src/sama5/sam_ehci.c b/arch/arm/src/sama5/sam_ehci.c index 6065a04d50d..d84f1c2dbc4 100644 --- a/arch/arm/src/sama5/sam_ehci.c +++ b/arch/arm/src/sama5/sam_ehci.c @@ -388,7 +388,7 @@ static inline void sam_portsc_bottomhalf(void); static inline void sam_syserr_bottomhalf(void); static inline void sam_async_advance_bottomhalf(void); static void sam_ehci_bottomhalf(FAR void *arg); -static int sam_ehci_tophalf(int irq, FAR void *context); +static int sam_ehci_tophalf(int irq, FAR void *context, FAR void *arg); /* USB Host Controller Operations **********************************************/ @@ -3167,7 +3167,7 @@ static void sam_ehci_bottomhalf(FAR void *arg) * ****************************************************************************/ -static int sam_ehci_tophalf(int irq, FAR void *context) +static int sam_ehci_tophalf(int irq, FAR void *context, FAR void *arg) { uint32_t usbsts; uint32_t pending; @@ -3228,15 +3228,15 @@ static int sam_ehci_tophalf(int irq, FAR void *context) ****************************************************************************/ #ifdef CONFIG_SAMA5_OHCI -static int sam_uhphs_interrupt(int irq, FAR void *context) +static int sam_uhphs_interrupt(int irq, FAR void *context, FAR void *arg) { int ohci; int ehci; /* Provide the interrupting event to both the EHCI and OHCI top half */ - ohci = sam_ohci_tophalf(irq, context); - ehci = sam_ehci_tophalf(irq, context); + ohci = sam_ohci_tophalf(irq, context, arg); + ehci = sam_ehci_tophalf(irq, context, arg); /* Return OK only if both handlers returned OK */ @@ -5098,9 +5098,9 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller) */ #ifdef CONFIG_SAMA5_OHCI - ret = irq_attach(SAM_IRQ_UHPHS, sam_uhphs_interrupt); + ret = irq_attach(SAM_IRQ_UHPHS, sam_uhphs_interrupt, NULL); #else - ret = irq_attach(SAM_IRQ_UHPHS, sam_ehci_tophalf); + ret = irq_attach(SAM_IRQ_UHPHS, sam_ehci_tophalf, NULL); #endif if (ret != 0) { diff --git a/arch/arm/src/sama5/sam_emaca.c b/arch/arm/src/sama5/sam_emaca.c index 605bb965a06..bad06160cdf 100644 --- a/arch/arm/src/sama5/sam_emaca.c +++ b/arch/arm/src/sama5/sam_emaca.c @@ -386,7 +386,7 @@ static void sam_receive(struct sam_emac_s *priv); static void sam_txdone(struct sam_emac_s *priv); static void sam_interrupt_work(FAR void *arg); -static int sam_emac_interrupt(int irq, void *context); +static int sam_emac_interrupt(int irq, void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -1653,7 +1653,7 @@ static void sam_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int sam_emac_interrupt(int irq, void *context) +static int sam_emac_interrupt(int irq, void *context, FAR void *arg) { struct sam_emac_s *priv = &g_emac; uint32_t tsr; @@ -3759,7 +3759,7 @@ int sam_emac_initialize(void) * the interface is in the 'up' state. */ - ret = irq_attach(SAM_IRQ_EMAC, sam_emac_interrupt); + ret = irq_attach(SAM_IRQ_EMAC, sam_emac_interrupt, NULL); if (ret < 0) { nerr("ERROR: Failed to attach the handler to the IRQ%d\n", SAM_IRQ_EMAC); diff --git a/arch/arm/src/sama5/sam_emacb.c b/arch/arm/src/sama5/sam_emacb.c index 4aa61f4b9e3..688053c7b82 100644 --- a/arch/arm/src/sama5/sam_emacb.c +++ b/arch/arm/src/sama5/sam_emacb.c @@ -483,10 +483,10 @@ static void sam_txdone(struct sam_emac_s *priv); static void sam_interrupt_work(FAR void *arg); static int sam_emac_interrupt(struct sam_emac_s *priv); #ifdef CONFIG_SAMA5_EMAC0 -static int sam_emac0_interrupt(int irq, void *context); +static int sam_emac0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMA5_EMAC1 -static int sam_emac1_interrupt(int irq, void *context); +static int sam_emac1_interrupt(int irq, void *context, FAR void *arg); #endif /* Watchdog timer expirations */ @@ -2102,14 +2102,14 @@ static int sam_emac_interrupt(struct sam_emac_s *priv) ****************************************************************************/ #ifdef CONFIG_SAMA5_EMAC0 -static int sam_emac0_interrupt(int irq, void *context) +static int sam_emac0_interrupt(int irq, void *context, FAR void *arg) { return sam_emac_interrupt(&g_emac0); } #endif #ifdef CONFIG_SAMA5_EMAC1 -static int sam_emac1_interrupt(int irq, void *context) +static int sam_emac1_interrupt(int irq, void *context, FAR void *arg) { return sam_emac_interrupt(&g_emac1); } @@ -4485,7 +4485,7 @@ int sam_emac_initialize(int intf) * the interface is in the 'up' state. */ - ret = irq_attach(priv->attr->irq, priv->attr->handler); + ret = irq_attach(priv->attr->irq, priv->attr->handler, NULL); if (ret < 0) { nerr("ERROR: Failed to attach the handler to the IRQ%d\n", priv->attr->irq); diff --git a/arch/arm/src/sama5/sam_flexcom_serial.c b/arch/arm/src/sama5/sam_flexcom_serial.c index c0d4693ac86..e44793214d3 100644 --- a/arch/arm/src/sama5/sam_flexcom_serial.c +++ b/arch/arm/src/sama5/sam_flexcom_serial.c @@ -235,19 +235,19 @@ struct flexus_dev_s static int flexus_interrupt(struct uart_dev_s *dev); #ifdef CONFIG_USART0_SERIALDRIVER -static int flexus0_interrupt(int irq, void *context); +static int flexus0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_USART1_SERIALDRIVER -static int flexus1_interrupt(int irq, void *context); +static int flexus1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_USART2_SERIALDRIVER -static int flexus2_interrupt(int irq, void *context); +static int flexus2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_USART3_SERIALDRIVER -static int flexus3_interrupt(int irq, void *context); +static int flexus3_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_USART4_SERIALDRIVER -static int flexus4_interrupt(int irq, void *context); +static int flexus4_interrupt(int irq, void *context, FAR void *arg); #endif static int flexus_setup(struct uart_dev_s *dev); @@ -614,31 +614,31 @@ static int flexus_interrupt(struct uart_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_USART0_SERIALDRIVER -static int flexus0_interrupt(int irq, void *context) +static int flexus0_interrupt(int irq, void *context, FAR void *arg) { return flexus_interrupt(&g_flexus0port); } #endif #ifdef CONFIG_USART1_SERIALDRIVER -static int flexus1_interrupt(int irq, void *context) +static int flexus1_interrupt(int irq, void *context, FAR void *arg) { return flexus_interrupt(&g_flexus1port); } #endif #ifdef CONFIG_USART2_SERIALDRIVER -static int flexus2_interrupt(int irq, void *context) +static int flexus2_interrupt(int irq, void *context, FAR void *arg) { return flexus_interrupt(&g_flexus2port); } #endif #ifdef CONFIG_USART3_SERIALDRIVER -static int flexus3_interrupt(int irq, void *context) +static int flexus3_interrupt(int irq, void *context, FAR void *arg) { return flexus_interrupt(&g_flexus3port); } #endif #ifdef CONFIG_USART4_SERIALDRIVER -static int flexus4_interrupt(int irq, void *context) +static int flexus4_interrupt(int irq, void *context, FAR void *arg) { return flexus_interrupt(&g_flexus4port); } @@ -803,7 +803,7 @@ static int flexus_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler); + ret = irq_attach(priv->irq, priv->handler, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled diff --git a/arch/arm/src/sama5/sam_gmac.c b/arch/arm/src/sama5/sam_gmac.c index ab97e405695..2d21e5c023b 100644 --- a/arch/arm/src/sama5/sam_gmac.c +++ b/arch/arm/src/sama5/sam_gmac.c @@ -311,7 +311,7 @@ static void sam_receive(struct sam_gmac_s *priv); static void sam_txdone(struct sam_gmac_s *priv); static void sam_interrupt_work(FAR void *arg); -static int sam_gmac_interrupt(int irq, void *context); +static int sam_gmac_interrupt(int irq, void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -1605,7 +1605,7 @@ static void sam_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int sam_gmac_interrupt(int irq, void *context) +static int sam_gmac_interrupt(int irq, void *context, FAR void *arg) { struct sam_gmac_s *priv = &g_gmac; uint32_t tsr; @@ -3830,7 +3830,7 @@ int sam_gmac_initialize(void) * the interface is in the 'up' state. */ - ret = irq_attach(SAM_IRQ_GMAC, sam_gmac_interrupt); + ret = irq_attach(SAM_IRQ_GMAC, sam_gmac_interrupt, NULL); if (ret < 0) { nerr("ERROR: Failed to attach the handler to the IRQ%d\n", SAM_IRQ_GMAC); diff --git a/arch/arm/src/sama5/sam_hsmci.c b/arch/arm/src/sama5/sam_hsmci.c index a76e471319e..8caa71157a9 100644 --- a/arch/arm/src/sama5/sam_hsmci.c +++ b/arch/arm/src/sama5/sam_hsmci.c @@ -1984,7 +1984,7 @@ static int sam_attach(FAR struct sdio_dev_s *dev) /* Attach the HSMCI interrupt handler */ - ret = irq_attach(irq, handler); + ret = irq_attach(irq, handler, NULL); if (ret == OK) { diff --git a/arch/arm/src/sama5/sam_nand.c b/arch/arm/src/sama5/sam_nand.c index 1ac8e2a9ba6..05182120d93 100644 --- a/arch/arm/src/sama5/sam_nand.c +++ b/arch/arm/src/sama5/sam_nand.c @@ -181,7 +181,7 @@ static void nand_wait_nfcbusy(struct sam_nandcs_s *priv); #endif static uint32_t nand_nfc_poll(void); #ifdef CONFIG_SAMA5_NAND_HSMCINTERRUPTS -static int hsmc_interrupt(int irq, void *context); +static int hsmc_interrupt(int irq, void *context, FAR void *arg); #endif /* DMA Helpers */ @@ -1059,7 +1059,7 @@ static uint32_t nand_nfc_poll(void) ****************************************************************************/ #ifdef CONFIG_SAMA5_NAND_HSMCINTERRUPTS -static int hsmc_interrupt(int irq, void *context) +static int hsmc_interrupt(int irq, void *context, FAR void *arg) { uint32_t sr = nand_nfc_poll(); uint32_t imr = nand_getreg(SAM_HSMC_IMR); @@ -2992,7 +2992,7 @@ struct mtd_dev_s *sam_nand_initialize(int cs) #ifdef CONFIG_SAMA5_NAND_HSMCINTERRUPTS /* Attach the CAN interrupt handler */ - ret = irq_attach(SAM_IRQ_HSMC, hsmc_interrupt); + ret = irq_attach(SAM_IRQ_HSMC, hsmc_interrupt, NULL); if (ret < 0) { ferr("ERROR: Failed to attach HSMC IRQ (%d)", SAM_IRQ_HSMC); diff --git a/arch/arm/src/sama5/sam_ohci.c b/arch/arm/src/sama5/sam_ohci.c index b4a6b03f92d..f6907d1b0f2 100644 --- a/arch/arm/src/sama5/sam_ohci.c +++ b/arch/arm/src/sama5/sam_ohci.c @@ -4109,7 +4109,7 @@ struct usbhost_connection_s *sam_ohci_initialize(int controller) * then it will manage the shared interrupt. */ - if (irq_attach(SAM_IRQ_UHPHS, sam_ohci_tophalf) != 0) + if (irq_attach(SAM_IRQ_UHPHS, sam_ohci_tophalf, NULL) != 0) { usbhost_trace1(OHCI_TRACE1_IRQATTACH, SAM_IRQ_UHPHS); return NULL; @@ -4176,7 +4176,7 @@ struct usbhost_connection_s *sam_ohci_initialize(int controller) * ****************************************************************************/ -int sam_ohci_tophalf(int irq, void *context) +int sam_ohci_tophalf(int irq, void *context, FAR void *arg) { uint32_t intst; uint32_t inten; diff --git a/arch/arm/src/sama5/sam_pioirq.c b/arch/arm/src/sama5/sam_pioirq.c index 2d9950168ed..97aef6a0bce 100644 --- a/arch/arm/src/sama5/sam_pioirq.c +++ b/arch/arm/src/sama5/sam_pioirq.c @@ -202,42 +202,42 @@ static int sam_piointerrupt(uint32_t base, int irq0, void *context) } #ifdef CONFIG_SAMA5_PIOA_IRQ -static int sam_pioainterrupt(int irq, void *context) +static int sam_pioainterrupt(int irq, void *context, FAR void *arg) { return sam_piointerrupt(SAM_PIOA_VBASE, SAM_IRQ_PA0, context); } #endif #ifdef CONFIG_SAMA5_PIOB_IRQ -static int sam_piobinterrupt(int irq, void *context) +static int sam_piobinterrupt(int irq, void *context, FAR void *arg) { return sam_piointerrupt(SAM_PIOB_VBASE, SAM_IRQ_PB0, context); } #endif #ifdef CONFIG_SAMA5_PIOC_IRQ -static int sam_piocinterrupt(int irq, void *context) +static int sam_piocinterrupt(int irq, void *context, FAR void *arg) { return sam_piointerrupt(SAM_PIOC_VBASE, SAM_IRQ_PC0, context); } #endif #ifdef CONFIG_SAMA5_PIOD_IRQ -static int sam_piodinterrupt(int irq, void *context) +static int sam_piodinterrupt(int irq, void *context, FAR void *arg) { return sam_piointerrupt(SAM_PIOD_VBASE, SAM_IRQ_PD0, context); } #endif #ifdef CONFIG_SAMA5_PIOE_IRQ -static int sam_pioeinterrupt(int irq, void *context) +static int sam_pioeinterrupt(int irq, void *context, FAR void *arg) { return sam_piointerrupt(SAM_PIOE_VBASE, SAM_IRQ_PE0, context); } #endif #ifdef CONFIG_SAMA5_PIOF_IRQ -static int sam_piofinterrupt(int irq, void *context) +static int sam_piofinterrupt(int irq, void *context, FAR void *arg) { return sam_piointerrupt(SAM_PIOF_VBASE, SAM_IRQ_PF0, context); } @@ -272,7 +272,7 @@ void sam_pioirqinitialize(void) /* Attach and enable the PIOA IRQ */ - (void)irq_attach(SAM_IRQ_PIOA, sam_pioainterrupt); + (void)irq_attach(SAM_IRQ_PIOA, sam_pioainterrupt, NULL); up_enable_irq(SAM_IRQ_PIOA); #endif @@ -290,7 +290,7 @@ void sam_pioirqinitialize(void) /* Attach and enable the PIOB IRQ */ - (void)irq_attach(SAM_IRQ_PIOB, sam_piobinterrupt); + (void)irq_attach(SAM_IRQ_PIOB, sam_piobinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOB); #endif @@ -308,7 +308,7 @@ void sam_pioirqinitialize(void) /* Attach and enable the PIOC IRQ */ - (void)irq_attach(SAM_IRQ_PIOC, sam_piocinterrupt); + (void)irq_attach(SAM_IRQ_PIOC, sam_piocinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOC); #endif @@ -326,7 +326,7 @@ void sam_pioirqinitialize(void) /* Attach and enable the PIOC IRQ */ - (void)irq_attach(SAM_IRQ_PIOD, sam_piodinterrupt); + (void)irq_attach(SAM_IRQ_PIOD, sam_piodinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOD); #endif @@ -344,7 +344,7 @@ void sam_pioirqinitialize(void) /* Attach and enable the PIOE IRQ */ - (void)irq_attach(SAM_IRQ_PIOE, sam_pioeinterrupt); + (void)irq_attach(SAM_IRQ_PIOE, sam_pioeinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOE); #endif @@ -362,7 +362,7 @@ void sam_pioirqinitialize(void) /* Attach and enable the PIOF IRQ */ - (void)irq_attach(SAM_IRQ_PIOF, sam_piofinterrupt); + (void)irq_attach(SAM_IRQ_PIOF, sam_piofinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOF); #endif } diff --git a/arch/arm/src/sama5/sam_pwm.c b/arch/arm/src/sama5/sam_pwm.c index 622d4569b0f..90b204eac30 100644 --- a/arch/arm/src/sama5/sam_pwm.c +++ b/arch/arm/src/sama5/sam_pwm.c @@ -330,7 +330,7 @@ static void pwm_dumpregs(FAR struct sam_pwm_chan_s *chan, FAR const char *msg); /* PWM Interrupts */ #ifdef PWM_INTERRUPTS -static int pwm_interrupt(int irq, void *context); +static int pwm_interrupt(int irq, void *context, FAR void *arg); #endif /* PWM driver methods */ @@ -836,7 +836,7 @@ static void pwm_dumpregs(struct sam_pwm_chan_s *chan, FAR const char *msg) ****************************************************************************/ #ifdef PWM_INTERRUPTS -static int pwm_interrupt(int irq, void *context) +static int pwm_interrupt(int irq, void *context, FAR void *arg) { /* No PWM interrupts are used in the current design */ @@ -1393,7 +1393,7 @@ FAR struct pwm_lowerhalf_s *sam_pwminitialize(int channel) /* Attach the PWM interrupt handler */ #ifdef PWM_INTERRUPTS - ret = irq_attach(SAM_IRQ_PWM, pwm_interrupt); + ret = irq_attach(SAM_IRQ_PWM, pwm_interrupt, NULL); if (ret < 0) { pwmerr("ERROR: Failed to attach IRQ%d\n", channel); diff --git a/arch/arm/src/sama5/sam_rtc.c b/arch/arm/src/sama5/sam_rtc.c index e73e473b706..b5a893b3616 100644 --- a/arch/arm/src/sama5/sam_rtc.c +++ b/arch/arm/src/sama5/sam_rtc.c @@ -255,7 +255,7 @@ static void rtc_worker(FAR void *arg) ************************************************************************************/ #ifdef CONFIG_RTC_ALARM -static int rtc_interrupt(int irq, void *context) +static int rtc_interrupt(int irq, void *context, FAR void *arg) { int ret; @@ -321,7 +321,7 @@ int up_rtc_initialize(void) #ifdef CONFIG_RTC_ALARM /* Then attach the ALARM interrupt handler */ - irq_attach(SAM_PID_SYS, rtc_interrupt); + irq_attach(SAM_PID_SYS, rtc_interrupt, NULL); /* Should RTC alarm interrupt be enabled at the peripheral? Let's assume so * for now. Let's say yes if the time is valid and a valid alarm has been diff --git a/arch/arm/src/sama5/sam_serial.c b/arch/arm/src/sama5/sam_serial.c index a73ac33cd24..49573981db1 100644 --- a/arch/arm/src/sama5/sam_serial.c +++ b/arch/arm/src/sama5/sam_serial.c @@ -437,34 +437,34 @@ struct up_dev_s static int up_interrupt(struct uart_dev_s *dev); #ifdef CONFIG_SAMA5_UART0 -static int up_uart0_interrupt(int irq, void *context); +static int up_uart0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMA5_UART1 -static int up_uart1_interrupt(int irq, void *context); +static int up_uart1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMA5_UART2 -static int up_uart2_interrupt(int irq, void *context); +static int up_uart2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMA5_UART3 -static int up_uart3_interrupt(int irq, void *context); +static int up_uart3_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMA5_UART4 -static int up_uart4_interrupt(int irq, void *context); +static int up_uart4_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_USART0_SERIALDRIVER -static int up_usart0_interrupt(int irq, void *context); +static int up_usart0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_USART1_SERIALDRIVER -static int up_usart1_interrupt(int irq, void *context); +static int up_usart1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_USART2_SERIALDRIVER -static int up_usart2_interrupt(int irq, void *context); +static int up_usart2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_USART3_SERIALDRIVER -static int up_usart3_interrupt(int irq, void *context); +static int up_usart3_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_USART4_SERIALDRIVER -static int up_usart4_interrupt(int irq, void *context); +static int up_usart4_interrupt(int irq, void *context, FAR void *arg); #endif static int up_setup(struct uart_dev_s *dev); @@ -1044,61 +1044,61 @@ static int up_interrupt(struct uart_dev_s *dev) } #ifdef CONFIG_SAMA5_UART0 -static int up_uart0_interrupt(int irq, void *context) +static int up_uart0_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_uart0port); } #endif #ifdef CONFIG_SAMA5_UART1 -static int up_uart1_interrupt(int irq, void *context) +static int up_uart1_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_uart1port); } #endif #ifdef CONFIG_SAMA5_UART2 -static int up_uart2_interrupt(int irq, void *context) +static int up_uart2_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_uart2port); } #endif #ifdef CONFIG_SAMA5_UART3 -static int up_uart3_interrupt(int irq, void *context) +static int up_uart3_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_uart3port); } #endif #ifdef CONFIG_SAMA5_UART4 -static int up_uart4_interrupt(int irq, void *context) +static int up_uart4_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_uart4port); } #endif #ifdef CONFIG_USART0_SERIALDRIVER -static int up_usart0_interrupt(int irq, void *context) +static int up_usart0_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_usart0port); } #endif #ifdef CONFIG_USART1_SERIALDRIVER -static int up_usart1_interrupt(int irq, void *context) +static int up_usart1_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_usart1port); } #endif #ifdef CONFIG_USART2_SERIALDRIVER -static int up_usart2_interrupt(int irq, void *context) +static int up_usart2_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_usart2port); } #endif #ifdef CONFIG_USART3_SERIALDRIVER -static int up_usart3_interrupt(int irq, void *context) +static int up_usart3_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_usart3port); } #endif #ifdef CONFIG_USART4_SERIALDRIVER -static int up_usart4_interrupt(int irq, void *context) +static int up_usart4_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_usart4port); } @@ -1294,7 +1294,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler); + ret = irq_attach(priv->irq, priv->handler, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled diff --git a/arch/arm/src/sama5/sam_tc.c b/arch/arm/src/sama5/sam_tc.c index 7d8e19370cc..015d6bc96a5 100644 --- a/arch/arm/src/sama5/sam_tc.c +++ b/arch/arm/src/sama5/sam_tc.c @@ -175,13 +175,13 @@ static inline void sam_chan_putreg(struct sam_chan_s *chan, static int sam_tc_interrupt(struct sam_tc_s *tc); #ifdef CONFIG_SAMA5_TC0 -static int sam_tc012_interrupt(int irq, void *context); +static int sam_tc012_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMA5_TC1 -static int sam_tc345_interrupt(int irq, void *context); +static int sam_tc345_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMA5_TC2 -static int sam_tc678_interrupt(int irq, void *context); +static int sam_tc678_interrupt(int irq, void *context, FAR void *arg); #endif /* Initialization ***********************************************************/ @@ -763,21 +763,21 @@ static int sam_tc_interrupt(struct sam_tc_s *tc) ****************************************************************************/ #ifdef CONFIG_SAMA5_TC0 -static int sam_tc012_interrupt(int irq, void *context) +static int sam_tc012_interrupt(int irq, void *context, void *arg) { return sam_tc_interrupt(&g_tc012); } #endif #ifdef CONFIG_SAMA5_TC1 -static int sam_tc345_interrupt(int irq, void *context) +static int sam_tc345_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc345); } #endif #ifdef CONFIG_SAMA5_TC2 -static int sam_tc678_interrupt(int irq, void *context) +static int sam_tc678_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc678); } @@ -1038,7 +1038,7 @@ static inline struct sam_chan_s *sam_tc_initialize(int channel) /* Attach the timer interrupt handler and enable the timer interrupts */ - (void)irq_attach(tc->pid, handler); + (void)irq_attach(tc->pid, handler, NULL); up_enable_irq(tc->pid); /* Now the channel is initialized */ diff --git a/arch/arm/src/sama5/sam_timerisr.c b/arch/arm/src/sama5/sam_timerisr.c index 3495bc64271..957c4efad24 100644 --- a/arch/arm/src/sama5/sam_timerisr.c +++ b/arch/arm/src/sama5/sam_timerisr.c @@ -88,7 +88,7 @@ * ****************************************************************************/ -static int sam_timerisr(int irq, uint32_t *regs) +static int sam_timerisr(int irq, uint32_t *regs, void *arg) { /* "When CPIV and PICNT values are obtained by reading the Periodic * Interval Value Register (PIT_PIVR), the overflow counter (PICNT) is @@ -136,7 +136,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(SAM_IRQ_PIT, (xcpt_t)sam_timerisr); + (void)irq_attach(SAM_IRQ_PIT, (xcpt_t)sam_timerisr, NULL); /* Set the PIT overflow value (PIV), enable the PIT, and enable * interrupts from the PIT. diff --git a/arch/arm/src/sama5/sam_trng.c b/arch/arm/src/sama5/sam_trng.c index c724612456a..fed9a347acf 100644 --- a/arch/arm/src/sama5/sam_trng.c +++ b/arch/arm/src/sama5/sam_trng.c @@ -71,7 +71,7 @@ /* Interrupts */ -static int sam_interrupt(int irq, void *context); +static int sam_interrupt(int irq, void *context, FAR void *arg); /* Character driver methods */ @@ -127,7 +127,7 @@ static const struct file_operations g_trngops = * ****************************************************************************/ -static int sam_interrupt(int irq, void *context) +static int sam_interrupt(int irq, void *context, FAR void *arg) { uint32_t odata; @@ -371,7 +371,7 @@ static int sam_rng_initialize(void) /* Initialize the TRNG interrupt */ - ret = irq_attach(SAM_IRQ_TRNG, sam_interrupt); + ret = irq_attach(SAM_IRQ_TRNG, sam_interrupt, NULL); if (ret < 0) { ferr("ERROR: Failed to attach to IRQ%d\n", SAM_IRQ_TRNG); diff --git a/arch/arm/src/sama5/sam_twi.c b/arch/arm/src/sama5/sam_twi.c index 52f3e0950d1..65bb0e118b3 100644 --- a/arch/arm/src/sama5/sam_twi.c +++ b/arch/arm/src/sama5/sam_twi.c @@ -203,16 +203,16 @@ static int twi_wait(struct twi_dev_s *priv, unsigned int size); static void twi_wakeup(struct twi_dev_s *priv, int result); static int twi_interrupt(struct twi_dev_s *priv); #ifdef CONFIG_SAMA5_TWI0 -static int twi0_interrupt(int irq, FAR void *context); +static int twi0_interrupt(int irq, FAR void *context, FAR void * arg); #endif #ifdef CONFIG_SAMA5_TWI1 -static int twi1_interrupt(int irq, FAR void *context); +static int twi1_interrupt(int irq, FAR void *context, FAR void * arg); #endif #ifdef CONFIG_SAMA5_TWI2 -static int twi2_interrupt(int irq, FAR void *context); +static int twi2_interrupt(int irq, FAR void *context, FAR void * arg); #endif #ifdef CONFIG_SAMA5_TWI3 -static int twi3_interrupt(int irq, FAR void *context); +static int twi3_interrupt(int irq, FAR void *context, FAR void * arg); #endif static void twi_timeout(int argc, uint32_t arg, ...); @@ -668,28 +668,28 @@ static int twi_interrupt(struct twi_dev_s *priv) } #ifdef CONFIG_SAMA5_TWI0 -static int twi0_interrupt(int irq, FAR void *context) +static int twi0_interrupt(int irq, FAR void *context, FAR void * arg) { return twi_interrupt(&g_twi0); } #endif #ifdef CONFIG_SAMA5_TWI1 -static int twi1_interrupt(int irq, FAR void *context) +static int twi1_interrupt(int irq, FAR void *context, FAR void * arg) { return twi_interrupt(&g_twi1); } #endif #ifdef CONFIG_SAMA5_TWI2 -static int twi2_interrupt(int irq, FAR void *context) +static int twi2_interrupt(int irq, FAR void *context, FAR void * arg) { return twi_interrupt(&g_twi2); } #endif #ifdef CONFIG_SAMA5_TWI3 -static int twi3_interrupt(int irq, FAR void *context) +static int twi3_interrupt(int irq, FAR void *context, FAR void * arg) { return twi_interrupt(&g_twi3); } @@ -1296,7 +1296,7 @@ struct i2c_master_s *sam_i2cbus_initialize(int bus) /* Attach Interrupt Handler */ - ret = irq_attach(priv->attr->irq, priv->attr->handler); + ret = irq_attach(priv->attr->irq, priv->attr->handler, NULL); if (ret < 0) { ierr("ERROR: Failed to attach irq %d\n", priv->attr->irq); diff --git a/arch/arm/src/sama5/sam_udphs.c b/arch/arm/src/sama5/sam_udphs.c index 76f704d1f69..3f27bd31122 100644 --- a/arch/arm/src/sama5/sam_udphs.c +++ b/arch/arm/src/sama5/sam_udphs.c @@ -448,7 +448,7 @@ static void sam_setdevaddr(struct sam_usbdev_s *priv, uint8_t value); static void sam_ep0_setup(struct sam_usbdev_s *priv); static void sam_dma_interrupt(struct sam_usbdev_s *priv, int chan); static void sam_ep_interrupt(struct sam_usbdev_s *priv, int epno); -static int sam_udphs_interrupt(int irq, void *context); +static int sam_udphs_interrupt(int irq, void *context, FAR void *arg); /* Endpoint helpers *********************************************************/ @@ -2770,7 +2770,7 @@ static void sam_ep_interrupt(struct sam_usbdev_s *priv, int epno) * ****************************************************************************/ -static int sam_udphs_interrupt(int irq, void *context) +static int sam_udphs_interrupt(int irq, void *context, FAR void *arg) { /* For now there is only one USB controller, but we will always refer to * it using a pointer to make any future ports to multiple UDPHS controllers @@ -4437,7 +4437,7 @@ void up_usbinitialize(void) * them when we need them later. */ - if (irq_attach(SAM_IRQ_UDPHS, sam_udphs_interrupt) != 0) + if (irq_attach(SAM_IRQ_UDPHS, sam_udphs_interrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(SAM_TRACEERR_IRQREGISTRATION), (uint16_t)SAM_IRQ_UDPHS); diff --git a/arch/arm/src/sama5/sam_usbhost.h b/arch/arm/src/sama5/sam_usbhost.h index a67a0a42ddc..90e2b81a590 100644 --- a/arch/arm/src/sama5/sam_usbhost.h +++ b/arch/arm/src/sama5/sam_usbhost.h @@ -271,7 +271,7 @@ FAR struct usbhost_connection_s *sam_ohci_initialize(int controller); ************************************************************************************/ #ifdef CONFIG_SAMA5_OHCI -int sam_ohci_tophalf(int irq, FAR void *context); +int sam_ohci_tophalf(int irq, FAR void *context, FAR void *arg); #endif /************************************************************************************ diff --git a/arch/arm/src/sama5/sam_wdt.c b/arch/arm/src/sama5/sam_wdt.c index 342aa5c8f3d..9d3f7dd61ea 100644 --- a/arch/arm/src/sama5/sam_wdt.c +++ b/arch/arm/src/sama5/sam_wdt.c @@ -120,7 +120,7 @@ static void sam_putreg(uint32_t regval, uintptr_t regaddr); /* Interrupt hanlding *******************************************************/ #ifdef CONFIG_SAMA5_WDT_INTERRUPT -static int sam_interrupt(int irq, FAR void *context); +static int sam_interrupt(int irq, FAR void *context, FAR void *arg); #endif /* "Lower half" driver methods **********************************************/ @@ -260,7 +260,7 @@ static void sam_putreg(uint32_t regval, uintptr_t regaddr) ****************************************************************************/ #ifdef CONFIG_SAMA5_WDT_INTERRUPT -static int sam_interrupt(int irq, FAR void *context) +static int sam_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct sam_lowerhalf_s *priv = &g_wdtdev; @@ -684,7 +684,7 @@ int sam_wdt_initialize(void) #ifdef CONFIG_SAMA5_WDT_INTERRUPT /* Attach our WDT interrupt handler (But don't enable it yet) */ - (void)irq_attach(SAM_IRQ_WDT, sam_interrupt); + (void)irq_attach(SAM_IRQ_WDT, sam_interrupt, NULL); #endif /* Register the watchdog driver at the configured location (default diff --git a/arch/arm/src/sama5/sam_xdmac.c b/arch/arm/src/sama5/sam_xdmac.c index 9b819555569..5a229f77e96 100644 --- a/arch/arm/src/sama5/sam_xdmac.c +++ b/arch/arm/src/sama5/sam_xdmac.c @@ -1899,14 +1899,14 @@ static int sam_xdmac_interrupt(struct sam_xdmac_s *xdmac) ****************************************************************************/ #ifdef CONFIG_SAMA5_XDMAC0 -static int sam_xdmac0_interrupt(int irq, void *context) +static int sam_xdmac0_interrupt(int irq, void *context, FAR void *arg) { return sam_xdmac_interrupt(&g_xdmac0); } #endif #ifdef CONFIG_SAMA5_XDMAC1 -static int sam_xdmac1_interrupt(int irq, void *context) +static int sam_xdmac1_interrupt(int irq, void *context, FAR void *arg) { return sam_xdmac_interrupt(&g_xdmac1); } @@ -1965,7 +1965,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(SAM_IRQ_XDMAC0, sam_xdmac0_interrupt); + (void)irq_attach(SAM_IRQ_XDMAC0, sam_xdmac0_interrupt, NULL); /* Initialize the controller */ @@ -1985,7 +1985,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(SAM_IRQ_XDMAC1, sam_xdmac1_interrupt); + (void)irq_attach(SAM_IRQ_XDMAC1, sam_xdmac1_interrupt, NULL); /* Initialize the controller */ diff --git a/arch/arm/src/samdl/sam_dmac.c b/arch/arm/src/samdl/sam_dmac.c index d465d4d5f87..20501ecc0ed 100644 --- a/arch/arm/src/samdl/sam_dmac.c +++ b/arch/arm/src/samdl/sam_dmac.c @@ -117,7 +117,7 @@ static void sam_takedsem(void); static inline void sam_givedsem(void); #endif static void sam_dmaterminate(struct sam_dmach_s *dmach, int result); -static int sam_dmainterrupt(int irq, void *context); +static int sam_dmainterrupt(int irq, void *context, FAR void *arg); static struct dma_desc_s *sam_alloc_desc(struct sam_dmach_s *dmach); static struct dma_desc_s *sam_append_desc(struct sam_dmach_s *dmach, uint16_t btctrl, uint16_t btcnt, @@ -275,7 +275,7 @@ static void sam_dmaterminate(struct sam_dmach_s *dmach, int result) * ****************************************************************************/ -static int sam_dmainterrupt(int irq, void *context) +static int sam_dmainterrupt(int irq, void *context, FAR void *arg) { struct sam_dmach_s *dmach; unsigned int chndx; @@ -807,7 +807,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(SAM_IRQ_DMAC, sam_dmainterrupt); + (void)irq_attach(SAM_IRQ_DMAC, sam_dmainterrupt, NULL); /* Set the LPRAM DMA descriptor table addresses. These can only be * written when the DMAC is disabled. diff --git a/arch/arm/src/samdl/sam_irq.c b/arch/arm/src/samdl/sam_irq.c index 025c2008182..6d3deeb2e83 100644 --- a/arch/arm/src/samdl/sam_irq.c +++ b/arch/arm/src/samdl/sam_irq.c @@ -94,7 +94,7 @@ volatile uint32_t *g_current_regs[1]; ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int sam_nmi(int irq, FAR void *context) +static int sam_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -102,7 +102,7 @@ static int sam_nmi(int irq, FAR void *context) return 0; } -static int sam_pendsv(int irq, FAR void *context) +static int sam_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -110,7 +110,7 @@ static int sam_pendsv(int irq, FAR void *context) return 0; } -static int sam_reserved(int irq, FAR void *context) +static int sam_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -187,15 +187,15 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(SAM_IRQ_SVCALL, up_svcall); - irq_attach(SAM_IRQ_HARDFAULT, up_hardfault); + irq_attach(SAM_IRQ_SVCALL, up_svcall, NULL); + irq_attach(SAM_IRQ_HARDFAULT, up_hardfault, NULL); /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(SAM_IRQ_NMI, sam_nmi); - irq_attach(SAM_IRQ_PENDSV, sam_pendsv); - irq_attach(SAM_IRQ_RESERVED, sam_reserved); + irq_attach(SAM_IRQ_NMI, sam_nmi, NULL); + irq_attach(SAM_IRQ_PENDSV, sam_pendsv, NULL); + irq_attach(SAM_IRQ_RESERVED, sam_reserved, NULL); #endif sam_dumpnvic("initial", NR_IRQS); diff --git a/arch/arm/src/samdl/sam_serial.c b/arch/arm/src/samdl/sam_serial.c index ac94f694acf..9bdf6e85f7f 100644 --- a/arch/arm/src/samdl/sam_serial.c +++ b/arch/arm/src/samdl/sam_serial.c @@ -252,22 +252,22 @@ static void sam_disableallints(struct sam_dev_s *priv); static int sam_interrupt(struct uart_dev_s *dev); #ifdef SAMDL_HAVE_USART0 -static int sam_usart0_interrupt(int irq, void *context); +static int sam_usart0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef SAMDL_HAVE_USART1 -static int sam_usart1_interrupt(int irq, void *context); +static int sam_usart1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef SAMDL_HAVE_USART2 -static int sam_usart2_interrupt(int irq, void *context); +static int sam_usart2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef SAMDL_HAVE_USART3 -static int sam_usart3_interrupt(int irq, void *context); +static int sam_usart3_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef SAMDL_HAVE_USART4 -static int sam_usart4_interrupt(int irq, void *context); +static int sam_usart4_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef SAMDL_HAVE_USART5 -static int sam_usart5_interrupt(int irq, void *context); +static int sam_usart5_interrupt(int irq, void *context, FAR void *arg); #endif /* UART methods */ @@ -609,42 +609,42 @@ static int sam_interrupt(struct uart_dev_s *dev) ****************************************************************************/ #ifdef SAMDL_HAVE_USART0 -static int sam_usart0_interrupt(int irq, void *context) +static int sam_usart0_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_usart0port); } #endif #ifdef SAMDL_HAVE_USART1 -static int sam_usart1_interrupt(int irq, void *context) +static int sam_usart1_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_usart1port); } #endif #ifdef SAMDL_HAVE_USART2 -static int sam_usart2_interrupt(int irq, void *context) +static int sam_usart2_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_usart2port); } #endif #ifdef SAMDL_HAVE_USART3 -static int sam_usart3_interrupt(int irq, void *context) +static int sam_usart3_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_usart3port); } #endif #ifdef SAMDL_HAVE_USART4 -static int sam_usart4_interrupt(int irq, void *context) +static int sam_usart4_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_usart4port); } #endif #ifdef SAMDL_HAVE_USART5 -static int sam_usart5_interrupt(int irq, void *context) +static int sam_usart5_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_usart5port); } @@ -726,7 +726,7 @@ static int sam_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(config->irq, priv->handler); + ret = irq_attach(config->irq, priv->handler, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled diff --git a/arch/arm/src/samdl/sam_spi.c b/arch/arm/src/samdl/sam_spi.c index ac7ea3d2cc2..702a55fadf3 100644 --- a/arch/arm/src/samdl/sam_spi.c +++ b/arch/arm/src/samdl/sam_spi.c @@ -166,22 +166,22 @@ static void spi_dumpregs(struct sam_spidev_s *priv, const char *msg); static int spi_interrupt(struct sam_spidev_s *dev); #ifdef SAMDL_HAVE_SPI0 -static int spi0_interrupt(int irq, void *context); +static int spi0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef SAMDL_HAVE_SPI1 -static int spi1_interrupt(int irq, void *context); +static int spi1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef SAMDL_HAVE_SPI2 -static int spi2_interrupt(int irq, void *context); +static int spi2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef SAMDL_HAVE_SPI3 -static int spi3_interrupt(int irq, void *context); +static int spi3_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef SAMDL_HAVE_SPI4 -static int spi4_interrupt(int irq, void *context); +static int spi4_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef SAMDL_HAVE_SPI5 -static int spi5_interrupt(int irq, void *context); +static int spi5_interrupt(int irq, void *context, FAR void *arg); #endif #endif @@ -802,42 +802,42 @@ static int spi_interrupt(struct sam_spidev_s *dev) #if 0 /* Not used */ #ifdef SAMDL_HAVE_SPI0 -static int spi0_interrupt(int irq, void *context) +static int spi0_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spi0dev); } #endif #ifdef SAMDL_HAVE_SPI1 -static int spi1_interrupt(int irq, void *context) +static int spi1_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spi1dev); } #endif #ifdef SAMDL_HAVE_SPI2 -static int spi2_interrupt(int irq, void *context) +static int spi2_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spi2dev); } #endif #ifdef SAMDL_HAVE_SPI3 -static int spi3_interrupt(int irq, void *context) +static int spi3_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spi3dev); } #endif #ifdef SAMDL_HAVE_SPI4 -static int spi4_interrupt(int irq, void *context) +static int spi4_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spi4dev); } #endif #ifdef SAMDL_HAVE_SPI5 -static int spi5_interrupt(int irq, void *context) +static int spi5_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spi5dev); } @@ -1546,7 +1546,7 @@ struct spi_dev_s *sam_spibus_initialize(int port) #if 0 /* Not used */ /* Attach and enable the SERCOM interrupt handler */ - ret = irq_attach(priv->irq, priv->handler); + ret = irq_attach(priv->irq, priv->handler, NULL); if (ret < 0) { spierr("ERROR: Failed to attach interrupt: %d\n", irq); diff --git a/arch/arm/src/samdl/sam_timerisr.c b/arch/arm/src/samdl/sam_timerisr.c index 5236ee45b5b..abc61f355f0 100644 --- a/arch/arm/src/samdl/sam_timerisr.c +++ b/arch/arm/src/samdl/sam_timerisr.c @@ -95,7 +95,7 @@ * ****************************************************************************/ -static int sam_timerisr(int irq, uint32_t *regs) +static int sam_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -133,7 +133,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(SAM_IRQ_SYSTICK, (xcpt_t)sam_timerisr); + (void)irq_attach(SAM_IRQ_SYSTICK, (xcpt_t)sam_timerisr, NULL); /* Enable SysTick interrupts */ diff --git a/arch/arm/src/samv7/sam_dac.c b/arch/arm/src/samv7/sam_dac.c index 598201ce390..78a19929b54 100644 --- a/arch/arm/src/samv7/sam_dac.c +++ b/arch/arm/src/samv7/sam_dac.c @@ -109,7 +109,7 @@ struct sam_chan_s /* Interrupt handler */ -static int dac_interrupt(int irq, FAR void *context); +static int dac_interrupt(int irq, FAR void *context, FAR void *arg); /* DAC methods */ @@ -199,7 +199,7 @@ static struct sam_dac_s g_dacmodule; * ****************************************************************************/ -static int dac_interrupt(int irq, FAR void *context) +static int dac_interrupt(int irq, FAR void *context, FAR void *arg) { #ifdef CONFIG_SAMV7_DAC1 uint32_t status; @@ -569,7 +569,7 @@ static int dac_module_init(void) /* Configure interrupts */ - ret = irq_attach(SAM_IRQ_DACC, dac_interrupt); + ret = irq_attach(SAM_IRQ_DACC, dac_interrupt, NULL); if (ret < 0) { aerr("irq_attach failed: %d\n", ret); diff --git a/arch/arm/src/samv7/sam_emac.c b/arch/arm/src/samv7/sam_emac.c index 617df6226b5..9a59a9b3173 100644 --- a/arch/arm/src/samv7/sam_emac.c +++ b/arch/arm/src/samv7/sam_emac.c @@ -585,10 +585,10 @@ static void sam_txerr_interrupt(FAR struct sam_emac_s *priv, int qid); static void sam_interrupt_work(FAR void *arg); static int sam_emac_interrupt(struct sam_emac_s *priv); #ifdef CONFIG_SAMV7_EMAC0 -static int sam_emac0_interrupt(int irq, void *context); +static int sam_emac0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_EMAC1 -static int sam_emac1_interrupt(int irq, void *context); +static int sam_emac1_interrupt(int irq, void *context, FAR void *arg); #endif /* Watchdog timer expirations */ @@ -2548,14 +2548,14 @@ static int sam_emac_interrupt(struct sam_emac_s *priv) ****************************************************************************/ #ifdef CONFIG_SAMV7_EMAC0 -static int sam_emac0_interrupt(int irq, void *context) +static int sam_emac0_interrupt(int irq, void *context, FAR void *arg) { return sam_emac_interrupt(&g_emac0); } #endif #ifdef CONFIG_SAMV7_EMAC1 -static int sam_emac1_interrupt(int irq, void *context) +static int sam_emac1_interrupt(int irq, void *context, FAR void *arg) { return sam_emac_interrupt(&g_emac1); } @@ -5052,7 +5052,7 @@ int sam_emac_initialize(int intf) * the interface is in the 'up' state. */ - ret = irq_attach(priv->attr->irq, priv->attr->handler); + ret = irq_attach(priv->attr->irq, priv->attr->handler, NULL); if (ret < 0) { nerr("ERROR: Failed to attach the handler to the IRQ%d\n", priv->attr->irq); diff --git a/arch/arm/src/samv7/sam_gpioirq.c b/arch/arm/src/samv7/sam_gpioirq.c index 8929d175779..78cbc4c5ed7 100644 --- a/arch/arm/src/samv7/sam_gpioirq.c +++ b/arch/arm/src/samv7/sam_gpioirq.c @@ -192,35 +192,35 @@ static int sam_gpiointerrupt(uint32_t base, int irq0, void *context) } #ifdef CONFIG_SAMV7_GPIOA_IRQ -static int sam_gpioainterrupt(int irq, void *context) +static int sam_gpioainterrupt(int irq, void *context, FAR void *arg) { return sam_gpiointerrupt(SAM_PIOA_BASE, SAM_IRQ_PA0, context); } #endif #ifdef CONFIG_SAMV7_GPIOB_IRQ -static int sam_gpiobinterrupt(int irq, void *context) +static int sam_gpiobinterrupt(int irq, void *context, FAR void *arg) { return sam_gpiointerrupt(SAM_PIOB_BASE, SAM_IRQ_PB0, context); } #endif #ifdef CONFIG_SAMV7_GPIOC_IRQ -static int sam_gpiocinterrupt(int irq, void *context) +static int sam_gpiocinterrupt(int irq, void *context, FAR void *arg) { return sam_gpiointerrupt(SAM_PIOC_BASE, SAM_IRQ_PC0, context); } #endif #ifdef CONFIG_SAMV7_GPIOD_IRQ -static int sam_gpiodinterrupt(int irq, void *context) +static int sam_gpiodinterrupt(int irq, void *context, FAR void *arg) { return sam_gpiointerrupt(SAM_PIOD_BASE, SAM_IRQ_PD0, context); } #endif #ifdef CONFIG_SAMV7_GPIOE_IRQ -static int sam_gpioeinterrupt(int irq, void *context) +static int sam_gpioeinterrupt(int irq, void *context, FAR void *arg) { return sam_gpiointerrupt(SAM_PIOE_BASE, SAM_IRQ_PE0, context); } @@ -255,7 +255,7 @@ void sam_gpioirqinitialize(void) /* Attach and enable the GPIOA IRQ */ - (void)irq_attach(SAM_IRQ_PIOA, sam_gpioainterrupt); + (void)irq_attach(SAM_IRQ_PIOA, sam_gpioainterrupt, NULL); up_enable_irq(SAM_IRQ_PIOA); #endif @@ -273,7 +273,7 @@ void sam_gpioirqinitialize(void) /* Attach and enable the GPIOB IRQ */ - (void)irq_attach(SAM_IRQ_PIOB, sam_gpiobinterrupt); + (void)irq_attach(SAM_IRQ_PIOB, sam_gpiobinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOB); #endif @@ -291,7 +291,7 @@ void sam_gpioirqinitialize(void) /* Attach and enable the GPIOC IRQ */ - (void)irq_attach(SAM_IRQ_PIOC, sam_gpiocinterrupt); + (void)irq_attach(SAM_IRQ_PIOC, sam_gpiocinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOC); #endif @@ -309,7 +309,7 @@ void sam_gpioirqinitialize(void) /* Attach and enable the GPIOC IRQ */ - (void)irq_attach(SAM_IRQ_PIOD, sam_gpiodinterrupt); + (void)irq_attach(SAM_IRQ_PIOD, sam_gpiodinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOD); #endif @@ -327,7 +327,7 @@ void sam_gpioirqinitialize(void) /* Attach and enable the GPIOE IRQ */ - (void)irq_attach(SAM_IRQ_PIOE, sam_gpioeinterrupt); + (void)irq_attach(SAM_IRQ_PIOE, sam_gpioeinterrupt, NULL); up_enable_irq(SAM_IRQ_PIOE); #endif } diff --git a/arch/arm/src/samv7/sam_hsmci.c b/arch/arm/src/samv7/sam_hsmci.c index 3fe5a7dbff3..436b3b231d2 100644 --- a/arch/arm/src/samv7/sam_hsmci.c +++ b/arch/arm/src/samv7/sam_hsmci.c @@ -1951,7 +1951,7 @@ static int sam_attach(FAR struct sdio_dev_s *dev) /* Attach the HSMCI interrupt handler */ - ret = irq_attach(irq, handler); + ret = irq_attach(irq, handler, NULL); if (ret == OK) { diff --git a/arch/arm/src/samv7/sam_irq.c b/arch/arm/src/samv7/sam_irq.c index 08537f65970..f2e44893298 100644 --- a/arch/arm/src/samv7/sam_irq.c +++ b/arch/arm/src/samv7/sam_irq.c @@ -174,7 +174,7 @@ static void sam_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int sam_nmi(int irq, FAR void *context) +static int sam_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -182,7 +182,7 @@ static int sam_nmi(int irq, FAR void *context) return 0; } -static int sam_busfault(int irq, FAR void *context) +static int sam_busfault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Bus fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -190,7 +190,7 @@ static int sam_busfault(int irq, FAR void *context) return 0; } -static int sam_usagefault(int irq, FAR void *context) +static int sam_usagefault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Usage fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -198,7 +198,7 @@ static int sam_usagefault(int irq, FAR void *context) return 0; } -static int sam_pendsv(int irq, FAR void *context) +static int sam_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -206,7 +206,7 @@ static int sam_pendsv(int irq, FAR void *context) return 0; } -static int sam_dbgmonitor(int irq, FAR void *context) +static int sam_dbgmonitor(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Debug Monitor received\n"); @@ -214,7 +214,7 @@ static int sam_dbgmonitor(int irq, FAR void *context) return 0; } -static int sam_reserved(int irq, FAR void *context) +static int sam_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -435,8 +435,8 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(SAM_IRQ_SVCALL, up_svcall); - irq_attach(SAM_IRQ_HARDFAULT, up_hardfault); + irq_attach(SAM_IRQ_SVCALL, up_svcall, NULL); + irq_attach(SAM_IRQ_HARDFAULT, up_hardfault, NULL); /* Set the priority of the SVCall interrupt */ @@ -452,22 +452,22 @@ void up_irqinitialize(void) */ #ifdef CONFIG_ARM_MPU - irq_attach(SAM_IRQ_MEMFAULT, up_memfault); + irq_attach(SAM_IRQ_MEMFAULT, up_memfault, NULL); up_enable_irq(SAM_IRQ_MEMFAULT); #endif /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(SAM_IRQ_NMI, sam_nmi); + irq_attach(SAM_IRQ_NMI, sam_nmi, NULL); #ifndef CONFIG_ARM_MPU - irq_attach(SAM_IRQ_MEMFAULT, up_memfault); + irq_attach(SAM_IRQ_MEMFAULT, up_memfault, NULL); #endif - irq_attach(SAM_IRQ_BUSFAULT, sam_busfault); - irq_attach(SAM_IRQ_USAGEFAULT, sam_usagefault); - irq_attach(SAM_IRQ_PENDSV, sam_pendsv); - irq_attach(SAM_IRQ_DBGMONITOR, sam_dbgmonitor); - irq_attach(SAM_IRQ_RESERVED, sam_reserved); + irq_attach(SAM_IRQ_BUSFAULT, sam_busfault, NULL); + irq_attach(SAM_IRQ_USAGEFAULT, sam_usagefault, NULL); + irq_attach(SAM_IRQ_PENDSV, sam_pendsv, NULL); + irq_attach(SAM_IRQ_DBGMONITOR, sam_dbgmonitor, NULL); + irq_attach(SAM_IRQ_RESERVED, sam_reserved, NULL); #endif sam_dumpnvic("initial", SAM_IRQ_NIRQS); diff --git a/arch/arm/src/samv7/sam_mcan.c b/arch/arm/src/samv7/sam_mcan.c index 683463be9e6..be66ea55211 100644 --- a/arch/arm/src/samv7/sam_mcan.c +++ b/arch/arm/src/samv7/sam_mcan.c @@ -975,10 +975,10 @@ static void mcan_receive(FAR struct can_dev_s *dev, FAR uint32_t *rxbuffer, unsigned long nwords); static void mcan_interrupt(FAR struct can_dev_s *dev); #ifdef CONFIG_SAMV7_MCAN0 -static int mcan0_interrupt(int irq, void *context); +static int mcan0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_MCAN1 -static int mcan1_interrupt(int irq, void *context); +static int mcan1_interrupt(int irq, void *context, FAR void *arg); #endif /* Hardware initialization */ @@ -2340,7 +2340,7 @@ static int mcan_setup(FAR struct can_dev_s *dev) /* Attach the MCAN interrupt handlers */ - ret = irq_attach(config->irq0, config->handler); + ret = irq_attach(config->irq0, config->handler, NULL); if (ret < 0) { canerr("ERROR: Failed to attach MCAN%d line 0 IRQ (%d)", @@ -2348,7 +2348,7 @@ static int mcan_setup(FAR struct can_dev_s *dev) return ret; } - ret = irq_attach(config->irq1, config->handler); + ret = irq_attach(config->irq1, config->handler, NULL); if (ret < 0) { canerr("ERROR: Failed to attach MCAN%d line 1 IRQ (%d)", @@ -3691,7 +3691,7 @@ static void mcan_interrupt(FAR struct can_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_SAMV7_MCAN0 -static int mcan0_interrupt(int irq, void *context) +static int mcan0_interrupt(int irq, void *context, FAR void *arg) { mcan_interrupt(&g_mcan0dev); return OK; @@ -3714,7 +3714,7 @@ static int mcan0_interrupt(int irq, void *context) ****************************************************************************/ #ifdef CONFIG_SAMV7_MCAN1 -static int mcan1_interrupt(int irq, void *context) +static int mcan1_interrupt(int irq, void *context, FAR void *arg) { mcan_interrupt(&g_mcan1dev); return OK; diff --git a/arch/arm/src/samv7/sam_qspi.c b/arch/arm/src/samv7/sam_qspi.c index a37245c7e6e..3e51bee7515 100644 --- a/arch/arm/src/samv7/sam_qspi.c +++ b/arch/arm/src/samv7/sam_qspi.c @@ -270,7 +270,7 @@ static void qspi_memcpy(uint8_t *dest, const uint8_t *src, #ifdef QSPI_USE_INTERRUPTS static int qspi_interrupt(struct sam_qspidev_s *priv); #ifdef CONFIG_SAMV7_QSPI -static int qspi0_interrupt(int irq, void *context); +static int qspi0_interrupt(int irq, void *context, FAR void *arg); #endif #endif @@ -1811,7 +1811,7 @@ struct qspi_dev_s *sam_qspi_initialize(int intf) #ifdef QSPI_USE_INTERRUPTS /* Attach the interrupt handler */ - ret = irq_attach(priv->irq, priv->handler); + ret = irq_attach(priv->irq, priv->handler, NULL); if (ret < 0) { spierr("ERROR: Failed to attach irq %d\n", priv->irq); diff --git a/arch/arm/src/samv7/sam_rswdt.c b/arch/arm/src/samv7/sam_rswdt.c index 980ecd5b037..6d5add03a23 100644 --- a/arch/arm/src/samv7/sam_rswdt.c +++ b/arch/arm/src/samv7/sam_rswdt.c @@ -120,7 +120,7 @@ static void sam_putreg(uint32_t regval, uintptr_t regaddr); /* Interrupt hanlding *******************************************************/ #ifdef CONFIG_SAMV7_RSWDT_INTERRUPT -static int sam_interrupt(int irq, FAR void *context); +static int sam_interrupt(int irq, FAR void *context, FAR void *arg); #endif /* "Lower half" driver methods **********************************************/ @@ -260,7 +260,7 @@ static void sam_putreg(uint32_t regval, uintptr_t regaddr) ****************************************************************************/ #ifdef CONFIG_SAMV7_RSWDT_INTERRUPT -static int sam_interrupt(int irq, FAR void *context) +static int sam_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct sam_lowerhalf_s *priv = &g_wdtdev; @@ -684,7 +684,7 @@ int sam_rswdt_initialize(void) #ifdef CONFIG_SAMV7_RSWDT_INTERRUPT /* Attach our RSWDT interrupt handler (But don't enable it yet) */ - (void)irq_attach(SAM_IRQ_RSWDT, sam_interrupt); + (void)irq_attach(SAM_IRQ_RSWDT, sam_interrupt, NULL); #endif /* Register the watchdog driver as /dev/rswdt */ diff --git a/arch/arm/src/samv7/sam_serial.c b/arch/arm/src/samv7/sam_serial.c index 6744a72ce2e..47ca07e1b1a 100644 --- a/arch/arm/src/samv7/sam_serial.c +++ b/arch/arm/src/samv7/sam_serial.c @@ -355,28 +355,28 @@ static int sam_attach(struct uart_dev_s *dev); static void sam_detach(struct uart_dev_s *dev); static int sam_interrupt(struct uart_dev_s *dev); #ifdef CONFIG_SAMV7_UART0 -static int sam_uart0_interrupt(int irq, void *context); +static int sam_uart0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_UART1 -static int sam_uart1_interrupt(int irq, void *context); +static int sam_uart1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_UART2 -static int sam_uart2_interrupt(int irq, void *context); +static int sam_uart2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_UART3 -static int sam_uart3_interrupt(int irq, void *context); +static int sam_uart3_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_UART4 -static int sam_uart4_interrupt(int irq, void *context); +static int sam_uart4_interrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_SAMV7_USART0) && defined(CONFIG_USART0_SERIALDRIVER) -static int sam_usart0_interrupt(int irq, void *context); +static int sam_usart0_interrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_SAMV7_USART1) && defined(CONFIG_USART1_SERIALDRIVER) -static int sam_usart1_interrupt(int irq, void *context); +static int sam_usart1_interrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_SAMV7_USART2) && defined(CONFIG_USART2_SERIALDRIVER) -static int sam_usart2_interrupt(int irq, void *context); +static int sam_usart2_interrupt(int irq, void *context, FAR void *arg); #endif static int sam_ioctl(struct file *filep, int cmd, unsigned long arg); static int sam_receive(struct uart_dev_s *dev, uint32_t *status); @@ -973,7 +973,7 @@ static int sam_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler); + ret = irq_attach(priv->irq, priv->handler, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -1077,31 +1077,31 @@ static int sam_interrupt(struct uart_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_SAMV7_UART0 -static int sam_uart0_interrupt(int irq, void *context) +static int sam_uart0_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_uart0port); } #endif #ifdef CONFIG_SAMV7_UART1 -static int sam_uart1_interrupt(int irq, void *context) +static int sam_uart1_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_uart1port); } #endif #ifdef CONFIG_SAMV7_UART2 -static int sam_uart2_interrupt(int irq, void *context) +static int sam_uart2_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_uart2port); } #endif #ifdef CONFIG_SAMV7_UART3 -static int sam_uart3_interrupt(int irq, void *context) +static int sam_uart3_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_uart3port); } #endif #ifdef CONFIG_SAMV7_UART4 -static int sam_uart4_interrupt(int irq, void *context) +static int sam_uart4_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_uart4port); } @@ -1116,19 +1116,19 @@ static int sam_uart4_interrupt(int irq, void *context) ****************************************************************************/ #if defined(CONFIG_SAMV7_USART0) && defined(CONFIG_USART0_SERIALDRIVER) -static int sam_usart0_interrupt(int irq, void *context) +static int sam_usart0_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_usart0port); } #endif #if defined(CONFIG_SAMV7_USART1) && defined(CONFIG_USART1_SERIALDRIVER) -static int sam_usart1_interrupt(int irq, void *context) +static int sam_usart1_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_usart1port); } #endif #if defined(CONFIG_SAMV7_USART2) && defined(CONFIG_USART2_SERIALDRIVER) -static int sam_usart2_interrupt(int irq, void *context) +static int sam_usart2_interrupt(int irq, void *context, FAR void *arg) { return sam_interrupt(&g_usart2port); } diff --git a/arch/arm/src/samv7/sam_spi_slave.c b/arch/arm/src/samv7/sam_spi_slave.c index d2856cd2e99..55b226634e4 100644 --- a/arch/arm/src/samv7/sam_spi_slave.c +++ b/arch/arm/src/samv7/sam_spi_slave.c @@ -148,10 +148,10 @@ static void spi_semtake(struct sam_spidev_s *priv); static int spi_interrupt(struct sam_spidev_s *priv); #ifdef CONFIG_SAMV7_SPI0_SLAVE -static int spi0_interrupt(int irq, void *context); +static int spi0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_SPI1_SLAVE -static int spi1_interrupt(int irq, void *context); +static int spi1_interrupt(int irq, void *context, FAR void *arg); #endif /* SPI Helpers */ @@ -568,7 +568,7 @@ static int spi_interrupt(struct sam_spidev_s *priv) ****************************************************************************/ #ifdef CONFIG_SAMV7_SPI0_SLAVE -static int spi0_interrupt(int irq, void *context) +static int spi0_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spi0_sctrlr); } @@ -589,7 +589,7 @@ static int spi0_interrupt(int irq, void *context) ****************************************************************************/ #ifdef CONFIG_SAMV7_SPI1_SLAVE -static int spi1_interrupt(int irq, void *context) +static int spi1_interrupt(int irq, void *context, FAR void *arg) { return spi_interrupt(&g_spi1_sctrlr); } @@ -1255,7 +1255,7 @@ struct spi_sctrlr_s *sam_spi_slave_initialize(int port) /* Attach and enable interrupts at the NVIC */ - DEBUGVERIFY(irq_attach(priv->irq, priv->handler)); + DEBUGVERIFY(irq_attach(priv->irq, priv->handler, NULL)); up_enable_irq(priv->irq); spi_dumpregs(priv, "After initialization"); diff --git a/arch/arm/src/samv7/sam_tc.c b/arch/arm/src/samv7/sam_tc.c index 691366af8f8..4b9303fd534 100644 --- a/arch/arm/src/samv7/sam_tc.c +++ b/arch/arm/src/samv7/sam_tc.c @@ -186,27 +186,27 @@ static inline void sam_chan_putreg(struct sam_chan_s *chan, static int sam_tc_interrupt(struct sam_tc_s *tc, struct sam_chan_s *chan); #ifdef CONFIG_SAMV7_TC0 -static int sam_tc0_interrupt(int irq, void *context); -static int sam_tc1_interrupt(int irq, void *context); -static int sam_tc2_interrupt(int irq, void *context); +static int sam_tc0_interrupt(int irq, void *context, FAR void *arg); +static int sam_tc1_interrupt(int irq, void *context, FAR void *arg); +static int sam_tc2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_TC1 -static int sam_tc3_interrupt(int irq, void *context); -static int sam_tc4_interrupt(int irq, void *context); -static int sam_tc5_interrupt(int irq, void *context); +static int sam_tc3_interrupt(int irq, void *context, FAR void *arg); +static int sam_tc4_interrupt(int irq, void *context, FAR void *arg); +static int sam_tc5_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_TC2 -static int sam_tc6_interrupt(int irq, void *context); -static int sam_tc7_interrupt(int irq, void *context); -static int sam_tc8_interrupt(int irq, void *context); +static int sam_tc6_interrupt(int irq, void *context, FAR void *arg); +static int sam_tc7_interrupt(int irq, void *context, FAR void *arg); +static int sam_tc8_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_TC3 -static int sam_tc9_interrupt(int irq, void *context); -static int sam_tc10_interrupt(int irq, void *context); -static int sam_tc11_interrupt(int irq, void *context); +static int sam_tc9_interrupt(int irq, void *context, FAR void *arg); +static int sam_tc10_interrupt(int irq, void *context, FAR void *arg); +static int sam_tc11_interrupt(int irq, void *context, FAR void *arg); #endif /* Initialization ***********************************************************/ @@ -893,68 +893,68 @@ static int sam_tc_interrupt(struct sam_tc_s *tc, struct sam_chan_s *chan) ****************************************************************************/ #ifdef CONFIG_SAMV7_TC0 -static int sam_tc0_interrupt(int irq, void *context) +static int sam_tc0_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc012, &g_tc012.channel[0]); } -static int sam_tc1_interrupt(int irq, void *context) +static int sam_tc1_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc012, &g_tc012.channel[1]); } -static int sam_tc2_interrupt(int irq, void *context) +static int sam_tc2_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc012, &g_tc012.channel[2]); } #endif #ifdef CONFIG_SAMV7_TC1 -static int sam_tc3_interrupt(int irq, void *context) +static int sam_tc3_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc345, &g_tc345.channel[0]); } -static int sam_tc4_interrupt(int irq, void *context) +static int sam_tc4_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc345, &g_tc345.channel[1]); } -static int sam_tc5_interrupt(int irq, void *context) +static int sam_tc5_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc345, &g_tc345.channel[2]); } #endif #ifdef CONFIG_SAMV7_TC2 -static int sam_tc6_interrupt(int irq, void *context) +static int sam_tc6_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc678, &g_tc678.channel[0]); } -static int sam_tc7_interrupt(int irq, void *context) +static int sam_tc7_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc678, &g_tc678.channel[1]); } -static int sam_tc8_interrupt(int irq, void *context) +static int sam_tc8_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc678, &g_tc678.channel[2]); } #endif #ifdef CONFIG_SAMV7_TC3 -static int sam_tc9_interrupt(int irq, void *context) +static int sam_tc9_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc901, &g_tc901.channel[0]); } -static int sam_tc10_interrupt(int irq, void *context) +static int sam_tc10_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc901, &g_tc901.channel[1]); } -static int sam_tc11_interrupt(int irq, void *context) +static int sam_tc11_interrupt(int irq, void *context, FAR void *arg) { return sam_tc_interrupt(&g_tc901, &g_tc901.channel[2]); } @@ -1279,7 +1279,7 @@ static inline struct sam_chan_s *sam_tc_initialize(int channel) /* Attach the timer interrupt handler and enable the timer interrupts */ - (void)irq_attach(chconfig->irq, chconfig->handler); + (void)irq_attach(chconfig->irq, chconfig->handler, NULL); up_enable_irq(chconfig->irq); /* Mark the channel "inuse" */ diff --git a/arch/arm/src/samv7/sam_timerisr.c b/arch/arm/src/samv7/sam_timerisr.c index c2c30ea0afe..751878d9843 100644 --- a/arch/arm/src/samv7/sam_timerisr.c +++ b/arch/arm/src/samv7/sam_timerisr.c @@ -98,7 +98,7 @@ * ****************************************************************************/ -static int sam_timerisr(int irq, uint32_t *regs) +static int sam_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -130,7 +130,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(SAM_IRQ_SYSTICK, (xcpt_t)sam_timerisr); + (void)irq_attach(SAM_IRQ_SYSTICK, (xcpt_t)sam_timerisr, NULL); /* Enable SysTick interrupts (no divide-by-8) */ diff --git a/arch/arm/src/samv7/sam_trng.c b/arch/arm/src/samv7/sam_trng.c index 6fee91e850c..e8eae34f997 100644 --- a/arch/arm/src/samv7/sam_trng.c +++ b/arch/arm/src/samv7/sam_trng.c @@ -72,7 +72,7 @@ /* Interrupts */ -static int sam_interrupt(int irq, void *context); +static int sam_interrupt(int irq, void *context, FAR void *arg); /* Character driver methods */ @@ -128,7 +128,7 @@ static const struct file_operations g_trngops = * ****************************************************************************/ -static int sam_interrupt(int irq, void *context) +static int sam_interrupt(int irq, void *context, FAR void *arg) { uint32_t odata; @@ -372,7 +372,7 @@ static int sam_rng_initialize(void) /* Initialize the TRNG interrupt */ - ret = irq_attach(SAM_IRQ_TRNG, sam_interrupt); + ret = irq_attach(SAM_IRQ_TRNG, sam_interrupt, NULL); if (ret < 0) { ferr("ERROR: Failed to attach to IRQ%d\n", SAM_IRQ_TRNG); diff --git a/arch/arm/src/samv7/sam_twihs.c b/arch/arm/src/samv7/sam_twihs.c index bdb5523ace6..a26e43de3f2 100644 --- a/arch/arm/src/samv7/sam_twihs.c +++ b/arch/arm/src/samv7/sam_twihs.c @@ -203,13 +203,13 @@ static int twi_wait(struct twi_dev_s *priv, unsigned int size); static void twi_wakeup(struct twi_dev_s *priv, int result); static int twi_interrupt(struct twi_dev_s *priv); #ifdef CONFIG_SAMV7_TWIHS0 -static int twi0_interrupt(int irq, FAR void *context); +static int twi0_interrupt(int irq, FAR void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_TWIHS1 -static int twi1_interrupt(int irq, FAR void *context); +static int twi1_interrupt(int irq, FAR void *context, FAR void *arg); #endif #ifdef CONFIG_SAMV7_TWIHS2 -static int twi2_interrupt(int irq, FAR void *context); +static int twi2_interrupt(int irq, FAR void *context, FAR void *arg); #endif static void twi_timeout(int argc, uint32_t arg, ...); @@ -762,21 +762,21 @@ static int twi_interrupt(struct twi_dev_s *priv) } #ifdef CONFIG_SAMV7_TWIHS0 -static int twi0_interrupt(int irq, FAR void *context) +static int twi0_interrupt(int irq, FAR void *context, FAR void *arg) { return twi_interrupt(&g_twi0); } #endif #ifdef CONFIG_SAMV7_TWIHS1 -static int twi1_interrupt(int irq, FAR void *context) +static int twi1_interrupt(int irq, FAR void *context, FAR void *arg) { return twi_interrupt(&g_twi1); } #endif #ifdef CONFIG_SAMV7_TWIHS2 -static int twi2_interrupt(int irq, FAR void *context) +static int twi2_interrupt(int irq, FAR void *context, FAR void *arg) { return twi_interrupt(&g_twi2); } @@ -1444,7 +1444,7 @@ struct i2c_master_s *sam_i2cbus_initialize(int bus) /* Attach Interrupt Handler */ - ret = irq_attach(priv->attr->irq, priv->attr->handler); + ret = irq_attach(priv->attr->irq, priv->attr->handler, NULL); if (ret < 0) { ierr("ERROR: Failed to attach irq %d\n", priv->attr->irq); diff --git a/arch/arm/src/samv7/sam_usbdevhs.c b/arch/arm/src/samv7/sam_usbdevhs.c index 1d48ca410a1..4adfa117c11 100644 --- a/arch/arm/src/samv7/sam_usbdevhs.c +++ b/arch/arm/src/samv7/sam_usbdevhs.c @@ -517,7 +517,7 @@ static void sam_ep0_setup(struct sam_usbdev_s *priv); static void sam_dma_interrupt(struct sam_usbdev_s *priv, int epno); #endif static void sam_ep_interrupt(struct sam_usbdev_s *priv, int epno); -static int sam_usbhs_interrupt(int irq, void *context); +static int sam_usbhs_interrupt(int irq, void *context, FAR void *arg); /* Endpoint helpers *********************************************************/ @@ -2992,7 +2992,7 @@ static void sam_ep_interrupt(struct sam_usbdev_s *priv, int epno) * ****************************************************************************/ -static int sam_usbhs_interrupt(int irq, void *context) +static int sam_usbhs_interrupt(int irq, void *context, FAR void *arg) { /* For now there is only one USB controller, but we will always refer to * it using a pointer to make any future ports to multiple USBHS controllers @@ -4862,7 +4862,7 @@ void up_usbinitialize(void) * them when we need them later. */ - if (irq_attach(SAM_IRQ_USBHS, sam_usbhs_interrupt) != 0) + if (irq_attach(SAM_IRQ_USBHS, sam_usbhs_interrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(SAM_TRACEERR_IRQREGISTRATION), (uint16_t)SAM_IRQ_USBHS); diff --git a/arch/arm/src/samv7/sam_wdt.c b/arch/arm/src/samv7/sam_wdt.c index 850fd2288c3..e662146077e 100644 --- a/arch/arm/src/samv7/sam_wdt.c +++ b/arch/arm/src/samv7/sam_wdt.c @@ -120,7 +120,7 @@ static void sam_putreg(uint32_t regval, uintptr_t regaddr); /* Interrupt hanlding *******************************************************/ #ifdef CONFIG_SAMV7_WDT_INTERRUPT -static int sam_interrupt(int irq, FAR void *context); +static int sam_interrupt(int irq, FAR void *context, FAR void *arg); #endif /* "Lower half" driver methods **********************************************/ @@ -260,7 +260,7 @@ static void sam_putreg(uint32_t regval, uintptr_t regaddr) ****************************************************************************/ #ifdef CONFIG_SAMV7_WDT_INTERRUPT -static int sam_interrupt(int irq, FAR void *context) +static int sam_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct sam_lowerhalf_s *priv = &g_wdtdev; @@ -684,7 +684,7 @@ int sam_wdt_initialize(void) #ifdef CONFIG_SAMV7_WDT_INTERRUPT /* Attach our WDT interrupt handler (But don't enable it yet) */ - (void)irq_attach(SAM_IRQ_WDT, sam_interrupt); + (void)irq_attach(SAM_IRQ_WDT, sam_interrupt, NULL); #endif /* Register the watchdog driver as device-node configured via .config. diff --git a/arch/arm/src/samv7/sam_xdmac.c b/arch/arm/src/samv7/sam_xdmac.c index 206ecb5d0f1..b47617cafec 100644 --- a/arch/arm/src/samv7/sam_xdmac.c +++ b/arch/arm/src/samv7/sam_xdmac.c @@ -1506,7 +1506,7 @@ static void sam_dmaterminate(struct sam_xdmach_s *xdmach, int result) * ****************************************************************************/ -static int sam_xdmac_interrupt(int irq, void *context) +static int sam_xdmac_interrupt(int irq, void *context, FAR void *arg) { struct sam_xdmac_s *xdmac = &g_xdmac; struct sam_xdmach_s *xdmach; @@ -1624,7 +1624,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(SAM_IRQ_XDMAC, sam_xdmac_interrupt); + (void)irq_attach(SAM_IRQ_XDMAC, sam_xdmac_interrupt, NULL); /* Initialize the controller */ diff --git a/arch/arm/src/stm32/stm32_1wire.c b/arch/arm/src/stm32/stm32_1wire.c index 952f2777ec7..a6bf2388398 100644 --- a/arch/arm/src/stm32/stm32_1wire.c +++ b/arch/arm/src/stm32/stm32_1wire.c @@ -117,7 +117,7 @@ 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); /* Interrupt handler */ + int (*const vector)(int irq, void *context, void *arg); /* Interrupt handler */ }; /* 1-Wire device Private Data */ @@ -164,28 +164,28 @@ static int stm32_1wire_process(struct stm32_1wire_priv_s *priv, 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); +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); +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); +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); +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); +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); +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); +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); +static int stm32_interrupt_1wire8(int irq, void *context, FAR void *arg); #endif static int stm32_1wire_reset(FAR struct onewire_dev_s *dev); @@ -679,7 +679,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); + ret = irq_attach(config->irq, config->vector, NULL); if (ret == OK) { up_enable_irq(config->irq); @@ -1042,49 +1042,49 @@ 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) +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) +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) +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) +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) +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) +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) +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) +static int stm32_interrupt_1wire8(int irq, void *context, FAR void *arg) { return stm32_1wire_isr(&stm32_1wire8_priv); } diff --git a/arch/arm/src/stm32/stm32_adc.c b/arch/arm/src/stm32/stm32_adc.c index b807b6bb103..818d8165366 100644 --- a/arch/arm/src/stm32/stm32_adc.c +++ b/arch/arm/src/stm32/stm32_adc.c @@ -364,20 +364,20 @@ static void adc_rccreset(FAR struct stm32_dev_s *priv, bool reset); static int adc_interrupt(FAR struct adc_dev_s *dev); #if defined(STM32_IRQ_ADC1) && defined(CONFIG_STM32_ADC1) -static int adc1_interrupt(int irq, FAR void *context); +static int adc1_interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(STM32_IRQ_ADC12) && (defined(CONFIG_STM32_ADC1) || \ defined(CONFIG_STM32_ADC2)) -static int adc12_interrupt(int irq, FAR void *context); +static int adc12_interrupt(int irq, FAR void *context, FAR void * arg); #endif #if (defined(STM32_IRQ_ADC3) && defined(CONFIG_STM32_ADC3)) -static int adc3_interrupt(int irq, FAR void *context); +static int adc3_interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(STM32_IRQ_ADC4) && defined(CONFIG_STM32_ADC4) -static int adc4_interrupt(int irq, FAR void *context); +static int adc4_interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(STM32_IRQ_ADC) -static int adc123_interrupt(int irq, FAR void *context); +static int adc123_interrupt(int irq, FAR void *context, FAR void * arg); #endif /* ADC Driver Methods */ @@ -2137,7 +2137,7 @@ static int adc_setup(FAR struct adc_dev_s *dev) /* Attach the ADC interrupt */ - ret = irq_attach(priv->irq, priv->isr); + ret = irq_attach(priv->irq, priv->isr, NULL); if (ret < 0) { ainfo("irq_attach failed: %d\n", ret); @@ -2832,7 +2832,7 @@ static int adc_interrupt(FAR struct adc_dev_s *dev) ****************************************************************************/ #if defined(STM32_IRQ_ADC1) -static int adc1_interrupt(int irq, FAR void *context) +static int adc1_interrupt(int irq, FAR void *context, FAR void * arg) { adc_interrupt(&g_adcdev1); @@ -2854,7 +2854,7 @@ static int adc1_interrupt(int irq, FAR void *context) #if defined(STM32_IRQ_ADC12) && \ (defined(CONFIG_STM32_ADC1) || defined(CONFIG_STM32_ADC2)) -static int adc12_interrupt(int irq, FAR void *context) +static int adc12_interrupt(int irq, FAR void *context, FAR void * arg) { #ifdef CONFIG_STM32_ADC1 adc_interrupt(&g_adcdev1); @@ -2881,7 +2881,7 @@ static int adc12_interrupt(int irq, FAR void *context) ****************************************************************************/ #if defined(STM32_IRQ_ADC3) && defined(CONFIG_STM32_ADC3) -static int adc3_interrupt(int irq, FAR void *context) +static int adc3_interrupt(int irq, FAR void *context, FAR void * arg) { adc_interrupt(&g_adcdev3); @@ -2902,7 +2902,7 @@ static int adc3_interrupt(int irq, FAR void *context) ****************************************************************************/ #if defined(STM32_IRQ_ADC4) && defined(CONFIG_STM32_ADC4) -static int adc4_interrupt(int irq, FAR void *context) +static int adc4_interrupt(int irq, FAR void *context, FAR void * arg) { adc_interrupt(&g_adcdev4); return OK; @@ -2922,7 +2922,7 @@ static int adc4_interrupt(int irq, FAR void *context) ****************************************************************************/ #if defined(STM32_IRQ_ADC) -static int adc123_interrupt(int irq, FAR void *context) +static int adc123_interrupt(int irq, FAR void *context, FAR void * arg) { #ifdef CONFIG_STM32_ADC1 adc_interrupt(&g_adcdev1); diff --git a/arch/arm/src/stm32/stm32_can.c b/arch/arm/src/stm32/stm32_can.c index ed973d57bd0..52783e62171 100644 --- a/arch/arm/src/stm32/stm32_can.c +++ b/arch/arm/src/stm32/stm32_can.c @@ -160,9 +160,9 @@ static bool stm32can_txempty(FAR struct can_dev_s *dev); /* CAN interrupt handling */ static int stm32can_rxinterrupt(int irq, FAR void *context, int rxmb); -static int stm32can_rx0interrupt(int irq, FAR void *context); -static int stm32can_rx1interrupt(int irq, FAR void *context); -static int stm32can_txinterrupt(int irq, FAR void *context); +static int stm32can_rx0interrupt(int irq, FAR void *context, FAR void *arg); +static int stm32can_rx1interrupt(int irq, FAR void *context, FAR void *arg); +static int stm32can_txinterrupt(int irq, FAR void *context, FAR void *arg); /* Initialization */ @@ -654,7 +654,7 @@ static int stm32can_setup(FAR struct can_dev_s *dev) * The others are not used. */ - ret = irq_attach(priv->canrx[0], stm32can_rx0interrupt); + ret = irq_attach(priv->canrx[0], stm32can_rx0interrupt, NULL); if (ret < 0) { canerr("ERROR: Failed to attach CAN%d RX0 IRQ (%d)", @@ -662,7 +662,7 @@ static int stm32can_setup(FAR struct can_dev_s *dev) return ret; } - ret = irq_attach(priv->canrx[1], stm32can_rx1interrupt); + ret = irq_attach(priv->canrx[1], stm32can_rx1interrupt, NULL); if (ret < 0) { canerr("ERROR: Failed to attach CAN%d RX1 IRQ (%d)", @@ -670,7 +670,7 @@ static int stm32can_setup(FAR struct can_dev_s *dev) return ret; } - ret = irq_attach(priv->cantx, stm32can_txinterrupt); + ret = irq_attach(priv->cantx, stm32can_txinterrupt, NULL); if (ret < 0) { canerr("ERROR: Failed to attach CAN%d TX IRQ (%d)", @@ -1506,7 +1506,7 @@ errout: * ****************************************************************************/ -static int stm32can_rx0interrupt(int irq, FAR void *context) +static int stm32can_rx0interrupt(int irq, FAR void *context, FAR void *arg) { return stm32can_rxinterrupt(irq, context, 0); } @@ -1526,7 +1526,7 @@ static int stm32can_rx0interrupt(int irq, FAR void *context) * ****************************************************************************/ -static int stm32can_rx1interrupt(int irq, FAR void *context) +static int stm32can_rx1interrupt(int irq, FAR void *context, FAR void *arg) { return stm32can_rxinterrupt(irq, context, 1); } @@ -1546,7 +1546,7 @@ static int stm32can_rx1interrupt(int irq, FAR void *context) * ****************************************************************************/ -static int stm32can_txinterrupt(int irq, FAR void *context) +static int stm32can_txinterrupt(int irq, FAR void *context, FAR void *arg) { FAR struct can_dev_s *dev = NULL; FAR struct stm32_can_s *priv; diff --git a/arch/arm/src/stm32/stm32_capture.c b/arch/arm/src/stm32/stm32_capture.c index 3d43f871195..ac1cb69573c 100644 --- a/arch/arm/src/stm32/stm32_capture.c +++ b/arch/arm/src/stm32/stm32_capture.c @@ -736,13 +736,13 @@ static int stm32_cap_setisr(FAR struct stm32_cap_dev_s *dev, xcpt_t handler) /* Otherwise set callback and enable interrupt */ - irq_attach(irq, handler); + irq_attach(irq, handler, NULL); up_enable_irq(irq); #ifdef USE_ADVENCED_TIM if (priv->irq_of) { - irq_attach(priv->irq_of, handler); + irq_attach(priv->irq_of, handler, NULL); up_enable_irq(priv->irq_of); } #endif diff --git a/arch/arm/src/stm32/stm32_dac.c b/arch/arm/src/stm32/stm32_dac.c index 9d17736136e..e12c9f65c5f 100644 --- a/arch/arm/src/stm32/stm32_dac.c +++ b/arch/arm/src/stm32/stm32_dac.c @@ -382,7 +382,7 @@ static void tim_putreg(FAR struct stm32_chan_s *chan, int offset, /* Interrupt handler */ #if defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX) -static int dac_interrupt(int irq, FAR void *context); +static int dac_interrupt(int irq, FAR void *context, FAR void *arg); #endif /* DAC methods */ @@ -621,7 +621,7 @@ static void tim_modifyreg(FAR struct stm32_chan_s *chan, int offset, ****************************************************************************/ #if defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX) -static int dac_interrupt(int irq, FAR void *context) +static int dac_interrupt(int irq, FAR void *context, FAR void *arg) { #warning "Missing logic" return OK; diff --git a/arch/arm/src/stm32/stm32_dma2d.c b/arch/arm/src/stm32/stm32_dma2d.c index c4ef73fc2be..8611ab2c1a3 100644 --- a/arch/arm/src/stm32/stm32_dma2d.c +++ b/arch/arm/src/stm32/stm32_dma2d.c @@ -285,7 +285,7 @@ static const uintptr_t stm32_cmar_layer_t[DMA2D_NLAYERS - 1] = static int stm32_dma2d_pixelformat(uint8_t fmt, uint8_t *fmtmap); static int stm32_dma2d_bpp(uint8_t fmt, uint8_t *bpp); static void stm32_dma2d_control(uint32_t setbits, uint32_t clrbits); -static int stm32_dma2dirq(int irq, void *context); +static int stm32_dma2dirq(int irq, void *context, FAR void *arg); static int stm32_dma2d_waitforirq(void); static int stm32_dma2d_start(void); #ifdef CONFIG_STM32_DMA2D_L8 @@ -425,7 +425,7 @@ static void stm32_dma2d_control(uint32_t setbits, uint32_t clrbits) * ****************************************************************************/ -static int stm32_dma2dirq(int irq, void *context) +static int stm32_dma2dirq(int irq, void *context, FAR void *arg) { uint32_t regval = getreg32(STM32_DMA2D_ISR); FAR struct stm32_interrupt_s *priv = &g_interrupt; @@ -2190,7 +2190,7 @@ int up_dma2dinitialize(void) /* Attach DMA2D interrupt vector */ - (void)irq_attach(g_interrupt.irq, stm32_dma2dirq); + (void)irq_attach(g_interrupt.irq, stm32_dma2dirq, NULL); /* Enable the IRQ at the NVIC */ diff --git a/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c index adfc4412c35..ac19abc52d4 100644 --- a/arch/arm/src/stm32/stm32_eth.c +++ b/arch/arm/src/stm32/stm32_eth.c @@ -658,7 +658,7 @@ static void stm32_freeframe(FAR struct stm32_ethmac_s *priv); static void stm32_txdone(FAR struct stm32_ethmac_s *priv); static void stm32_interrupt_work(FAR void *arg); -static int stm32_interrupt(int irq, FAR void *context); +static int stm32_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -2088,7 +2088,7 @@ static void stm32_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int stm32_interrupt(int irq, FAR void *context) +static int stm32_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct stm32_ethmac_s *priv = &g_stm32ethmac[0]; uint32_t dmasr; @@ -4023,7 +4023,7 @@ int stm32_ethinitialize(int intf) /* Attach the IRQ to the driver */ - if (irq_attach(STM32_IRQ_ETH, stm32_interrupt)) + if (irq_attach(STM32_IRQ_ETH, stm32_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ diff --git a/arch/arm/src/stm32/stm32_exti_alarm.c b/arch/arm/src/stm32/stm32_exti_alarm.c index 2e6d582a4aa..ba60faabe4a 100644 --- a/arch/arm/src/stm32/stm32_exti_alarm.c +++ b/arch/arm/src/stm32/stm32_exti_alarm.c @@ -73,7 +73,7 @@ static xcpt_t stm32_exti_callback; * ****************************************************************************/ -static int stm32_exti_alarm_isr(int irq, void *context) +static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -127,7 +127,7 @@ xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, if (func) { - irq_attach(STM32_IRQ_RTCALRM, stm32_exti_alarm_isr); + irq_attach(STM32_IRQ_RTCALRM, stm32_exti_alarm_isr, NULL); up_enable_irq(STM32_IRQ_RTCALRM); } else diff --git a/arch/arm/src/stm32/stm32_exti_gpio.c b/arch/arm/src/stm32/stm32_exti_gpio.c index 6aa2cf4be2b..dbf0691597f 100644 --- a/arch/arm/src/stm32/stm32_exti_gpio.c +++ b/arch/arm/src/stm32/stm32_exti_gpio.c @@ -71,7 +71,7 @@ static xcpt_t stm32_exti_callbacks[16]; * Interrupt Service Routines - Dispatchers ****************************************************************************/ -static int stm32_exti0_isr(int irq, void *context) +static int stm32_exti0_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -83,13 +83,13 @@ static int stm32_exti0_isr(int irq, void *context) if (stm32_exti_callbacks[0]) { - ret = stm32_exti_callbacks[0](irq, context); + ret = stm32_exti_callbacks[0](irq, context, arg); } return ret; } -static int stm32_exti1_isr(int irq, void *context) +static int stm32_exti1_isr(int irq, void *context, void *arg) { int ret = OK; @@ -101,13 +101,13 @@ static int stm32_exti1_isr(int irq, void *context) if (stm32_exti_callbacks[1]) { - ret = stm32_exti_callbacks[1](irq, context); + ret = stm32_exti_callbacks[1](irq, context, arg); } return ret; } -static int stm32_exti2_isr(int irq, void *context) +static int stm32_exti2_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -119,13 +119,13 @@ static int stm32_exti2_isr(int irq, void *context) if (stm32_exti_callbacks[2]) { - ret = stm32_exti_callbacks[2](irq, context); + ret = stm32_exti_callbacks[2](irq, context, arg); } return ret; } -static int stm32_exti3_isr(int irq, void *context) +static int stm32_exti3_isr(int irq, void *context, void * arg) { int ret = OK; @@ -137,13 +137,13 @@ static int stm32_exti3_isr(int irq, void *context) if (stm32_exti_callbacks[3]) { - ret = stm32_exti_callbacks[3](irq, context); + ret = stm32_exti_callbacks[3](irq, context, arg); } return ret; } -static int stm32_exti4_isr(int irq, void *context) +static int stm32_exti4_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -155,13 +155,13 @@ static int stm32_exti4_isr(int irq, void *context) if (stm32_exti_callbacks[4]) { - ret = stm32_exti_callbacks[4](irq, context); + ret = stm32_exti_callbacks[4](irq, context, arg); } return ret; } -static int stm32_exti_multiisr(int irq, void *context, int first, int last) +static int stm32_exti_multiisr(int irq, void *context, FAR void *arg, int first, int last) { uint32_t pr; int pin; @@ -188,7 +188,7 @@ static int stm32_exti_multiisr(int irq, void *context, int first, int last) if (stm32_exti_callbacks[pin]) { - int tmp = stm32_exti_callbacks[pin](irq, context); + int tmp = stm32_exti_callbacks[pin](irq, context, arg); if (tmp != OK) { ret = tmp; @@ -200,14 +200,14 @@ static int stm32_exti_multiisr(int irq, void *context, int first, int last) return ret; } -static int stm32_exti95_isr(int irq, void *context) +static int stm32_exti95_isr(int irq, void *context, FAR void *arg) { - return stm32_exti_multiisr(irq, context, 5, 9); + return stm32_exti_multiisr(irq, context, arg, 5, 9); } -static int stm32_exti1510_isr(int irq, void *context) +static int stm32_exti1510_isr(int irq, void *context, void *arg) { - return stm32_exti_multiisr(irq, context, 10, 15); + return stm32_exti_multiisr(irq, context, arg, 10, 15); } /**************************************************************************** @@ -300,7 +300,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, if (func) { - irq_attach(irq, handler); + irq_attach(irq, handler, NULL); up_enable_irq(irq); } else diff --git a/arch/arm/src/stm32/stm32_exti_pwr.c b/arch/arm/src/stm32/stm32_exti_pwr.c index f57e85e6ca9..8da33e2c43c 100644 --- a/arch/arm/src/stm32/stm32_exti_pwr.c +++ b/arch/arm/src/stm32/stm32_exti_pwr.c @@ -83,7 +83,7 @@ static xcpt_t stm32_exti_pvd_callback; * ****************************************************************************/ -static int stm32_exti_pvd_isr(int irq, void *context) +static int stm32_exti_pvd_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -95,7 +95,7 @@ static int stm32_exti_pvd_isr(int irq, void *context) if (stm32_exti_pvd_callback) { - ret = stm32_exti_pvd_callback(irq, context); + ret = stm32_exti_pvd_callback(irq, context, arg); } return ret; @@ -137,7 +137,7 @@ xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, if (func) { - irq_attach(STM32_IRQ_PVD, stm32_exti_pvd_isr); + irq_attach(STM32_IRQ_PVD, stm32_exti_pvd_isr, NULL); up_enable_irq(STM32_IRQ_PVD); } else diff --git a/arch/arm/src/stm32/stm32_i2c.c b/arch/arm/src/stm32/stm32_i2c.c index 631ba665016..f4c97eca506 100644 --- a/arch/arm/src/stm32/stm32_i2c.c +++ b/arch/arm/src/stm32/stm32_i2c.c @@ -230,7 +230,7 @@ struct stm32_i2c_config_s uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ #ifndef CONFIG_I2C_POLLED - int (*isr)(int, void *); /* Interrupt handler */ + int (*isr)(int, void *, void *); /* Interrupt handler */ uint32_t ev_irq; /* Event IRQ */ uint32_t er_irq; /* Error IRQ */ #endif @@ -317,13 +317,13 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s * priv); #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_STM32_I2C1 -static int stm32_i2c1_isr(int irq, void *context); +static int stm32_i2c1_isr(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_STM32_I2C2 -static int stm32_i2c2_isr(int irq, void *context); +static int stm32_i2c2_isr(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_STM32_I2C3 -static int stm32_i2c3_isr(int irq, void *context); +static int stm32_i2c3_isr(int irq, void *context, FAR void *arg); #endif #endif /* !CONFIG_I2C_POLLED */ @@ -1468,7 +1468,7 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_STM32_I2C1 -static int stm32_i2c1_isr(int irq, void *context) +static int stm32_i2c1_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c1_priv); } @@ -1483,7 +1483,7 @@ static int stm32_i2c1_isr(int irq, void *context) ************************************************************************************/ #ifdef CONFIG_STM32_I2C2 -static int stm32_i2c2_isr(int irq, void *context) +static int stm32_i2c2_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c2_priv); } @@ -1498,7 +1498,7 @@ static int stm32_i2c2_isr(int irq, void *context) ************************************************************************************/ #ifdef CONFIG_STM32_I2C3 -static int stm32_i2c3_isr(int irq, void *context) +static int stm32_i2c3_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c3_priv); } @@ -1543,8 +1543,8 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv) /* Attach ISRs */ #ifndef CONFIG_I2C_POLLED - irq_attach(priv->config->ev_irq, priv->config->isr); - irq_attach(priv->config->er_irq, priv->config->isr); + irq_attach(priv->config->ev_irq, priv->config->isr, NULL); + irq_attach(priv->config->er_irq, priv->config->isr, NULL); up_enable_irq(priv->config->ev_irq); up_enable_irq(priv->config->er_irq); #endif diff --git a/arch/arm/src/stm32/stm32_i2c_alt.c b/arch/arm/src/stm32/stm32_i2c_alt.c index 545a6473347..f9a2905f0e1 100644 --- a/arch/arm/src/stm32/stm32_i2c_alt.c +++ b/arch/arm/src/stm32/stm32_i2c_alt.c @@ -257,7 +257,7 @@ struct stm32_i2c_config_s uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ #ifndef CONFIG_I2C_POLLED - int (*isr)(int, void *); /* Interrupt handler */ + int (*isr)(int, void *, void *); /* Interrupt handler */ uint32_t ev_irq; /* Event IRQ */ uint32_t er_irq; /* Error IRQ */ #endif @@ -346,13 +346,13 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s * priv); #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_STM32_I2C1 -static int stm32_i2c1_isr(int irq, void *context); +static int stm32_i2c1_isr(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_STM32_I2C2 -static int stm32_i2c2_isr(int irq, void *context); +static int stm32_i2c2_isr(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_STM32_I2C3 -static int stm32_i2c3_isr(int irq, void *context); +static int stm32_i2c3_isr(int irq, void *context, FAR void *arg); #endif #endif /* !CONFIG_I2C_POLLED */ @@ -1899,7 +1899,7 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_STM32_I2C1 -static int stm32_i2c1_isr(int irq, void *context) +static int stm32_i2c1_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c1_priv); } @@ -1914,7 +1914,7 @@ static int stm32_i2c1_isr(int irq, void *context) ************************************************************************************/ #ifdef CONFIG_STM32_I2C2 -static int stm32_i2c2_isr(int irq, void *context) +static int stm32_i2c2_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c2_priv); } @@ -1929,7 +1929,7 @@ static int stm32_i2c2_isr(int irq, void *context) ************************************************************************************/ #ifdef CONFIG_STM32_I2C3 -static int stm32_i2c3_isr(int irq, void *context) +static int stm32_i2c3_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c3_priv); } @@ -1974,8 +1974,8 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv) /* Attach ISRs */ #ifndef CONFIG_I2C_POLLED - irq_attach(priv->config->ev_irq, priv->config->isr); - irq_attach(priv->config->er_irq, priv->config->isr); + irq_attach(priv->config->ev_irq, priv->config->isr, NULL); + irq_attach(priv->config->er_irq, priv->config->isr, NULL); up_enable_irq(priv->config->ev_irq); up_enable_irq(priv->config->er_irq); #endif diff --git a/arch/arm/src/stm32/stm32_irq.c b/arch/arm/src/stm32/stm32_irq.c index ff40bf8d033..051c9829794 100644 --- a/arch/arm/src/stm32/stm32_irq.c +++ b/arch/arm/src/stm32/stm32_irq.c @@ -161,7 +161,7 @@ static void stm32_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int stm32_nmi(int irq, FAR void *context) +static int stm32_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -169,7 +169,7 @@ static int stm32_nmi(int irq, FAR void *context) return 0; } -static int stm32_busfault(int irq, FAR void *context) +static int stm32_busfault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Bus fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -177,7 +177,7 @@ static int stm32_busfault(int irq, FAR void *context) return 0; } -static int stm32_usagefault(int irq, FAR void *context) +static int stm32_usagefault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Usage fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -185,7 +185,7 @@ static int stm32_usagefault(int irq, FAR void *context) return 0; } -static int stm32_pendsv(int irq, FAR void *context) +static int stm32_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -193,7 +193,7 @@ static int stm32_pendsv(int irq, FAR void *context) return 0; } -static int stm32_dbgmonitor(int irq, FAR void *context) +static int stm32_dbgmonitor(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Debug Monitor received\n"); @@ -201,7 +201,7 @@ static int stm32_dbgmonitor(int irq, FAR void *context) return 0; } -static int stm32_reserved(int irq, FAR void *context) +static int stm32_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -376,8 +376,8 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(STM32_IRQ_SVCALL, up_svcall); - irq_attach(STM32_IRQ_HARDFAULT, up_hardfault); + irq_attach(STM32_IRQ_SVCALL, up_svcall, NULL); + irq_attach(STM32_IRQ_HARDFAULT, up_hardfault, NULL); /* Set the priority of the SVCall interrupt */ @@ -393,22 +393,22 @@ void up_irqinitialize(void) */ #ifdef CONFIG_ARM_MPU - irq_attach(STM32_IRQ_MEMFAULT, up_memfault); + irq_attach(STM32_IRQ_MEMFAULT, up_memfault, NULL); up_enable_irq(STM32_IRQ_MEMFAULT); #endif /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(STM32_IRQ_NMI, stm32_nmi); + irq_attach(STM32_IRQ_NMI, stm32_nmi, NULL); #ifndef CONFIG_ARM_MPU - irq_attach(STM32_IRQ_MEMFAULT, up_memfault); + irq_attach(STM32_IRQ_MEMFAULT, up_memfault, NULL); #endif - irq_attach(STM32_IRQ_BUSFAULT, stm32_busfault); - irq_attach(STM32_IRQ_USAGEFAULT, stm32_usagefault); - irq_attach(STM32_IRQ_PENDSV, stm32_pendsv); - irq_attach(STM32_IRQ_DBGMONITOR, stm32_dbgmonitor); - irq_attach(STM32_IRQ_RESERVED, stm32_reserved); + irq_attach(STM32_IRQ_BUSFAULT, stm32_busfault, NULL); + irq_attach(STM32_IRQ_USAGEFAULT, stm32_usagefault, NULL); + irq_attach(STM32_IRQ_PENDSV, stm32_pendsv, NULL); + irq_attach(STM32_IRQ_DBGMONITOR, stm32_dbgmonitor, NULL); + irq_attach(STM32_IRQ_RESERVED, stm32_reserved, NULL); #endif stm32_dumpnvic("initial", NR_IRQS); diff --git a/arch/arm/src/stm32/stm32_ltdc.c b/arch/arm/src/stm32/stm32_ltdc.c index ebaeff8d470..2573730172c 100644 --- a/arch/arm/src/stm32/stm32_ltdc.c +++ b/arch/arm/src/stm32/stm32_ltdc.c @@ -550,7 +550,7 @@ static void stm32_ltdc_periphconfig(void); static void stm32_ltdc_bgcolor(uint32_t rgb); static void stm32_ltdc_dither(bool enable, uint8_t red, uint8_t green, uint8_t blue); -static int stm32_ltdcirq(int irq, void *context); +static int stm32_ltdcirq(int irq, void *context, FAR void *arg); static int stm32_ltdc_waitforirq(void); static int stm32_ltdc_reload(uint8_t value, bool waitvblank); @@ -1128,7 +1128,7 @@ static void stm32_ltdc_irqctrl(uint32_t setirqs, uint32_t clrirqs) * ****************************************************************************/ -static int stm32_ltdcirq(int irq, void *context) +static int stm32_ltdcirq(int irq, void *context, FAR void *arg) { FAR struct stm32_interrupt_s *priv = &g_interrupt; @@ -1298,7 +1298,7 @@ static void stm32_global_configure(void) /* Attach LTDC interrupt vector */ - (void)irq_attach(g_interrupt.irq, stm32_ltdcirq); + (void)irq_attach(g_interrupt.irq, stm32_ltdcirq, NULL); /* Enable the IRQ at the NVIC */ diff --git a/arch/arm/src/stm32/stm32_otgfsdev.c b/arch/arm/src/stm32/stm32_otgfsdev.c index 2fcbf599f06..47b212c3c28 100644 --- a/arch/arm/src/stm32/stm32_otgfsdev.c +++ b/arch/arm/src/stm32/stm32_otgfsdev.c @@ -619,7 +619,7 @@ static inline void stm32_otginterrupt(FAR struct stm32_usbdev_s *priv); /* First level interrupt processing */ -static int stm32_usbinterrupt(int irq, FAR void *context); +static int stm32_usbinterrupt(int irq, FAR void *context, FAR void *arg); /* Endpoint operations *********************************************************/ /* Global OUT NAK controls */ @@ -3554,7 +3554,7 @@ static inline void stm32_otginterrupt(FAR struct stm32_usbdev_s *priv) * ****************************************************************************/ -static int stm32_usbinterrupt(int irq, FAR void *context) +static int stm32_usbinterrupt(int irq, FAR void *context, FAR void *arg) { /* At present, there is only a single OTG FS device support. Hence it is * pre-allocated as g_otgfsdev. However, in most code, the private data @@ -5502,7 +5502,7 @@ void up_usbinitialize(void) /* Attach the OTG FS interrupt handler */ - ret = irq_attach(STM32_IRQ_OTGFS, stm32_usbinterrupt); + ret = irq_attach(STM32_IRQ_OTGFS, stm32_usbinterrupt, NULL); if (ret < 0) { uerr("ERROR: irq_attach failed\n", ret); diff --git a/arch/arm/src/stm32/stm32_otgfshost.c b/arch/arm/src/stm32/stm32_otgfshost.c index 3feb0924c0d..0adea86e747 100644 --- a/arch/arm/src/stm32/stm32_otgfshost.c +++ b/arch/arm/src/stm32/stm32_otgfshost.c @@ -404,7 +404,7 @@ static inline void stm32_gint_ipxfrisr(FAR struct stm32_usbhost_s *priv); /* First level, global interrupt handler */ -static int stm32_gint_isr(int irq, FAR void *context); +static int stm32_gint_isr(int irq, FAR void *context, FAR void *arg); /* Interrupt controls */ @@ -3431,7 +3431,7 @@ static inline void stm32_gint_ipxfrisr(FAR struct stm32_usbhost_s *priv) * ****************************************************************************/ -static int stm32_gint_isr(int irq, FAR void *context) +static int stm32_gint_isr(int irq, FAR void *context, FAR void *arg) { /* At present, there is only support for a single OTG FS host. Hence it is * pre-allocated as g_usbhost. However, in most code, the private data @@ -5302,7 +5302,7 @@ FAR struct usbhost_connection_s *stm32_otgfshost_initialize(int controller) /* Attach USB host controller interrupt handler */ - if (irq_attach(STM32_IRQ_OTGFS, stm32_gint_isr) != 0) + if (irq_attach(STM32_IRQ_OTGFS, stm32_gint_isr, NULL) != 0) { usbhost_trace1(OTGFS_TRACE1_IRQATTACH, 0); return NULL; diff --git a/arch/arm/src/stm32/stm32_otghsdev.c b/arch/arm/src/stm32/stm32_otghsdev.c index 97d71aa0aa9..97474f2f435 100644 --- a/arch/arm/src/stm32/stm32_otghsdev.c +++ b/arch/arm/src/stm32/stm32_otghsdev.c @@ -572,7 +572,7 @@ static inline void stm32_otginterrupt(FAR struct stm32_usbdev_s *priv); /* First level interrupt processing */ -static int stm32_usbinterrupt(int irq, FAR void *context); +static int stm32_usbinterrupt(int irq, FAR void *context, FAR void *arg); /* Endpoint operations *********************************************************/ /* Global OUT NAK controls */ @@ -3498,7 +3498,7 @@ static inline void stm32_otginterrupt(FAR struct stm32_usbdev_s *priv) * ****************************************************************************/ -static int stm32_usbinterrupt(int irq, FAR void *context) +static int stm32_usbinterrupt(int irq, FAR void *context, FAR void *arg) { /* At present, there is only a single OTG HS device support. Hence it is * pre-allocated as g_otghsdev. However, in most code, the private data @@ -5438,7 +5438,7 @@ void up_usbinitialize(void) /* Attach the OTG HS interrupt handler */ - ret = irq_attach(STM32_IRQ_OTGHS, stm32_usbinterrupt); + ret = irq_attach(STM32_IRQ_OTGHS, stm32_usbinterrupt, NULL); if (ret < 0) { uerr("ERROR: irq_attach failed\n", ret); diff --git a/arch/arm/src/stm32/stm32_otghshost.c b/arch/arm/src/stm32/stm32_otghshost.c index 9dee00ae45c..c3c8be579ad 100644 --- a/arch/arm/src/stm32/stm32_otghshost.c +++ b/arch/arm/src/stm32/stm32_otghshost.c @@ -409,7 +409,7 @@ static inline void stm32_gint_ipxfrisr(FAR struct stm32_usbhost_s *priv); /* First level, global interrupt handler */ -static int stm32_gint_isr(int irq, FAR void *context); +static int stm32_gint_isr(int irq, FAR void *context, FAR void *arg); /* Interrupt controls */ @@ -3436,7 +3436,7 @@ static inline void stm32_gint_ipxfrisr(FAR struct stm32_usbhost_s *priv) * ****************************************************************************/ -static int stm32_gint_isr(int irq, FAR void *context) +static int stm32_gint_isr(int irq, FAR void *context, FAR void *arg) { /* At present, there is only support for a single OTG HS host. Hence it is * pre-allocated as g_usbhost. However, in most code, the private data @@ -5307,7 +5307,7 @@ FAR struct usbhost_connection_s *stm32_otghshost_initialize(int controller) /* Attach USB host controller interrupt handler */ - if (irq_attach(STM32_IRQ_OTGHS, stm32_gint_isr) != 0) + if (irq_attach(STM32_IRQ_OTGHS, stm32_gint_isr, NULL) != 0) { usbhost_trace1(OTGHS_TRACE1_IRQATTACH, 0); return NULL; diff --git a/arch/arm/src/stm32/stm32_pwm.c b/arch/arm/src/stm32/stm32_pwm.c index 83a1a4cd7df..87bfb577421 100644 --- a/arch/arm/src/stm32/stm32_pwm.c +++ b/arch/arm/src/stm32/stm32_pwm.c @@ -352,10 +352,10 @@ static int pwm_timer(FAR struct stm32_pwmtimer_s *priv, #if defined(CONFIG_PWM_PULSECOUNT) && (defined(CONFIG_STM32_TIM1_PWM) || defined(CONFIG_STM32_TIM8_PWM)) static int pwm_interrupt(struct stm32_pwmtimer_s *priv); #if defined(CONFIG_STM32_TIM1_PWM) -static int pwm_tim1interrupt(int irq, void *context); +static int pwm_tim1interrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_STM32_TIM8_PWM) -static int pwm_tim8interrupt(int irq, void *context); +static int pwm_tim8interrupt(int irq, void *context, FAR void *arg); #endif static uint8_t pwm_pulsecount(uint32_t count); #endif @@ -1981,14 +1981,14 @@ static int pwm_interrupt(struct stm32_pwmtimer_s *priv) ****************************************************************************/ #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_STM32_TIM1_PWM) -static int pwm_tim1interrupt(int irq, void *context) +static int pwm_tim1interrupt(int irq, void *context, FAR void *arg) { return pwm_interrupt(&g_pwm1dev); } #endif #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_STM32_TIM8_PWM) -static int pwm_tim8interrupt(int irq, void *context) +static int pwm_tim8interrupt(int irq, void *context, FAR void *arg) { return pwm_interrupt(&g_pwm8dev); } @@ -2599,7 +2599,7 @@ FAR struct pwm_lowerhalf_s *stm32_pwminitialize(int timer) /* Attach but disable the TIM1 update interrupt */ #ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, pwm_tim1interrupt); + irq_attach(lower->irq, pwm_tim1interrupt, NULL); up_disable_irq(lower->irq); #endif break; @@ -2636,7 +2636,7 @@ FAR struct pwm_lowerhalf_s *stm32_pwminitialize(int timer) /* Attach but disable the TIM8 update interrupt */ #ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, pwm_tim8interrupt); + irq_attach(lower->irq, pwm_tim8interrupt, NULL); up_disable_irq(lower->irq); #endif break; diff --git a/arch/arm/src/stm32/stm32_qencoder.c b/arch/arm/src/stm32/stm32_qencoder.c index 056b7d43f44..07e8faf0a95 100644 --- a/arch/arm/src/stm32/stm32_qencoder.c +++ b/arch/arm/src/stm32/stm32_qencoder.c @@ -306,22 +306,22 @@ static FAR struct stm32_lowerhalf_s *stm32_tim2lower(int tim); #ifdef HAVE_16BIT_TIMERS static int stm32_interrupt(FAR struct stm32_lowerhalf_s *priv); #if defined(CONFIG_STM32_TIM1_QE) && TIM1_BITWIDTH == 16 -static int stm32_tim1interrupt(int irq, FAR void *context); +static int stm32_tim1interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32_TIM2_QE) && TIM2_BITWIDTH == 16 -static int stm32_tim2interrupt(int irq, FAR void *context); +static int stm32_tim2interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32_TIM3_QE) && TIM3_BITWIDTH == 16 -static int stm32_tim3interrupt(int irq, FAR void *context); +static int stm32_tim3interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32_TIM4_QE) && TIM4_BITWIDTH == 16 -static int stm32_tim4interrupt(int irq, FAR void *context); +static int stm32_tim4interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32_TIM5_QE) && TIM5_BITWIDTH == 16 -static int stm32_tim5interrupt(int irq, FAR void *context); +static int stm32_tim5interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32_TIM8_QE) && TIM8_BITWIDTH == 16 -static int stm32_tim8interrupt(int irq, FAR void *context); +static int stm32_tim8interrupt(int irq, FAR void *context, FAR void * arg); #endif #endif @@ -753,42 +753,42 @@ static int stm32_interrupt(FAR struct stm32_lowerhalf_s *priv) ************************************************************************************/ #if defined(CONFIG_STM32_TIM1_QE) && TIM1_BITWIDTH == 16 -static int stm32_tim1interrupt(int irq, FAR void *context) +static int stm32_tim1interrupt(int irq, FAR void *context, FAR void * arg) { return stm32_interrupt(&g_tim1lower); } #endif #if defined(CONFIG_STM32_TIM2_QE) && TIM2_BITWIDTH == 16 -static int stm32_tim2interrupt(int irq, FAR void *context) +static int stm32_tim2interrupt(int irq, FAR void *context, FAR void * arg) { return stm32_interrupt(&g_tim2lower); } #endif #if defined(CONFIG_STM32_TIM3_QE) && TIM3_BITWIDTH == 16 -static int stm32_tim3interrupt(int irq, FAR void *context) +static int stm32_tim3interrupt(int irq, FAR void *context, FAR void * arg) { return stm32_interrupt(&g_tim3lower); } #endif #if defined(CONFIG_STM32_TIM4_QE) && TIM4_BITWIDTH == 16 -static int stm32_tim4interrupt(int irq, FAR void *context) +static int stm32_tim4interrupt(int irq, FAR void *context, FAR void * arg) { return stm32_interrupt(&g_tim4lower); } #endif #if defined(CONFIG_STM32_TIM5_QE) && TIM5_BITWIDTH == 16 -static int stm32_tim5interrupt(int irq, FAR void *context) +static int stm32_tim5interrupt(int irq, FAR void *context, FAR void * arg) { return stm32_interrupt(&g_tim5lower); } #endif #if defined(CONFIG_STM32_TIM8_QE) && TIM8_BITWIDTH == 16 -static int stm32_tim8interrupt(int irq, FAR void *context) +static int stm32_tim8interrupt(int irq, FAR void *context, FAR void * arg) { return stm32_interrupt(&g_tim8lower); } @@ -973,7 +973,7 @@ static int stm32_setup(FAR struct qe_lowerhalf_s *lower) { /* Attach the interrupt handler */ - ret = irq_attach(priv->config->irq, priv->config->handler); + ret = irq_attach(priv->config->irq, priv->config->handler, NULL); if (ret < 0) { stm32_shutdown(lower); diff --git a/arch/arm/src/stm32/stm32_rng.c b/arch/arm/src/stm32/stm32_rng.c index 8dde6a6c35c..ccbbd96dd72 100644 --- a/arch/arm/src/stm32/stm32_rng.c +++ b/arch/arm/src/stm32/stm32_rng.c @@ -61,7 +61,7 @@ ****************************************************************************/ static int stm32_rng_initialize(void); -static int stm32_interrupt(int irq, void *context); +static int stm32_interrupt(int irq, void *context, FAR void *arg); static void stm32_enable(void); static void stm32_disable(void); static ssize_t stm32_read(struct file *filep, char *buffer, size_t); @@ -113,7 +113,7 @@ static int stm32_rng_initialize() sem_init(&g_rngdev.rd_devsem, 0, 1); - if (irq_attach(STM32_IRQ_RNG, stm32_interrupt)) + if (irq_attach(STM32_IRQ_RNG, stm32_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ @@ -152,7 +152,7 @@ static void stm32_disable() putreg32(regval, STM32_RNG_CR); } -static int stm32_interrupt(int irq, void *context) +static int stm32_interrupt(int irq, void *context, FAR void *arg) { uint32_t rngsr; uint32_t data; diff --git a/arch/arm/src/stm32/stm32_rtcc.c b/arch/arm/src/stm32/stm32_rtcc.c index d27a8ddd387..b7155854965 100644 --- a/arch/arm/src/stm32/stm32_rtcc.c +++ b/arch/arm/src/stm32/stm32_rtcc.c @@ -768,7 +768,7 @@ int up_rtc_initialize(void) /* Then attach the ALARM interrupt handler */ - irq_attach(STM32_IRQ_RTC_WKUP, rtc_interrupt); + irq_attach(STM32_IRQ_RTC_WKUP, rtc_interrupt, NULL); up_enable_irq(STM32_IRQ_RTC_WKUP); #endif diff --git a/arch/arm/src/stm32/stm32_rtcounter.c b/arch/arm/src/stm32/stm32_rtcounter.c index 1c90be9c14d..9a046f8318c 100644 --- a/arch/arm/src/stm32/stm32_rtcounter.c +++ b/arch/arm/src/stm32/stm32_rtcounter.c @@ -324,7 +324,7 @@ static inline void stm32_rtc_breakout(FAR const struct timespec *tp, ************************************************************************************/ #if defined(CONFIG_RTC_HIRES) || defined(CONFIG_RTC_ALARM) -static int stm32_rtc_interrupt(int irq, void *context) +static int stm32_rtc_interrupt(int irq, void *context, FAR void *arg) { uint16_t source = getreg16(STM32_RTC_CRL); @@ -406,7 +406,7 @@ int up_rtc_initialize(void) /* Configure RTC interrupt to catch overflow and alarm interrupts. */ #if defined(CONFIG_RTC_HIRES) || defined(CONFIG_RTC_ALARM) - irq_attach(STM32_IRQ_RTC, stm32_rtc_interrupt); + irq_attach(STM32_IRQ_RTC, stm32_rtc_interrupt, NULL); up_enable_irq(STM32_IRQ_RTC); #endif diff --git a/arch/arm/src/stm32/stm32_sdadc.c b/arch/arm/src/stm32/stm32_sdadc.c index 6ec4fbf3948..cbd0d19ce77 100644 --- a/arch/arm/src/stm32/stm32_sdadc.c +++ b/arch/arm/src/stm32/stm32_sdadc.c @@ -184,13 +184,13 @@ static void sdadc_rccreset(FAR struct stm32_dev_s *priv, bool reset); static int sdadc_interrupt(FAR struct adc_dev_s *dev); #if defined(CONFIG_STM32_SDADC1) -static int sdadc1_interrupt(int irq, FAR void *context); +static int sdadc1_interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32_SDADC2) -static int sdadc2_interrupt(int irq, FAR void *context); +static int sdadc2_interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32_SDADC3) -static int sdadc3_interrupt(int irq, FAR void *context); +static int sdadc3_interrupt(int irq, FAR void *context, FAR void * arg); #endif /* ADC Driver Methods */ @@ -998,7 +998,7 @@ static int sdadc_setup(FAR struct adc_dev_s *dev) { /* Attach the SDADC interrupt */ - ret = irq_attach(priv->irq, priv->isr); + ret = irq_attach(priv->irq, priv->isr, NULL); if (ret < 0) { ainfo("irq_attach failed: %d\n", ret); @@ -1008,7 +1008,7 @@ static int sdadc_setup(FAR struct adc_dev_s *dev) #else /* Attach the SDADC interrupt */ - ret = irq_attach(priv->irq, priv->isr); + ret = irq_attach(priv->irq, priv->isr, NULL); if (ret < 0) { ainfo("irq_attach failed: %d\n", ret); @@ -1313,7 +1313,7 @@ static int sdadc_interrupt(FAR struct adc_dev_s *dev) ****************************************************************************/ #if defined(CONFIG_STM32_SDADC1) -static int sdadc1_interrupt(int irq, FAR void *context) +static int sdadc1_interrupt(int irq, FAR void *context, FAR void * arg) { sdadc_interrupt(&g_sdadcdev1); @@ -1336,7 +1336,7 @@ static int sdadc1_interrupt(int irq, FAR void *context) ****************************************************************************/ #if defined(CONFIG_STM32_SDADC2) -static int sdadc2_interrupt(int irq, FAR void *context) +static int sdadc2_interrupt(int irq, FAR void *context, FAR void * arg) { sdadc_interrupt(&g_sdadcdev2); @@ -1359,7 +1359,7 @@ static int sdadc2_interrupt(int irq, FAR void *context) ****************************************************************************/ #if defined(CONFIG_STM32_SDADC3) -static int sdadc3_interrupt(int irq, FAR void *context) +static int sdadc3_interrupt(int irq, FAR void *context, FAR void * arg) { sdadc_interrupt(&g_sdadcdev3); diff --git a/arch/arm/src/stm32/stm32_sdio.c b/arch/arm/src/stm32/stm32_sdio.c index 68ca6122c81..8be48a8b8ef 100644 --- a/arch/arm/src/stm32/stm32_sdio.c +++ b/arch/arm/src/stm32/stm32_sdio.c @@ -416,7 +416,7 @@ static void stm32_endtransfer(struct stm32_dev_s *priv, sdio_eventset_t wkupeven /* Interrupt Handling *******************************************************/ -static int stm32_interrupt(int irq, void *context); +static int stm32_interrupt(int irq, void *context, FAR void *arg); #ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE static int stm32_rdyinterrupt(int irq, void *context); #endif @@ -1337,7 +1337,7 @@ static int stm32_rdyinterrupt(int irq, void *context) * ****************************************************************************/ -static int stm32_interrupt(int irq, void *context) +static int stm32_interrupt(int irq, void *context, FAR void *arg) { struct stm32_dev_s *priv = &g_sdiodev; uint32_t enabled; @@ -1768,7 +1768,7 @@ static int stm32_attach(FAR struct sdio_dev_s *dev) /* Attach the SDIO interrupt handler */ - ret = irq_attach(STM32_IRQ_SDIO, stm32_interrupt); + ret = irq_attach(STM32_IRQ_SDIO, stm32_interrupt, NULL); if (ret == OK) { diff --git a/arch/arm/src/stm32/stm32_serial.c b/arch/arm/src/stm32/stm32_serial.c index f4dfa810ed7..feff33e8836 100644 --- a/arch/arm/src/stm32/stm32_serial.c +++ b/arch/arm/src/stm32/stm32_serial.c @@ -315,7 +315,7 @@ struct up_dev_s const unsigned int rxdma_channel; /* DMA channel assigned */ #endif - int (*const vector)(int irq, void *context); /* Interrupt handler */ + int (*const vector)(int irq, void *context, void *arg); /* Interrupt handler */ /* RX DMA state */ @@ -374,28 +374,28 @@ static int up_pm_prepare(struct pm_callback_s *cb, int domain, #endif #ifdef CONFIG_STM32_USART1_SERIALDRIVER -static int up_interrupt_usart1(int irq, void *context); +static int up_interrupt_usart1(int irq, void *context, void *arg); #endif #ifdef CONFIG_STM32_USART2_SERIALDRIVER -static int up_interrupt_usart2(int irq, void *context); +static int up_interrupt_usart2(int irq, void *context, void *arg); #endif #ifdef CONFIG_STM32_USART3_SERIALDRIVER -static int up_interrupt_usart3(int irq, void *context); +static int up_interrupt_usart3(int irq, void *context, void *arg); #endif #ifdef CONFIG_STM32_UART4_SERIALDRIVER -static int up_interrupt_uart4(int irq, void *context); +static int up_interrupt_uart4(int irq, void *context, void *arg); #endif #ifdef CONFIG_STM32_UART5_SERIALDRIVER -static int up_interrupt_uart5(int irq, void *context); +static int up_interrupt_uart5(int irq, void *context, void *arg); #endif #ifdef CONFIG_STM32_USART6_SERIALDRIVER -static int up_interrupt_usart6(int irq, void *context); +static int up_interrupt_usart6(int irq, void *context, void *arg); #endif #ifdef CONFIG_STM32_UART7_SERIALDRIVER -static int up_interrupt_uart7(int irq, void *context); +static int up_interrupt_uart7(int irq, void *context, void *arg); #endif #ifdef CONFIG_STM32_UART8_SERIALDRIVER -static int up_interrupt_uart8(int irq, void *context); +static int up_interrupt_uart8(int irq, void *context, void *arg); #endif /**************************************************************************** @@ -1744,7 +1744,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->vector); + ret = irq_attach(priv->irq, priv->vector, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -2520,56 +2520,56 @@ static bool up_txready(struct uart_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_STM32_USART1_SERIALDRIVER -static int up_interrupt_usart1(int irq, void *context) +static int up_interrupt_usart1(int irq, void *context, void *arg) { return up_interrupt_common(&g_usart1priv); } #endif #ifdef CONFIG_STM32_USART2_SERIALDRIVER -static int up_interrupt_usart2(int irq, void *context) +static int up_interrupt_usart2(int irq, void *context, void *arg) { return up_interrupt_common(&g_usart2priv); } #endif #ifdef CONFIG_STM32_USART3_SERIALDRIVER -static int up_interrupt_usart3(int irq, void *context) +static int up_interrupt_usart3(int irq, void *context, void *arg) { return up_interrupt_common(&g_usart3priv); } #endif #ifdef CONFIG_STM32_UART4_SERIALDRIVER -static int up_interrupt_uart4(int irq, void *context) +static int up_interrupt_uart4(int irq, void *context, void *arg) { return up_interrupt_common(&g_uart4priv); } #endif #ifdef CONFIG_STM32_UART5_SERIALDRIVER -static int up_interrupt_uart5(int irq, void *context) +static int up_interrupt_uart5(int irq, void *context, void *arg) { return up_interrupt_common(&g_uart5priv); } #endif #ifdef CONFIG_STM32_USART6_SERIALDRIVER -static int up_interrupt_usart6(int irq, void *context) +static int up_interrupt_usart6(int irq, void *context, void *arg) { return up_interrupt_common(&g_usart6priv); } #endif #ifdef CONFIG_STM32_UART7_SERIALDRIVER -static int up_interrupt_uart7(int irq, void *context) +static int up_interrupt_uart7(int irq, void *context, void *arg) { return up_interrupt_common(&g_uart7priv); } #endif #ifdef CONFIG_STM32_UART8_SERIALDRIVER -static int up_interrupt_uart8(int irq, void *context) +static int up_interrupt_uart8(int irq, void *context, void *arg) { return up_interrupt_common(&g_uart8priv); } diff --git a/arch/arm/src/stm32/stm32_tim.c b/arch/arm/src/stm32/stm32_tim.c index ae0e20d6ec2..7d9ac4efc8b 100644 --- a/arch/arm/src/stm32/stm32_tim.c +++ b/arch/arm/src/stm32/stm32_tim.c @@ -1596,7 +1596,7 @@ static int stm32_tim_setisr(FAR struct stm32_tim_dev_s *dev, /* Otherwise set callback and enable interrupt */ - irq_attach(vectorno, handler); + irq_attach(vectorno, handler, NULL); up_enable_irq(vectorno); #ifdef CONFIG_ARCH_IRQPRIO diff --git a/arch/arm/src/stm32/stm32_timerisr.c b/arch/arm/src/stm32/stm32_timerisr.c index cb0bd885a7d..ac2aaae0945 100644 --- a/arch/arm/src/stm32/stm32_timerisr.c +++ b/arch/arm/src/stm32/stm32_timerisr.c @@ -98,7 +98,7 @@ * ****************************************************************************/ -static int stm32_timerisr(int irq, uint32_t *regs) +static int stm32_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -148,7 +148,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(STM32_IRQ_SYSTICK, (xcpt_t)stm32_timerisr); + (void)irq_attach(STM32_IRQ_SYSTICK, (xcpt_t)stm32_timerisr, NULL); /* Enable SysTick interrupts */ diff --git a/arch/arm/src/stm32/stm32_usbdev.c b/arch/arm/src/stm32/stm32_usbdev.c index 9c69a86b8fe..e042f50a76e 100644 --- a/arch/arm/src/stm32/stm32_usbdev.c +++ b/arch/arm/src/stm32/stm32_usbdev.c @@ -484,8 +484,8 @@ static void stm32_ep0in(struct stm32_usbdev_s *priv); static inline void stm32_ep0done(struct stm32_usbdev_s *priv, uint16_t istr); static void stm32_lptransfer(struct stm32_usbdev_s *priv); -static int stm32_hpinterrupt(int irq, void *context); -static int stm32_lpinterrupt(int irq, void *context); +static int stm32_hpinterrupt(int irq, void *context, FAR void *arg); +static int stm32_lpinterrupt(int irq, void *context, FAR void *arg); /* Endpoint helpers *********************************************************/ @@ -2413,7 +2413,7 @@ static void stm32_lptransfer(struct stm32_usbdev_s *priv) * Name: stm32_hpinterrupt ****************************************************************************/ -static int stm32_hpinterrupt(int irq, void *context) +static int stm32_hpinterrupt(int irq, void *context, FAR void *arg) { /* For now there is only one USB controller, but we will always refer to * it using a pointer to make any future ports to multiple USB controllers @@ -2455,7 +2455,7 @@ static int stm32_hpinterrupt(int irq, void *context) * Name: stm32_lpinterrupt ****************************************************************************/ -static int stm32_lpinterrupt(int irq, void *context) +static int stm32_lpinterrupt(int irq, void *context, FAR void *arg) { /* For now there is only one USB controller, but we will always refer to * it using a pointer to make any future ports to multiple USB controllers @@ -3752,14 +3752,14 @@ void up_usbinitialize(void) * them when we need them later. */ - if (irq_attach(STM32_IRQ_USBHP, stm32_hpinterrupt) != 0) + if (irq_attach(STM32_IRQ_USBHP, stm32_hpinterrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(STM32_TRACEERR_IRQREGISTRATION), (uint16_t)STM32_IRQ_USBHP); goto errout; } - if (irq_attach(STM32_IRQ_USBLP, stm32_lpinterrupt) != 0) + if (irq_attach(STM32_IRQ_USBLP, stm32_lpinterrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(STM32_TRACEERR_IRQREGISTRATION), (uint16_t)STM32_IRQ_USBLP); diff --git a/arch/arm/src/stm32/stm32_wwdg.c b/arch/arm/src/stm32/stm32_wwdg.c index 6c982997437..ddf9c688474 100644 --- a/arch/arm/src/stm32/stm32_wwdg.c +++ b/arch/arm/src/stm32/stm32_wwdg.c @@ -121,7 +121,7 @@ static void stm32_setwindow(FAR struct stm32_lowerhalf_s *priv, /* Interrupt hanlding *******************************************************/ -static int stm32_interrupt(int irq, FAR void *context); +static int stm32_interrupt(int irq, FAR void *context, FAR void *arg); /* "Lower half" driver methods **********************************************/ @@ -286,7 +286,7 @@ static void stm32_setwindow(FAR struct stm32_lowerhalf_s *priv, uint8_t window) * ****************************************************************************/ -static int stm32_interrupt(int irq, FAR void *context) +static int stm32_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct stm32_lowerhalf_s *priv = &g_wdgdev; uint16_t regval; @@ -766,7 +766,7 @@ void stm32_wwdginitialize(FAR const char *devpath) /* Attach our EWI interrupt handler (But don't enable it yet) */ - (void)irq_attach(STM32_IRQ_WWDG, stm32_interrupt); + (void)irq_attach(STM32_IRQ_WWDG, stm32_interrupt, NULL); /* Select an arbitrary initial timeout value. But don't start the watchdog * yet. NOTE: If the "Hardware watchdog" feature is enabled through the diff --git a/arch/arm/src/stm32/stm32f10xxx_dma.c b/arch/arm/src/stm32/stm32f10xxx_dma.c index 8a7782773e2..1e6751ee563 100644 --- a/arch/arm/src/stm32/stm32f10xxx_dma.c +++ b/arch/arm/src/stm32/stm32f10xxx_dma.c @@ -275,7 +275,7 @@ static void stm32_dmachandisable(struct stm32_dma_s *dmach) * ************************************************************************************/ -static int stm32_dmainterrupt(int irq, void *context) +static int stm32_dmainterrupt(int irq, void *context, FAR void *arg) { struct stm32_dma_s *dmach; uint32_t isr; @@ -351,7 +351,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vectors */ - (void)irq_attach(dmach->irq, stm32_dmainterrupt); + (void)irq_attach(dmach->irq, stm32_dmainterrupt, NULL); /* Disable the DMA channel */ diff --git a/arch/arm/src/stm32/stm32f20xxx_dma.c b/arch/arm/src/stm32/stm32f20xxx_dma.c index 8edd31db2cb..4ab975de781 100644 --- a/arch/arm/src/stm32/stm32f20xxx_dma.c +++ b/arch/arm/src/stm32/stm32f20xxx_dma.c @@ -370,7 +370,7 @@ static void stm32_dmastreamdisable(struct stm32_dma_s *dmast) * ************************************************************************************/ -static int stm32_dmainterrupt(int irq, void *context) +static int stm32_dmainterrupt(int irq, void *context, FAR void *arg) { struct stm32_dma_s *dmast; uint32_t status; @@ -482,7 +482,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vectors */ - (void)irq_attach(dmast->irq, stm32_dmainterrupt); + (void)irq_attach(dmast->irq, stm32_dmainterrupt, NULL); /* Disable the DMA stream */ diff --git a/arch/arm/src/stm32/stm32f30xxx_i2c.c b/arch/arm/src/stm32/stm32f30xxx_i2c.c index 312e0b4bb88..4a1ae02a512 100644 --- a/arch/arm/src/stm32/stm32f30xxx_i2c.c +++ b/arch/arm/src/stm32/stm32f30xxx_i2c.c @@ -222,7 +222,7 @@ struct stm32_i2c_config_s uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ #ifndef CONFIG_I2C_POLLED - int (*isr)(int, void *); /* Interrupt handler */ + int (*isr)(int, void *, void *); /* Interrupt handler */ uint32_t ev_irq; /* Event IRQ */ uint32_t er_irq; /* Error IRQ */ #endif @@ -304,13 +304,13 @@ static inline uint32_t stm32_i2c_getstatus(FAR struct stm32_i2c_priv_s *priv); static int stm32_i2c_isr(struct stm32_i2c_priv_s * priv); #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_STM32_I2C1 -static int stm32_i2c1_isr(int irq, void *context); +static int stm32_i2c1_isr(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_STM32_I2C2 -static int stm32_i2c2_isr(int irq, void *context); +static int stm32_i2c2_isr(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_STM32_I2C3 -static int stm32_i2c3_isr(int irq, void *context); +static int stm32_i2c3_isr(int irq, void *context, FAR void *arg); #endif #endif static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv); @@ -1493,7 +1493,7 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_STM32_I2C1 -static int stm32_i2c1_isr(int irq, void *context) +static int stm32_i2c1_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c1_priv); } @@ -1508,7 +1508,7 @@ static int stm32_i2c1_isr(int irq, void *context) ************************************************************************************/ #ifdef CONFIG_STM32_I2C2 -static int stm32_i2c2_isr(int irq, void *context) +static int stm32_i2c2_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c2_priv); } @@ -1523,7 +1523,7 @@ static int stm32_i2c2_isr(int irq, void *context) ************************************************************************************/ #ifdef CONFIG_STM32_I2C3 -static int stm32_i2c3_isr(int irq, void *context) +static int stm32_i2c3_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c3_priv); } @@ -1568,8 +1568,8 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv) /* Attach ISRs */ #ifndef CONFIG_I2C_POLLED - irq_attach(priv->config->ev_irq, priv->config->isr); - irq_attach(priv->config->er_irq, priv->config->isr); + irq_attach(priv->config->ev_irq, priv->config->isr, NULL); + irq_attach(priv->config->er_irq, priv->config->isr, NULL); up_enable_irq(priv->config->ev_irq); up_enable_irq(priv->config->er_irq); #endif diff --git a/arch/arm/src/stm32/stm32f40xxx_dma.c b/arch/arm/src/stm32/stm32f40xxx_dma.c index f631c6ea4a6..aec0712cc74 100644 --- a/arch/arm/src/stm32/stm32f40xxx_dma.c +++ b/arch/arm/src/stm32/stm32f40xxx_dma.c @@ -369,7 +369,7 @@ static void stm32_dmastreamdisable(struct stm32_dma_s *dmast) * ************************************************************************************/ -static int stm32_dmainterrupt(int irq, void *context) +static int stm32_dmainterrupt(int irq, void *context, FAR void *arg) { struct stm32_dma_s *dmast; uint32_t status; @@ -481,7 +481,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vectors */ - (void)irq_attach(dmast->irq, stm32_dmainterrupt); + (void)irq_attach(dmast->irq, stm32_dmainterrupt, NULL); /* Disable the DMA stream */ diff --git a/arch/arm/src/stm32/stm32f40xxx_i2c.c b/arch/arm/src/stm32/stm32f40xxx_i2c.c index 2bb715c4a87..be15a27be00 100644 --- a/arch/arm/src/stm32/stm32f40xxx_i2c.c +++ b/arch/arm/src/stm32/stm32f40xxx_i2c.c @@ -230,7 +230,7 @@ struct stm32_i2c_config_s uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ #ifndef CONFIG_I2C_POLLED - int (*isr)(int, void *); /* Interrupt handler */ + int (*isr)(int, void *, void *); /* Interrupt handler */ uint32_t ev_irq; /* Event IRQ */ uint32_t er_irq; /* Error IRQ */ #endif @@ -319,13 +319,13 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s * priv); #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_STM32_I2C1 -static int stm32_i2c1_isr(int irq, void *context); +static int stm32_i2c1_isr(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_STM32_I2C2 -static int stm32_i2c2_isr(int irq, void *context); +static int stm32_i2c2_isr(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_STM32_I2C3 -static int stm32_i2c3_isr(int irq, void *context); +static int stm32_i2c3_isr(int irq, void *context, FAR void *arg); #endif #endif /* !CONFIG_I2C_POLLED */ @@ -1878,7 +1878,7 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_STM32_I2C1 -static int stm32_i2c1_isr(int irq, void *context) +static int stm32_i2c1_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c1_priv); } @@ -1893,7 +1893,7 @@ static int stm32_i2c1_isr(int irq, void *context) ************************************************************************************/ #ifdef CONFIG_STM32_I2C2 -static int stm32_i2c2_isr(int irq, void *context) +static int stm32_i2c2_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c2_priv); } @@ -1908,7 +1908,7 @@ static int stm32_i2c2_isr(int irq, void *context) ************************************************************************************/ #ifdef CONFIG_STM32_I2C3 -static int stm32_i2c3_isr(int irq, void *context) +static int stm32_i2c3_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c3_priv); } @@ -1953,8 +1953,8 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv) /* Attach ISRs */ #ifndef CONFIG_I2C_POLLED - irq_attach(priv->config->ev_irq, priv->config->isr); - irq_attach(priv->config->er_irq, priv->config->isr); + irq_attach(priv->config->ev_irq, priv->config->isr, NULL); + irq_attach(priv->config->er_irq, priv->config->isr, NULL); up_enable_irq(priv->config->ev_irq); up_enable_irq(priv->config->er_irq); #endif diff --git a/arch/arm/src/stm32f7/stm32_adc.c b/arch/arm/src/stm32f7/stm32_adc.c index 1ec19c8ae77..661c172624c 100644 --- a/arch/arm/src/stm32f7/stm32_adc.c +++ b/arch/arm/src/stm32f7/stm32_adc.c @@ -258,7 +258,7 @@ static void adc_rccreset(FAR struct stm32_dev_s *priv, bool reset); /* ADC Interrupt Handler */ static int adc_interrupt(FAR struct adc_dev_s *dev); -static int adc123_interrupt(int irq, FAR void *context); +static int adc123_interrupt(int irq, FAR void *context, FAR void * arg); /* ADC Driver Methods */ @@ -1373,7 +1373,7 @@ static int adc_setup(FAR struct adc_dev_s *dev) /* Attach the ADC interrupt */ - ret = irq_attach(priv->irq, priv->isr); + ret = irq_attach(priv->irq, priv->isr, NULL); if (ret < 0) { ainfo("irq_attach failed: %d\n", ret); @@ -1678,7 +1678,7 @@ static int adc_interrupt(FAR struct adc_dev_s *dev) * ****************************************************************************/ -static int adc123_interrupt(int irq, FAR void *context) +static int adc123_interrupt(int irq, FAR void *context, FAR void * arg) { #ifdef CONFIG_STM32F7_ADC1 adc_interrupt(&g_adcdev1); diff --git a/arch/arm/src/stm32f7/stm32_dma.c b/arch/arm/src/stm32f7/stm32_dma.c index a695a07adf5..8f405b0594e 100644 --- a/arch/arm/src/stm32f7/stm32_dma.c +++ b/arch/arm/src/stm32f7/stm32_dma.c @@ -369,7 +369,7 @@ static void stm32_dmastreamdisable(struct stm32_dma_s *dmast) * ************************************************************************************/ -static int stm32_dmainterrupt(int irq, void *context) +static int stm32_dmainterrupt(int irq, void *context, FAR void *arg) { struct stm32_dma_s *dmast; uint32_t status; @@ -482,7 +482,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vectors */ - (void)irq_attach(dmast->irq, stm32_dmainterrupt); + (void)irq_attach(dmast->irq, stm32_dmainterrupt, NULL); /* Disable the DMA stream */ diff --git a/arch/arm/src/stm32f7/stm32_ethernet.c b/arch/arm/src/stm32f7/stm32_ethernet.c index 1ef4e09503b..0450dadab90 100644 --- a/arch/arm/src/stm32f7/stm32_ethernet.c +++ b/arch/arm/src/stm32f7/stm32_ethernet.c @@ -701,7 +701,7 @@ static void stm32_freeframe(struct stm32_ethmac_s *priv); static void stm32_txdone(struct stm32_ethmac_s *priv); static void stm32_interrupt_work(void *arg); -static int stm32_interrupt(int irq, void *context); +static int stm32_interrupt(int irq, void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -2200,7 +2200,7 @@ static void stm32_interrupt_work(void *arg) * ****************************************************************************/ -static int stm32_interrupt(int irq, void *context) +static int stm32_interrupt(int irq, void *context, FAR void *arg) { struct stm32_ethmac_s *priv = &g_stm32ethmac[0]; uint32_t dmasr; @@ -4136,7 +4136,7 @@ int stm32_ethinitialize(int intf) /* Attach the IRQ to the driver */ - if (irq_attach(STM32_IRQ_ETH, stm32_interrupt)) + if (irq_attach(STM32_IRQ_ETH, stm32_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ diff --git a/arch/arm/src/stm32f7/stm32_exti_alarm.c b/arch/arm/src/stm32f7/stm32_exti_alarm.c index ff53915178a..3ad112d7a44 100644 --- a/arch/arm/src/stm32f7/stm32_exti_alarm.c +++ b/arch/arm/src/stm32f7/stm32_exti_alarm.c @@ -85,7 +85,7 @@ static xcpt_t stm32_exti_callback; * ****************************************************************************/ -static int stm32_exti_alarm_isr(int irq, void *context) +static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -139,7 +139,7 @@ xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, if (func) { - irq_attach(STM32_IRQ_RTCALRM, stm32_exti_alarm_isr); + irq_attach(STM32_IRQ_RTCALRM, stm32_exti_alarm_isr, NULL); up_enable_irq(STM32_IRQ_RTCALRM); } else diff --git a/arch/arm/src/stm32f7/stm32_exti_gpio.c b/arch/arm/src/stm32f7/stm32_exti_gpio.c index ec4cd1a7d71..283ec89286d 100644 --- a/arch/arm/src/stm32f7/stm32_exti_gpio.c +++ b/arch/arm/src/stm32f7/stm32_exti_gpio.c @@ -313,7 +313,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, if (func) { - irq_attach(irq, handler); + irq_attach(irq, handler, NULL); up_enable_irq(irq); } else diff --git a/arch/arm/src/stm32f7/stm32_exti_pwr.c b/arch/arm/src/stm32f7/stm32_exti_pwr.c index 104dbff0105..5b6419fba0f 100644 --- a/arch/arm/src/stm32f7/stm32_exti_pwr.c +++ b/arch/arm/src/stm32f7/stm32_exti_pwr.c @@ -88,7 +88,7 @@ static xcpt_t stm32_exti_pvd_callback; * ****************************************************************************/ -static int stm32_exti_pvd_isr(int irq, void *context) +static int stm32_exti_pvd_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -142,7 +142,7 @@ xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, if (func) { - irq_attach(STM32_IRQ_PVD, stm32_exti_pvd_isr); + irq_attach(STM32_IRQ_PVD, stm32_exti_pvd_isr, NULL); up_enable_irq(STM32_IRQ_PVD); } else diff --git a/arch/arm/src/stm32f7/stm32_i2c.c b/arch/arm/src/stm32f7/stm32_i2c.c index d089db9623b..c98a1bd2251 100644 --- a/arch/arm/src/stm32f7/stm32_i2c.c +++ b/arch/arm/src/stm32f7/stm32_i2c.c @@ -402,7 +402,7 @@ struct stm32_i2c_config_s uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ #ifndef CONFIG_I2C_POLLED - int (*isr)(int, void *); /* Interrupt handler */ + int (*isr)(int, void *, void *); /* Interrupt handler */ uint32_t ev_irq; /* Event IRQ */ uint32_t er_irq; /* Error IRQ */ #endif @@ -487,16 +487,16 @@ static inline uint32_t stm32_i2c_getstatus(FAR struct stm32_i2c_priv_s *priv); static int stm32_i2c_isr(struct stm32_i2c_priv_s * priv); #ifndef CONFIG_I2C_POLLED # ifdef CONFIG_STM32F7_I2C1 -static int stm32_i2c1_isr(int irq, void *context); +static int stm32_i2c1_isr(int irq, void *context, FAR void *arg); # endif # ifdef CONFIG_STM32F7_I2C2 -static int stm32_i2c2_isr(int irq, void *context); +static int stm32_i2c2_isr(int irq, void *context, FAR void *arg); # endif # ifdef CONFIG_STM32F7_I2C3 -static int stm32_i2c3_isr(int irq, void *context); +static int stm32_i2c3_isr(int irq, void *context, FAR void *arg); # endif # ifdef CONFIG_STM32F7_I2C4 -static int stm32_i2c4_isr(int irq, void *context); +static int stm32_i2c4_isr(int irq, void *context, FAR void *arg); # endif #endif static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv); @@ -2152,7 +2152,7 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) #ifndef CONFIG_I2C_POLLED # ifdef CONFIG_STM32F7_I2C1 -static int stm32_i2c1_isr(int irq, void *context) +static int stm32_i2c1_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c1_priv); } @@ -2167,7 +2167,7 @@ static int stm32_i2c1_isr(int irq, void *context) ************************************************************************************/ # ifdef CONFIG_STM32F7_I2C2 -static int stm32_i2c2_isr(int irq, void *context) +static int stm32_i2c2_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c2_priv); } @@ -2182,7 +2182,7 @@ static int stm32_i2c2_isr(int irq, void *context) ************************************************************************************/ # ifdef CONFIG_STM32F7_I2C3 -static int stm32_i2c3_isr(int irq, void *context) +static int stm32_i2c3_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c3_priv); } @@ -2197,7 +2197,7 @@ static int stm32_i2c3_isr(int irq, void *context) ************************************************************************************/ # ifdef CONFIG_STM32F7_I2C4 -static int stm32_i2c4_isr(int irq, void *context) +static int stm32_i2c4_isr(int irq, void *context, FAR void *arg) { return stm32_i2c_isr(&stm32_i2c4_priv); } @@ -2242,8 +2242,8 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv) #ifndef CONFIG_I2C_POLLED /* Attach error and event interrupts to the ISRs */ - irq_attach(priv->config->ev_irq, priv->config->isr); - irq_attach(priv->config->er_irq, priv->config->isr); + irq_attach(priv->config->ev_irq, priv->config->isr, NULL); + irq_attach(priv->config->er_irq, priv->config->isr, NULL); up_enable_irq(priv->config->ev_irq); up_enable_irq(priv->config->er_irq); #endif diff --git a/arch/arm/src/stm32f7/stm32_irq.c b/arch/arm/src/stm32f7/stm32_irq.c index 758f32b1477..b2407501036 100644 --- a/arch/arm/src/stm32f7/stm32_irq.c +++ b/arch/arm/src/stm32f7/stm32_irq.c @@ -186,7 +186,7 @@ static void stm32_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int stm32_nmi(int irq, FAR void *context) +static int stm32_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -194,7 +194,7 @@ static int stm32_nmi(int irq, FAR void *context) return 0; } -static int stm32_busfault(int irq, FAR void *context) +static int stm32_busfault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Bus fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -202,7 +202,7 @@ static int stm32_busfault(int irq, FAR void *context) return 0; } -static int stm32_usagefault(int irq, FAR void *context) +static int stm32_usagefault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Usage fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -210,7 +210,7 @@ static int stm32_usagefault(int irq, FAR void *context) return 0; } -static int stm32_pendsv(int irq, FAR void *context) +static int stm32_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -218,7 +218,7 @@ static int stm32_pendsv(int irq, FAR void *context) return 0; } -static int stm32_dbgmonitor(int irq, FAR void *context) +static int stm32_dbgmonitor(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Debug Monitor received\n"); @@ -226,7 +226,7 @@ static int stm32_dbgmonitor(int irq, FAR void *context) return 0; } -static int stm32_reserved(int irq, FAR void *context) +static int stm32_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -469,8 +469,8 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(STM32_IRQ_SVCALL, up_svcall); - irq_attach(STM32_IRQ_HARDFAULT, up_hardfault); + irq_attach(STM32_IRQ_SVCALL, up_svcall, NULL); + irq_attach(STM32_IRQ_HARDFAULT, up_hardfault, NULL); /* Set the priority of the SVCall interrupt */ @@ -486,22 +486,22 @@ void up_irqinitialize(void) */ #ifdef CONFIG_ARM_MPU - irq_attach(STM32_IRQ_MEMFAULT, up_memfault); + irq_attach(STM32_IRQ_MEMFAULT, up_memfault, NULL); up_enable_irq(STM32_IRQ_MEMFAULT); #endif /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(STM32_IRQ_NMI, stm32_nmi); + irq_attach(STM32_IRQ_NMI, stm32_nmi, NULL); #ifndef CONFIG_ARM_MPU - irq_attach(STM32_IRQ_MEMFAULT, up_memfault); + irq_attach(STM32_IRQ_MEMFAULT, up_memfault, NULL); #endif - irq_attach(STM32_IRQ_BUSFAULT, stm32_busfault); - irq_attach(STM32_IRQ_USAGEFAULT, stm32_usagefault); - irq_attach(STM32_IRQ_PENDSV, stm32_pendsv); - irq_attach(STM32_IRQ_DBGMONITOR, stm32_dbgmonitor); - irq_attach(STM32_IRQ_RESERVED, stm32_reserved); + irq_attach(STM32_IRQ_BUSFAULT, stm32_busfault, NULL); + irq_attach(STM32_IRQ_USAGEFAULT, stm32_usagefault, NULL); + irq_attach(STM32_IRQ_PENDSV, stm32_pendsv, NULL); + irq_attach(STM32_IRQ_DBGMONITOR, stm32_dbgmonitor, NULL); + irq_attach(STM32_IRQ_RESERVED, stm32_reserved, NULL); #endif stm32_dumpnvic("initial", STM32_IRQ_NIRQS); diff --git a/arch/arm/src/stm32f7/stm32_otgdev.c b/arch/arm/src/stm32f7/stm32_otgdev.c index 9bf818182b4..ff2a6e026ee 100644 --- a/arch/arm/src/stm32f7/stm32_otgdev.c +++ b/arch/arm/src/stm32f7/stm32_otgdev.c @@ -650,7 +650,7 @@ static inline void stm32_otginterrupt(FAR struct stm32_usbdev_s *priv); /* First level interrupt processing */ -static int stm32_usbinterrupt(int irq, FAR void *context); +static int stm32_usbinterrupt(int irq, FAR void *context, FAR void *arg); /* Endpoint operations *********************************************************/ /* Global OUT NAK controls */ @@ -3572,7 +3572,7 @@ static inline void stm32_otginterrupt(FAR struct stm32_usbdev_s *priv) * ****************************************************************************/ -static int stm32_usbinterrupt(int irq, FAR void *context) +static int stm32_usbinterrupt(int irq, FAR void *context, FAR void *arg) { /* At present, there is only a single OTG device support. Hence it is * pre-allocated as g_otghsdev. However, in most code, the private data @@ -5557,7 +5557,7 @@ void up_usbinitialize(void) /* Attach the OTG interrupt handler */ - ret = irq_attach(STM32_IRQ_OTG, stm32_usbinterrupt); + ret = irq_attach(STM32_IRQ_OTG, stm32_usbinterrupt, NULL); if (ret < 0) { uerr("irq_attach failed\n", ret); diff --git a/arch/arm/src/stm32f7/stm32_otghost.c b/arch/arm/src/stm32f7/stm32_otghost.c index 12488c262f0..9eb12159e7d 100644 --- a/arch/arm/src/stm32f7/stm32_otghost.c +++ b/arch/arm/src/stm32f7/stm32_otghost.c @@ -406,7 +406,7 @@ static inline void stm32_gint_ipxfrisr(FAR struct stm32_usbhost_s *priv); /* First level, global interrupt handler */ -static int stm32_gint_isr(int irq, FAR void *context); +static int stm32_gint_isr(int irq, FAR void *context, FAR void *arg); /* Interrupt controls */ @@ -3430,7 +3430,7 @@ static inline void stm32_gint_ipxfrisr(FAR struct stm32_usbhost_s *priv) * ****************************************************************************/ -static int stm32_gint_isr(int irq, FAR void *context) +static int stm32_gint_isr(int irq, FAR void *context, FAR void *arg) { /* At present, there is only support for a single OTG FS host. Hence it is * pre-allocated as g_usbhost. However, in most code, the private data @@ -5300,7 +5300,7 @@ FAR struct usbhost_connection_s *stm32_otgfshost_initialize(int controller) /* Attach USB host controller interrupt handler */ - if (irq_attach(STM32_IRQ_OTGFS, stm32_gint_isr) != 0) + if (irq_attach(STM32_IRQ_OTGFS, stm32_gint_isr, NULL) != 0) { usbhost_trace1(OTG_TRACE1_IRQATTACH, 0); return NULL; diff --git a/arch/arm/src/stm32f7/stm32_sdmmc.c b/arch/arm/src/stm32f7/stm32_sdmmc.c index 376f67ce2d3..34a8bdb3d8a 100644 --- a/arch/arm/src/stm32f7/stm32_sdmmc.c +++ b/arch/arm/src/stm32f7/stm32_sdmmc.c @@ -473,10 +473,10 @@ static void stm32_endtransfer(struct stm32_dev_s *priv, sdio_eventset_t wkupeven static int stm32_sdmmc_interrupt(struct stm32_dev_s *sdmmc_dev); #ifdef CONFIG_STM32F7_SDMMC1 -static int stm32_sdmmc1_interrupt(int irq, void *context); +static int stm32_sdmmc1_interrupt(int irq, void *context, void *arg); #endif #ifdef CONFIG_STM32F7_SDMMC2 -static int stm32_sdmmc2_interrupt(int irq, void *context); +static int stm32_sdmmc2_interrupt(int irq, void *context, void *arg); #endif #ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE @@ -1742,7 +1742,7 @@ static int stm32_sdmmc_interrupt(struct stm32_dev_s *priv) ****************************************************************************/ #ifdef CONFIG_STM32F7_SDMMC1 -static int stm32_sdmmc1_interrupt(int irq, void *context) +static int stm32_sdmmc1_interrupt(int irq, void *context, void *arg) { return stm32_sdmmc_interrupt(&g_sdmmcdev1); } @@ -1764,7 +1764,7 @@ static int stm32_sdmmc1_interrupt(int irq, void *context) * ****************************************************************************/ #ifdef CONFIG_STM32F7_SDMMC2 -static int stm32_sdmmc2_interrupt(int irq, void *context) +static int stm32_sdmmc2_interrupt(int irq, void *context, void *arg) { return stm32_sdmmc_interrupt(&g_sdmmcdev2); } @@ -2021,7 +2021,7 @@ static int stm32_attach(FAR struct sdio_dev_s *dev) /* Attach the SDIO interrupt handler */ - ret = irq_attach(priv->nirq, priv->handler); + ret = irq_attach(priv->nirq, priv->handler, NULL); if (ret == OK) { diff --git a/arch/arm/src/stm32f7/stm32_serial.c b/arch/arm/src/stm32f7/stm32_serial.c index 1f5445ac710..3fd262666de 100644 --- a/arch/arm/src/stm32f7/stm32_serial.c +++ b/arch/arm/src/stm32f7/stm32_serial.c @@ -281,7 +281,7 @@ struct up_dev_s const unsigned int rxdma_channel; /* DMA channel assigned */ #endif - int (*const vector)(int irq, void *context); /* Interrupt handler */ + int (*const vector)(int irq, void *context, FAR void *arg); /* Interrupt handler */ /* RX DMA state */ @@ -341,28 +341,28 @@ static int up_pm_prepare(struct pm_callback_s *cb, int domain, #endif #ifdef CONFIG_STM32F7_USART1 -static int up_interrupt_usart1(int irq, void *context); +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); +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); +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); +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); +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); +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); +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); +static int up_interrupt_uart8(int irq, void *context, FAR void *arg); #endif /**************************************************************************** @@ -1681,7 +1681,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->vector); + ret = irq_attach(priv->irq, priv->vector, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -2510,56 +2510,56 @@ static bool up_txready(struct uart_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_STM32F7_USART1 -static int up_interrupt_usart1(int irq, void *context) +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) +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) +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) +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) +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) +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) +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) +static int up_interrupt_uart8(int irq, void *context, FAR void *arg) { return up_interrupt_common(&g_uart8priv); } diff --git a/arch/arm/src/stm32f7/stm32_tim.c b/arch/arm/src/stm32f7/stm32_tim.c index 84934db13dc..7ded94ee339 100644 --- a/arch/arm/src/stm32f7/stm32_tim.c +++ b/arch/arm/src/stm32f7/stm32_tim.c @@ -584,7 +584,7 @@ static int stm32_tim_setisr(FAR struct stm32_tim_dev_s *dev, /* Otherwise set callback and enable interrupt */ - irq_attach(vectorno, handler); + irq_attach(vectorno, handler, NULL); up_enable_irq(vectorno); #ifdef CONFIG_ARCH_IRQPRIO diff --git a/arch/arm/src/stm32f7/stm32_timerisr.c b/arch/arm/src/stm32f7/stm32_timerisr.c index 07cfd01d0f5..52610882356 100644 --- a/arch/arm/src/stm32f7/stm32_timerisr.c +++ b/arch/arm/src/stm32f7/stm32_timerisr.c @@ -104,7 +104,7 @@ * ****************************************************************************/ -static int stm32_timerisr(int irq, uint32_t *regs) +static int stm32_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -136,7 +136,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(STM32_IRQ_SYSTICK, (xcpt_t)stm32_timerisr); + (void)irq_attach(STM32_IRQ_SYSTICK, (xcpt_t)stm32_timerisr, NULL); /* Enable SysTick interrupts: * diff --git a/arch/arm/src/stm32l4/stm32l4_can.c b/arch/arm/src/stm32l4/stm32l4_can.c index 18b49a86e74..ed14ca43609 100644 --- a/arch/arm/src/stm32l4/stm32l4_can.c +++ b/arch/arm/src/stm32l4/stm32l4_can.c @@ -163,9 +163,9 @@ static bool stm32l4can_txempty(FAR struct can_dev_s *dev); /* CAN interrupt handling */ static int stm32l4can_rxinterrupt(int irq, FAR void *context, int rxmb); -static int stm32l4can_rx0interrupt(int irq, FAR void *context); -static int stm32l4can_rx1interrupt(int irq, FAR void *context); -static int stm32l4can_txinterrupt(int irq, FAR void *context); +static int stm32l4can_rx0interrupt(int irq, FAR void *context, FAR void *arg); +static int stm32l4can_rx1interrupt(int irq, FAR void *context, FAR void *arg); +static int stm32l4can_txinterrupt(int irq, FAR void *context, FAR void *arg); /* Initialization */ @@ -627,7 +627,7 @@ static int stm32l4can_setup(FAR struct can_dev_s *dev) * The others are not used. */ - ret = irq_attach(priv->canrx[0], stm32l4can_rx0interrupt); + ret = irq_attach(priv->canrx[0], stm32l4can_rx0interrupt, NULL); if (ret < 0) { canerr("ERROR: Failed to attach CAN%d RX0 IRQ (%d)", @@ -635,7 +635,7 @@ static int stm32l4can_setup(FAR struct can_dev_s *dev) return ret; } - ret = irq_attach(priv->canrx[1], stm32l4can_rx1interrupt); + ret = irq_attach(priv->canrx[1], stm32l4can_rx1interrupt, NULL); if (ret < 0) { canerr("ERROR: Failed to attach CAN%d RX1 IRQ (%d)", @@ -643,7 +643,7 @@ static int stm32l4can_setup(FAR struct can_dev_s *dev) return ret; } - ret = irq_attach(priv->cantx, stm32l4can_txinterrupt); + ret = irq_attach(priv->cantx, stm32l4can_txinterrupt, NULL); if (ret < 0) { canerr("ERROR: Failed to attach CAN%d TX IRQ (%d)", @@ -1462,7 +1462,7 @@ errout: * ****************************************************************************/ -static int stm32l4can_rx0interrupt(int irq, FAR void *context) +static int stm32l4can_rx0interrupt(int irq, FAR void *context, FAR void *arg) { return stm32l4can_rxinterrupt(irq, context, 0); } @@ -1482,7 +1482,7 @@ static int stm32l4can_rx0interrupt(int irq, FAR void *context) * ****************************************************************************/ -static int stm32l4can_rx1interrupt(int irq, FAR void *context) +static int stm32l4can_rx1interrupt(int irq, FAR void *context, FAR void *arg) { return stm32l4can_rxinterrupt(irq, context, 1); } @@ -1502,7 +1502,7 @@ static int stm32l4can_rx1interrupt(int irq, FAR void *context) * ****************************************************************************/ -static int stm32l4can_txinterrupt(int irq, FAR void *context) +static int stm32l4can_txinterrupt(int irq, FAR void *context, FAR void *arg) { FAR struct can_dev_s *dev = NULL; FAR struct stm32l4_can_s *priv; diff --git a/arch/arm/src/stm32l4/stm32l4_exti_alarm.c b/arch/arm/src/stm32l4/stm32l4_exti_alarm.c index c71d9752837..5aec102d178 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_alarm.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_alarm.c @@ -74,7 +74,7 @@ static xcpt_t stm32l4_exti_callback; * ****************************************************************************/ -static int stm32l4_exti_alarm_isr(int irq, void *context) +static int stm32l4_exti_alarm_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -82,7 +82,7 @@ static int stm32l4_exti_alarm_isr(int irq, void *context) if (stm32l4_exti_callback) { - ret = stm32l4_exti_callback(irq, context); + ret = stm32l4_exti_callback(irq, context, arg); } /* Clear the pending EXTI interrupt */ @@ -128,7 +128,7 @@ xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event, if (func) { - irq_attach(STM32L4_IRQ_RTCALRM, stm32l4_exti_alarm_isr); + irq_attach(STM32L4_IRQ_RTCALRM, stm32l4_exti_alarm_isr, NULL); up_enable_irq(STM32L4_IRQ_RTCALRM); } else diff --git a/arch/arm/src/stm32l4/stm32l4_exti_gpio.c b/arch/arm/src/stm32l4/stm32l4_exti_gpio.c index ede05e83221..985d6588c4b 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_gpio.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_gpio.c @@ -71,7 +71,7 @@ static xcpt_t stm32l4_exti_callbacks[16]; * Interrupt Service Routines - Dispatchers ****************************************************************************/ -static int stm32l4_exti0_isr(int irq, void *context) +static int stm32l4_exti0_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -83,13 +83,13 @@ static int stm32l4_exti0_isr(int irq, void *context) if (stm32l4_exti_callbacks[0]) { - ret = stm32l4_exti_callbacks[0](irq, context); + ret = stm32l4_exti_callbacks[0](irq, context, arg); } return ret; } -static int stm32l4_exti1_isr(int irq, void *context) +static int stm32l4_exti1_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -101,13 +101,13 @@ static int stm32l4_exti1_isr(int irq, void *context) if (stm32l4_exti_callbacks[1]) { - ret = stm32l4_exti_callbacks[1](irq, context); + ret = stm32l4_exti_callbacks[1](irq, context, arg); } return ret; } -static int stm32l4_exti2_isr(int irq, void *context) +static int stm32l4_exti2_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -119,13 +119,13 @@ static int stm32l4_exti2_isr(int irq, void *context) if (stm32l4_exti_callbacks[2]) { - ret = stm32l4_exti_callbacks[2](irq, context); + ret = stm32l4_exti_callbacks[2](irq, context, arg); } return ret; } -static int stm32l4_exti3_isr(int irq, void *context) +static int stm32l4_exti3_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -137,13 +137,13 @@ static int stm32l4_exti3_isr(int irq, void *context) if (stm32l4_exti_callbacks[3]) { - ret = stm32l4_exti_callbacks[3](irq, context); + ret = stm32l4_exti_callbacks[3](irq, context, arg); } return ret; } -static int stm32l4_exti4_isr(int irq, void *context) +static int stm32l4_exti4_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -155,13 +155,13 @@ static int stm32l4_exti4_isr(int irq, void *context) if (stm32l4_exti_callbacks[4]) { - ret = stm32l4_exti_callbacks[4](irq, context); + ret = stm32l4_exti_callbacks[4](irq, context, arg); } return ret; } -static int stm32l4_exti_multiisr(int irq, void *context, int first, int last) +static int stm32l4_exti_multiisr(int irq, void *context, void *arg, int first, int last) { uint32_t pr; int pin; @@ -188,7 +188,7 @@ static int stm32l4_exti_multiisr(int irq, void *context, int first, int last) if (stm32l4_exti_callbacks[pin]) { - int tmp = stm32l4_exti_callbacks[pin](irq, context); + int tmp = stm32l4_exti_callbacks[pin](irq, context, arg); if (tmp != OK) { ret = tmp; @@ -200,14 +200,14 @@ static int stm32l4_exti_multiisr(int irq, void *context, int first, int last) return ret; } -static int stm32l4_exti95_isr(int irq, void *context) +static int stm32l4_exti95_isr(int irq, void *context, void *arg) { - return stm32l4_exti_multiisr(irq, context, 5, 9); + return stm32l4_exti_multiisr(irq, context, arg, 5, 9); } -static int stm32l4_exti1510_isr(int irq, void *context) +static int stm32l4_exti1510_isr(int irq, void *context, FAR void *arg) { - return stm32l4_exti_multiisr(irq, context, 10, 15); + return stm32l4_exti_multiisr(irq, context, arg, 10, 15); } /**************************************************************************** @@ -300,7 +300,7 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, if (func) { - irq_attach(irq, handler); + irq_attach(irq, handler, NULL); up_enable_irq(irq); } else diff --git a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c index f037936c649..535183316e3 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c @@ -83,7 +83,7 @@ static xcpt_t stm32l4_exti_pvd_callback; * ****************************************************************************/ -static int stm32l4_exti_pvd_isr(int irq, void *context) +static int stm32l4_exti_pvd_isr(int irq, void *context, FAR void *arg) { int ret = OK; @@ -95,7 +95,7 @@ static int stm32l4_exti_pvd_isr(int irq, void *context) if (stm32l4_exti_pvd_callback) { - ret = stm32l4_exti_pvd_callback(irq, context); + ret = stm32l4_exti_pvd_callback(irq, context, arg); } return ret; @@ -137,7 +137,7 @@ xcpt_t stm32l4_exti_pvd(bool risingedge, bool fallingedge, bool event, if (func) { - irq_attach(STM32L4_IRQ_PVD, stm32l4_exti_pvd_isr); + irq_attach(STM32L4_IRQ_PVD, stm32l4_exti_pvd_isr, NULL); up_enable_irq(STM32L4_IRQ_PVD); } else diff --git a/arch/arm/src/stm32l4/stm32l4_i2c.c b/arch/arm/src/stm32l4/stm32l4_i2c.c index eed199f86dd..48aa7a9b0e2 100644 --- a/arch/arm/src/stm32l4/stm32l4_i2c.c +++ b/arch/arm/src/stm32l4/stm32l4_i2c.c @@ -214,7 +214,7 @@ struct stm32l4_i2c_config_s uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ #ifndef CONFIG_I2C_POLLED - int (*isr)(int, void *); /* Interrupt handler */ + int (*isr)(int, void *, void *); /* Interrupt handler */ uint32_t ev_irq; /* Event IRQ */ uint32_t er_irq; /* Error IRQ */ #endif @@ -292,13 +292,13 @@ static inline uint32_t stm32l4_i2c_getstatus(FAR struct stm32l4_i2c_priv_s *priv static int stm32l4_i2c_isr(struct stm32l4_i2c_priv_s * priv); #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_STM32L4_I2C1 -static int stm32l4_i2c1_isr(int irq, void *context); +static int stm32l4_i2c1_isr(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_STM32L4_I2C2 -static int stm32l4_i2c2_isr(int irq, void *context); +static int stm32l4_i2c2_isr(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_STM32L4_I2C3 -static int stm32l4_i2c3_isr(int irq, void *context); +static int stm32l4_i2c3_isr(int irq, void *context, FAR void *arg); #endif #endif static int stm32l4_i2c_init(FAR struct stm32l4_i2c_priv_s *priv); @@ -1515,7 +1515,7 @@ static int stm32l4_i2c_isr(struct stm32l4_i2c_priv_s *priv) #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_STM32L4_I2C1 -static int stm32l4_i2c1_isr(int irq, void *context) +static int stm32l4_i2c1_isr(int irq, void *context, FAR void *arg) { return stm32l4_i2c_isr(&stm32l4_i2c1_priv); } @@ -1530,7 +1530,7 @@ static int stm32l4_i2c1_isr(int irq, void *context) ************************************************************************************/ #ifdef CONFIG_STM32L4_I2C2 -static int stm32l4_i2c2_isr(int irq, void *context) +static int stm32l4_i2c2_isr(int irq, void *context, FAR void *arg) { return stm32l4_i2c_isr(&stm32l4_i2c2_priv); } @@ -1545,7 +1545,7 @@ static int stm32l4_i2c2_isr(int irq, void *context) ************************************************************************************/ #ifdef CONFIG_STM32L4_I2C3 -static int stm32l4_i2c3_isr(int irq, void *context) +static int stm32l4_i2c3_isr(int irq, void *context, FAR void *arg) { return stm32l4_i2c_isr(&stm32l4_i2c3_priv); } @@ -1590,8 +1590,8 @@ static int stm32l4_i2c_init(FAR struct stm32l4_i2c_priv_s *priv) /* Attach ISRs */ #ifndef CONFIG_I2C_POLLED - irq_attach(priv->config->ev_irq, priv->config->isr); - irq_attach(priv->config->er_irq, priv->config->isr); + irq_attach(priv->config->ev_irq, priv->config->isr, NULL); + irq_attach(priv->config->er_irq, priv->config->isr, NULL); up_enable_irq(priv->config->ev_irq); up_enable_irq(priv->config->er_irq); #endif diff --git a/arch/arm/src/stm32l4/stm32l4_irq.c b/arch/arm/src/stm32l4/stm32l4_irq.c index 720c05ecc69..7a0ed88bd37 100644 --- a/arch/arm/src/stm32l4/stm32l4_irq.c +++ b/arch/arm/src/stm32l4/stm32l4_irq.c @@ -155,7 +155,7 @@ static void stm32l4_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int stm32l4_nmi(int irq, FAR void *context) +static int stm32l4_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -163,7 +163,7 @@ static int stm32l4_nmi(int irq, FAR void *context) return 0; } -static int stm32l4_busfault(int irq, FAR void *context) +static int stm32l4_busfault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Bus fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -171,7 +171,7 @@ static int stm32l4_busfault(int irq, FAR void *context) return 0; } -static int stm32l4_usagefault(int irq, FAR void *context) +static int stm32l4_usagefault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Usage fault received: %08x\n", getreg32(NVIC_CFAULTS)); @@ -179,7 +179,7 @@ static int stm32l4_usagefault(int irq, FAR void *context) return 0; } -static int stm32l4_pendsv(int irq, FAR void *context) +static int stm32l4_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -187,7 +187,7 @@ static int stm32l4_pendsv(int irq, FAR void *context) return 0; } -static int stm32l4_dbgmonitor(int irq, FAR void *context) +static int stm32l4_dbgmonitor(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Debug Monitor received\n"); @@ -195,7 +195,7 @@ static int stm32l4_dbgmonitor(int irq, FAR void *context) return 0; } -static int stm32l4_reserved(int irq, FAR void *context) +static int stm32l4_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -366,8 +366,8 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(STM32L4_IRQ_SVCALL, up_svcall); - irq_attach(STM32L4_IRQ_HARDFAULT, up_hardfault); + irq_attach(STM32L4_IRQ_SVCALL, up_svcall, NULL); + irq_attach(STM32L4_IRQ_HARDFAULT, up_hardfault, NULL); /* Set the priority of the SVCall interrupt */ @@ -383,22 +383,22 @@ void up_irqinitialize(void) */ #ifdef CONFIG_ARM_MPU - irq_attach(STM32L4_IRQ_MEMFAULT, up_memfault); + irq_attach(STM32L4_IRQ_MEMFAULT, up_memfault, NULL); up_enable_irq(STM32L4_IRQ_MEMFAULT); #endif /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(STM32L4_IRQ_NMI, stm32l4_nmi); + irq_attach(STM32L4_IRQ_NMI, stm32l4_nmi, NULL); #ifndef CONFIG_ARM_MPU - irq_attach(STM32L4_IRQ_MEMFAULT, up_memfault); + irq_attach(STM32L4_IRQ_MEMFAULT, up_memfault, NULL); #endif - irq_attach(STM32L4_IRQ_BUSFAULT, stm32l4_busfault); - irq_attach(STM32L4_IRQ_USAGEFAULT, stm32l4_usagefault); - irq_attach(STM32L4_IRQ_PENDSV, stm32l4_pendsv); - irq_attach(STM32L4_IRQ_DBGMONITOR, stm32l4_dbgmonitor); - irq_attach(STM32L4_IRQ_RESERVED, stm32l4_reserved); + irq_attach(STM32L4_IRQ_BUSFAULT, stm32l4_busfault, NULL); + irq_attach(STM32L4_IRQ_USAGEFAULT, stm32l4_usagefault, NULL); + irq_attach(STM32L4_IRQ_PENDSV, stm32l4_pendsv, NULL); + irq_attach(STM32L4_IRQ_DBGMONITOR, stm32l4_dbgmonitor, NULL); + irq_attach(STM32L4_IRQ_RESERVED, stm32l4_reserved, NULL); #endif stm32l4_dumpnvic("initial", NR_IRQS); diff --git a/arch/arm/src/stm32l4/stm32l4_otgfsdev.c b/arch/arm/src/stm32l4/stm32l4_otgfsdev.c index 407534f4fbc..d57701ad6ae 100644 --- a/arch/arm/src/stm32l4/stm32l4_otgfsdev.c +++ b/arch/arm/src/stm32l4/stm32l4_otgfsdev.c @@ -678,7 +678,7 @@ static inline void stm32l4_otginterrupt(FAR struct stm32l4_usbdev_s *priv); /* First level interrupt processing */ -static int stm32l4_usbinterrupt(int irq, FAR void *context); +static int stm32l4_usbinterrupt(int irq, FAR void *context, FAR void *arg); /* Endpoint operations *********************************************************/ /* Global OUT NAK controls */ @@ -3621,7 +3621,7 @@ static inline void stm32l4_otginterrupt(FAR struct stm32l4_usbdev_s *priv) * ****************************************************************************/ -static int stm32l4_usbinterrupt(int irq, FAR void *context) +static int stm32l4_usbinterrupt(int irq, FAR void *context, FAR void *arg) { /* At present, there is only a single OTG FS device support. Hence it is * pre-allocated as g_otgfsdev. However, in most code, the private data @@ -5584,7 +5584,7 @@ void up_usbinitialize(void) /* Attach the OTG FS interrupt handler */ - ret = irq_attach(STM32L4_IRQ_OTGFS, stm32l4_usbinterrupt); + ret = irq_attach(STM32L4_IRQ_OTGFS, stm32l4_usbinterrupt, NULL); if (ret < 0) { uerr("irq_attach failed\n", ret); diff --git a/arch/arm/src/stm32l4/stm32l4_otgfshost.c b/arch/arm/src/stm32l4/stm32l4_otgfshost.c index d47295f429b..f6a34f1f7a4 100644 --- a/arch/arm/src/stm32l4/stm32l4_otgfshost.c +++ b/arch/arm/src/stm32l4/stm32l4_otgfshost.c @@ -405,7 +405,7 @@ static inline void stm32l4_gint_ipxfrisr(FAR struct stm32l4_usbhost_s *priv); /* First level, global interrupt handler */ -static int stm32l4_gint_isr(int irq, FAR void *context); +static int stm32l4_gint_isr(int irq, FAR void *context, FAR void *arg); /* Interrupt controls */ @@ -3436,7 +3436,7 @@ static inline void stm32l4_gint_ipxfrisr(FAR struct stm32l4_usbhost_s *priv) * ****************************************************************************/ -static int stm32l4_gint_isr(int irq, FAR void *context) +static int stm32l4_gint_isr(int irq, FAR void *context, FAR void *arg) { /* At present, there is only support for a single OTG FS host. Hence it is * pre-allocated as g_usbhost. However, in most code, the private data @@ -5307,7 +5307,7 @@ FAR struct usbhost_connection_s *stm32l4_otgfshost_initialize(int controller) /* Attach USB host controller interrupt handler */ - if (irq_attach(STM32L4_IRQ_OTGFS, stm32l4_gint_isr) != 0) + if (irq_attach(STM32L4_IRQ_OTGFS, stm32l4_gint_isr, NULL) != 0) { usbhost_trace1(OTGFS_TRACE1_IRQATTACH, 0); return NULL; diff --git a/arch/arm/src/stm32l4/stm32l4_pwm.c b/arch/arm/src/stm32l4/stm32l4_pwm.c index 80214fb9e5b..fe46e8cc4ef 100644 --- a/arch/arm/src/stm32l4/stm32l4_pwm.c +++ b/arch/arm/src/stm32l4/stm32l4_pwm.c @@ -178,10 +178,10 @@ static int stm32l4pwm_timer(FAR struct stm32l4_pwmtimer_s *priv, #if defined(CONFIG_PWM_PULSECOUNT) && (defined(CONFIG_STM32L4_TIM1_PWM) || defined(CONFIG_STM32L4_TIM8_PWM)) static int stm32l4pwm_interrupt(struct stm32l4_pwmtimer_s *priv); #if defined(CONFIG_STM32L4_TIM1_PWM) -static int stm32l4pwm_tim1interrupt(int irq, void *context); +static int stm32l4pwm_tim1interrupt(int irq, void *context, FAR void *arg); #endif #if defined(CONFIG_STM32L4_TIM8_PWM) -static int stm32l4pwm_tim8interrupt(int irq, void *context); +static int stm32l4pwm_tim8interrupt(int irq, void *context, FAR void *arg); #endif static uint8_t stm32l4pwm_pulsecount(uint32_t count); #endif @@ -1527,14 +1527,14 @@ static int stm32l4pwm_interrupt(struct stm32l4_pwmtimer_s *priv) ****************************************************************************/ #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_STM32L4_TIM1_PWM) -static int stm32l4pwm_tim1interrupt(int irq, void *context) +static int stm32l4pwm_tim1interrupt(int irq, void *context, FAR void *arg) { return stm32l4pwm_interrupt(&g_pwm1dev); } #endif #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_STM32L4_TIM8_PWM) -static int stm32l4pwm_tim8interrupt(int irq, void *context) +static int stm32l4pwm_tim8interrupt(int irq, void *context, FAR void *arg) { return stm32l4pwm_interrupt(&g_pwm8dev); } @@ -2072,7 +2072,7 @@ FAR struct pwm_lowerhalf_s *stm32l4_pwminitialize(int timer) /* Attach but disable the TIM1 update interrupt */ #ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, stm32l4pwm_tim1interrupt); + irq_attach(lower->irq, stm32l4pwm_tim1interrupt, NULL); up_disable_irq(lower->irq); #endif break; @@ -2109,7 +2109,7 @@ FAR struct pwm_lowerhalf_s *stm32l4_pwminitialize(int timer) /* Attach but disable the TIM8 update interrupt */ #ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, stm32l4pwm_tim8interrupt); + irq_attach(lower->irq, stm32l4pwm_tim8interrupt, NULL); up_disable_irq(lower->irq); #endif break; diff --git a/arch/arm/src/stm32l4/stm32l4_qencoder.c b/arch/arm/src/stm32l4/stm32l4_qencoder.c index 4e0ebb0283c..5e2dc4e0018 100644 --- a/arch/arm/src/stm32l4/stm32l4_qencoder.c +++ b/arch/arm/src/stm32l4/stm32l4_qencoder.c @@ -246,22 +246,22 @@ static FAR struct stm32l4_lowerhalf_s *stm32l4_tim2lower(int tim); #ifdef HAVE_16BIT_TIMERS static int stm32l4_interrupt(FAR struct stm32l4_lowerhalf_s *priv); #if defined(CONFIG_STM32L4_TIM1_QE) && TIM1_BITWIDTH == 16 -static int stm32l4_tim1interrupt(int irq, FAR void *context); +static int stm32l4_tim1interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32L4_TIM2_QE) && TIM2_BITWIDTH == 16 -static int stm32l4_tim2interrupt(int irq, FAR void *context); +static int stm32l4_tim2interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32L4_TIM3_QE) && TIM3_BITWIDTH == 16 -static int stm32l4_tim3interrupt(int irq, FAR void *context); +static int stm32l4_tim3interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32L4_TIM4_QE) && TIM4_BITWIDTH == 16 -static int stm32l4_tim4interrupt(int irq, FAR void *context); +static int stm32l4_tim4interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32L4_TIM5_QE) && TIM5_BITWIDTH == 16 -static int stm32l4_tim5interrupt(int irq, FAR void *context); +static int stm32l4_tim5interrupt(int irq, FAR void *context, FAR void * arg); #endif #if defined(CONFIG_STM32L4_TIM8_QE) && TIM8_BITWIDTH == 16 -static int stm32l4_tim8interrupt(int irq, FAR void *context); +static int stm32l4_tim8interrupt(int irq, FAR void *context, FAR void * arg); #endif #endif @@ -685,42 +685,42 @@ static int stm32l4_interrupt(FAR struct stm32l4_lowerhalf_s *priv) ************************************************************************************/ #if defined(CONFIG_STM32L4_TIM1_QE) && TIM1_BITWIDTH == 16 -static int stm32l4_tim1interrupt(int irq, FAR void *context) +static int stm32l4_tim1interrupt(int irq, FAR void *context, FAR void * arg) { return stm32l4_interrupt(&g_tim1lower); } #endif #if defined(CONFIG_STM32L4_TIM2_QE) && TIM2_BITWIDTH == 16 -static int stm32l4_tim2interrupt(int irq, FAR void *context) +static int stm32l4_tim2interrupt(int irq, FAR void *context, FAR void * arg) { return stm32l4_interrupt(&g_tim2lower); } #endif #if defined(CONFIG_STM32L4_TIM3_QE) && TIM3_BITWIDTH == 16 -static int stm32l4_tim3interrupt(int irq, FAR void *context) +static int stm32l4_tim3interrupt(int irq, FAR void *context, FAR void * arg) { return stm32l4_interrupt(&g_tim3lower); } #endif #if defined(CONFIG_STM32L4_TIM4_QE) && TIM4_BITWIDTH == 16 -static int stm32l4_tim4interrupt(int irq, FAR void *context) +static int stm32l4_tim4interrupt(int irq, FAR void *context, FAR void * arg) { return stm32l4_interrupt(&g_tim4lower); } #endif #if defined(CONFIG_STM32L4_TIM5_QE) && TIM5_BITWIDTH == 16 -static int stm32l4_tim5interrupt(int irq, FAR void *context) +static int stm32l4_tim5interrupt(int irq, FAR void *context, FAR void * arg) { return stm32l4_interrupt(&g_tim5lower); } #endif #if defined(CONFIG_STM32L4_TIM8_QE) && TIM8_BITWIDTH == 16 -static int stm32l4_tim8interrupt(int irq, FAR void *context) +static int stm32l4_tim8interrupt(int irq, FAR void *context, FAR void * arg) { return stm32l4_interrupt(&g_tim8lower); } @@ -912,7 +912,7 @@ static int stm32l4_setup(FAR struct qe_lowerhalf_s *lower) { /* Attach the interrupt handler */ - ret = irq_attach(priv->config->irq, priv->config->handler); + ret = irq_attach(priv->config->irq, priv->config->handler, NULL); if (ret < 0) { stm32l4_shutdown(lower); diff --git a/arch/arm/src/stm32l4/stm32l4_qspi.c b/arch/arm/src/stm32l4/stm32l4_qspi.c index 95d2da540b4..0f55e764a0d 100644 --- a/arch/arm/src/stm32l4/stm32l4_qspi.c +++ b/arch/arm/src/stm32l4/stm32l4_qspi.c @@ -281,7 +281,7 @@ static void qspi_dumpgpioconfig(const char *msg); /* Interrupts */ #ifdef STM32L4_QSPI_INTERRUPTS -static int qspi0_interrupt(int irq, void *context); +static int qspi0_interrupt(int irq, void *context, FAR void *arg); #endif @@ -1067,7 +1067,7 @@ static void qspi_ccrconfig(struct stm32l4_qspidev_s *priv, * ****************************************************************************/ -static int qspi0_interrupt(int irq, void *context) +static int qspi0_interrupt(int irq, void *context, FAR void *arg) { uint32_t status; uint32_t cr; @@ -2522,7 +2522,7 @@ struct qspi_dev_s *stm32l4_qspi_initialize(int intf) #ifdef STM32L4_QSPI_INTERRUPTS /* Attach the interrupt handler */ - ret = irq_attach(priv->irq, priv->handler); + ret = irq_attach(priv->irq, priv->handler, NULL); if (ret < 0) { spierr("ERROR: Failed to attach irq %d\n", priv->irq); diff --git a/arch/arm/src/stm32l4/stm32l4_rng.c b/arch/arm/src/stm32l4/stm32l4_rng.c index abd28510374..dd0f782f2d0 100644 --- a/arch/arm/src/stm32l4/stm32l4_rng.c +++ b/arch/arm/src/stm32l4/stm32l4_rng.c @@ -63,7 +63,7 @@ ****************************************************************************/ static int stm32l4_rng_initialize(void); -static int stm32l4_rnginterrupt(int irq, void *context); +static int stm32l4_rnginterrupt(int irq, void *context, FAR void *arg); static void stm32l4_rngenable(void); static void stm32l4_rngdisable(void); static ssize_t stm32l4_rngread(struct file *filep, char *buffer, size_t); @@ -117,7 +117,7 @@ static int stm32l4_rng_initialize(void) sem_init(&g_rngdev.rd_devsem, 0, 1); - if (irq_attach(STM32L4_IRQ_RNG, stm32l4_rnginterrupt)) + if (irq_attach(STM32L4_IRQ_RNG, stm32l4_rnginterrupt, NULL)) { /* We could not attach the ISR to the interrupt */ @@ -157,7 +157,7 @@ static void stm32l4_rngdisable() putreg32(regval, STM32L4_RNG_CR); } -static int stm32l4_rnginterrupt(int irq, void *context) +static int stm32l4_rnginterrupt(int irq, void *context, FAR void *arg) { uint32_t rngsr; uint32_t data; diff --git a/arch/arm/src/stm32l4/stm32l4_rtcc.c b/arch/arm/src/stm32l4/stm32l4_rtcc.c index 1ee4306080f..d783804c084 100644 --- a/arch/arm/src/stm32l4/stm32l4_rtcc.c +++ b/arch/arm/src/stm32l4/stm32l4_rtcc.c @@ -512,7 +512,7 @@ static void rtc_resume(void) ************************************************************************************/ #ifdef CONFIG_RTC_ALARM -static int stm32l4_rtc_alarm_handler(int irq, FAR void *context) +static int stm32l4_rtc_alarm_handler(int irq, FAR void *context, FAR void *rtc_handler_arg) { FAR struct alm_cbinfo_s *cbinfo; alm_callback_t cb; diff --git a/arch/arm/src/stm32l4/stm32l4_serial.c b/arch/arm/src/stm32l4/stm32l4_serial.c index e8c05428ee4..14e82953fec 100644 --- a/arch/arm/src/stm32l4/stm32l4_serial.c +++ b/arch/arm/src/stm32l4/stm32l4_serial.c @@ -243,7 +243,7 @@ struct stm32l4_serial_s const unsigned int rxdma_channel; /* DMA channel assigned */ #endif - int (*const vector)(int irq, void *context); /* Interrupt handler */ + int (*const vector)(int irq, void *context, FAR void *arg); /* Interrupt handler */ /* RX DMA state */ @@ -308,19 +308,19 @@ static int stm32l4serial_pmprepare(FAR struct pm_callback_s *cb, int domain, #endif #ifdef CONFIG_STM32L4_USART1 -static int up_interrupt_usart1(int irq, FAR void *context); +static int up_interrupt_usart1(int irq, FAR void *context, FAR void *arg); #endif #ifdef CONFIG_STM32L4_USART2 -static int up_interrupt_usart2(int irq, FAR void *context); +static int up_interrupt_usart2(int irq, FAR void *context, FAR void *arg); #endif #ifdef CONFIG_STM32L4_USART3 -static int up_interrupt_usart3(int irq, FAR void *context); +static int up_interrupt_usart3(int irq, FAR void *context, FAR void *arg); #endif #ifdef CONFIG_STM32L4_UART4 -static int up_interrupt_uart4(int irq, FAR void *context); +static int up_interrupt_uart4(int irq, FAR void *context, FAR void *arg); #endif #ifdef CONFIG_STM32L4_UART5 -static int up_interrupt_uart5(int irq, FAR void *context); +static int up_interrupt_uart5(int irq, FAR void *context, FAR void *arg); #endif /**************************************************************************** @@ -1399,7 +1399,7 @@ static int stm32l4serial_attach(FAR struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->vector); + ret = irq_attach(priv->irq, priv->vector, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -2209,35 +2209,35 @@ static bool stm32l4serial_txready(FAR struct uart_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_STM32L4_USART1 -static int up_interrupt_usart1(int irq, FAR void *context) +static int up_interrupt_usart1(int irq, FAR void *context, FAR void *arg) { return up_interrupt_common(&g_usart1priv); } #endif #ifdef CONFIG_STM32L4_USART2 -static int up_interrupt_usart2(int irq, FAR void *context) +static int up_interrupt_usart2(int irq, FAR void *context, FAR void *arg) { return up_interrupt_common(&g_usart2priv); } #endif #ifdef CONFIG_STM32L4_USART3 -static int up_interrupt_usart3(int irq, FAR void *context) +static int up_interrupt_usart3(int irq, FAR void *context, FAR void *arg) { return up_interrupt_common(&g_usart3priv); } #endif #ifdef CONFIG_STM32L4_UART4 -static int up_interrupt_uart4(int irq, FAR void *context) +static int up_interrupt_uart4(int irq, FAR void *context, FAR void *arg) { return up_interrupt_common(&g_uart4priv); } #endif #ifdef CONFIG_STM32L4_UART5 -static int up_interrupt_uart5(int irq, FAR void *context) +static int up_interrupt_uart5(int irq, FAR void *context, FAR void *arg) { return up_interrupt_common(&g_uart5priv); } diff --git a/arch/arm/src/stm32l4/stm32l4_tim.c b/arch/arm/src/stm32l4/stm32l4_tim.c index 57440d902aa..b1194446492 100644 --- a/arch/arm/src/stm32l4/stm32l4_tim.c +++ b/arch/arm/src/stm32l4/stm32l4_tim.c @@ -1239,7 +1239,7 @@ static int stm32l4_tim_setisr(FAR struct stm32l4_tim_dev_s *dev, /* Otherwise set callback and enable interrupt */ - irq_attach(vectorno, handler); + irq_attach(vectorno, handler, NULL); up_enable_irq(vectorno); #ifdef CONFIG_ARCH_IRQPRIO diff --git a/arch/arm/src/stm32l4/stm32l4_timerisr.c b/arch/arm/src/stm32l4/stm32l4_timerisr.c index fff106e8525..4fdec1a6209 100644 --- a/arch/arm/src/stm32l4/stm32l4_timerisr.c +++ b/arch/arm/src/stm32l4/stm32l4_timerisr.c @@ -98,7 +98,7 @@ * ****************************************************************************/ -static int stm32l4_timerisr(int irq, uint32_t *regs) +static int stm32l4_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -148,7 +148,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(STM32L4_IRQ_SYSTICK, (xcpt_t)stm32l4_timerisr); + (void)irq_attach(STM32L4_IRQ_SYSTICK, (xcpt_t)stm32l4_timerisr, NULL); /* Enable SysTick interrupts */ diff --git a/arch/arm/src/stm32l4/stm32l4x6xx_dma.c b/arch/arm/src/stm32l4/stm32l4x6xx_dma.c index e05173d82c4..335e008b182 100644 --- a/arch/arm/src/stm32l4/stm32l4x6xx_dma.c +++ b/arch/arm/src/stm32l4/stm32l4x6xx_dma.c @@ -275,7 +275,7 @@ static void stm32l4_dmachandisable(struct stm32l4_dma_s *dmach) * ************************************************************************************/ -static int stm32l4_dmainterrupt(int irq, void *context) +static int stm32l4_dmainterrupt(int irq, void *context, FAR void *arg) { struct stm32l4_dma_s *dmach; uint32_t isr; @@ -351,7 +351,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vectors */ - (void)irq_attach(dmach->irq, stm32l4_dmainterrupt); + (void)irq_attach(dmach->irq, stm32l4_dmainterrupt, NULL); /* Disable the DMA channel */ diff --git a/arch/arm/src/str71x/str71x_serial.c b/arch/arm/src/str71x/str71x_serial.c index fe98f543aa7..3e5076648ed 100644 --- a/arch/arm/src/str71x/str71x_serial.c +++ b/arch/arm/src/str71x/str71x_serial.c @@ -254,7 +254,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -618,7 +618,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -667,7 +667,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/str71x/str71x_timerisr.c b/arch/arm/src/str71x/str71x_timerisr.c index 553705d24cc..8fe2bda5aa5 100644 --- a/arch/arm/src/str71x/str71x_timerisr.c +++ b/arch/arm/src/str71x/str71x_timerisr.c @@ -126,7 +126,7 @@ * ****************************************************************************/ -static int str71x_timerisr(int irq, uint32_t *regs) +static int str71x_timerisr(int irq, uint32_t *regs, void *arg) { uint16_t ocar; @@ -204,7 +204,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(STR71X_IRQ_SYSTIMER, (xcpt_t)str71x_timerisr); + (void)irq_attach(STR71X_IRQ_SYSTIMER, (xcpt_t)str71x_timerisr, NULL); /* And enable the timer interrupt */ diff --git a/arch/arm/src/str71x/str71x_xti.c b/arch/arm/src/str71x/str71x_xti.c index 1bb42e656b9..386b01784bb 100644 --- a/arch/arm/src/str71x/str71x_xti.c +++ b/arch/arm/src/str71x/str71x_xti.c @@ -95,7 +95,7 @@ static const struct xtiregs_s g_xtiregs[2] = * ********************************************************************************/ -static int str71x_xtiinterrupt(int irq, FAR void *context) +static int str71x_xtiinterrupt(int irq, FAR void *context, FAR void *arg) { uint16_t enabled = (uint16_t)getreg8(STR71X_XTI_MRH) << 8 | (uint16_t)getreg8(STR71X_XTI_MRL); @@ -168,7 +168,7 @@ int str71x_xtiinitialize(void) /* Attach the XTI interrupt */ - ret = irq_attach(STR71X_IRQ_XTI, str71x_xtiinterrupt); + ret = irq_attach(STR71X_IRQ_XTI, str71x_xtiinterrupt, NULL); if (ret == OK) { /* Enable the XTI interrupt at the XTI */ diff --git a/arch/arm/src/tiva/lm3s_ethernet.c b/arch/arm/src/tiva/lm3s_ethernet.c index 0671306553e..3e0895d9f1c 100644 --- a/arch/arm/src/tiva/lm3s_ethernet.c +++ b/arch/arm/src/tiva/lm3s_ethernet.c @@ -251,7 +251,7 @@ static void tiva_receive(struct tiva_driver_s *priv); static void tiva_txdone(struct tiva_driver_s *priv); static void tiva_interrupt_work(void *arg); -static int tiva_interrupt(int irq, void *context); +static int tiva_interrupt(int irq, void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -1052,7 +1052,7 @@ static void tiva_interrupt_work(void *arg) * ****************************************************************************/ -static int tiva_interrupt(int irq, void *context) +static int tiva_interrupt(int irq, void *context, FAR void *arg) { struct tiva_driver_s *priv; uint32_t ris; @@ -1741,9 +1741,9 @@ static inline int tiva_ethinitialize(int intf) /* Attach the IRQ to the driver */ #if TIVA_NETHCONTROLLERS > 1 - ret = irq_attach(priv->irq, tiva_interrupt); + ret = irq_attach(priv->irq, tiva_interrupt, NULL); #else - ret = irq_attach(TIVA_IRQ_ETHCON, tiva_interrupt); + ret = irq_attach(TIVA_IRQ_ETHCON, tiva_interrupt, NULL); #endif if (ret != 0) { diff --git a/arch/arm/src/tiva/tiva_adclib.c b/arch/arm/src/tiva/tiva_adclib.c index 8376e51cc8b..dc2768fc163 100644 --- a/arch/arm/src/tiva/tiva_adclib.c +++ b/arch/arm/src/tiva/tiva_adclib.c @@ -414,7 +414,7 @@ void tiva_adc_irq_attach(uint8_t adc, uint8_t sse, xcpt_t isr) isr, adc, sse, irq); #endif - ret = irq_attach(irq, isr); + ret = irq_attach(irq, isr, NULL); if (ret < 0) { aerr("ERROR: Failed to attach IRQ %d: %d\n", irq, ret); diff --git a/arch/arm/src/tiva/tiva_gpioirq.c b/arch/arm/src/tiva/tiva_gpioirq.c index 1023dd7bc23..f8279d6f382 100644 --- a/arch/arm/src/tiva/tiva_gpioirq.c +++ b/arch/arm/src/tiva/tiva_gpioirq.c @@ -308,7 +308,7 @@ static int tiva_gpioporthandler(uint8_t port, void *context) g_gpioportirqvector[TIVA_GPIO_IRQ_IDX(port, pin)], TIVA_GPIO_IRQ_IDX(port, pin)); - g_gpioportirqvector[TIVA_GPIO_IRQ_IDX(port, pin)](irq, context); + g_gpioportirqvector[TIVA_GPIO_IRQ_IDX(port, pin)](irq, context, NULL); } } } @@ -317,7 +317,7 @@ static int tiva_gpioporthandler(uint8_t port, void *context) } #ifdef CONFIG_TIVA_GPIOA_IRQS -static int tiva_gpioahandler(int irq, FAR void *context) +static int tiva_gpioahandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -330,7 +330,7 @@ static int tiva_gpioahandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOB_IRQS -static int tiva_gpiobhandler(int irq, FAR void *context) +static int tiva_gpiobhandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -343,7 +343,7 @@ static int tiva_gpiobhandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOC_IRQS -static int tiva_gpiochandler(int irq, FAR void *context) +static int tiva_gpiochandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -356,7 +356,7 @@ static int tiva_gpiochandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOD_IRQS -static int tiva_gpiodhandler(int irq, FAR void *context) +static int tiva_gpiodhandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -369,7 +369,7 @@ static int tiva_gpiodhandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOE_IRQS -static int tiva_gpioehandler(int irq, FAR void *context) +static int tiva_gpioehandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -382,7 +382,7 @@ static int tiva_gpioehandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOF_IRQS -static int tiva_gpiofhandler(int irq, FAR void *context) +static int tiva_gpiofhandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -395,7 +395,7 @@ static int tiva_gpiofhandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOG_IRQS -static int tiva_gpioghandler(int irq, FAR void *context) +static int tiva_gpioghandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -408,7 +408,7 @@ static int tiva_gpioghandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOH_IRQS -static int tiva_gpiohhandler(int irq, FAR void *context) +static int tiva_gpiohhandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -421,7 +421,7 @@ static int tiva_gpiohhandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOJ_IRQS -static int tiva_gpiojhandler(int irq, FAR void *context) +static int tiva_gpiojhandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -434,7 +434,7 @@ static int tiva_gpiojhandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOK_IRQS -static int tiva_gpiokhandler(int irq, FAR void *context) +static int tiva_gpiokhandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -447,7 +447,7 @@ static int tiva_gpiokhandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOL_IRQS -static int tiva_gpiolhandler(int irq, FAR void *context) +static int tiva_gpiolhandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -460,7 +460,7 @@ static int tiva_gpiolhandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOM_IRQS -static int tiva_gpiomhandler(int irq, FAR void *context) +static int tiva_gpiomhandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -473,7 +473,7 @@ static int tiva_gpiomhandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPION_IRQS -static int tiva_gpionhandler(int irq, FAR void *context) +static int tiva_gpionhandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -486,7 +486,7 @@ static int tiva_gpionhandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOP_IRQS -static int tiva_gpiophandler(int irq, FAR void *context) +static int tiva_gpiophandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -499,7 +499,7 @@ static int tiva_gpiophandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOQ_IRQS -static int tiva_gpioqhandler(int irq, FAR void *context) +static int tiva_gpioqhandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -512,7 +512,7 @@ static int tiva_gpioqhandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOR_IRQS -static int tiva_gpiorhandler(int irq, FAR void *context) +static int tiva_gpiorhandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -525,7 +525,7 @@ static int tiva_gpiorhandler(int irq, FAR void *context) #endif #ifdef CONFIG_TIVA_GPIOS_IRQS -static int tiva_gpioshandler(int irq, FAR void *context) +static int tiva_gpioshandler(int irq, FAR void *context, FAR void *arg) { irqstate_t flags; flags = enter_critical_section(); @@ -568,87 +568,87 @@ int tiva_gpioirqinitialize(void) */ #ifdef CONFIG_TIVA_GPIOA_IRQS - irq_attach(TIVA_IRQ_GPIOA, tiva_gpioahandler); + irq_attach(TIVA_IRQ_GPIOA, tiva_gpioahandler, NULL); up_enable_irq(TIVA_IRQ_GPIOA); #endif #ifdef CONFIG_TIVA_GPIOB_IRQS - irq_attach(TIVA_IRQ_GPIOB, tiva_gpiobhandler); + irq_attach(TIVA_IRQ_GPIOB, tiva_gpiobhandler, NULL); up_enable_irq(TIVA_IRQ_GPIOB); #endif #ifdef CONFIG_TIVA_GPIOC_IRQS - irq_attach(TIVA_IRQ_GPIOC, tiva_gpiochandler); + irq_attach(TIVA_IRQ_GPIOC, tiva_gpiochandler, NULL); up_enable_irq(TIVA_IRQ_GPIOC); #endif #ifdef CONFIG_TIVA_GPIOD_IRQS - irq_attach(TIVA_IRQ_GPIOD, tiva_gpiodhandler); + irq_attach(TIVA_IRQ_GPIOD, tiva_gpiodhandler, NULL); up_enable_irq(TIVA_IRQ_GPIOD); #endif #ifdef CONFIG_TIVA_GPIOE_IRQS - irq_attach(TIVA_IRQ_GPIOE, tiva_gpioehandler); + irq_attach(TIVA_IRQ_GPIOE, tiva_gpioehandler, NULL); up_enable_irq(TIVA_IRQ_GPIOE); #endif #ifdef CONFIG_TIVA_GPIOF_IRQS - irq_attach(TIVA_IRQ_GPIOF, tiva_gpiofhandler); + irq_attach(TIVA_IRQ_GPIOF, tiva_gpiofhandler, NULL); up_enable_irq(TIVA_IRQ_GPIOF); #endif #ifdef CONFIG_TIVA_GPIOG_IRQS - irq_attach(TIVA_IRQ_GPIOG, tiva_gpioghandler); + irq_attach(TIVA_IRQ_GPIOG, tiva_gpioghandler, NULL); up_enable_irq(TIVA_IRQ_GPIOG); #endif #ifdef CONFIG_TIVA_GPIOH_IRQS - irq_attach(TIVA_IRQ_GPIOH, tiva_gpiohhandler); + irq_attach(TIVA_IRQ_GPIOH, tiva_gpiohhandler, NULL); up_enable_irq(TIVA_IRQ_GPIOH); #endif #ifdef CONFIG_TIVA_GPIOJ_IRQS - irq_attach(TIVA_IRQ_GPIOJ, tiva_gpiojhandler); + irq_attach(TIVA_IRQ_GPIOJ, tiva_gpiojhandler, NULL); up_enable_irq(TIVA_IRQ_GPIOJ); #endif #ifdef CONFIG_TIVA_GPIOK_IRQS - irq_attach(TIVA_IRQ_GPIOK, tiva_gpiokhandler); + irq_attach(TIVA_IRQ_GPIOK, tiva_gpiokhandler, NULL); up_enable_irq(TIVA_IRQ_GPIOK); #endif #ifdef CONFIG_TIVA_GPIOL_IRQS - irq_attach(TIVA_IRQ_GPIOL, tiva_gpiolhandler); + irq_attach(TIVA_IRQ_GPIOL, tiva_gpiolhandler, NULL); up_enable_irq(TIVA_IRQ_GPIOL); #endif #ifdef CONFIG_TIVA_GPIOM_IRQS - irq_attach(TIVA_IRQ_GPIOM, tiva_gpiomhandler); + irq_attach(TIVA_IRQ_GPIOM, tiva_gpiomhandler, NULL); up_enable_irq(TIVA_IRQ_GPIOM); #endif #ifdef CONFIG_TIVA_GPION_IRQS - irq_attach(TIVA_IRQ_GPION, tiva_gpionhandler); + irq_attach(TIVA_IRQ_GPION, tiva_gpionhandler, NULL); up_enable_irq(TIVA_IRQ_GPION); #endif #ifdef CONFIG_TIVA_GPIOP_IRQS - irq_attach(TIVA_IRQ_GPIOP, tiva_gpiophandler); + irq_attach(TIVA_IRQ_GPIOP, tiva_gpiophandler, NULL); up_enable_irq(TIVA_IRQ_GPIOP); #endif #ifdef CONFIG_TIVA_GPIOQ_IRQS - irq_attach(TIVA_IRQ_GPIOQ, tiva_gpioqhandler); + irq_attach(TIVA_IRQ_GPIOQ, tiva_gpioqhandler, NULL); up_enable_irq(TIVA_IRQ_GPIOQ); #endif #ifdef CONFIG_TIVA_GPIOR_IRQS - irq_attach(TIVA_IRQ_GPIOR, tiva_gpiorhandler); + irq_attach(TIVA_IRQ_GPIOR, tiva_gpiorhandler, NULL); up_enable_irq(TIVA_IRQ_GPIOR); #endif #ifdef CONFIG_TIVA_GPIOS_IRQS - irq_attach(TIVA_IRQ_GPIOS, tiva_gpioshandler); + irq_attach(TIVA_IRQ_GPIOS, tiva_gpioshandler, NULL); up_enable_irq(TIVA_IRQ_GPIOS); #endif @@ -742,11 +742,11 @@ void tiva_gpioportirqattach(uint8_t port, xcpt_t isr) if (isr == NULL) { tiva_gpioirqdisable(port, 0xff); - irq_attach(irq, irq_unexpected_isr); + irq_attach(irq, irq_unexpected_isr, NULL); } else { - irq_attach(irq, isr); + irq_attach(irq, isr, NULL); tiva_gpioirqenable(port, 0xff); } diff --git a/arch/arm/src/tiva/tiva_i2c.c b/arch/arm/src/tiva/tiva_i2c.c index 13b9c7b5adf..558a72554ca 100644 --- a/arch/arm/src/tiva/tiva_i2c.c +++ b/arch/arm/src/tiva/tiva_i2c.c @@ -195,7 +195,7 @@ struct tiva_i2c_config_s uint32_t scl_pin; /* GPIO configuration for SCL as SCL */ uint32_t sda_pin; /* GPIO configuration for SDA as SDA */ #ifndef CONFIG_I2C_POLLED - int (*isr)(int, void *); /* Interrupt handler */ + int (*isr)(int, void *, void *); /* Interrupt handler */ uint8_t irq; /* IRQ number */ #endif uint8_t devno; /* I2Cn where n = devno */ @@ -286,34 +286,34 @@ static int tiva_i2c_interrupt(struct tiva_i2c_priv_s * priv, uint32_t status); #ifndef CONFIG_I2C_POLLED #ifdef CONFIG_TIVA_I2C0 -static int tiva_i2c0_interrupt(int irq, void *context); +static int tiva_i2c0_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_TIVA_I2C1 -static int tiva_i2c1_interrupt(int irq, void *context); +static int tiva_i2c1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_TIVA_I2C2 -static int tiva_i2c2_interrupt(int irq, void *context); +static int tiva_i2c2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_TIVA_I2C3 -static int tiva_i2c3_interrupt(int irq, void *context); +static int tiva_i2c3_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_TIVA_I2C4 -static int tiva_i2c4_interrupt(int irq, void *context); +static int tiva_i2c4_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_TIVA_I2C5 -static int tiva_i2c5_interrupt(int irq, void *context); +static int tiva_i2c5_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_TIVA_I2C6 -static int tiva_i2c6_interrupt(int irq, void *context); +static int tiva_i2c6_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_TIVA_I2C7 -static int tiva_i2c7_interrupt(int irq, void *context); +static int tiva_i2c7_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_TIVA_I2C8 -static int tiva_i2c8_interrupt(int irq, void *context); +static int tiva_i2c8_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_TIVA_I2C9 -static int tiva_i2c9_interrupt(int irq, void *context); +static int tiva_i2c9_interrupt(int irq, void *context, FAR void *arg); #endif #endif /* !CONFIG_I2C_POLLED */ @@ -1419,7 +1419,7 @@ static int tiva_i2c_interrupt(struct tiva_i2c_priv_s *priv, uint32_t status) ************************************************************************************/ #if !defined(CONFIG_I2C_POLLED) && defined(CONFIG_TIVA_I2C0) -static int tiva_i2c0_interrupt(int irq, void *context) +static int tiva_i2c0_interrupt(int irq, void *context, void *arg) { struct tiva_i2c_priv_s *priv; uint32_t status; @@ -1444,7 +1444,7 @@ static int tiva_i2c0_interrupt(int irq, void *context) ************************************************************************************/ #if !defined(CONFIG_I2C_POLLED) && defined(CONFIG_TIVA_I2C1) -static int tiva_i2c1_interrupt(int irq, void *context) +static int tiva_i2c1_interrupt(int irq, void *context, FAR void *arg) { struct tiva_i2c_priv_s *priv; uint32_t status; @@ -1469,7 +1469,7 @@ static int tiva_i2c1_interrupt(int irq, void *context) ************************************************************************************/ #if !defined(CONFIG_I2C_POLLED) && defined(CONFIG_TIVA_I2C2) -static int tiva_i2c2_interrupt(int irq, void *context) +static int tiva_i2c2_interrupt(int irq, void *context, FAR void *arg) { struct tiva_i2c_priv_s *priv; uint32_t status; @@ -1494,7 +1494,7 @@ static int tiva_i2c2_interrupt(int irq, void *context) ************************************************************************************/ #if !defined(CONFIG_I2C_POLLED) && defined(CONFIG_TIVA_I2C3) -static int tiva_i2c3_interrupt(int irq, void *context) +static int tiva_i2c3_interrupt(int irq, void *context, FAR void *arg) { struct tiva_i2c_priv_s *priv; uint32_t status; @@ -1519,7 +1519,7 @@ static int tiva_i2c3_interrupt(int irq, void *context) ************************************************************************************/ #if !defined(CONFIG_I2C_POLLED) && defined(CONFIG_TIVA_I2C4) -static int tiva_i2c4_interrupt(int irq, void *context) +static int tiva_i2c4_interrupt(int irq, void *context, FAR void *arg) { struct tiva_i2c_priv_s *priv; uint32_t status; @@ -1544,7 +1544,7 @@ static int tiva_i2c4_interrupt(int irq, void *context) ************************************************************************************/ #if !defined(CONFIG_I2C_POLLED) && defined(CONFIG_TIVA_I2C5) -static int tiva_i2c5_interrupt(int irq, void *context) +static int tiva_i2c5_interrupt(int irq, void *context, FAR void *arg) { struct tiva_i2c_priv_s *priv; uint32_t status; @@ -1569,7 +1569,7 @@ static int tiva_i2c5_interrupt(int irq, void *context) ************************************************************************************/ #if !defined(CONFIG_I2C_POLLED) && defined(CONFIG_TIVA_I2C6) -static int tiva_i2c6_interrupt(int irq, void *context) +static int tiva_i2c6_interrupt(int irq, void *context, FAR void *arg) { struct tiva_i2c_priv_s *priv; uint32_t status; @@ -1594,7 +1594,7 @@ static int tiva_i2c6_interrupt(int irq, void *context) ************************************************************************************/ #if !defined(CONFIG_I2C_POLLED) && defined(CONFIG_TIVA_I2C7) -static int tiva_i2c7_interrupt(int irq, void *context) +static int tiva_i2c7_interrupt(int irq, void *context, FAR void *arg) { struct tiva_i2c_priv_s *priv; uint32_t status; @@ -1619,7 +1619,7 @@ static int tiva_i2c7_interrupt(int irq, void *context) ************************************************************************************/ #if !defined(CONFIG_I2C_POLLED) && defined(CONFIG_TIVA_I2C8) -static int tiva_i2c8_interrupt(int irq, void *context) +static int tiva_i2c8_interrupt(int irq, void *context, FAR void *arg) { struct tiva_i2c_priv_s *priv; uint32_t status; @@ -1644,7 +1644,7 @@ static int tiva_i2c8_interrupt(int irq, void *context) ************************************************************************************/ #if !defined(CONFIG_I2C_POLLED) && defined(CONFIG_TIVA_I2C9) -static int tiva_i2c9_interrupt(int irq, void *context) +static int tiva_i2c9_interrupt(int irq, void *context, FAR void *arg) { struct tiva_i2c_priv_s *priv; uint32_t status; @@ -1758,7 +1758,7 @@ static int tiva_i2c_initialize(struct tiva_i2c_priv_s *priv, uint32_t frequency) */ #ifndef CONFIG_I2C_POLLED - (void)irq_attach(config->irq, config->isr); + (void)irq_attach(config->irq, config->isr, NULL); up_enable_irq(config->irq); #endif diff --git a/arch/arm/src/tiva/tiva_irq.c b/arch/arm/src/tiva/tiva_irq.c index 6771007d59e..9099c54a2e9 100644 --- a/arch/arm/src/tiva/tiva_irq.c +++ b/arch/arm/src/tiva/tiva_irq.c @@ -196,7 +196,7 @@ static void tiva_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -static int tiva_nmi(int irq, FAR void *context) +static int tiva_nmi(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! NMI received\n"); @@ -204,7 +204,7 @@ static int tiva_nmi(int irq, FAR void *context) return 0; } -static int tiva_busfault(int irq, FAR void *context) +static int tiva_busfault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Bus fault recived\n"); @@ -212,7 +212,7 @@ static int tiva_busfault(int irq, FAR void *context) return 0; } -static int tiva_usagefault(int irq, FAR void *context) +static int tiva_usagefault(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Usage fault received\n"); @@ -220,7 +220,7 @@ static int tiva_usagefault(int irq, FAR void *context) return 0; } -static int tiva_pendsv(int irq, FAR void *context) +static int tiva_pendsv(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! PendSV received\n"); @@ -228,7 +228,7 @@ static int tiva_pendsv(int irq, FAR void *context) return 0; } -static int tiva_dbgmonitor(int irq, FAR void *context) +static int tiva_dbgmonitor(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Debug Monitor received\n"); @@ -236,7 +236,7 @@ static int tiva_dbgmonitor(int irq, FAR void *context) return 0; } -static int tiva_reserved(int irq, FAR void *context) +static int tiva_reserved(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("PANIC!!! Reserved interrupt\n"); @@ -451,8 +451,8 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(TIVA_IRQ_SVCALL, up_svcall); - irq_attach(TIVA_IRQ_HARDFAULT, up_hardfault); + irq_attach(TIVA_IRQ_SVCALL, up_svcall, NULL); + irq_attach(TIVA_IRQ_HARDFAULT, up_hardfault, NULL); /* Set the priority of the SVCall interrupt */ @@ -468,22 +468,22 @@ void up_irqinitialize(void) */ #ifdef CONFIG_ARM_MPU - irq_attach(TIVA_IRQ_MEMFAULT, up_memfault); + irq_attach(TIVA_IRQ_MEMFAULT, up_memfault, NULL); up_enable_irq(TIVA_IRQ_MEMFAULT); #endif /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES - irq_attach(TIVA_IRQ_NMI, tiva_nmi); + irq_attach(TIVA_IRQ_NMI, tiva_nmi, NULL); #ifndef CONFIG_ARM_MPU - irq_attach(TIVA_IRQ_MEMFAULT, up_memfault); + irq_attach(TIVA_IRQ_MEMFAULT, up_memfault, NULL); #endif - irq_attach(TIVA_IRQ_BUSFAULT, tiva_busfault); - irq_attach(TIVA_IRQ_USAGEFAULT, tiva_usagefault); - irq_attach(TIVA_IRQ_PENDSV, tiva_pendsv); - irq_attach(TIVA_IRQ_DBGMONITOR, tiva_dbgmonitor); - irq_attach(TIVA_IRQ_RESERVED, tiva_reserved); + irq_attach(TIVA_IRQ_BUSFAULT, tiva_busfault, NULL); + irq_attach(TIVA_IRQ_USAGEFAULT, tiva_usagefault, NULL); + irq_attach(TIVA_IRQ_PENDSV, tiva_pendsv, NULL); + irq_attach(TIVA_IRQ_DBGMONITOR, tiva_dbgmonitor, NULL); + irq_attach(TIVA_IRQ_RESERVED, tiva_reserved, NULL); #endif tiva_dumpnvic("initial", NR_IRQS); diff --git a/arch/arm/src/tiva/tiva_pwm.c b/arch/arm/src/tiva/tiva_pwm.c index 73b86349b33..0e882f0f7c1 100644 --- a/arch/arm/src/tiva/tiva_pwm.c +++ b/arch/arm/src/tiva/tiva_pwm.c @@ -99,19 +99,19 @@ struct tiva_pwm_chan_s ************************************************************************************/ #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_TIVA_PWM0_CHAN0) -static int tiva_pwm_gen0_interrupt(int irq, FAR void *context); +static int tiva_pwm_gen0_interrupt(int irq, FAR void *context, FAR void *arg); #endif #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_TIVA_PWM0_CHAN2) -static int tiva_pwm_gen1_interrupt(int irq, FAR void *context); +static int tiva_pwm_gen1_interrupt(int irq, FAR void *context, FAR void *arg); #endif #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_TIVA_PWM0_CHAN4) -static int tiva_pwm_gen2_interrupt(int irq, FAR void *context); +static int tiva_pwm_gen2_interrupt(int irq, FAR void *context, FAR void *arg); #endif #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_TIVA_PWM0_CHAN6) -static int tiva_pwm_gen3_interrupt(int irq, FAR void *context); +static int tiva_pwm_gen3_interrupt(int irq, FAR void *context, FAR void *arg); #endif #if defined(CONFIG_PWM_PULSECOUNT) && \ @@ -321,28 +321,28 @@ static struct tiva_pwm_chan_s g_pwm_chan7 = ************************************************************************************/ #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_TIVA_PWM0_CHAN0) -static int tiva_pwm_gen0_interrupt(int irq, FAR void *context) +static int tiva_pwm_gen0_interrupt(int irq, FAR void *context, FAR void *arg) { return tiva_pwm_interrupt(&g_pwm_chan0); } #endif #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_TIVA_PWM0_CHAN2) -static int tiva_pwm_gen1_interrupt(int irq, FAR void *context) +static int tiva_pwm_gen1_interrupt(int irq, FAR void *context, FAR void *arg) { return tiva_pwm_interrupt(&g_pwm_chan2); } #endif #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_TIVA_PWM0_CHAN4) -static int tiva_pwm_gen2_interrupt(int irq, FAR void *context) +static int tiva_pwm_gen2_interrupt(int irq, FAR void *context, FAR void *arg) { return tiva_pwm_interrupt(&g_pwm_chan4); } #endif #if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_TIVA_PWM0_CHAN6) -static int tiva_pwm_gen3_interrupt(int irq, FAR void *context) +static int tiva_pwm_gen3_interrupt(int irq, FAR void *context, FAR void *arg) { return tiva_pwm_interrupt(&g_pwm_chan6); } @@ -832,28 +832,28 @@ FAR struct pwm_lowerhalf_s *tiva_pwm_initialize(int channel) { #ifdef CONFIG_TIVA_PWM0_CHAN0 case 0: - irq_attach(chan->irq, tiva_pwm_gen0_interrupt); + irq_attach(chan->irq, tiva_pwm_gen0_interrupt, NULL); up_enable_irq(chan->irq); break; #endif #ifdef CONFIG_TIVA_PWM0_CHAN2 case 2: - irq_attach(chan->irq, tiva_pwm_gen1_interrupt); + irq_attach(chan->irq, tiva_pwm_gen1_interrupt, NULL); up_enable_irq(chan->irq); break; #endif #ifdef CONFIG_TIVA_PWM0_CHAN4 case 4: - irq_attach(chan->irq, tiva_pwm_gen2_interrupt); + irq_attach(chan->irq, tiva_pwm_gen2_interrupt, NULL); up_enable_irq(chan->irq); break; #endif #ifdef CONFIG_TIVA_PWM0_CHAN6 case 6: - irq_attach(chan->irq, tiva_pwm_gen3_interrupt); + irq_attach(chan->irq, tiva_pwm_gen3_interrupt, NULL); up_enable_irq(chan->irq); break; #endif diff --git a/arch/arm/src/tiva/tiva_serial.c b/arch/arm/src/tiva/tiva_serial.c index fb80e9f3263..6a2f3e055b1 100644 --- a/arch/arm/src/tiva/tiva_serial.c +++ b/arch/arm/src/tiva/tiva_serial.c @@ -322,7 +322,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -903,7 +903,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -946,7 +946,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/arm/src/tiva/tiva_ssi.c b/arch/arm/src/tiva/tiva_ssi.c index 6c2a92fbcc0..709850e01a8 100644 --- a/arch/arm/src/tiva/tiva_ssi.c +++ b/arch/arm/src/tiva/tiva_ssi.c @@ -267,7 +267,7 @@ static int ssi_transfer(struct tiva_ssidev_s *priv, const void *txbuffer, #ifndef CONFIG_SSI_POLLWAIT static inline struct tiva_ssidev_s *ssi_mapirq(int irq); -static int ssi_interrupt(int irq, void *context); +static int ssi_interrupt(int irq, void *context, FAR void *arg); #endif /* SPI methods */ @@ -1004,7 +1004,7 @@ static inline struct tiva_ssidev_s *ssi_mapirq(int irq) ****************************************************************************/ #ifndef CONFIG_SSI_POLLWAIT -static int ssi_interrupt(int irq, void *context) +static int ssi_interrupt(int irq, void *context, FAR void *arg) { struct tiva_ssidev_s *priv = ssi_mapirq(irq); uint32_t regval; @@ -1682,9 +1682,9 @@ FAR struct spi_dev_s *tiva_ssibus_initialize(int port) #ifndef CONFIG_SSI_POLLWAIT #if NSSI_ENABLED > 1 - irq_attach(priv->irq, (xcpt_t)ssi_interrupt); + irq_attach(priv->irq, (xcpt_t)ssi_interrupt, NULL); #else - irq_attach(SSI_IRQ, (xcpt_t)ssi_interrupt); + irq_attach(SSI_IRQ, (xcpt_t)ssi_interrupt, NULL); #endif #endif /* CONFIG_SSI_POLLWAIT */ diff --git a/arch/arm/src/tiva/tiva_timerisr.c b/arch/arm/src/tiva/tiva_timerisr.c index 41b8f0e4eda..62a90f49025 100644 --- a/arch/arm/src/tiva/tiva_timerisr.c +++ b/arch/arm/src/tiva/tiva_timerisr.c @@ -88,7 +88,7 @@ * ****************************************************************************/ -static int tiva_timerisr(int irq, uint32_t *regs) +static int tiva_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -126,7 +126,7 @@ void arm_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(TIVA_IRQ_SYSTICK, (xcpt_t)tiva_timerisr); + (void)irq_attach(TIVA_IRQ_SYSTICK, (xcpt_t)tiva_timerisr, NULL); /* Enable SysTick interrupts */ diff --git a/arch/arm/src/tiva/tiva_timerlib.c b/arch/arm/src/tiva/tiva_timerlib.c index f04dd260268..2baf0259733 100644 --- a/arch/arm/src/tiva/tiva_timerlib.c +++ b/arch/arm/src/tiva/tiva_timerlib.c @@ -126,28 +126,28 @@ static void tiva_putreg(struct tiva_gptmstate_s *priv, unsigned int offset, #ifdef CONFIG_TIVA_TIMER_32BIT static int tiva_timer32_interrupt(struct tiva_gptmstate_s *priv); # ifdef CONFIG_TIVA_TIMER0 -static int tiva_gptm0_interrupt(int irq, FAR void *context); +static int tiva_gptm0_interrupt(int irq, FAR void *context, FAR void * arg); # endif # ifdef CONFIG_TIVA_TIMER1 -static int tiva_gptm1_interrupt(int irq, FAR void *context); +static int tiva_gptm1_interrupt(int irq, FAR void *context, FAR void * arg); # endif # ifdef CONFIG_TIVA_TIMER2 -static int tiva_gptm2_interrupt(int irq, FAR void *context); +static int tiva_gptm2_interrupt(int irq, FAR void *context, FAR void * arg); # endif # ifdef CONFIG_TIVA_TIMER3 -static int tiva_gptm3_interrupt(int irq, FAR void *context); +static int tiva_gptm3_interrupt(int irq, FAR void *context, FAR void * arg); # endif # ifdef CONFIG_TIVA_TIMER4 -static int tiva_gptm4_interrupt(int irq, FAR void *context); +static int tiva_gptm4_interrupt(int irq, FAR void *context, FAR void * arg); # endif # ifdef CONFIG_TIVA_TIMER5 -static int tiva_gptm5_interrupt(int irq, FAR void *context); +static int tiva_gptm5_interrupt(int irq, FAR void *context, FAR void * arg); # endif # ifdef CONFIG_TIVA_TIMER6 -static int tiva_gptm6_interrupt(int irq, FAR void *context); +static int tiva_gptm6_interrupt(int irq, FAR void *context, FAR void * arg); # endif # ifdef CONFIG_TIVA_TIMER7 -static int tiva_gptm7_interrupt(int irq, FAR void *context); +static int tiva_gptm7_interrupt(int irq, FAR void *context, FAR void * arg); #endif #endif /* CONFIG_TIVA_TIMER_32BIT */ @@ -155,36 +155,36 @@ static int tiva_gptm7_interrupt(int irq, FAR void *context); static int tiva_timer16_interrupt(struct tiva_gptmstate_s *priv, int tmndx); #ifdef CONFIG_TIVA_TIMER0 -static int tiva_timer0a_interrupt(int irq, FAR void *context); -static int tiva_timer0b_interrupt(int irq, FAR void *context); +static int tiva_timer0a_interrupt(int irq, FAR void *context, FAR void * arg); +static int tiva_timer0b_interrupt(int irq, FAR void *context, FAR void * arg); #endif #ifdef CONFIG_TIVA_TIMER1 -static int tiva_timer1a_interrupt(int irq, FAR void *context); -static int tiva_timer1b_interrupt(int irq, FAR void *context); +static int tiva_timer1a_interrupt(int irq, FAR void *context, FAR void * arg); +static int tiva_timer1b_interrupt(int irq, FAR void *context, FAR void * arg); #endif #ifdef CONFIG_TIVA_TIMER2 -static int tiva_timer2a_interrupt(int irq, FAR void *context); -static int tiva_timer2b_interrupt(int irq, FAR void *context); +static int tiva_timer2a_interrupt(int irq, FAR void *context, FAR void * arg); +static int tiva_timer2b_interrupt(int irq, FAR void *context, FAR void * arg); #endif #ifdef CONFIG_TIVA_TIMER3 -static int tiva_timer3a_interrupt(int irq, FAR void *context); -static int tiva_timer3b_interrupt(int irq, FAR void *context); +static int tiva_timer3a_interrupt(int irq, FAR void *context, FAR void * arg); +static int tiva_timer3b_interrupt(int irq, FAR void *context, FAR void * arg); #endif #ifdef CONFIG_TIVA_TIMER4 -static int tiva_timer4a_interrupt(int irq, FAR void *context); -static int tiva_timer4b_interrupt(int irq, FAR void *context); +static int tiva_timer4a_interrupt(int irq, FAR void *context, FAR void * arg); +static int tiva_timer4b_interrupt(int irq, FAR void *context, FAR void * arg); #endif #ifdef CONFIG_TIVA_TIMER5 -static int tiva_timer5a_interrupt(int irq, FAR void *context); -static int tiva_timer5b_interrupt(int irq, FAR void *context); +static int tiva_timer5a_interrupt(int irq, FAR void *context, FAR void * arg); +static int tiva_timer5b_interrupt(int irq, FAR void *context, FAR void * arg); #endif #ifdef CONFIG_TIVA_TIMER6 -static int tiva_timer6a_interrupt(int irq, FAR void *context); -static int tiva_timer6b_interrupt(int irq, FAR void *context); +static int tiva_timer6a_interrupt(int irq, FAR void *context, FAR void * arg); +static int tiva_timer6b_interrupt(int irq, FAR void *context, FAR void * arg); #endif #ifdef CONFIG_TIVA_TIMER7 -static int tiva_timer7a_interrupt(int irq, FAR void *context); -static int tiva_timer7b_interrupt(int irq, FAR void *context); +static int tiva_timer7a_interrupt(int irq, FAR void *context, FAR void * arg); +static int tiva_timer7b_interrupt(int irq, FAR void *context, FAR void * arg); #endif #endif /* CONFIG_TIVA_TIMER_16BIT */ @@ -557,56 +557,56 @@ static int tiva_timer32_interrupt(struct tiva_gptmstate_s *priv) #ifdef CONFIG_TIVA_TIMER_32BIT #ifdef CONFIG_TIVA_TIMER0 -static int tiva_gptm0_interrupt(int irq, FAR void *context) +static int tiva_gptm0_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer32_interrupt(&g_gptm0_state); } #endif #ifdef CONFIG_TIVA_TIMER1 -static int tiva_gptm1_interrupt(int irq, FAR void *context) +static int tiva_gptm1_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer32_interrupt(&g_gptm1_state); } #endif #ifdef CONFIG_TIVA_TIMER2 -static int tiva_gptm2_interrupt(int irq, FAR void *context) +static int tiva_gptm2_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer32_interrupt(&g_gptm2_state); } #endif #ifdef CONFIG_TIVA_TIMER3 -static int tiva_gptm3_interrupt(int irq, FAR void *context) +static int tiva_gptm3_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer32_interrupt(&g_gptm3_state); } #endif #ifdef CONFIG_TIVA_TIMER4 -static int tiva_gptm4_interrupt(int irq, FAR void *context) +static int tiva_gptm4_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer32_interrupt(&g_gptm4_state); } #endif #ifdef CONFIG_TIVA_TIMER5 -static int tiva_gptm5_interrupt(int irq, FAR void *context) +static int tiva_gptm5_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer32_interrupt(&g_gptm5_state); } #endif #ifdef CONFIG_TIVA_TIMER6 -static int tiva_gptm6_interrupt(int irq, FAR void *context) +static int tiva_gptm6_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer32_interrupt(&g_gptm6_state); } #endif #ifdef CONFIG_TIVA_TIMER7 -static int tiva_gptm7_interrupt(int irq, FAR void *context) +static int tiva_gptm7_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer32_interrupt(&g_gptm7_state); } @@ -683,96 +683,96 @@ static int tiva_timer16_interrupt(struct tiva_gptmstate_s *priv, int tmndx) #ifdef CONFIG_TIVA_TIMER_16BIT #ifdef CONFIG_TIVA_TIMER0 -static int tiva_timer0a_interrupt(int irq, FAR void *context) +static int tiva_timer0a_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm0_state, TIMER16A); } -static int tiva_timer0b_interrupt(int irq, FAR void *context) +static int tiva_timer0b_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm0_state, TIMER16B); } #endif #ifdef CONFIG_TIVA_TIMER1 -static int tiva_timer1a_interrupt(int irq, FAR void *context) +static int tiva_timer1a_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm1_state, TIMER16A); } -static int tiva_timer1b_interrupt(int irq, FAR void *context) +static int tiva_timer1b_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm1_state, TIMER16B); } #endif #ifdef CONFIG_TIVA_TIMER2 -static int tiva_timer2a_interrupt(int irq, FAR void *context) +static int tiva_timer2a_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm2_state, TIMER16A); } -static int tiva_timer2b_interrupt(int irq, FAR void *context) +static int tiva_timer2b_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm2_state, TIMER16B); } #endif #ifdef CONFIG_TIVA_TIMER3 -static int tiva_timer3a_interrupt(int irq, FAR void *context) +static int tiva_timer3a_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm3_state, TIMER16A); } -static int tiva_timer3b_interrupt(int irq, FAR void *context) +static int tiva_timer3b_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm3_state, TIMER16B); } #endif #ifdef CONFIG_TIVA_TIMER4 -static int tiva_timer4a_interrupt(int irq, FAR void *context) +static int tiva_timer4a_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm4_state, TIMER16A); } -static int tiva_timer4b_interrupt(int irq, FAR void *context) +static int tiva_timer4b_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm4_state, TIMER16B); } #endif #ifdef CONFIG_TIVA_TIMER5 -static int tiva_timer5a_interrupt(int irq, FAR void *context) +static int tiva_timer5a_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm5_state, TIMER16A); } -static int tiva_timer5b_interrupt(int irq, FAR void *context) +static int tiva_timer5b_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm5_state, TIMER16B); } #endif #ifdef CONFIG_TIVA_TIMER6 -static int tiva_timer6a_interrupt(int irq, FAR void *context) +static int tiva_timer6a_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm6_state, TIMER16A); } -static int tiva_timer6b_interrupt(int irq, FAR void *context) +static int tiva_timer6b_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm6_state, TIMER16B); } #endif #ifdef CONFIG_TIVA_TIMER7 -static int tiva_timer7a_interrupt(int irq, FAR void *context) +static int tiva_timer7a_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm7_state, TIMER16A); } -static int tiva_timer7b_interrupt(int irq, FAR void *context) +static int tiva_timer7b_interrupt(int irq, FAR void *context, FAR void * arg) { return tiva_timer16_interrupt(&g_gptm7_state, TIMER16B); } @@ -1803,7 +1803,7 @@ TIMER_HANDLE tiva_gptm_configure(const struct tiva_gptmconfig_s *config) * the interrupt). */ - ret = irq_attach(attr->irq[TIMER32], attr->handler32); + ret = irq_attach(attr->irq[TIMER32], attr->handler32, NULL); if (ret == OK) { /* Configure the 32-bit timer */ @@ -1824,10 +1824,10 @@ TIMER_HANDLE tiva_gptm_configure(const struct tiva_gptmconfig_s *config) * the interrupts). */ - ret = irq_attach(attr->irq[TIMER16A], attr->handler16[TIMER16A]); + ret = irq_attach(attr->irq[TIMER16A], attr->handler16[TIMER16A], NULL); if (ret == OK) { - ret = irq_attach(attr->irq[TIMER16B], attr->handler16[TIMER16B]); + ret = irq_attach(attr->irq[TIMER16B], attr->handler16[TIMER16B], NULL); } if (ret == OK) diff --git a/arch/arm/src/tiva/tm4c_ethernet.c b/arch/arm/src/tiva/tm4c_ethernet.c index ea04d5200d4..f689028a9a3 100644 --- a/arch/arm/src/tiva/tm4c_ethernet.c +++ b/arch/arm/src/tiva/tm4c_ethernet.c @@ -704,7 +704,7 @@ static void tiva_freeframe(FAR struct tiva_ethmac_s *priv); static void tiva_txdone(FAR struct tiva_ethmac_s *priv); static void tiva_interrupt_work(FAR void *arg); -static int tiva_interrupt(int irq, FAR void *context); +static int tiva_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -2116,7 +2116,7 @@ static void tiva_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int tiva_interrupt(int irq, FAR void *context) +static int tiva_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct tiva_ethmac_s *priv = &g_tiva_ethmac[0]; uint32_t dmaris; @@ -2167,7 +2167,7 @@ static int tiva_interrupt(int irq, FAR void *context) if (priv->handler) { - (void)priv->handler(irq, context); + (void)priv->handler(irq, context, arg); } } #endif @@ -4134,7 +4134,7 @@ int tiva_ethinitialize(int intf) /* Attach the IRQ to the driver */ - if (irq_attach(TIVA_IRQ_ETHCON, tiva_interrupt)) + if (irq_attach(TIVA_IRQ_ETHCON, tiva_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ diff --git a/arch/arm/src/tms570/tms570_esm.c b/arch/arm/src/tms570/tms570_esm.c index 2019fac5065..dfecf47e8a7 100644 --- a/arch/arm/src/tms570/tms570_esm.c +++ b/arch/arm/src/tms570/tms570_esm.c @@ -145,7 +145,7 @@ int tms570_esm_initialize(void) * ****************************************************************************/ -int tms570_esm_interrupt(int irq, void *context) +int tms570_esm_interrupt(int irq, void *context, FAR void *arg) { /* Save the saved processor context in CURRENT_REGS where it can be accessed * for register dumps and possibly context switching. diff --git a/arch/arm/src/tms570/tms570_esm.h b/arch/arm/src/tms570/tms570_esm.h index 7222cc17fed..a1c93059a8e 100644 --- a/arch/arm/src/tms570/tms570_esm.h +++ b/arch/arm/src/tms570/tms570_esm.h @@ -79,7 +79,7 @@ int tms570_esm_initialize(void); * ****************************************************************************/ -int tms570_esm_interrupt(int irq, void *context); +int tms570_esm_interrupt(int irq, void *context, FAR void *arg); #undef EXTERN #if defined(__cplusplus) diff --git a/arch/arm/src/tms570/tms570_gioirq.c b/arch/arm/src/tms570/tms570_gioirq.c index 6eca48e6293..b4b5cf327b2 100644 --- a/arch/arm/src/tms570/tms570_gioirq.c +++ b/arch/arm/src/tms570/tms570_gioirq.c @@ -70,7 +70,7 @@ * ****************************************************************************/ -static int tms3570_gio_interrupt(int irq, void *context) +static int tms3570_gio_interrupt(int irq, void *context, FAR void *arg) { uint32_t off1; int irq2; @@ -113,7 +113,7 @@ void tms570_gioirq_initialize(void) /* Attach and enable the GIO level 0 interrupt */ - DEBUGVERIFY(irq_attach(TMS570_REQ_GIO_0, tms3570_gio_interrupt)); + DEBUGVERIFY(irq_attach(TMS570_REQ_GIO_0, tms3570_gio_interrupt, NULL)); up_enable_irq(TMS570_REQ_GIO_0); } diff --git a/arch/arm/src/tms570/tms570_irq.c b/arch/arm/src/tms570/tms570_irq.c index da9f8c5656f..99032611997 100644 --- a/arch/arm/src/tms570/tms570_irq.c +++ b/arch/arm/src/tms570/tms570_irq.c @@ -185,8 +185,8 @@ void up_irqinitialize(void) * an NMI. */ - (void)irq_attach(TMS570_REQ_ESMHIGH, tms570_esm_interrupt); - (void)irq_attach(TMS570_REQ_ESMLO, tms570_esm_interrupt); + (void)irq_attach(TMS570_REQ_ESMHIGH, tms570_esm_interrupt, NULL); + (void)irq_attach(TMS570_REQ_ESMLO, tms570_esm_interrupt, NULL); up_enable_irq(TMS570_REQ_ESMHIGH); up_enable_irq(TMS570_REQ_ESMLO); diff --git a/arch/arm/src/tms570/tms570_serial.c b/arch/arm/src/tms570/tms570_serial.c index b52755ac3ec..2878a03fd13 100644 --- a/arch/arm/src/tms570/tms570_serial.c +++ b/arch/arm/src/tms570/tms570_serial.c @@ -146,10 +146,10 @@ static int tms570_attach(struct uart_dev_s *dev); static void tms570_detach(struct uart_dev_s *dev); static int tms570_interrupt(struct uart_dev_s *dev); #ifdef CONFIG_TMS570_SCI1 -static int tms570_sci1_interrupt(int irq, void *context); +static int tms570_sci1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_TMS570_SCI2 -static int tms570_sci2_interrupt(int irq, void *context); +static int tms570_sci2_interrupt(int irq, void *context, FAR void *arg); #endif static int tms570_ioctl(struct file *filep, int cmd, unsigned long arg); static int tms570_receive(struct uart_dev_s *dev, uint32_t *status); @@ -387,7 +387,7 @@ static int tms570_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler); + ret = irq_attach(priv->irq, priv->handler, NULL); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -523,13 +523,13 @@ static int tms570_interrupt(struct uart_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_TMS570_SCI1 -static int tms570_sci1_interrupt(int irq, void *context) +static int tms570_sci1_interrupt(int irq, void *context, FAR void *arg) { return tms570_interrupt(&g_sci1port); } #endif #ifdef CONFIG_TMS570_SCI2 -static int tms570_sci2_interrupt(int irq, void *context) +static int tms570_sci2_interrupt(int irq, void *context, FAR void *arg) { return tms570_interrupt(&g_sci2port); } diff --git a/arch/arm/src/tms570/tms570_timerisr.c b/arch/arm/src/tms570/tms570_timerisr.c index 88337914524..3dba2a1eae0 100644 --- a/arch/arm/src/tms570/tms570_timerisr.c +++ b/arch/arm/src/tms570/tms570_timerisr.c @@ -130,7 +130,7 @@ * ****************************************************************************/ -static int tms570_timerisr(int irq, uint32_t *regs) +static int tms570_timerisr(int irq, uint32_t *regs, void *arg) { /* Cleear the RTI Compare 0 interrupts */ @@ -194,7 +194,7 @@ void arm_timer_initialize(void) /* Attach the interrupt handler to the RTI Compare 0 interrupt */ - DEBUGVERIFY(irq_attach(TMS570_REQ_RTICMP0, (xcpt_t)tms570_timerisr)); + DEBUGVERIFY(irq_attach(TMS570_REQ_RTICMP0, (xcpt_t)tms570_timerisr), NULL); /* Enable RTI compare 0 interrupts at the VIM */ diff --git a/arch/avr/src/at32uc3/at32uc3_gpioirq.c b/arch/avr/src/at32uc3/at32uc3_gpioirq.c index 171fa39f1f2..f525edd4451 100644 --- a/arch/avr/src/at32uc3/at32uc3_gpioirq.c +++ b/arch/avr/src/at32uc3/at32uc3_gpioirq.c @@ -262,7 +262,7 @@ static void gpio_porthandler(uint32_t regbase, int irqbase, uint32_t irqset, voi ****************************************************************************/ #if CONFIG_AVR32_GPIOIRQSETA != 0 -static int gpio0_interrupt(int irq, FAR void *context) +static int gpio0_interrupt(int irq, FAR void *context, FAR void *arg) { gpio_porthandler(AVR32_GPIO0_BASE, __IRQ_GPIO_PA0, CONFIG_AVR32_GPIOIRQSETA, context); @@ -271,7 +271,7 @@ static int gpio0_interrupt(int irq, FAR void *context) #endif #if CONFIG_AVR32_GPIOIRQSETB != 0 -static int gpio1_interrupt(int irq, FAR void *context) +static int gpio1_interrupt(int irq, FAR void *context, FAR void *arg) { gpio_porthandler(AVR32_GPIO1_BASE, __IRQ_GPIO_PB0, CONFIG_AVR32_GPIOIRQSETB, context); @@ -310,10 +310,10 @@ void gpio_irqinitialize(void) /* Then attach the GPIO interrupt handlers */ #if CONFIG_AVR32_GPIOIRQSETA != 0 - irq_attach(AVR32_IRQ_GPIO0, gpio0_interrupt); + irq_attach(AVR32_IRQ_GPIO0, gpio0_interrupt, NULL); #endif #if CONFIG_AVR32_GPIOIRQSETB != 0 - irq_attach(AVR32_IRQ_GPIO1, gpio1_interrupt); + irq_attach(AVR32_IRQ_GPIO1, gpio1_interrupt, NULL); #endif } diff --git a/arch/avr/src/at32uc3/at32uc3_irq.c b/arch/avr/src/at32uc3/at32uc3_irq.c index 4474f9e5c18..179430640cc 100644 --- a/arch/avr/src/at32uc3/at32uc3_irq.c +++ b/arch/avr/src/at32uc3/at32uc3_irq.c @@ -174,7 +174,7 @@ static int up_getgrp(unsigned int irq) * ****************************************************************************/ -static int avr32_xcptn(int irq, FAR void *context) +static int avr32_xcptn(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _alert("PANIC!!! Exception IRQ: %d\n", irq); @@ -223,7 +223,7 @@ void up_irqinitialize(void) for (irq = 0; irq < AVR32_IRQ_NEVENTS; irq++) { - irq_attach(irq, avr32_xcptn); + irq_attach(irq, avr32_xcptn, NULL); } /* Initialize GPIO interrupt facilities */ diff --git a/arch/avr/src/at32uc3/at32uc3_serial.c b/arch/avr/src/at32uc3/at32uc3_serial.c index f01dcc6ac7b..eaf1c8432d7 100644 --- a/arch/avr/src/at32uc3/at32uc3_serial.c +++ b/arch/avr/src/at32uc3/at32uc3_serial.c @@ -160,7 +160,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -408,7 +408,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach the IRQ */ - return irq_attach(priv->irq, up_interrupt); + return irq_attach(priv->irq, up_interrupt, NULL); } /**************************************************************************** @@ -440,7 +440,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/avr/src/at32uc3/at32uc3_timerisr.c b/arch/avr/src/at32uc3/at32uc3_timerisr.c index 79118a15d82..c1cb5ec48fb 100644 --- a/arch/avr/src/at32uc3/at32uc3_timerisr.c +++ b/arch/avr/src/at32uc3/at32uc3_timerisr.c @@ -157,7 +157,7 @@ static void rtc_waitnotbusy(void) * ****************************************************************************/ -static int at32uc3_timerisr(int irq, uint32_t *regs) +static int at32uc3_timerisr(int irq, uint32_t *regs, void *arg) { /* Clear the pending timer interrupt */ @@ -219,7 +219,7 @@ void avr_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(AVR32_IRQ_RTC, (xcpt_t)at32uc3_timerisr); + (void)irq_attach(AVR32_IRQ_RTC, (xcpt_t)at32uc3_timerisr, NULL); /* Enable RTC interrupts */ diff --git a/arch/avr/src/at90usb/at90usb_serial.c b/arch/avr/src/at90usb/at90usb_serial.c index 25077f57431..385211f97e8 100644 --- a/arch/avr/src/at90usb/at90usb_serial.c +++ b/arch/avr/src/at90usb/at90usb_serial.c @@ -90,8 +90,8 @@ static int usart1_setup(struct uart_dev_s *dev); static void usart1_shutdown(struct uart_dev_s *dev); static int usart1_attach(struct uart_dev_s *dev); static void usart1_detach(struct uart_dev_s *dev); -static int usart1_rxinterrupt(int irq, void *context); -static int usart1_txinterrupt(int irq, void *context); +static int usart1_rxinterrupt(int irq, void *context, FAR void *arg); +static int usart1_txinterrupt(int irq, void *context, FAR void *arg); static int usart1_ioctl(struct file *filep, int cmd, unsigned long arg); static int usart1_receive(struct uart_dev_s *dev, FAR unsigned int *status); static void usart1_rxint(struct uart_dev_s *dev, bool enable); @@ -245,9 +245,9 @@ static int usart1_attach(struct uart_dev_s *dev) * written. */ - (void)irq_attach(AT90USB_IRQ_U1RX, usart1_rxinterrupt); - (void)irq_attach(AT90USB_IRQ_U1DRE, usart1_txinterrupt); -//(void)irq_attach(AT90USB_IRQ_U1TX, usart1_txinterrupt); + (void)irq_attach(AT90USB_IRQ_U1RX, usart1_rxinterrupt, NULL); + (void)irq_attach(AT90USB_IRQ_U1DRE, usart1_txinterrupt, NULL); +//(void)irq_attach(AT90USB_IRQ_U1TX, usart1_txinterrupt, NULL); return OK; } @@ -284,7 +284,7 @@ static void usart1_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int usart1_rxinterrupt(int irq, void *context) +static int usart1_rxinterrupt(int irq, void *context, FAR void *arg) { uint8_t ucsr1a = UCSR1A; @@ -310,7 +310,7 @@ static int usart1_rxinterrupt(int irq, void *context) * ****************************************************************************/ -static int usart1_txinterrupt(int irq, void *context) +static int usart1_txinterrupt(int irq, void *context, FAR void *arg) { uint8_t ucsr1a = UCSR1A; diff --git a/arch/avr/src/at90usb/at90usb_timerisr.c b/arch/avr/src/at90usb/at90usb_timerisr.c index a2c6a089f1d..896fe111b55 100644 --- a/arch/avr/src/at90usb/at90usb_timerisr.c +++ b/arch/avr/src/at90usb/at90usb_timerisr.c @@ -114,7 +114,7 @@ * ****************************************************************************/ -static int at90usb_timerisr(int irq, uint32_t *regs) +static int at90usb_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -168,7 +168,7 @@ void avr_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(AT90USB_IRQ_T1COMPA, (xcpt_t)at90usb_timerisr); + (void)irq_attach(AT90USB_IRQ_T1COMPA, (xcpt_t)at90usb_timerisr, NULL); /* Enable the interrupt on compare match A */ diff --git a/arch/avr/src/at90usb/at90usb_usbdev.c b/arch/avr/src/at90usb/at90usb_usbdev.c index 333037d2158..2d47dd75447 100644 --- a/arch/avr/src/at90usb/at90usb_usbdev.c +++ b/arch/avr/src/at90usb/at90usb_usbdev.c @@ -295,7 +295,7 @@ static void avr_dispatchrequest(FAR const struct usb_ctrlreq_s *ctrl); static int avr_ep0configure(void); static void avr_setaddress(uint8_t address); static void avr_ep0setup(void); -static int avr_epinterrupt(int irq, FAR void *context); +static int avr_epinterrupt(int irq, FAR void *context, FAR void *arg); /* General interrupt handling **************************************************/ @@ -305,7 +305,7 @@ static void avr_genvbus(void); static inline void avr_gensuspend(void); static void avr_genwakeup(void); static inline void avr_geneor(void); -static int avr_geninterrupt(int irq, FAR void *context); +static int avr_geninterrupt(int irq, FAR void *context, FAR void *arg); /* USB device controller operations ********************************************/ @@ -1877,7 +1877,7 @@ static inline void avr_epNinterrupt(void) * ****************************************************************************/ -static int avr_epinterrupt(int irq, FAR void *context) +static int avr_epinterrupt(int irq, FAR void *context, FAR void *arg) { usbtrace(TRACE_INTENTRY(AVR_TRACEINTID_EPINT), irq); @@ -2061,7 +2061,7 @@ static inline void avr_geneor(void) * ****************************************************************************/ -static int avr_geninterrupt(int irq, FAR void *context) +static int avr_geninterrupt(int irq, FAR void *context, FAR void *arg) { usbtrace(TRACE_INTENTRY(AVR_TRACEINTID_GENINT), irq); @@ -2783,7 +2783,7 @@ void up_usbinitialize(void) /* Attach USB controller general interrupt handler */ - if (irq_attach(AT90USB_IRQ_USBGEN, avr_geninterrupt) != 0) + if (irq_attach(AT90USB_IRQ_USBGEN, avr_geninterrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(AVR_TRACEERR_IRQREGISTRATION), AT90USB_IRQ_USBGEN); goto errout; @@ -2791,7 +2791,7 @@ void up_usbinitialize(void) /* Attach USB controller endpoint/pipe interrupt handler */ - if (irq_attach(AT90USB_IRQ_USBEP, avr_epinterrupt) != 0) + if (irq_attach(AT90USB_IRQ_USBEP, avr_epinterrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(AVR_TRACEERR_IRQREGISTRATION), AT90USB_IRQ_USBEP); goto errout; diff --git a/arch/avr/src/atmega/atmega_serial.c b/arch/avr/src/atmega/atmega_serial.c index 9f770363a1d..7c49fab1c13 100644 --- a/arch/avr/src/atmega/atmega_serial.c +++ b/arch/avr/src/atmega/atmega_serial.c @@ -114,8 +114,8 @@ static int usart0_setup(struct uart_dev_s *dev); static void usart0_shutdown(struct uart_dev_s *dev); static int usart0_attach(struct uart_dev_s *dev); static void usart0_detach(struct uart_dev_s *dev); -static int usart0_rxinterrupt(int irq, void *context); -static int usart0_txinterrupt(int irq, void *context); +static int usart0_rxinterrupt(int irq, void *context, FAR void *arg); +static int usart0_txinterrupt(int irq, void *context, FAR void *arg); static int usart0_ioctl(struct file *filep, int cmd, unsigned long arg); static int usart0_receive(struct uart_dev_s *dev, FAR unsigned int *status); static void usart0_rxint(struct uart_dev_s *dev, bool enable); @@ -131,8 +131,8 @@ static int usart1_setup(struct uart_dev_s *dev); static void usart1_shutdown(struct uart_dev_s *dev); static int usart1_attach(struct uart_dev_s *dev); static void usart1_detach(struct uart_dev_s *dev); -static int usart1_rxinterrupt(int irq, void *context); -static int usart1_txinterrupt(int irq, void *context); +static int usart1_rxinterrupt(int irq, void *context, FAR void *arg); +static int usart1_txinterrupt(int irq, void *context, FAR void *arg); static int usart1_ioctl(struct file *filep, int cmd, unsigned long arg); static int usart1_receive(struct uart_dev_s *dev, FAR unsigned int *status); static void usart1_rxint(struct uart_dev_s *dev, bool enable); @@ -388,9 +388,9 @@ static int usart0_attach(struct uart_dev_s *dev) * written. */ - (void)irq_attach(ATMEGA_IRQ_U0RX, usart0_rxinterrupt); - (void)irq_attach(ATMEGA_IRQ_U0DRE, usart0_txinterrupt); -//(void)irq_attach(ATMEGA_IRQ_U0TX, usart0_txinterrupt); + (void)irq_attach(ATMEGA_IRQ_U0RX, usart0_rxinterrupt, NULL); + (void)irq_attach(ATMEGA_IRQ_U0DRE, usart0_txinterrupt, NULL); +//(void)irq_attach(ATMEGA_IRQ_U0TX, usart0_txinterrupt, NULL); return OK; } #endif @@ -410,9 +410,9 @@ static int usart1_attach(struct uart_dev_s *dev) * written. */ - (void)irq_attach(ATMEGA_IRQ_U1RX, usart1_rxinterrupt); - (void)irq_attach(ATMEGA_IRQ_U1DRE, usart1_txinterrupt); -//(void)irq_attach(ATMEGA_IRQ_U1TX, usart1_txinterrupt); + (void)irq_attach(ATMEGA_IRQ_U1RX, usart1_rxinterrupt, NULL); + (void)irq_attach(ATMEGA_IRQ_U1DRE, usart1_txinterrupt, NULL); +//(void)irq_attach(ATMEGA_IRQ_U1TX, usart1_txinterrupt, NULL); return OK; } #endif @@ -468,7 +468,7 @@ static void usart1_detach(struct uart_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_AVR_USART0 -static int usart0_rxinterrupt(int irq, void *context) +static int usart0_rxinterrupt(int irq, void *context, FAR void *arg) { uint8_t ucsr0a = UCSR0A; @@ -486,7 +486,7 @@ static int usart0_rxinterrupt(int irq, void *context) #endif #ifdef CONFIG_AVR_USART1 -static int usart1_rxinterrupt(int irq, void *context) +static int usart1_rxinterrupt(int irq, void *context, FAR void *arg) { uint8_t ucsr1a = UCSR1A; @@ -514,7 +514,7 @@ static int usart1_rxinterrupt(int irq, void *context) ****************************************************************************/ #ifdef CONFIG_AVR_USART0 -static int usart0_txinterrupt(int irq, void *context) +static int usart0_txinterrupt(int irq, void *context, FAR void *arg) { uint8_t ucsr0a = UCSR0A; @@ -534,7 +534,7 @@ static int usart0_txinterrupt(int irq, void *context) #endif #ifdef CONFIG_AVR_USART1 -static int usart1_txinterrupt(int irq, void *context) +static int usart1_txinterrupt(int irq, void *context, FAR void *arg) { uint8_t ucsr1a = UCSR1A; diff --git a/arch/avr/src/atmega/atmega_timerisr.c b/arch/avr/src/atmega/atmega_timerisr.c index ead918e7c3f..7bec4f46541 100644 --- a/arch/avr/src/atmega/atmega_timerisr.c +++ b/arch/avr/src/atmega/atmega_timerisr.c @@ -114,7 +114,7 @@ * ****************************************************************************/ -static int atmega_timerisr(int irq, uint32_t *regs) +static int atmega_timerisr(int irq, uint32_t *regs, FAR void *arg); { /* Process timer interrupt */ @@ -169,9 +169,9 @@ void avr_timer_initialize(void) /* Attach the timer interrupt vector */ #if defined(ATMEGA_IRQ_T1COMPA) - (void)irq_attach(ATMEGA_IRQ_T1COMPA, (xcpt_t)atmega_timerisr); + (void)irq_attach(ATMEGA_IRQ_T1COMPA, (xcpt_t)atmega_timerisr, NULL); #elif defined(ATMEGA_IRQ_TIM1_COMPA) - (void)irq_attach(ATMEGA_IRQ_TIM1_COMPA, (xcpt_t)atmega_timerisr); + (void)irq_attach(ATMEGA_IRQ_TIM1_COMPA, (xcpt_t)atmega_timerisr, NULL); #else # error "Unable to find IRQ for timer" #endif diff --git a/arch/hc/src/m9s12/m9s12_ethernet.c b/arch/hc/src/m9s12/m9s12_ethernet.c index 3a85446e6dc..2a2673ed5f8 100644 --- a/arch/hc/src/m9s12/m9s12_ethernet.c +++ b/arch/hc/src/m9s12/m9s12_ethernet.c @@ -127,7 +127,7 @@ static int emac_txpoll(struct net_driver_s *dev); static void emac_receive(FAR struct emac_driver_s *priv); static void emac_txdone(FAR struct emac_driver_s *priv); -static int emac_interrupt(int irq, FAR void *context); +static int emac_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -442,7 +442,7 @@ static void emac_txdone(FAR struct emac_driver_s *priv) * ****************************************************************************/ -static int emac_interrupt(int irq, FAR void *context) +static int emac_interrupt(int irq, FAR void *context, FAR void *arg) { register FAR struct emac_driver_s *priv = &g_emac[0]; @@ -752,7 +752,7 @@ int emac_initialize(int intf) /* Attach the IRQ to the driver */ - if (irq_attach(CONFIG_HCS12_IRQ, emac_interrupt)) + if (irq_attach(CONFIG_HCS12_IRQ, emac_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ diff --git a/arch/hc/src/m9s12/m9s12_gpioirq.c b/arch/hc/src/m9s12/m9s12_gpioirq.c index b0f72d77622..e8e5f697830 100644 --- a/arch/hc/src/m9s12/m9s12_gpioirq.c +++ b/arch/hc/src/m9s12/m9s12_gpioirq.c @@ -181,7 +181,7 @@ static int hcs12_interrupt(uint16_t base, int irq0, uint8_t valid, void *context } #ifdef CONFIG_HCS12_PORTG_INTS -static int hcs12_pginterrupt(int irq, void *context) +static int hcs12_pginterrupt(int irq, void *context, FAR void *arg) { return hcs12_interrupt(HCS12_PIM_PORTG_BASE, HCS12_IRQ_PG0, HCS12_IRQ_PGSET, context); @@ -189,7 +189,7 @@ static int hcs12_pginterrupt(int irq, void *context) #endif #ifdef CONFIG_HCS12_PORTH_INTS -static int hcs12_phinterrupt(int irq, void *context) +static int hcs12_phinterrupt(int irq, void *context, FAR void *arg) { return hcs12_interrupt(HCS12_PIM_PORTH_BASE, HCS12_IRQ_PH0, HCS12_IRQ_PHSET, context); @@ -197,7 +197,7 @@ static int hcs12_phinterrupt(int irq, void *context) #endif #ifdef CONFIG_HCS12_PORTJ_INTS -static int hcs12_pjinterrupt(int irq, void *context) +static int hcs12_pjinterrupt(int irq, void *context, FAR void *arg) { return hcs12_interrupt(HCS12_PIM_PORTJ_BASE, HCS12_IRQ_PJ0, HCS12_IRQ_PJSET, context); @@ -230,13 +230,13 @@ void hcs12_gpioirqinitialize(void) #ifdef CONFIG_HCS12_GPIOIRQ # ifdef CONFIG_HCS12_PORTG_INTS - irq_attach(HCS12_IRQ_VPORTG, hcs12_pginterrupt); + irq_attach(HCS12_IRQ_VPORTG, hcs12_pginterrupt, NULL); # endif # ifdef CONFIG_HCS12_PORTH_INTS - irq_attach(HCS12_IRQ_VPORTH, hcs12_phinterrupt); + irq_attach(HCS12_IRQ_VPORTH, hcs12_phinterrupt, NULL); # endif # ifdef CONFIG_HCS12_PORTJ_INTS - irq_attach(HCS12_IRQ_VPORTJ, hcs12_pjinterrupt); + irq_attach(HCS12_IRQ_VPORTJ, hcs12_pjinterrupt, NULL); # endif #endif /* CONFIG_HCS12_GPIOIRQ */ } diff --git a/arch/hc/src/m9s12/m9s12_serial.c b/arch/hc/src/m9s12/m9s12_serial.c index 1bc0091395b..885514c3ab6 100644 --- a/arch/hc/src/m9s12/m9s12_serial.c +++ b/arch/hc/src/m9s12/m9s12_serial.c @@ -123,7 +123,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -422,7 +422,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt); + ret = irq_attach(priv->irq, up_interrupt, NULL); if (ret == OK) { /* Enable the Rx interrupt (the TX interrupt is still disabled @@ -465,7 +465,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/hc/src/m9s12/m9s12_timerisr.c b/arch/hc/src/m9s12/m9s12_timerisr.c index eef0613ded3..f8d570b66d7 100644 --- a/arch/hc/src/m9s12/m9s12_timerisr.c +++ b/arch/hc/src/m9s12/m9s12_timerisr.c @@ -131,7 +131,7 @@ * ****************************************************************************/ -static int m9s12_timerisr(int irq, uint32_t *regs) +static int m9s12_timerisr(int irq, uint32_t *regs, void *arg) { /* Clear real time interrupt flag */ @@ -171,7 +171,7 @@ void hc_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(HCS12_IRQ_VRTI, (xcpt_t)m9s12_timerisr); + (void)irq_attach(HCS12_IRQ_VRTI, (xcpt_t)m9s12_timerisr, NULL); /* Enable RTI interrupt by setting the RTIE bit */ diff --git a/arch/mips/src/common/up_internal.h b/arch/mips/src/common/up_internal.h index 4dc2b54907a..39ba820682e 100644 --- a/arch/mips/src/common/up_internal.h +++ b/arch/mips/src/common/up_internal.h @@ -220,7 +220,7 @@ uint32_t *up_doirq(int irq, uint32_t *regs); /* Software interrupt 0 handler */ -int up_swint0(int irq, FAR void *context); +int up_swint0(int irq, FAR void *context, FAR void *arg); /* Signals */ diff --git a/arch/mips/src/mips32/up_swint0.c b/arch/mips/src/mips32/up_swint0.c index 95638c8c087..40cc800592c 100644 --- a/arch/mips/src/mips32/up_swint0.c +++ b/arch/mips/src/mips32/up_swint0.c @@ -129,7 +129,7 @@ static void dispatch_syscall(void) * ****************************************************************************/ -int up_swint0(int irq, FAR void *context) +int up_swint0(int irq, FAR void *context, FAR void *arg) { uint32_t *regs = (uint32_t *)context; uint32_t cause; diff --git a/arch/mips/src/pic32mx/pic32mx-ethernet.c b/arch/mips/src/pic32mx/pic32mx-ethernet.c index 3515635f220..acd5b7d44d4 100644 --- a/arch/mips/src/pic32mx/pic32mx-ethernet.c +++ b/arch/mips/src/pic32mx/pic32mx-ethernet.c @@ -395,7 +395,7 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv); static void pic32mx_txdone(struct pic32mx_driver_s *priv); static void pic32mx_interrupt_work(void *arg); -static int pic32mx_interrupt(int irq, void *context); +static int pic32mx_interrupt(int irq, void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -1853,7 +1853,7 @@ static void pic32mx_interrupt_work(void *arg) * ****************************************************************************/ -static int pic32mx_interrupt(int irq, void *context) +static int pic32mx_interrupt(int irq, void *context, FAR void *arg) { struct pic32mx_driver_s *priv; uint32_t status; @@ -3388,9 +3388,9 @@ static inline int pic32mx_ethinitialize(int intf) /* Attach the IRQ to the driver */ #if CONFIG_PIC32MX_NINTERFACES > 1 - ret = irq_attach(priv->pd_irq, pic32mx_interrupt); + ret = irq_attach(priv->pd_irq, pic32mx_interrupt, NULL); #else - ret = irq_attach(PIC32MX_IRQ_ETH, pic32mx_interrupt); + ret = irq_attach(PIC32MX_IRQ_ETH, pic32mx_interrupt, NULL); #endif if (ret != 0) { diff --git a/arch/mips/src/pic32mx/pic32mx-irq.c b/arch/mips/src/pic32mx/pic32mx-irq.c index f9e82155dc2..f19311889e8 100644 --- a/arch/mips/src/pic32mx/pic32mx-irq.c +++ b/arch/mips/src/pic32mx/pic32mx-irq.c @@ -154,7 +154,7 @@ void up_irqinitialize(void) /* Attach and enable software interrupts */ - irq_attach(PIC32MX_IRQ_CS0, up_swint0); + irq_attach(PIC32MX_IRQ_CS0, up_swint0, NULL); up_enable_irq(PIC32MX_IRQSRC_CS0); /* currents_regs is non-NULL only while processing an interrupt */ diff --git a/arch/mips/src/pic32mx/pic32mx-serial.c b/arch/mips/src/pic32mx/pic32mx-serial.c index ebd20cdfdda..3558ee1da3b 100644 --- a/arch/mips/src/pic32mx/pic32mx-serial.c +++ b/arch/mips/src/pic32mx/pic32mx-serial.c @@ -173,7 +173,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -413,7 +413,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach the IRQ */ - return irq_attach(priv->irq, up_interrupt); + return irq_attach(priv->irq, up_interrupt, NULL); } /**************************************************************************** @@ -451,7 +451,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/mips/src/pic32mx/pic32mx-spi.c b/arch/mips/src/pic32mx/pic32mx-spi.c index 2489f671c45..1cfd0164d52 100644 --- a/arch/mips/src/pic32mx/pic32mx-spi.c +++ b/arch/mips/src/pic32mx/pic32mx-spi.c @@ -909,7 +909,7 @@ FAR struct spi_dev_s *pic32mx_spibus_initialize(int port) * resource is available. */ - ret = irq_attach(priv->vector, spi_interrupt); + ret = irq_attach(priv->vector, spi_interrupt, NULL); if (ret < 0) { spierr("ERROR: Failed to attach vector: %d port: %d\n", diff --git a/arch/mips/src/pic32mx/pic32mx-timerisr.c b/arch/mips/src/pic32mx/pic32mx-timerisr.c index 73cdc8b3cbe..c34ceb5a9fe 100644 --- a/arch/mips/src/pic32mx/pic32mx-timerisr.c +++ b/arch/mips/src/pic32mx/pic32mx-timerisr.c @@ -137,7 +137,7 @@ * ****************************************************************************/ -static int pc32mx_timerisr(int irq, uint32_t *regs) +static int pc32mx_timerisr(int irq, uint32_t *regs, void *arg) { /* Clear the pending timer interrupt */ @@ -183,7 +183,7 @@ void mips_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(PIC32MX_IRQ_T1, (xcpt_t)pc32mx_timerisr); + (void)irq_attach(PIC32MX_IRQ_T1, (xcpt_t)pc32mx_timerisr, NULL); /* And enable the timer interrupt */ diff --git a/arch/mips/src/pic32mx/pic32mx-usbdev.c b/arch/mips/src/pic32mx/pic32mx-usbdev.c index da5544580a9..b184ff41ecd 100644 --- a/arch/mips/src/pic32mx/pic32mx-usbdev.c +++ b/arch/mips/src/pic32mx/pic32mx-usbdev.c @@ -492,7 +492,7 @@ static void pic32mx_ep0outcomplete(struct pic32mx_usbdev_s *priv); static void pic32mx_ep0incomplete(struct pic32mx_usbdev_s *priv); static void pic32mx_ep0transfer(struct pic32mx_usbdev_s *priv, uint16_t ustat); -static int pic32mx_interrupt(int irq, void *context); +static int pic32mx_interrupt(int irq, void *context, FAR void *arg); /* Endpoint helpers *********************************************************/ @@ -2643,7 +2643,7 @@ static void pic32mx_ep0transfer(struct pic32mx_usbdev_s *priv, uint16_t ustat) * Name: pic32mx_interrupt ****************************************************************************/ -static int pic32mx_interrupt(int irq, void *context) +static int pic32mx_interrupt(int irq, void *context, FAR void *arg) { /* For now there is only one USB controller, but we will always refer to * it using a pointer to make any future ports to multiple USB controllers @@ -4297,7 +4297,7 @@ void up_usbinitialize(void) * them when we need them later. */ - if (irq_attach(PIC32MX_IRQ_USB, pic32mx_interrupt) != 0) + if (irq_attach(PIC32MX_IRQ_USB, pic32mx_interrupt, NULL) != 0) { usbtrace(TRACE_DEVERROR(PIC32MX_TRACEERR_IRQREGISTRATION), (uint16_t)PIC32MX_IRQ_USB); diff --git a/arch/mips/src/pic32mz/pic32mz-ethernet.c b/arch/mips/src/pic32mz/pic32mz-ethernet.c index bdf8121857e..4e2560eecb0 100644 --- a/arch/mips/src/pic32mz/pic32mz-ethernet.c +++ b/arch/mips/src/pic32mz/pic32mz-ethernet.c @@ -422,7 +422,7 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv); static void pic32mz_txdone(struct pic32mz_driver_s *priv); static void pic32mz_interrupt_work(void *arg); -static int pic32mz_interrupt(int irq, void *context); +static int pic32mz_interrupt(int irq, void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -1880,7 +1880,7 @@ static void pic32mz_interrupt_work(void *arg) * ****************************************************************************/ -static int pic32mz_interrupt(int irq, void *context) +static int pic32mz_interrupt(int irq, void *context, FAR void *arg) { struct pic32mz_driver_s *priv; uint32_t status; @@ -3427,9 +3427,9 @@ static inline int pic32mz_ethinitialize(int intf) /* Attach the IRQ to the driver */ #if CONFIG_PIC32MZ_NINTERFACES > 1 - ret = irq_attach(priv->pd_irq, pic32mz_interrupt); + ret = irq_attach(priv->pd_irq, pic32mz_interrupt, NULL); #else - ret = irq_attach(PIC32MZ_IRQ_ETH, pic32mz_interrupt); + ret = irq_attach(PIC32MZ_IRQ_ETH, pic32mz_interrupt, NULL); #endif if (ret != 0) { diff --git a/arch/mips/src/pic32mz/pic32mz-gpioirq.c b/arch/mips/src/pic32mz/pic32mz-gpioirq.c index 9b7f8c68083..8e3106cc206 100644 --- a/arch/mips/src/pic32mz/pic32mz-gpioirq.c +++ b/arch/mips/src/pic32mz/pic32mz-gpioirq.c @@ -72,7 +72,7 @@ static inline bool pic32mz_input(pinset_t pinset); static inline bool pic32mz_interrupt(pinset_t pinset); static inline bool pic32mz_pullup(pinset_t pinset); static inline bool pic32mz_pulldown(pinset_t pinset); -static int pic32mz_cninterrupt(int irq, FAR void *context); +static int pic32mz_cninterrupt(int irq, FAR void *context, FAR void *arg); /**************************************************************************** * Public Data @@ -204,7 +204,7 @@ static inline unsigned int pic32mz_pin(pinset_t pinset) * ****************************************************************************/ -static int pic32mz_cninterrupt(int irq, FAR void *context) +static int pic32mz_cninterrupt(int irq, FAR void *context, FAR void *arg) { struct ioport_level2_s *handlers; xcpt_t handler; @@ -334,7 +334,7 @@ void pic32mz_gpioirqinitialize(void) * each IRQ number is consecutive beginning with IOPORTA. */ - ret = irq_attach(PIC32MZ_IRQ_PORTA + i, pic32mz_cninterrupt); + ret = irq_attach(PIC32MZ_IRQ_PORTA + i, pic32mz_cninterrupt, NULL); DEBUGASSERT(ret == OK); UNUSED(ret); diff --git a/arch/mips/src/pic32mz/pic32mz-irq.c b/arch/mips/src/pic32mz/pic32mz-irq.c index 4bb185939ec..bb1fda5108e 100644 --- a/arch/mips/src/pic32mz/pic32mz-irq.c +++ b/arch/mips/src/pic32mz/pic32mz-irq.c @@ -236,7 +236,7 @@ void up_irqinitialize(void) /* Attach and enable software interrupts */ - irq_attach(PIC32MZ_IRQ_CS0, up_swint0); + irq_attach(PIC32MZ_IRQ_CS0, up_swint0, NULL); up_enable_irq(PIC32MZ_IRQ_CS0); /* currents_regs is non-NULL only while processing an interrupt */ diff --git a/arch/mips/src/pic32mz/pic32mz-serial.c b/arch/mips/src/pic32mz/pic32mz-serial.c index fcdc0c1874d..9e4b23d9d37 100644 --- a/arch/mips/src/pic32mz/pic32mz-serial.c +++ b/arch/mips/src/pic32mz/pic32mz-serial.c @@ -279,22 +279,22 @@ static void up_detach(struct uart_dev_s *dev); static int up_interrupt(struct uart_dev_s *priv); #ifdef CONFIG_PIC32MZ_UART1 -static int up_uart1_interrupt(int irq, void *context); +static int up_uart1_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_PIC32MZ_UART2 -static int up_uart2_interrupt(int irq, void *context); +static int up_uart2_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_PIC32MZ_UART3 -static int up_uart3_interrupt(int irq, void *context); +static int up_uart3_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_PIC32MZ_UART4 -static int up_uart4_interrupt(int irq, void *context); +static int up_uart4_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_PIC32MZ_UART5 -static int up_uart5_interrupt(int irq, void *context); +static int up_uart5_interrupt(int irq, void *context, FAR void *arg); #endif #ifdef CONFIG_PIC32MZ_UART6 -static int up_uart6_interrupt(int irq, void *context); +static int up_uart6_interrupt(int irq, void *context, FAR void *arg); #endif static int up_ioctl(struct file *filep, int cmd, unsigned long arg); @@ -677,15 +677,15 @@ static int up_attach(struct uart_dev_s *dev) /* Attach the IRQs */ - ret = irq_attach(priv->irqrx, priv->handler); + ret = irq_attach(priv->irqrx, priv->handler, NULL); if (ret == 0) { - ret = irq_attach(priv->irqtx, priv->handler); + ret = irq_attach(priv->irqtx, priv->handler, NULL); } if (ret == 0) { - ret = irq_attach(priv->irqe, priv->handler); + ret = irq_attach(priv->irqe, priv->handler, NULL); } return ret; @@ -840,41 +840,41 @@ static int up_interrupt(struct uart_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_PIC32MZ_UART1 -static int up_uart1_interrupt(int irq, void *context) +static int up_uart1_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_uart1port); } #endif #ifdef CONFIG_PIC32MZ_UART2 -static int up_uart2_interrupt(int irq, void *context) +static int up_uart2_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_uart2port); } #endif #ifdef CONFIG_PIC32MZ_UART3 -static int up_uart3_interrupt(int irq, void *context) +static int up_uart3_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_uart3port); } #endif #ifdef CONFIG_PIC32MZ_UART4 -static int up_uart4_interrupt(int irq, void *context) +static int up_uart4_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_uart4port); } #endif #ifdef CONFIG_PIC32MZ_UART5 -static int up_uart5_interrupt(int irq, void *context) +static int up_uart5_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_uart5port); } #endif #ifdef CONFIG_PIC32MZ_UART6 -static int up_uart6_interrupt(int irq, void *context) +static int up_uart6_interrupt(int irq, void *context, FAR void *arg) { return up_interrupt(&g_uart6port); } diff --git a/arch/mips/src/pic32mz/pic32mz-spi.c b/arch/mips/src/pic32mz/pic32mz-spi.c index 3eea799d10c..ff56c7f527d 100644 --- a/arch/mips/src/pic32mz/pic32mz-spi.c +++ b/arch/mips/src/pic32mz/pic32mz-spi.c @@ -1294,7 +1294,7 @@ FAR struct spi_dev_s *pic32mz_spibus_initialize(int port) * resources are available. */ - ret = irq_attach(priv->config->rxirq, spi_interrupt); + ret = irq_attach(priv->config->rxirq, spi_interrupt, NULL); if (ret < 0) { spierr("ERROR: Failed to attach RX interrupt: %d port: %d\n", @@ -1302,7 +1302,7 @@ FAR struct spi_dev_s *pic32mz_spibus_initialize(int port) goto errout; } - ret = irq_attach(priv->config->txirq, spi_interrupt); + ret = irq_attach(priv->config->txirq, spi_interrupt, NULL); if (ret < 0) { spierr("ERROR: Failed to attach TX interrupt: %d port: %d\n", @@ -1310,7 +1310,7 @@ FAR struct spi_dev_s *pic32mz_spibus_initialize(int port) goto errout_with_rxirq; } - ret = irq_attach(priv->config->firq, spi_interrupt); + ret = irq_attach(priv->config->firq, spi_interrupt, NULL); if (ret < 0) { spierr("ERROR: Failed to attach fault interrupt: %d port: %d\n", diff --git a/arch/mips/src/pic32mz/pic32mz-timerisr.c b/arch/mips/src/pic32mz/pic32mz-timerisr.c index 63ca681a1eb..75e35ecf057 100644 --- a/arch/mips/src/pic32mz/pic32mz-timerisr.c +++ b/arch/mips/src/pic32mz/pic32mz-timerisr.c @@ -136,7 +136,7 @@ * ****************************************************************************/ -static int pc32mz_timerisr(int irq, uint32_t *regs) +static int pc32mz_timerisr(int irq, uint32_t *regs, void *arg) { /* Clear the pending timer interrupt */ @@ -179,7 +179,7 @@ void mips_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(PIC32MZ_IRQ_T1, (xcpt_t)pc32mz_timerisr); + (void)irq_attach(PIC32MZ_IRQ_T1, (xcpt_t)pc32mz_timerisr, NULL); /* And enable the timer interrupt */ diff --git a/arch/misoc/src/common/misoc_net.c b/arch/misoc/src/common/misoc_net.c index 63902b6eb77..c7903f364e7 100644 --- a/arch/misoc/src/common/misoc_net.c +++ b/arch/misoc/src/common/misoc_net.c @@ -161,7 +161,7 @@ static void misoc_net_receive(FAR struct misoc_net_driver_s *priv); static void misoc_net_txdone(FAR struct misoc_net_driver_s *priv); static void misoc_net_interrupt_work(FAR void *arg); -static int misoc_net_interrupt(int irq, FAR void *context); +static int misoc_net_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -652,7 +652,7 @@ static void misoc_net_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int misoc_net_interrupt(int irq, FAR void *context) +static int misoc_net_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct misoc_net_driver_s *priv = &g_misoc_net[0]; @@ -1187,7 +1187,7 @@ int misoc_net_initialize(int intf) /* Attach the IRQ to the driver */ - if (irq_attach(ETHMAC_INTERRUPT, misoc_net_interrupt)) + if (irq_attach(ETHMAC_INTERRUPT, misoc_net_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ diff --git a/arch/misoc/src/common/misoc_serial.c b/arch/misoc/src/common/misoc_serial.c index c9b1f838639..b64b0ea737b 100644 --- a/arch/misoc/src/common/misoc_serial.c +++ b/arch/misoc/src/common/misoc_serial.c @@ -156,7 +156,7 @@ static int misoc_setup(struct uart_dev_s *dev); static void misoc_shutdown(struct uart_dev_s *dev); static int misoc_attach(struct uart_dev_s *dev); static void misoc_detach(struct uart_dev_s *dev); -static int misoc_uart_interrupt(int irq, void *context); +static int misoc_uart_interrupt(int irq, void *context, FAR void *arg); static int misoc_ioctl(struct file *filep, int cmd, unsigned long arg); static int misoc_receive(struct uart_dev_s *dev, uint32_t *status); static void misoc_rxint(struct uart_dev_s *dev, bool enable); @@ -313,7 +313,7 @@ static int misoc_attach(struct uart_dev_s *dev) { struct misoc_dev_s *priv = (struct misoc_dev_s *)dev->priv; - (void)irq_attach(priv->irq, misoc_uart_interrupt); + (void)irq_attach(priv->irq, misoc_uart_interrupt, NULL); up_enable_irq(priv->irq); return OK; @@ -349,7 +349,7 @@ static void misoc_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int misoc_uart_interrupt(int irq, void *context) +static int misoc_uart_interrupt(int irq, void *context, FAR void *arg) { uint32_t stat; struct uart_dev_s *dev = NULL; diff --git a/arch/misoc/src/common/misoc_timerisr.c b/arch/misoc/src/common/misoc_timerisr.c index 38266b64556..3c4b4919d36 100644 --- a/arch/misoc/src/common/misoc_timerisr.c +++ b/arch/misoc/src/common/misoc_timerisr.c @@ -95,7 +95,7 @@ * ****************************************************************************/ -int misoc_timer_isr(int irq, void *context) +int misoc_timer_isr(int irq, void *context, void *arg) { /* Clear event pending */ @@ -139,7 +139,7 @@ void misoc_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(TIMER0_INTERRUPT, misoc_timer_isr); + (void)irq_attach(TIMER0_INTERRUPT, misoc_timer_isr, NULL); /* And enable the timer interrupt */ diff --git a/arch/misoc/src/lm32/lm32.h b/arch/misoc/src/lm32/lm32.h index a09bcfec47c..6d4ef15a073 100644 --- a/arch/misoc/src/lm32/lm32.h +++ b/arch/misoc/src/lm32/lm32.h @@ -139,7 +139,7 @@ uint32_t *lm32_doirq(int irq, uint32_t *regs); /* Software interrupts ******************************************************/ -int lm32_swint(int irq, FAR void *context); +int lm32_swint(int irq, FAR void *context, FAR void *arg); /* System timer *************************************************************/ diff --git a/arch/misoc/src/lm32/lm32_irq.c b/arch/misoc/src/lm32/lm32_irq.c index eb5313810d4..08b6953b081 100644 --- a/arch/misoc/src/lm32/lm32_irq.c +++ b/arch/misoc/src/lm32/lm32_irq.c @@ -71,7 +71,7 @@ void lm32_irq_initialize(void) /* Attach the software interrupt */ - (void)irq_attach(LM32_IRQ_SWINT, lm32_swint); + (void)irq_attach(LM32_IRQ_SWINT, lm32_swint, NULL); /* Enable interrupts */ diff --git a/arch/misoc/src/lm32/lm32_swint.c b/arch/misoc/src/lm32/lm32_swint.c index cdfbeeb389e..7a49cdbb337 100644 --- a/arch/misoc/src/lm32/lm32_swint.c +++ b/arch/misoc/src/lm32/lm32_swint.c @@ -130,7 +130,7 @@ static void dispatch_syscall(void) * ****************************************************************************/ -int lm32_swint(int irq, FAR void *context) +int lm32_swint(int irq, FAR void *context, FAR void *arg) { uint32_t *regs = (uint32_t *)context; diff --git a/arch/renesas/src/m16c/m16c_serial.c b/arch/renesas/src/m16c/m16c_serial.c index cdbcc2471c8..dad01c46050 100644 --- a/arch/renesas/src/m16c/m16c_serial.c +++ b/arch/renesas/src/m16c/m16c_serial.c @@ -267,12 +267,12 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_rcvinterrupt(int irq, void *context); +static int up_rcvinterrupt(int irq, void *context, FAR void *arg); static int up_receive(struct uart_dev_s *dev, unsigned int *status); static void m16c_rxint(struct up_dev_s *dev, bool enable); static void up_rxint(struct uart_dev_s *dev, bool enable); static bool up_rxavailable(struct uart_dev_s *dev); -static int up_xmtinterrupt(int irq, void *context); +static int up_xmtinterrupt(int irq, void *context, FAR void *arg); static void up_send(struct uart_dev_s *dev, int ch); static void m16c_txint(struct up_dev_s *dev, bool enable); static void up_txint(struct uart_dev_s *dev, bool enable); @@ -711,12 +711,12 @@ static int up_attach(struct uart_dev_s *dev) /* Attach the UART receive data available IRQ */ - ret = irq_attach(priv->rcvirq, up_rcvinterrupt); + ret = irq_attach(priv->rcvirq, up_rcvinterrupt, NULL); if (ret == OK) { /* Attach the UART transmit complete IRQ */ - ret = irq_attach(priv->xmtirq, up_xmtinterrupt); + ret = irq_attach(priv->xmtirq, up_xmtinterrupt, NULL); if (ret != OK) { /* Detach the ERI interrupt on failure */ @@ -764,7 +764,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_rcvinterrupt(int irq, void *context) +static int up_rcvinterrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; @@ -930,7 +930,7 @@ static bool up_rxavailable(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_xmtinterrupt(int irq, void *context) +static int up_xmtinterrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; diff --git a/arch/renesas/src/m16c/m16c_timerisr.c b/arch/renesas/src/m16c/m16c_timerisr.c index 8d1e8b15e8e..6d82add128f 100644 --- a/arch/renesas/src/m16c/m16c_timerisr.c +++ b/arch/renesas/src/m16c/m16c_timerisr.c @@ -119,7 +119,7 @@ * ****************************************************************************/ -static int m16c_timerisr(int irq, uint32_t *regs) +static int m16c_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -166,7 +166,7 @@ void renesas_timer_initialize(void) /* Attach the interrupt handler */ - irq_attach(M16C_SYSTIMER_IRQ, (xcpt_t)m16c_timerisr); + irq_attach(M16C_SYSTIMER_IRQ, (xcpt_t)m16c_timerisr, NULL); /* Enable timer interrupts */ diff --git a/arch/renesas/src/sh1/sh1_serial.c b/arch/renesas/src/sh1/sh1_serial.c index ff9246fad99..3dd5c1cff2b 100644 --- a/arch/renesas/src/sh1/sh1_serial.c +++ b/arch/renesas/src/sh1/sh1_serial.c @@ -158,7 +158,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +static int up_interrupt(int irq, void *context, FAR void *arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); static bool up_rxavailable(struct uart_dev_s *dev); @@ -485,17 +485,17 @@ static int up_attach(struct uart_dev_s *dev) /* Attach the RDR full IRQ (RXI) that is enabled by the RIE SCR bit */ - ret = irq_attach(priv->irq + SH1_RXI_IRQ_OFFSET, up_interrupt); + ret = irq_attach(priv->irq + SH1_RXI_IRQ_OFFSET, up_interrupt, NULL); if (ret == OK) { /* The RIE interrupt enable also enables the receive error interrupt (ERI) */ - ret = irq_attach(priv->irq + SH1_ERI_IRQ_OFFSET, up_interrupt); + ret = irq_attach(priv->irq + SH1_ERI_IRQ_OFFSET, up_interrupt, NULL); if (ret == OK) { /* Attach the TDR empty IRQ (TXI) enabled by the TIE SCR bit */ - ret = irq_attach(priv->irq + SH1_TXI_IRQ_OFFSET, up_interrupt); + ret = irq_attach(priv->irq + SH1_TXI_IRQ_OFFSET, up_interrupt, NULL); if (ret == OK) { #ifdef CONFIG_ARCH_IRQPRIO @@ -567,7 +567,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/renesas/src/sh1/sh1_timerisr.c b/arch/renesas/src/sh1/sh1_timerisr.c index a16b17a71de..a1ec7d3a556 100644 --- a/arch/renesas/src/sh1/sh1_timerisr.c +++ b/arch/renesas/src/sh1/sh1_timerisr.c @@ -125,7 +125,7 @@ * ****************************************************************************/ -static int sh1_timerisr(int irq, uint32_t *regs) +static int sh1_timerisr(int irq, uint32_t *regs, void *arg) { uint8_t reg8; @@ -183,7 +183,7 @@ void renesas_timer_initialize(void) /* Attach the IMIA0 IRQ */ - irq_attach(SH1_SYSTIMER_IRQ, (xcpt_t)sh1_timerisr); + irq_attach(SH1_SYSTIMER_IRQ, (xcpt_t)sh1_timerisr, NULL); /* Enable interrupts on GRA compare match */ diff --git a/arch/risc-v/src/common/up_internal.h b/arch/risc-v/src/common/up_internal.h index bed5f057609..bf0fa917783 100644 --- a/arch/risc-v/src/common/up_internal.h +++ b/arch/risc-v/src/common/up_internal.h @@ -137,7 +137,7 @@ void up_irqinitialize(void); void up_copystate(uint32_t *dest, uint32_t *src); void up_dumpstate(void); void up_sigdeliver(void); -int up_swint(int irq, FAR void *context); +int up_swint(int irq, FAR void *context, FAR void *arg); uint32_t up_get_newintctx(void); /* System timer *************************************************************/ diff --git a/arch/risc-v/src/nr5m100/nr5_irq.c b/arch/risc-v/src/nr5m100/nr5_irq.c index b0d1bfa756e..fd973e74541 100644 --- a/arch/risc-v/src/nr5m100/nr5_irq.c +++ b/arch/risc-v/src/nr5m100/nr5_irq.c @@ -111,7 +111,7 @@ void epic_dump(void) #define CONFIG_DEBUG -int nr5_trap_handler(int irq, void *context) +int nr5_trap_handler(int irq, void *context, FAR void *arg) { uint32_t sp; @@ -182,11 +182,11 @@ void up_irqinitialize(void) /* Attach the Trap exception handler. */ - irq_attach(NR5_IRQ_TRAP, nr5_trap_handler); + irq_attach(NR5_IRQ_TRAP, nr5_trap_handler, NULL); /* Attach software interrupt handler */ - irq_attach(NR5_IRQ_SOFTWARE, up_swint); + irq_attach(NR5_IRQ_SOFTWARE, up_swint, NULL); up_enable_irq(NR5_IRQ_SOFTWARE); /* Set the software interrupt priority higher */ diff --git a/arch/risc-v/src/nr5m100/nr5_serial.c b/arch/risc-v/src/nr5m100/nr5_serial.c index 44a4cd5d9f0..3d2e7381876 100644 --- a/arch/risc-v/src/nr5m100/nr5_serial.c +++ b/arch/risc-v/src/nr5m100/nr5_serial.c @@ -158,7 +158,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context); +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -363,8 +363,8 @@ static int up_attach(struct uart_dev_s *dev) /* Initialize interrupt generation on the peripheral */ up_serialout(priv, NR5_UART_CTRL_REG_OFFSET, IE_RX | IE_TX); - irq_attach(priv->irqrx, up_interrupt); - irq_attach(priv->irqtx, up_interrupt); + irq_attach(priv->irqrx, up_interrupt, NULL); + irq_attach(priv->irqtx, up_interrupt, NULL); /* Indicate no interrupts active in EPIC */ @@ -413,7 +413,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context) +static int up_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct up_dev_s *priv; diff --git a/arch/risc-v/src/nr5m100/nr5_timer.c b/arch/risc-v/src/nr5m100/nr5_timer.c index 132cb9e9849..4df3ef67556 100644 --- a/arch/risc-v/src/nr5m100/nr5_timer.c +++ b/arch/risc-v/src/nr5m100/nr5_timer.c @@ -275,7 +275,7 @@ static int nr5_timer_setisr(FAR struct nr5_timer_dev_s *dev, /* Otherwise set callback and enable interrupt */ - irq_attach(vectorno, handler); + irq_attach(vectorno, handler, NULL); up_enable_irq(vectorno); #ifdef CONFIG_ARCH_IRQPRIO diff --git a/arch/risc-v/src/nr5m100/nr5_timerisr.c b/arch/risc-v/src/nr5m100/nr5_timerisr.c index fc168a12c8a..93375279ec7 100644 --- a/arch/risc-v/src/nr5m100/nr5_timerisr.c +++ b/arch/risc-v/src/nr5m100/nr5_timerisr.c @@ -102,7 +102,7 @@ static uint64_t g_systick = 0; * ****************************************************************************/ -static int nr5m100_timerisr(int irq, void *context) +static int nr5m100_timerisr(int irq, void *context, FAR void *arg) { /* Process timer interrupt */ @@ -146,7 +146,7 @@ void riscv_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(NR5_IRQ_SYSTICK, nr5m100_timerisr); + (void)irq_attach(NR5_IRQ_SYSTICK, nr5m100_timerisr, NULL); /* Configure and enable SysTick to interrupt at the requested rate */ diff --git a/arch/risc-v/src/nr5m100/nr5_uart.c b/arch/risc-v/src/nr5m100/nr5_uart.c index 4497e70d3e9..312c6743d17 100644 --- a/arch/risc-v/src/nr5m100/nr5_uart.c +++ b/arch/risc-v/src/nr5m100/nr5_uart.c @@ -168,7 +168,7 @@ void nr5_uart_init(int uart) { /* Attache the ISR and enable the IRQ with the EPIC */ - //irq_attach(dev->regs->rx_irq, &nr5_uart_rx_isr); + //irq_attach(dev->regs->rx_irq, &nr5_uart_rx_isr, NULL); //up_enable_irq(dev->regs->rx_irq); // Set the baud rate diff --git a/arch/risc-v/src/rv32im/up_swint.c b/arch/risc-v/src/rv32im/up_swint.c index 61f3afefacf..1ba8c73bbd8 100644 --- a/arch/risc-v/src/rv32im/up_swint.c +++ b/arch/risc-v/src/rv32im/up_swint.c @@ -128,7 +128,7 @@ static void dispatch_syscall(void) * ****************************************************************************/ -int up_swint(int irq, FAR void *context) +int up_swint(int irq, FAR void *context, FAR void *arg) { uint32_t *regs = (uint32_t *)context; diff --git a/arch/x86/src/qemu/qemu_timerisr.c b/arch/x86/src/qemu/qemu_timerisr.c index ca1ff272f7d..56d5e42a657 100644 --- a/arch/x86/src/qemu/qemu_timerisr.c +++ b/arch/x86/src/qemu/qemu_timerisr.c @@ -93,7 +93,7 @@ * ****************************************************************************/ -static int qemu_timerisr(int irq, uint32_t *regs) +static int qemu_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -123,7 +123,7 @@ void x86_timer_initialize(void) /* Attach to the timer interrupt handler */ - (void)irq_attach(IRQ0, (xcpt_t)qemu_timerisr); + (void)irq_attach(IRQ0, (xcpt_t)qemu_timerisr, NULL); /* Send the command byte to configure counter 0 */ diff --git a/arch/xtensa/src/esp32/esp32_cpustart.c b/arch/xtensa/src/esp32/esp32_cpustart.c index 1efb25b567c..e79e7c3345b 100644 --- a/arch/xtensa/src/esp32/esp32_cpustart.c +++ b/arch/xtensa/src/esp32/esp32_cpustart.c @@ -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. */ diff --git a/arch/xtensa/src/esp32/esp32_gpio.c b/arch/xtensa/src/esp32/esp32_gpio.c index a86110c0fbb..892b87d51c5 100644 --- a/arch/xtensa/src/esp32/esp32_gpio.c +++ b/arch/xtensa/src/esp32/esp32_gpio.c @@ -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 diff --git a/arch/xtensa/src/esp32/esp32_intercpu_interrupt.c b/arch/xtensa/src/esp32/esp32_intercpu_interrupt.c index 01bac85b0cb..779aa3d7465 100644 --- a/arch/xtensa/src/esp32/esp32_intercpu_interrupt.c +++ b/arch/xtensa/src/esp32/esp32_intercpu_interrupt.c @@ -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); } diff --git a/arch/xtensa/src/esp32/esp32_irq.c b/arch/xtensa/src/esp32/esp32_irq.c index 11c43a4a1ce..c5a43a3d55e 100644 --- a/arch/xtensa/src/esp32/esp32_irq.c +++ b/arch/xtensa/src/esp32/esp32_irq.c @@ -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. */ diff --git a/arch/xtensa/src/esp32/esp32_serial.c b/arch/xtensa/src/esp32/esp32_serial.c index 3226895de7d..37027c8b9b9 100644 --- a/arch/xtensa/src/esp32/esp32_serial.c +++ b/arch/xtensa/src/esp32/esp32_serial.c @@ -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); } diff --git a/arch/xtensa/src/esp32/esp32_smp.h b/arch/xtensa/src/esp32/esp32_smp.h index 7418a2e0606..14da3164ac9 100644 --- a/arch/xtensa/src/esp32/esp32_smp.h +++ b/arch/xtensa/src/esp32/esp32_smp.h @@ -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 */ diff --git a/arch/xtensa/src/esp32/esp32_timerisr.c b/arch/xtensa/src/esp32/esp32_timerisr.c index 09653a582f3..777d0377323 100644 --- a/arch/xtensa/src/esp32/esp32_timerisr.c +++ b/arch/xtensa/src/esp32/esp32_timerisr.c @@ -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. */ diff --git a/arch/z16/src/z16f/z16f_serial.c b/arch/z16/src/z16f/z16f_serial.c index dcbcff5ceff..c12f34392b9 100644 --- a/arch/z16/src/z16f/z16f_serial.c +++ b/arch/z16/src/z16f/z16f_serial.c @@ -95,8 +95,8 @@ static int z16f_setup(struct uart_dev_s *dev); static void z16f_shutdown(struct uart_dev_s *dev); static int z16f_attach(struct uart_dev_s *dev); static void z16f_detach(struct uart_dev_s *dev); -static int z16f_rxinterrupt(int irq, void *context); -static int z16f_txinterrupt(int irq, void *context); +static int z16f_rxinterrupt(int irq, void *context, FAR void *arg); +static int z16f_txinterrupt(int irq, void *context, FAR void *arg); static int z16f_ioctl(struct file *filep, int cmd, unsigned long arg); static int z16f_receive(struct uart_dev_s *dev, uint32_t *status); static void z16f_rxint(struct uart_dev_s *dev, bool enable); @@ -426,12 +426,12 @@ static int z16f_attach(struct uart_dev_s *dev) /* Attach the RX IRQ */ - ret = irq_attach(priv->rxirq, z16f_rxinterrupt); + ret = irq_attach(priv->rxirq, z16f_rxinterrupt, NULL); if (ret == OK) { /* Attach the TX IRQ */ - ret = irq_attach(priv->txirq, z16f_txinterrupt); + ret = irq_attach(priv->txirq, z16f_txinterrupt, NULL); if (ret != OK) { irq_detach(priv->rxirq); @@ -471,7 +471,7 @@ static void z16f_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int z16f_rxinterrupt(int irq, void *context) +static int z16f_rxinterrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct z16f_uart_s *priv; @@ -526,7 +526,7 @@ static int z16f_rxinterrupt(int irq, void *context) * ****************************************************************************/ -static int z16f_txinterrupt(int irq, void *context) +static int z16f_txinterrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct z16f_uart_s *priv; diff --git a/arch/z16/src/z16f/z16f_timerisr.c b/arch/z16/src/z16f/z16f_timerisr.c index c9d75e6fa0f..19fca1f1b24 100644 --- a/arch/z16/src/z16f/z16f_timerisr.c +++ b/arch/z16/src/z16f/z16f_timerisr.c @@ -82,7 +82,7 @@ extern _Erom uint8_t SYS_CLK_FREQ; * ****************************************************************************/ -static int z16f_timerisr(int irq, uint32_t *regs) +static int z16f_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -224,6 +224,6 @@ void z16_timer_initialize(void) /* Attach and enable the timer interrupt (leaving at priority 0) */ - irq_attach(Z16F_IRQ_SYSTIMER, (xcpt_t)z16f_timerisr); + irq_attach(Z16F_IRQ_SYSTIMER, (xcpt_t)z16f_timerisr, NULL); up_enable_irq(Z16F_IRQ_SYSTIMER); } diff --git a/arch/z80/src/ez80/ez80_emac.c b/arch/z80/src/ez80/ez80_emac.c index 6d34a38a89a..eab60f95dce 100644 --- a/arch/z80/src/ez80/ez80_emac.c +++ b/arch/z80/src/ez80/ez80_emac.c @@ -400,13 +400,13 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv); /* Interrupt handling */ static void ez80emac_txinterrupt_work(FAR void *arg); -static int ez80emac_txinterrupt(int irq, FAR void *context); +static int ez80emac_txinterrupt(int irq, FAR void *context, FAR void *arg); static void ez80emac_rxinterrupt_work(FAR void *arg); -static int ez80emac_rxinterrupt(int irq, FAR void *context); +static int ez80emac_rxinterrupt(int irq, FAR void *context, FAR void *arg); static void ez80emac_sysinterrupt_work(FAR void *arg); -static int ez80emac_sysinterrupt(int irq, FAR void *context); +static int ez80emac_sysinterrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -1581,7 +1581,7 @@ static void ez80emac_txinterrupt_work(FAR void *arg) * ****************************************************************************/ -static int ez80emac_txinterrupt(int irq, FAR void *context) +static int ez80emac_txinterrupt(int irq, FAR void *context, FAR void *arg) { FAR struct ez80emac_driver_s *priv = &g_emac; uint8_t istat; @@ -1683,7 +1683,7 @@ static void ez80emac_rxinterrupt_work(FAR void *arg) * ****************************************************************************/ -static int ez80emac_rxinterrupt(int irq, FAR void *context) +static int ez80emac_rxinterrupt(int irq, FAR void *context, FAR void *arg) { FAR struct ez80emac_driver_s *priv = &g_emac; @@ -1804,7 +1804,7 @@ static void ez80emac_sysinterrupt_work(FAR void *arg) * ****************************************************************************/ -static int ez80emac_sysinterrupt(int irq, FAR void *context) +static int ez80emac_sysinterrupt(int irq, FAR void *context, FAR void *arg) { FAR struct ez80emac_driver_s *priv = &g_emac; @@ -2510,7 +2510,7 @@ int up_netinitialize(void) /* Attach IRQs */ - ret = irq_attach(EZ80_EMACSYS_IRQ, ez80emac_sysinterrupt); + ret = irq_attach(EZ80_EMACSYS_IRQ, ez80emac_sysinterrupt, NULL); if (ret < 0) { nerr("ERROR: Unable to attach IRQ %d\n", EZ80_EMACSYS_IRQ); @@ -2518,7 +2518,7 @@ int up_netinitialize(void) goto errout; } - ret = irq_attach(EZ80_EMACRX_IRQ, ez80emac_rxinterrupt); + ret = irq_attach(EZ80_EMACRX_IRQ, ez80emac_rxinterrupt, NULL); if (ret < 0) { nerr("ERROR: Unable to attach IRQ %d\n", EZ80_EMACRX_IRQ); @@ -2526,7 +2526,7 @@ int up_netinitialize(void) goto errout; } - ret = irq_attach(EZ80_EMACTX_IRQ, ez80emac_txinterrupt); + ret = irq_attach(EZ80_EMACTX_IRQ, ez80emac_txinterrupt, NULL); if (ret < 0) { nerr("ERROR: Unable to attach IRQ %d\n", EZ80_EMACTX_IRQ); diff --git a/arch/z80/src/ez80/ez80_serial.c b/arch/z80/src/ez80/ez80_serial.c index 4fbfdda7d57..6f52e86df24 100644 --- a/arch/z80/src/ez80/ez80_serial.c +++ b/arch/z80/src/ez80/ez80_serial.c @@ -85,7 +85,7 @@ static int ez80_setup(struct uart_dev_s *dev); static void ez80_shutdown(struct uart_dev_s *dev); static int ez80_attach(struct uart_dev_s *dev); static void ez80_detach(struct uart_dev_s *dev); -static int ez80_interrupt(int irq, void *context); +static int ez80_interrupt(int irq, void *context, FAR void *arg); static int ez80_ioctl(struct file *filep, int cmd, unsigned long arg); static int ez80_receive(struct uart_dev_s *dev, unsigned int *status); static void ez80_rxint(struct uart_dev_s *dev, bool enable); @@ -438,7 +438,7 @@ static int ez80_attach(struct uart_dev_s *dev) /* Attach the IRQ */ - return irq_attach(priv->irq, ez80_interrupt); + return irq_attach(priv->irq, ez80_interrupt, NULL); } /**************************************************************************** @@ -471,7 +471,7 @@ static void ez80_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int ez80_interrupt(int irq, void *context) +static int ez80_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct ez80_dev_s *priv; diff --git a/arch/z80/src/ez80/ez80_timerisr.c b/arch/z80/src/ez80/ez80_timerisr.c index ec21d58382b..16730bf5984 100644 --- a/arch/z80/src/ez80/ez80_timerisr.c +++ b/arch/z80/src/ez80/ez80_timerisr.c @@ -62,7 +62,7 @@ * ****************************************************************************/ -static int ez80_timerisr(int irq, chipreg_t *regs) +static int ez80_timerisr(int irq, chipreg_t *regs, void *arg) { /* Read the appropriate timer0 register to clear the interrupt */ @@ -110,7 +110,7 @@ void z80_timer_initialize(void) /* Attach system timer interrupts */ - irq_attach(EZ80_IRQ_SYSTIMER, (xcpt_t)ez80_timerisr); + irq_attach(EZ80_IRQ_SYSTIMER, (xcpt_t)ez80_timerisr, NULL); /* Set up the timer reload value */ /* Write to the timer reload register to set the reload value. diff --git a/arch/z80/src/z180/z180_timerisr.c b/arch/z80/src/z180/z180_timerisr.c index 29984d77bd2..0e1ac95da01 100644 --- a/arch/z80/src/z180/z180_timerisr.c +++ b/arch/z80/src/z180/z180_timerisr.c @@ -84,7 +84,7 @@ * ****************************************************************************/ -static int z180_timerisr(int irq, chipreg_t *regs) +static int z180_timerisr(int irq, chipreg_t *regs, void *arg) { /* "When TMDR0 decrements to 0, TIF0 is set to 1. This generates an interrupt * request if enabled by TIE0 = 1. TIF0 is reset to 0 when TCR is read and @@ -142,7 +142,7 @@ void z80_timer_initialize(void) /* Attach the timer interrupt vector */ - (void)irq_attach(Z180_PRT0, (xcpt_t)z180_timerisr); + (void)irq_attach(Z180_PRT0, (xcpt_t)z180_timerisr, NULL); /* And enable the timer interrupt */ diff --git a/arch/z80/src/z8/z8_serial.c b/arch/z80/src/z8/z8_serial.c index f7fe721ac03..bbd7b07fd30 100644 --- a/arch/z80/src/z8/z8_serial.c +++ b/arch/z80/src/z8/z8_serial.c @@ -96,8 +96,8 @@ static int z8_setup(FAR struct uart_dev_s *dev); static void z8_shutdown(FAR struct uart_dev_s *dev); static int z8_attach(FAR struct uart_dev_s *dev); static void z8_detach(FAR struct uart_dev_s *dev); -static int z8_rxinterrupt(int irq, FAR void *context); -static int z8_txinterrupt(int irq, FAR void *context); +static int z8_rxinterrupt(int irq, FAR void *context, FAR void *arg); +static int z8_txinterrupt(int irq, FAR void *context, FAR void *arg); static int z8_ioctl(FAR struct file *filep, int cmd, unsigned long arg); static int z8_receive(FAR struct uart_dev_s *dev, FAR uint32_t *status); static void z8_rxint(FAR struct uart_dev_s *dev, bool enable); @@ -446,12 +446,12 @@ static int z8_attach(FAR struct uart_dev_s *dev) /* Attach the RX IRQ */ - ret = irq_attach(priv->rxirq, z8_rxinterrupt); + ret = irq_attach(priv->rxirq, z8_rxinterrupt, NULL); if (ret == OK) { /* Attach the TX IRQ */ - ret = irq_attach(priv->txirq, z8_txinterrupt); + ret = irq_attach(priv->txirq, z8_txinterrupt, NULL); if (ret != OK) { irq_detach(priv->rxirq); @@ -488,7 +488,7 @@ static void z8_detach(FAR struct uart_dev_s *dev) * ****************************************************************************/ -static int z8_rxinterrupt(int irq, FAR void *context) +static int z8_rxinterrupt(int irq, FAR void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct z8_uart_s *priv; @@ -537,7 +537,7 @@ static int z8_rxinterrupt(int irq, FAR void *context) * ****************************************************************************/ -static int z8_txinterrupt(int irq, FAR void *context) +static int z8_txinterrupt(int irq, FAR void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct z8_uart_s *priv; diff --git a/arch/z80/src/z8/z8_timerisr.c b/arch/z80/src/z8/z8_timerisr.c index b399c12d8b0..e3fd1e48580 100644 --- a/arch/z80/src/z8/z8_timerisr.c +++ b/arch/z80/src/z8/z8_timerisr.c @@ -70,7 +70,7 @@ extern uint32_t get_freq(void); * ****************************************************************************/ -static int z8_timerisr(int irq, uint32_t *regs) +static int z8_timerisr(int irq, uint32_t *regs, void *arg) { /* Process timer interrupt */ @@ -137,7 +137,7 @@ void z80_timer_initialize(void) /* Attach and enable the timer interrupt (leaving at priority 0 */ - irq_attach(Z8_IRQ_SYSTIMER, (xcpt_t)z8_timerisr); + irq_attach(Z8_IRQ_SYSTIMER, (xcpt_t)z8_timerisr, NULL); up_enable_irq(Z8_IRQ_SYSTIMER); } diff --git a/configs/arduino-due/src/sam_touchscreen.c b/configs/arduino-due/src/sam_touchscreen.c index d16184a6cd0..b93aa11f688 100644 --- a/configs/arduino-due/src/sam_touchscreen.c +++ b/configs/arduino-due/src/sam_touchscreen.c @@ -267,7 +267,7 @@ static int tsc_attach(FAR struct ads7843e_config_s *state, xcpt_t isr) /* Attach the XPT2046 interrupt */ iinfo("Attaching %p to IRQ %d\n", isr, SAM_TSC_IRQ); - return irq_attach(SAM_TSC_IRQ, isr); + return irq_attach(SAM_TSC_IRQ, isr, NULL); } static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable) diff --git a/configs/bambino-200e/src/lpc43_buttons.c b/configs/bambino-200e/src/lpc43_buttons.c index 95755ccb791..b84a0744399 100644 --- a/configs/bambino-200e/src/lpc43_buttons.c +++ b/configs/bambino-200e/src/lpc43_buttons.c @@ -200,7 +200,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) { /* Attach then enable the new interrupt handler */ - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); up_enable_irq(irq); } else diff --git a/configs/dk-tm4c129x/src/tm4c_buttons.c b/configs/dk-tm4c129x/src/tm4c_buttons.c index 829891e7d5e..3e08a92512e 100644 --- a/configs/dk-tm4c129x/src/tm4c_buttons.c +++ b/configs/dk-tm4c129x/src/tm4c_buttons.c @@ -175,7 +175,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (irqhandler) { - ret = irq_attach(IRQ_SW4, irqhandler); + ret = irq_attach(IRQ_SW4, irqhandler, NULL); if (ret == OK) { handler = irqhandler; diff --git a/configs/ez80f910200zco/src/ez80_buttons.c b/configs/ez80f910200zco/src/ez80_buttons.c index 1fbfdcf2ad8..6bc2aa9462b 100644 --- a/configs/ez80f910200zco/src/ez80_buttons.c +++ b/configs/ez80f910200zco/src/ez80_buttons.c @@ -126,9 +126,9 @@ void board_button_initialize(void) /* Attach GIO interrupts */ - irq_attach(EZ80_PB_IRQ, up_PBinterrupt); - irq_attach(EZ80_PB1_IRQ, up_pb1interrupt); - irq_attach(EZ80_PB2_IRQ, up_pb2interrupt); + irq_attach(EZ80_PB_IRQ, up_PBinterrupt, NULL); + irq_attach(EZ80_PB1_IRQ, up_pb1interrupt, NULL); + irq_attach(EZ80_PB2_IRQ, up_pb2interrupt, NULL); /* Configure PB0,1,2 as interrupt, rising edge */ diff --git a/configs/hymini-stm32v/src/stm32_appinit.c b/configs/hymini-stm32v/src/stm32_appinit.c index 725a2126190..843660880a4 100644 --- a/configs/hymini-stm32v/src/stm32_appinit.c +++ b/configs/hymini-stm32v/src/stm32_appinit.c @@ -125,7 +125,7 @@ static FAR struct sdio_dev_s *g_sdiodev; ****************************************************************************/ #ifdef NSH_HAVEMMCSD -static int nsh_cdinterrupt(int irq, FAR void *context) +static int nsh_cdinterrupt(int irq, FAR void *context, FAR void *arg) { static bool inserted = 0xff; /* Impossible value */ bool present; diff --git a/configs/launchxl-tms57004/src/tms570_buttons.c b/configs/launchxl-tms57004/src/tms570_buttons.c index 2d2741280dd..d59368aacbb 100644 --- a/configs/launchxl-tms57004/src/tms570_buttons.c +++ b/configs/launchxl-tms57004/src/tms570_buttons.c @@ -108,7 +108,7 @@ static xcpt_t board_button_irqx(gio_pinset_t pinset, int irq, /* Configure the interrupt */ tms570_gioirq(pinset); - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); tms570_gioirqenable(irq); } else diff --git a/configs/lincoln60/src/lpc17_buttons.c b/configs/lincoln60/src/lpc17_buttons.c index ebcfc385c67..8b24ff5f3ad 100644 --- a/configs/lincoln60/src/lpc17_buttons.c +++ b/configs/lincoln60/src/lpc17_buttons.c @@ -207,7 +207,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) { /* Attach then enable the new interrupt handler */ - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); up_enable_irq(irq); } else diff --git a/configs/lpc4330-xplorer/src/lpc43_buttons.c b/configs/lpc4330-xplorer/src/lpc43_buttons.c index a277bfc8689..c74d6dae60e 100644 --- a/configs/lpc4330-xplorer/src/lpc43_buttons.c +++ b/configs/lpc4330-xplorer/src/lpc43_buttons.c @@ -206,7 +206,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) { /* Attach then enable the new interrupt handler */ - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); up_enable_irq(irq); } else diff --git a/configs/lpc4357-evb/src/lpc43_buttons.c b/configs/lpc4357-evb/src/lpc43_buttons.c index 37ac652cdfc..410b942c76b 100644 --- a/configs/lpc4357-evb/src/lpc43_buttons.c +++ b/configs/lpc4357-evb/src/lpc43_buttons.c @@ -213,7 +213,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) { /* Attach then enable the new interrupt handler */ - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); up_enable_irq(irq); } else diff --git a/configs/nucleo-f4x1re/src/stm32_ajoystick.c b/configs/nucleo-f4x1re/src/stm32_ajoystick.c index 7bc30b1d676..5fc611bb020 100644 --- a/configs/nucleo-f4x1re/src/stm32_ajoystick.c +++ b/configs/nucleo-f4x1re/src/stm32_ajoystick.c @@ -122,7 +122,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower, ajoy_handler_t handler, FAR void *arg); static void ajoy_disable(void); -static int ajoy_interrupt(int irq, FAR void *context); +static int ajoy_interrupt(int irq, FAR void *context, FAR void *arg); /**************************************************************************** * Private Data @@ -422,7 +422,7 @@ static void ajoy_disable(void) * ****************************************************************************/ -static int ajoy_interrupt(int irq, FAR void *context) +static int ajoy_interrupt(int irq, FAR void *context, FAR void *arg) { DEBUGASSERT(g_ajoyhandler); diff --git a/configs/nucleo-l476rg/src/stm32_ajoystick.c b/configs/nucleo-l476rg/src/stm32_ajoystick.c index 1fc72b5629c..b524d82279c 100644 --- a/configs/nucleo-l476rg/src/stm32_ajoystick.c +++ b/configs/nucleo-l476rg/src/stm32_ajoystick.c @@ -121,7 +121,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower, ajoy_handler_t handler, FAR void *arg); static void ajoy_disable(void); -static int ajoy_interrupt(int irq, FAR void *context); +static int ajoy_interrupt(int irq, FAR void *context, FAR void *arg); /**************************************************************************** * Private Data @@ -421,7 +421,7 @@ static void ajoy_disable(void) * ****************************************************************************/ -static int ajoy_interrupt(int irq, FAR void *context) +static int ajoy_interrupt(int irq, FAR void *context, FAR void *arg) { DEBUGASSERT(g_ajoyhandler); diff --git a/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c b/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c index 5545d5dac77..7b3f6228abd 100644 --- a/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c +++ b/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c @@ -205,7 +205,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Attach and enable the interrupt */ - (void)irq_attach(g_button_irqs[id], irqhandler); + (void)irq_attach(g_button_irqs[id], irqhandler, NULL); efm32_gpioirqenable(g_button_irqs[id]); } else diff --git a/configs/olimex-lpc1766stk/src/lpc17_buttons.c b/configs/olimex-lpc1766stk/src/lpc17_buttons.c index 888335f46bc..36b54237ac4 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_buttons.c +++ b/configs/olimex-lpc1766stk/src/lpc17_buttons.c @@ -210,7 +210,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) { /* Attach then enable the new interrupt handler */ - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); up_enable_irq(irq); } else diff --git a/configs/olimex-lpc1766stk/src/lpc17_ssp.c b/configs/olimex-lpc1766stk/src/lpc17_ssp.c index 17df5733e0e..7317a014b0f 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_ssp.c +++ b/configs/olimex-lpc1766stk/src/lpc17_ssp.c @@ -142,7 +142,7 @@ static void ssp_cdirqsetup(int irq, xcpt_t irqhandler) { /* Attach then enable the new interrupt handler */ - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); up_enable_irq(irq); } else diff --git a/configs/olimex-strp711/src/str71_enc28j60.c b/configs/olimex-strp711/src/str71_enc28j60.c index 73d16f1eadc..5b40eb13570 100644 --- a/configs/olimex-strp711/src/str71_enc28j60.c +++ b/configs/olimex-strp711/src/str71_enc28j60.c @@ -184,7 +184,7 @@ static const struct enc_lower_s g_enclower = static int up_attach(FAR const struct enc_lower_s *lower, xcpt_t handler) { - return irq_attach(ENC28J60_IRQ, handler); + return irq_attach(ENC28J60_IRQ, handler, NULL); } static void up_enable(FAR const struct enc_lower_s *lower) diff --git a/configs/open1788/src/lpc17_appinit.c b/configs/open1788/src/lpc17_appinit.c index d25f9bc2d18..7a43837649f 100644 --- a/configs/open1788/src/lpc17_appinit.c +++ b/configs/open1788/src/lpc17_appinit.c @@ -209,7 +209,7 @@ static int nsh_waiter(int argc, char *argv[]) ****************************************************************************/ #ifdef NSH_HAVE_MMCSD_CDINT -static int nsh_cdinterrupt(int irq, FAR void *context) +static int nsh_cdinterrupt(int irq, FAR void *context, FAR void *arg) { static bool inserted = 0xff; /* Impossible value */ bool present; @@ -249,7 +249,7 @@ static int nsh_sdinitialize(void) #ifdef NSH_HAVE_MMCSD_CDINT - (void)irq_attach(LPC17_IRQ_P0p13, nsh_cdinterrupt); + (void)irq_attach(LPC17_IRQ_P0p13, nsh_cdinterrupt, NULL); up_enable_irq(LPC17_IRQ_P0p13); #endif diff --git a/configs/open1788/src/lpc17_buttons.c b/configs/open1788/src/lpc17_buttons.c index 5ad2814f1ac..ca8f99278b9 100644 --- a/configs/open1788/src/lpc17_buttons.c +++ b/configs/open1788/src/lpc17_buttons.c @@ -234,7 +234,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) { /* Attach then enable the new interrupt handler */ - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); up_enable_irq(irq); } else diff --git a/configs/open1788/src/lpc17_touchscreen.c b/configs/open1788/src/lpc17_touchscreen.c index 008abc0660d..f6143069796 100644 --- a/configs/open1788/src/lpc17_touchscreen.c +++ b/configs/open1788/src/lpc17_touchscreen.c @@ -169,7 +169,7 @@ static int tsc_attach(FAR struct ads7843e_config_s *state, xcpt_t handler) { /* Attach then enable the touchscreen interrupt handler */ - (void)irq_attach(LPC17_IRQ_PENIRQ, handler); + (void)irq_attach(LPC17_IRQ_PENIRQ, handler, NULL); return OK; } diff --git a/configs/pcduino-a10/src/a1x_buttons.c b/configs/pcduino-a10/src/a1x_buttons.c index 1802b3656d8..b9e1deff0fc 100644 --- a/configs/pcduino-a10/src/a1x_buttons.c +++ b/configs/pcduino-a10/src/a1x_buttons.c @@ -142,7 +142,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Configure the interrupt */ a1x_pioirq(xxx); - (void)irq_attach(xxx, irqhandler); + (void)irq_attach(xxx, irqhandler, NULL); a1x_pioirqenable(xxx); leave_critical_section(flags); } diff --git a/configs/sam3u-ek/src/sam_buttons.c b/configs/sam3u-ek/src/sam_buttons.c index 57d087792ff..a995f19ab62 100644 --- a/configs/sam3u-ek/src/sam_buttons.c +++ b/configs/sam3u-ek/src/sam_buttons.c @@ -103,7 +103,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, /* Configure the interrupt */ sam_gpioirq(pinset); - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); sam_gpioirqenable(irq); } else diff --git a/configs/sam3u-ek/src/sam_touchscreen.c b/configs/sam3u-ek/src/sam_touchscreen.c index 7dec7f8e7a3..c5cc9df288d 100644 --- a/configs/sam3u-ek/src/sam_touchscreen.c +++ b/configs/sam3u-ek/src/sam_touchscreen.c @@ -157,7 +157,7 @@ static int tsc_attach(FAR struct ads7843e_config_s *state, xcpt_t isr) /* Attach the ADS7843E interrupt */ iinfo("Attaching %p to IRQ %d\n", isr, SAM_TCS_IRQ); - return irq_attach(SAM_TCS_IRQ, isr); + return irq_attach(SAM_TCS_IRQ, isr, NULL); } static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable) diff --git a/configs/sam4e-ek/src/sam_ads7843e.c b/configs/sam4e-ek/src/sam_ads7843e.c index d4b555aa449..82dd848cd90 100644 --- a/configs/sam4e-ek/src/sam_ads7843e.c +++ b/configs/sam4e-ek/src/sam_ads7843e.c @@ -154,7 +154,7 @@ static int tsc_attach(FAR struct ads7843e_config_s *state, xcpt_t isr) /* Attach the ADS7843E interrupt */ iinfo("Attaching %p to IRQ %d\n", isr, SAM_TCS_IRQ); - return irq_attach(SAM_TCS_IRQ, isr); + return irq_attach(SAM_TCS_IRQ, isr, NULL); } static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable) diff --git a/configs/sam4e-ek/src/sam_buttons.c b/configs/sam4e-ek/src/sam_buttons.c index d6650047284..46ab285bd59 100644 --- a/configs/sam4e-ek/src/sam_buttons.c +++ b/configs/sam4e-ek/src/sam_buttons.c @@ -105,7 +105,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, /* Configure the interrupt */ sam_gpioirq(pinset); - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); sam_gpioirqenable(irq); } else diff --git a/configs/sam4e-ek/src/sam_ethernet.c b/configs/sam4e-ek/src/sam_ethernet.c index b15cf06107a..c59e395e94f 100644 --- a/configs/sam4e-ek/src/sam_ethernet.c +++ b/configs/sam4e-ek/src/sam_ethernet.c @@ -243,7 +243,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable) sam_gpioirq(pinset); phyinfo("Attach IRQ%d\n", irq); - (void)irq_attach(irq, handler); + (void)irq_attach(irq, handler, NULL); } else { diff --git a/configs/sam4e-ek/src/sam_hsmci.c b/configs/sam4e-ek/src/sam_hsmci.c index e799cf0d1b9..92eb8f7ba19 100644 --- a/configs/sam4e-ek/src/sam_hsmci.c +++ b/configs/sam4e-ek/src/sam_hsmci.c @@ -90,7 +90,7 @@ static struct sam_hsmci_state_s g_hsmci; * ****************************************************************************/ -static int sam_hsmci_cardetect(int irq, void *regs) +static int sam_hsmci_cardetect(int irq, void *regs, FAR void *arg) { bool inserted; @@ -160,7 +160,7 @@ int sam_hsmci_initialize(int minor) /* Configure card detect interrupts */ sam_gpioirq(GPIO_MCI_CD); - (void)irq_attach(MCI_CD_IRQ, sam_hsmci_cardetect); + (void)irq_attach(MCI_CD_IRQ, sam_hsmci_cardetect, NULL); /* Then inform the HSMCI driver if there is or is not a card in the slot. */ diff --git a/configs/sam4l-xplained/src/sam_buttons.c b/configs/sam4l-xplained/src/sam_buttons.c index f57cf79eb5b..63cc85efd77 100644 --- a/configs/sam4l-xplained/src/sam_buttons.c +++ b/configs/sam4l-xplained/src/sam_buttons.c @@ -150,7 +150,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Configure the interrupt */ sam_gpioirq(GPIO_SW0); - (void)irq_attach(IRQ_SW0, irqhandler); + (void)irq_attach(IRQ_SW0, irqhandler, NULL); sam_gpioirqenable(IRQ_SW0); } else diff --git a/configs/sam4s-xplained-pro/src/sam_buttons.c b/configs/sam4s-xplained-pro/src/sam_buttons.c index 85d461217a5..11b19b87b43 100644 --- a/configs/sam4s-xplained-pro/src/sam_buttons.c +++ b/configs/sam4s-xplained-pro/src/sam_buttons.c @@ -149,7 +149,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Configure the interrupt */ sam_gpioirq(GPIO_SW0); - (void)irq_attach(IRQ_SW0, irqhandler); + (void)irq_attach(IRQ_SW0, irqhandler, NULL); sam_gpioirqenable(IRQ_SW0); } else diff --git a/configs/sam4s-xplained-pro/src/sam_hsmci.c b/configs/sam4s-xplained-pro/src/sam_hsmci.c index e71e948de82..1446269a5d5 100644 --- a/configs/sam4s-xplained-pro/src/sam_hsmci.c +++ b/configs/sam4s-xplained-pro/src/sam_hsmci.c @@ -95,7 +95,7 @@ static struct sam_hsmci_state_s g_hsmci; ****************************************************************************/ #ifdef CONFIG_MMCSD_HAVECARDDETECT -static int sam_hsmci_cardetect_int(int irq, void *regs) +static int sam_hsmci_cardetect_int(int irq, void *regs, FAR void *arg) { bool inserted; @@ -168,7 +168,7 @@ int sam_hsmci_initialize(void) /* Configure card detect interrupts */ sam_gpioirq(GPIO_MCI_CD); - (void)irq_attach(MCI_CD_IRQ, sam_hsmci_cardetect_int); + (void)irq_attach(MCI_CD_IRQ, sam_hsmci_cardetect_int, NULL); g_hsmci.inserted = sam_cardinserted(0); #else g_hsmci.inserted = true; /* An assumption? */ diff --git a/configs/sam4s-xplained/src/sam_buttons.c b/configs/sam4s-xplained/src/sam_buttons.c index b48e88461bb..3efa1df16e9 100644 --- a/configs/sam4s-xplained/src/sam_buttons.c +++ b/configs/sam4s-xplained/src/sam_buttons.c @@ -150,7 +150,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Configure the interrupt */ sam_gpioirq(GPIO_BP2); - (void)irq_attach(IRQ_BP2, irqhandler); + (void)irq_attach(IRQ_BP2, irqhandler, NULL); sam_gpioirqenable(IRQ_BP2); } else diff --git a/configs/sama5d2-xult/src/sam_buttons.c b/configs/sama5d2-xult/src/sam_buttons.c index 2bdef205c02..dddab61307a 100644 --- a/configs/sama5d2-xult/src/sam_buttons.c +++ b/configs/sama5d2-xult/src/sam_buttons.c @@ -159,7 +159,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Configure the interrupt */ sam_pioirq(PIO_BTN_USER); - (void)irq_attach(IRQ_BTN_USER, irqhandler); + (void)irq_attach(IRQ_BTN_USER, irqhandler, NULL); sam_pioirqenable(IRQ_BTN_USER); } else diff --git a/configs/sama5d3-xplained/src/sam_ajoystick.c b/configs/sama5d3-xplained/src/sam_ajoystick.c index a4712eabf85..322240fd9da 100644 --- a/configs/sama5d3-xplained/src/sam_ajoystick.c +++ b/configs/sama5d3-xplained/src/sam_ajoystick.c @@ -107,7 +107,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower, ajoy_handler_t handler, FAR void *arg); static void ajoy_disable(void); -static int ajoy_interrupt(int irq, FAR void *context); +static int ajoy_interrupt(int irq, FAR void *context, FAR void *arg); /**************************************************************************** * Private Data @@ -377,7 +377,7 @@ static void ajoy_disable(void) * ****************************************************************************/ -static int ajoy_interrupt(int irq, FAR void *context) +static int ajoy_interrupt(int irq, FAR void *context, FAR void *arg) { DEBUGASSERT(g_ajoyhandler); if (g_ajoyhandler) @@ -442,7 +442,7 @@ int sam_ajoy_initialization(void) */ sam_pioirq(g_joypio[i]); - (void)irq_attach(g_joyirq[i], ajoy_interrupt); + (void)irq_attach(g_joyirq[i], ajoy_interrupt, NULL); sam_pioirqdisable(g_joyirq[i]); } diff --git a/configs/sama5d3-xplained/src/sam_buttons.c b/configs/sama5d3-xplained/src/sam_buttons.c index 50636737c4e..93b51edaa2a 100644 --- a/configs/sama5d3-xplained/src/sam_buttons.c +++ b/configs/sama5d3-xplained/src/sam_buttons.c @@ -163,7 +163,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Configure the interrupt */ sam_pioirq(PIO_USER); - (void)irq_attach(IRQ_USER1, irqhandler); + (void)irq_attach(IRQ_USER1, irqhandler, NULL); sam_pioirqenable(IRQ_USER1); } else diff --git a/configs/sama5d3-xplained/src/sam_ethernet.c b/configs/sama5d3-xplained/src/sam_ethernet.c index 8505711302a..bad7d48b92a 100644 --- a/configs/sama5d3-xplained/src/sam_ethernet.c +++ b/configs/sama5d3-xplained/src/sam_ethernet.c @@ -332,7 +332,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable) sam_pioirq(pinset); phyinfo("Attach IRQ%d\n", irq); - (void)irq_attach(irq, handler); + (void)irq_attach(irq, handler, NULL); } else { diff --git a/configs/sama5d3-xplained/src/sam_hsmci.c b/configs/sama5d3-xplained/src/sam_hsmci.c index 27db3addacf..c6806034e84 100644 --- a/configs/sama5d3-xplained/src/sam_hsmci.c +++ b/configs/sama5d3-xplained/src/sam_hsmci.c @@ -112,7 +112,7 @@ struct sam_hsmci_state_s /* HSCMI device state */ #ifdef CONFIG_SAMA5_HSMCI0 -static int sam_hsmci0_cardetect(int irq, void *regs); +static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg); static struct sam_hsmci_state_s g_hsmci0 = { @@ -124,7 +124,7 @@ static struct sam_hsmci_state_s g_hsmci0 = #endif #ifdef CONFIG_SAMA5_HSMCI1 -static int sam_hsmci1_cardetect(int irq, void *regs); +static int sam_hsmci1_cardetect(int irq, void *regs, FAR void *arg); static struct sam_hsmci_state_s g_hsmci1 = { @@ -189,14 +189,14 @@ static int sam_hsmci_cardetect(struct sam_hsmci_state_s *state) } #ifdef CONFIG_SAMA5_HSMCI0 -static int sam_hsmci0_cardetect(int irq, void *regs) +static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg) { return sam_hsmci_cardetect(&g_hsmci0); } #endif #ifdef CONFIG_SAMA5_HSMCI1 -static int sam_hsmci1_cardetect(int irq, void *regs) +static int sam_hsmci1_cardetect(int irq, void *regs, FAR void *arg) { return sam_hsmci_cardetect(&g_hsmci1); } @@ -287,7 +287,7 @@ int sam_hsmci_initialize(int slotno, int minor) /* Configure card detect interrupts */ sam_pioirq(state->pincfg); - (void)irq_attach(state->irq, state->handler); + (void)irq_attach(state->irq, state->handler, NULL); /* Then inform the HSMCI driver if there is or is not a card in the slot. */ diff --git a/configs/sama5d3-xplained/src/sam_usb.c b/configs/sama5d3-xplained/src/sam_usb.c index b04c4eeb2ee..cad7cf01500 100644 --- a/configs/sama5d3-xplained/src/sam_usb.c +++ b/configs/sama5d3-xplained/src/sam_usb.c @@ -517,7 +517,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler) /* Configure the interrupt */ sam_pioirq(PIO_USBBC_VBUS_OVERCURRENT); - (void)irq_attach(IRQ_USBBC_VBUS_OVERCURRENT, handler); + (void)irq_attach(IRQ_USBBC_VBUS_OVERCURRENT, handler, NULL); sam_pioirqenable(IRQ_USBBC_VBUS_OVERCURRENT); /* Return the old handler (so that it can be restored) */ diff --git a/configs/sama5d3x-ek/src/sam_buttons.c b/configs/sama5d3x-ek/src/sam_buttons.c index 0449c3a4627..180d80fcf96 100644 --- a/configs/sama5d3x-ek/src/sam_buttons.c +++ b/configs/sama5d3x-ek/src/sam_buttons.c @@ -163,7 +163,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Configure the interrupt */ sam_pioirq(PIO_USER1); - (void)irq_attach(IRQ_USER1, irqhandler); + (void)irq_attach(IRQ_USER1, irqhandler, NULL); sam_pioirqenable(IRQ_USER1); } else diff --git a/configs/sama5d3x-ek/src/sam_ethernet.c b/configs/sama5d3x-ek/src/sam_ethernet.c index 87ee620ba7b..9dd45b9c62e 100644 --- a/configs/sama5d3x-ek/src/sam_ethernet.c +++ b/configs/sama5d3x-ek/src/sam_ethernet.c @@ -332,7 +332,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable) sam_pioirq(pinset); phyinfo("Attach IRQ%d\n", irq); - (void)irq_attach(irq, handler); + (void)irq_attach(irq, handler, NULL); } else { diff --git a/configs/sama5d3x-ek/src/sam_hsmci.c b/configs/sama5d3x-ek/src/sam_hsmci.c index 89a0307d890..94ba8342973 100644 --- a/configs/sama5d3x-ek/src/sam_hsmci.c +++ b/configs/sama5d3x-ek/src/sam_hsmci.c @@ -112,7 +112,7 @@ struct sam_hsmci_state_s /* HSCMI device state */ #ifdef CONFIG_SAMA5_HSMCI0 -static int sam_hsmci0_cardetect(int irq, void *regs); +static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg); static struct sam_hsmci_state_s g_hsmci0 = { @@ -124,7 +124,7 @@ static struct sam_hsmci_state_s g_hsmci0 = #endif #ifdef CONFIG_SAMA5_HSMCI1 -static int sam_hsmci1_cardetect(int irq, void *regs); +static int sam_hsmci1_cardetect(int irq, void *regs, FAR void *arg); static struct sam_hsmci_state_s g_hsmci1 = { @@ -189,14 +189,14 @@ static int sam_hsmci_cardetect(struct sam_hsmci_state_s *state) } #ifdef CONFIG_SAMA5_HSMCI0 -static int sam_hsmci0_cardetect(int irq, void *regs) +static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg) { return sam_hsmci_cardetect(&g_hsmci0); } #endif #ifdef CONFIG_SAMA5_HSMCI1 -static int sam_hsmci1_cardetect(int irq, void *regs) +static int sam_hsmci1_cardetect(int irq, void *regs, FAR void *arg) { return sam_hsmci_cardetect(&g_hsmci1); } @@ -287,7 +287,7 @@ int sam_hsmci_initialize(int slotno, int minor) /* Configure card detect interrupts */ sam_pioirq(state->pincfg); - (void)irq_attach(state->irq, state->handler); + (void)irq_attach(state->irq, state->handler, NULL); /* Then inform the HSMCI driver if there is or is not a card in the slot. */ diff --git a/configs/sama5d3x-ek/src/sam_usb.c b/configs/sama5d3x-ek/src/sam_usb.c index 93fec362310..5b365f422d9 100644 --- a/configs/sama5d3x-ek/src/sam_usb.c +++ b/configs/sama5d3x-ek/src/sam_usb.c @@ -509,7 +509,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler) /* Configure the interrupt */ sam_pioirq(PIO_USBBC_VBUS_OVERCURRENT); - (void)irq_attach(IRQ_USBBC_VBUS_OVERCURRENT, handler); + (void)irq_attach(IRQ_USBBC_VBUS_OVERCURRENT, handler, NULL); sam_pioirqenable(IRQ_USBBC_VBUS_OVERCURRENT); /* Return the old handler (so that it can be restored) */ diff --git a/configs/sama5d3x-ek/src/sam_wm8904.c b/configs/sama5d3x-ek/src/sam_wm8904.c index 7727afcd353..2bba0f3f045 100644 --- a/configs/sama5d3x-ek/src/sam_wm8904.c +++ b/configs/sama5d3x-ek/src/sam_wm8904.c @@ -204,7 +204,7 @@ static bool wm8904_enable(FAR const struct wm8904_lower_s *lower, bool enable) return ret; } -static int wm8904_interrupt(int irq, FAR void *context) +static int wm8904_interrupt(int irq, FAR void *context, FAR void *arg) { /* Just forward the interrupt to the WM8904 driver */ @@ -311,7 +311,7 @@ int sam_wm8904_initialize(int minor) /* Configure WM8904 interrupts */ sam_pioirq(PIO_INT_WM8904); - ret = irq_attach(IRQ_INT_WM8904, wm8904_interrupt); + ret = irq_attach(IRQ_INT_WM8904, wm8904_interrupt, NULL); if (ret < 0) { auderr("ERROR: Failed to attach WM8904 interrupt: %d\n", ret); diff --git a/configs/sama5d4-ek/src/sam_buttons.c b/configs/sama5d4-ek/src/sam_buttons.c index 52fc7af11b1..9b4fd75a8ca 100644 --- a/configs/sama5d4-ek/src/sam_buttons.c +++ b/configs/sama5d4-ek/src/sam_buttons.c @@ -159,7 +159,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Configure the interrupt */ sam_pioirq(PIO_BTN_USER); - (void)irq_attach(IRQ_BTN_USER, irqhandler); + (void)irq_attach(IRQ_BTN_USER, irqhandler, NULL); sam_pioirqenable(IRQ_BTN_USER); } else diff --git a/configs/sama5d4-ek/src/sam_ethernet.c b/configs/sama5d4-ek/src/sam_ethernet.c index edda5f686a2..9231e227585 100644 --- a/configs/sama5d4-ek/src/sam_ethernet.c +++ b/configs/sama5d4-ek/src/sam_ethernet.c @@ -301,7 +301,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable) sam_pioirq(pinset); phyinfo("Attach IRQ%d\n", irq); - (void)irq_attach(irq, handler); + (void)irq_attach(irq, handler, NULL); } else { diff --git a/configs/sama5d4-ek/src/sam_hsmci.c b/configs/sama5d4-ek/src/sam_hsmci.c index 5af7468a5ec..6687176542b 100644 --- a/configs/sama5d4-ek/src/sam_hsmci.c +++ b/configs/sama5d4-ek/src/sam_hsmci.c @@ -124,7 +124,7 @@ struct sam_hsmci_state_s /* HSCMI device state */ #ifdef CONFIG_SAMA5_HSMCI0 -static int sam_hsmci0_cardetect(int irq, void *regs); +static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg); static struct sam_hsmci_state_s g_hsmci0 = { @@ -202,7 +202,7 @@ static int sam_hsmci_cardetect(struct sam_hsmci_state_s *state) } #ifdef CONFIG_SAMA5_HSMCI0 -static int sam_hsmci0_cardetect(int irq, void *regs) +static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg) { int ret; @@ -337,7 +337,7 @@ int sam_hsmci_initialize(int slotno, int minor) /* Configure card detect interrupts */ sam_pioirq(state->cdcfg); - (void)irq_attach(state->irq, state->handler); + (void)irq_attach(state->irq, state->handler, NULL); /* Then inform the HSMCI driver if there is or is not a card in the slot. */ diff --git a/configs/sama5d4-ek/src/sam_maxtouch.c b/configs/sama5d4-ek/src/sam_maxtouch.c index adc98320ade..1511c7a662c 100644 --- a/configs/sama5d4-ek/src/sam_maxtouch.c +++ b/configs/sama5d4-ek/src/sam_maxtouch.c @@ -197,7 +197,7 @@ static void mxt_clear(FAR const struct mxt_lower_s *lower) /* Does nothing */ } -static int mxt_interrupt(int irq, FAR void *context) +static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) { /* Just forward the interrupt to the maXTouch driver */ @@ -269,7 +269,7 @@ int board_tsc_setup(int minor) /* Configure maXTouch CHG interrupts */ sam_pioirq(PIO_CHG_MXT); - (void)irq_attach(IRQ_CHG_MXT, mxt_interrupt); + (void)irq_attach(IRQ_CHG_MXT, mxt_interrupt, NULL); /* Initialize and register the I2C touchscreen device */ diff --git a/configs/sama5d4-ek/src/sam_usb.c b/configs/sama5d4-ek/src/sam_usb.c index 1f4d3aff62a..a73c4b384f7 100644 --- a/configs/sama5d4-ek/src/sam_usb.c +++ b/configs/sama5d4-ek/src/sam_usb.c @@ -510,7 +510,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler) /* Configure the interrupt */ sam_pioirq(PIO_USBBC_VBUS_OVERCURRENT); - (void)irq_attach(IRQ_USBBC_VBUS_OVERCURRENT, handler); + (void)irq_attach(IRQ_USBBC_VBUS_OVERCURRENT, handler, NULL); sam_pioirqenable(IRQ_USBBC_VBUS_OVERCURRENT); /* Return the old handler (so that it can be restored) */ diff --git a/configs/sama5d4-ek/src/sam_wm8904.c b/configs/sama5d4-ek/src/sam_wm8904.c index 7afb4b85af4..34ded3756d7 100644 --- a/configs/sama5d4-ek/src/sam_wm8904.c +++ b/configs/sama5d4-ek/src/sam_wm8904.c @@ -204,7 +204,7 @@ static bool wm8904_enable(FAR const struct wm8904_lower_s *lower, bool enable) return ret; } -static int wm8904_interrupt(int irq, FAR void *context) +static int wm8904_interrupt(int irq, FAR void *context, FAR void *arg) { /* Just forward the interrupt to the WM8904 driver */ @@ -311,7 +311,7 @@ int sam_wm8904_initialize(int minor) /* Configure WM8904 interrupts */ sam_pioirq(PIO_INT_WM8904); - ret = irq_attach(IRQ_INT_WM8904, wm8904_interrupt); + ret = irq_attach(IRQ_INT_WM8904, wm8904_interrupt, NULL); if (ret < 0) { auderr("ERROR: Failed to attach WM8904 interrupt: %d\n", ret); diff --git a/configs/samd20-xplained/src/sam_buttons.c b/configs/samd20-xplained/src/sam_buttons.c index 368014f2bce..59ffa0bd41b 100644 --- a/configs/samd20-xplained/src/sam_buttons.c +++ b/configs/samd20-xplained/src/sam_buttons.c @@ -146,7 +146,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Configure the interrupt */ sam_portirq(IRQ_SW0); - (void)irq_attach(IRQ_SW0, irqhandler); + (void)irq_attach(IRQ_SW0, irqhandler, NULL); sam_portirqenable(IRQ_SW0); leave_critical_section(flags); } diff --git a/configs/samd21-xplained/src/sam_buttons.c b/configs/samd21-xplained/src/sam_buttons.c index 280475de6de..ee63c024d6b 100644 --- a/configs/samd21-xplained/src/sam_buttons.c +++ b/configs/samd21-xplained/src/sam_buttons.c @@ -146,7 +146,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Configure the interrupt */ sam_portirq(IRQ_SW0); - (void)irq_attach(IRQ_SW0, irqhandler); + (void)irq_attach(IRQ_SW0, irqhandler, NULL); sam_portirqenable(IRQ_SW0); leave_critical_section(flags); } diff --git a/configs/same70-xplained/src/sam_buttons.c b/configs/same70-xplained/src/sam_buttons.c index d1154f70c89..46813e9ae4d 100644 --- a/configs/same70-xplained/src/sam_buttons.c +++ b/configs/same70-xplained/src/sam_buttons.c @@ -112,7 +112,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, /* Configure the interrupt */ sam_gpioirq(pinset); - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); sam_gpioirqenable(irq); } else diff --git a/configs/same70-xplained/src/sam_ethernet.c b/configs/same70-xplained/src/sam_ethernet.c index 8f427e8c97a..ecf61bdf731 100644 --- a/configs/same70-xplained/src/sam_ethernet.c +++ b/configs/same70-xplained/src/sam_ethernet.c @@ -347,7 +347,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable) sam_gpioirq(pinset); phyinfo("Attach IRQ%d\n", irq); - (void)irq_attach(irq, handler); + (void)irq_attach(irq, handler, NULL); } else { diff --git a/configs/same70-xplained/src/sam_hsmci.c b/configs/same70-xplained/src/sam_hsmci.c index 56df5830bd9..24d27d1c821 100644 --- a/configs/same70-xplained/src/sam_hsmci.c +++ b/configs/same70-xplained/src/sam_hsmci.c @@ -99,7 +99,7 @@ struct sam_hsmci_state_s /* HSCMI device state */ #ifdef CONFIG_SAMV7_HSMCI0 -static int sam_hsmci0_cardetect(int irq, void *regs); +static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg); static struct sam_hsmci_state_s g_hsmci0 = { @@ -164,7 +164,7 @@ static int sam_hsmci_cardetect(struct sam_hsmci_state_s *state) } #ifdef CONFIG_SAMV7_HSMCI0 -static int sam_hsmci0_cardetect(int irq, void *regs) +static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg) { int ret; @@ -263,7 +263,7 @@ int sam_hsmci_initialize(int slotno, int minor) /* Configure card detect interrupts */ sam_gpioirq(state->cdcfg); - (void)irq_attach(state->irq, state->handler); + (void)irq_attach(state->irq, state->handler, NULL); /* Then inform the HSMCI driver if there is or is not a card in the slot. */ diff --git a/configs/saml21-xplained/src/sam_buttons.c b/configs/saml21-xplained/src/sam_buttons.c index ea8994df6aa..c5f3226d4f7 100644 --- a/configs/saml21-xplained/src/sam_buttons.c +++ b/configs/saml21-xplained/src/sam_buttons.c @@ -146,7 +146,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Configure the interrupt */ sam_portirq(IRQ_SW0); - (void)irq_attach(IRQ_SW0, irqhandler); + (void)irq_attach(IRQ_SW0, irqhandler, NULL); sam_portirqenable(IRQ_SW0); leave_critical_section(flags); } diff --git a/configs/samv71-xult/src/sam_buttons.c b/configs/samv71-xult/src/sam_buttons.c index 2a803623880..70df9a1b6da 100644 --- a/configs/samv71-xult/src/sam_buttons.c +++ b/configs/samv71-xult/src/sam_buttons.c @@ -115,7 +115,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, /* Configure the interrupt */ sam_gpioirq(pinset); - (void)irq_attach(irq, irqhandler); + (void)irq_attach(irq, irqhandler, NULL); sam_gpioirqenable(irq); } else diff --git a/configs/samv71-xult/src/sam_ethernet.c b/configs/samv71-xult/src/sam_ethernet.c index 2714eab3beb..247c7258244 100644 --- a/configs/samv71-xult/src/sam_ethernet.c +++ b/configs/samv71-xult/src/sam_ethernet.c @@ -352,7 +352,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable) sam_gpioirq(pinset); phyinfo("Attach IRQ%d\n", irq); - (void)irq_attach(irq, handler); + (void)irq_attach(irq, handler, NULL); } else { diff --git a/configs/samv71-xult/src/sam_hsmci.c b/configs/samv71-xult/src/sam_hsmci.c index 2b4cb3295f8..2835e64357c 100644 --- a/configs/samv71-xult/src/sam_hsmci.c +++ b/configs/samv71-xult/src/sam_hsmci.c @@ -99,7 +99,7 @@ struct sam_hsmci_state_s /* HSCMI device state */ #ifdef CONFIG_SAMV7_HSMCI0 -static int sam_hsmci0_cardetect(int irq, void *regs); +static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg); static struct sam_hsmci_state_s g_hsmci0 = { @@ -164,7 +164,7 @@ static int sam_hsmci_cardetect(struct sam_hsmci_state_s *state) } #ifdef CONFIG_SAMV7_HSMCI0 -static int sam_hsmci0_cardetect(int irq, void *regs) +static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg) { int ret; @@ -263,7 +263,7 @@ int sam_hsmci_initialize(int slotno, int minor) /* Configure card detect interrupts */ sam_gpioirq(state->cdcfg); - (void)irq_attach(state->irq, state->handler); + (void)irq_attach(state->irq, state->handler, NULL); /* Then inform the HSMCI driver if there is or is not a card in the slot. */ diff --git a/configs/samv71-xult/src/sam_maxtouch.c b/configs/samv71-xult/src/sam_maxtouch.c index 7bce968fcd0..32e1cda60d3 100644 --- a/configs/samv71-xult/src/sam_maxtouch.c +++ b/configs/samv71-xult/src/sam_maxtouch.c @@ -196,7 +196,7 @@ static void mxt_clear(FAR const struct mxt_lower_s *lower) /* Does nothing */ } -static int mxt_interrupt(int irq, FAR void *context) +static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) { /* Just forward the interrupt to the maXTouch driver */ @@ -268,7 +268,7 @@ int board_tsc_setup(int minor) /* Configure maXTouch CHG interrupts */ sam_gpioirq(GPIO_MXT_CHG); - (void)irq_attach(IRQ_MXT_CHG, mxt_interrupt); + (void)irq_attach(IRQ_MXT_CHG, mxt_interrupt, NULL); /* Initialize and register the I2C touchscreen device */ diff --git a/configs/samv71-xult/src/sam_wm8904.c b/configs/samv71-xult/src/sam_wm8904.c index abb920bd0b7..8ffe0dfe214 100644 --- a/configs/samv71-xult/src/sam_wm8904.c +++ b/configs/samv71-xult/src/sam_wm8904.c @@ -204,7 +204,7 @@ static bool wm8904_enable(FAR const struct wm8904_lower_s *lower, bool enable) return ret; } -static int wm8904_interrupt(int irq, FAR void *context) +static int wm8904_interrupt(int irq, FAR void *context, FAR void *arg) { /* Just forward the interrupt to the WM8904 driver */ @@ -311,7 +311,7 @@ int sam_wm8904_initialize(int minor) /* Configure WM8904 interrupts */ sam_gpioirq(GPIO_INT_WM8904); - ret = irq_attach(IRQ_INT_WM8904, wm8904_interrupt); + ret = irq_attach(IRQ_INT_WM8904, wm8904_interrupt, NULL); if (ret < 0) { auderr("ERROR: Failed to attach WM8904 interrupt: %d\n", ret); diff --git a/configs/xtrs/src/xtr_irq.c b/configs/xtrs/src/xtr_irq.c index fb9890390ab..5cc00da9503 100644 --- a/configs/xtrs/src/xtr_irq.c +++ b/configs/xtrs/src/xtr_irq.c @@ -70,7 +70,7 @@ void up_irqinitialize(void) * xtrs_timer_initialize() */ - irq_attach(Z80_IRQ_SYSTIMER, (xcpt_t)xtrs_timerisr); + irq_attach(Z80_IRQ_SYSTIMER, (xcpt_t)xtrs_timerisr, NULL); /* And finally, enable interrupts (including the timer) */ diff --git a/configs/xtrs/src/xtr_timerisr.c b/configs/xtrs/src/xtr_timerisr.c index 5c12e6630c9..c05c661b35e 100644 --- a/configs/xtrs/src/xtr_timerisr.c +++ b/configs/xtrs/src/xtr_timerisr.c @@ -59,7 +59,7 @@ * ****************************************************************************/ -int xtrs_timerisr(int irq, FAR chipreg_t *regs) +int xtrs_timerisr(int irq, FAR chipreg_t *regs, FAR void *arg) { /* Process timer interrupt */ diff --git a/configs/z80sim/src/z80_irq.c b/configs/z80sim/src/z80_irq.c index b1fa22dc4cb..27f3c393e97 100644 --- a/configs/z80sim/src/z80_irq.c +++ b/configs/z80sim/src/z80_irq.c @@ -70,7 +70,7 @@ void up_irqinitialize(void) * z80sim_timer_initialize() */ - irq_attach(Z80_IRQ_SYSTIMER, (xcpt_t)z80sim_timerisr); + irq_attach(Z80_IRQ_SYSTIMER, (xcpt_t)z80sim_timerisr, NULL); /* And finally, enable interrupts (including the timer) */ diff --git a/configs/z80sim/src/z80_timerisr.c b/configs/z80sim/src/z80_timerisr.c index cd0bb57292b..a230652d5cc 100644 --- a/configs/z80sim/src/z80_timerisr.c +++ b/configs/z80sim/src/z80_timerisr.c @@ -59,7 +59,7 @@ * ****************************************************************************/ -int z80sim_timerisr(int irq, FAR chipreg_t *regs) +int z80sim_timerisr(int irq, FAR chipreg_t *regs, void *arg) { /* Process timer interrupt */ diff --git a/configs/zkit-arm-1769/src/lpc17_buttons.c b/configs/zkit-arm-1769/src/lpc17_buttons.c index 205473b2132..f8a479f8cca 100644 --- a/configs/zkit-arm-1769/src/lpc17_buttons.c +++ b/configs/zkit-arm-1769/src/lpc17_buttons.c @@ -186,7 +186,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Attach the new interrupt handler and enable the interrupt */ - ret = irq_attach(ZKITARM_KEY5_IRQ, irqhandler); + ret = irq_attach(ZKITARM_KEY5_IRQ, irqhandler, NULL); if (ret == OK) { up_enable_irq(ZKITARM_KEY5_IRQ); diff --git a/drivers/analog/ad5410.c b/drivers/analog/ad5410.c index 1608fc0689f..679edf2c5f2 100644 --- a/drivers/analog/ad5410.c +++ b/drivers/analog/ad5410.c @@ -97,7 +97,7 @@ static void dac_shutdown(FAR struct dac_dev_s *dev); static void dac_txint(FAR struct dac_dev_s *dev, bool enable); static int dac_send(FAR struct dac_dev_s *dev, FAR struct dac_msg_s *msg); static int dac_ioctl(FAR struct dac_dev_s *dev, int cmd, unsigned long arg); -static int dac_interrupt(int irq, void *context); +static int dac_interrupt(int irq, void *context, FAR void *arg); /**************************************************************************** * ad_private Data diff --git a/drivers/analog/ads1255.c b/drivers/analog/ads1255.c index 30810c2f69f..94b278de096 100644 --- a/drivers/analog/ads1255.c +++ b/drivers/analog/ads1255.c @@ -148,7 +148,7 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg); /* Interrupt handling */ static void adc_worker(FAR void *arg); -static int adc_interrupt(int irq, void *context); +static int adc_interrupt(int irq, void *context, FAR void *arg); /**************************************************************************** * Private Data @@ -312,7 +312,7 @@ static int adc_setup(FAR struct adc_dev_s *dev) DEBUGASSERT(priv != NULL && priv->spi != NULL); spi = priv->spi; - ret = irq_attach(priv->irq, adc_interrupt); + ret = irq_attach(priv->irq, adc_interrupt, NULL); if (ret == OK) { adc_lock(spi); @@ -473,7 +473,7 @@ static void adc_worker(FAR void *arg) * ****************************************************************************/ -static int adc_interrupt(int irq, void *context) +static int adc_interrupt(int irq, void *context, FAR void *arg) { FAR struct ads1255_dev_s *priv = (FAR struct ads1255_dev_s *)g_adcdev.ad_priv; diff --git a/drivers/input/mxt.c b/drivers/input/mxt.c index 5d617ba764b..713d6ddb3af 100644 --- a/drivers/input/mxt.c +++ b/drivers/input/mxt.c @@ -256,7 +256,7 @@ static void mxt_touch_event(FAR struct mxt_dev_s *priv, FAR struct mxt_msg_s *msg, int ndx); static void mxt_worker(FAR void *arg); static int mxt_interrupt(FAR const struct mxt_lower_s *lower, - FAR void *arg); + FAR void *context); /* Character driver methods */ @@ -1074,7 +1074,7 @@ errout_with_semaphore: * Name: mxt_interrupt ****************************************************************************/ -static int mxt_interrupt(FAR const struct mxt_lower_s *lower, FAR void *arg) +static int mxt_interrupt(FAR const struct mxt_lower_s *lower, FAR void * arg) { FAR struct mxt_dev_s *priv = (FAR struct mxt_dev_s *)arg; int ret; diff --git a/drivers/ioexpander/skeleton.c b/drivers/ioexpander/skeleton.c index 03f15f8cffb..77e390a2f90 100644 --- a/drivers/ioexpander/skeleton.c +++ b/drivers/ioexpander/skeleton.c @@ -664,7 +664,7 @@ static void skel_irqworker(void *arg) * * NOTE: A more typical prototype for an interrupt handler would be: * - * int skel_interrupt(int irq, FAR void *context) + * int skel_interrupt(int irq, FAR void *context, FAR void *arg) * * However, it is assume that the lower half, board specific interface * can provide intercept the actual interrupt, and call this function with diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index f662f40f38a..a883370bbf8 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -126,7 +126,7 @@ static void cs89x0_txdone(struct cs89x0_driver_s *cs89x0, uint16_t isq); #if CONFIG_CS89x0_NINTERFACES > 1 static inline FAR struct cs89x0_driver_s *cs89x0_mapirq(int irq); #endif -static int cs89x0_interrupt(int irq, FAR void *context); +static int cs89x0_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -672,7 +672,7 @@ static inline FAR struct cs89x0_driver_s *cs89x0_mapirq(int irq) * ****************************************************************************/ -static int cs89x0_interrupt(int irq, FAR void *context) +static int cs89x0_interrupt(int irq, FAR void *context, FAR void *arg) { register struct cs89x0_driver_s *cs89x0 = s89x0_mapirq(irq); uint16_t isq; @@ -1023,7 +1023,7 @@ int cs89x0_initialize(FAR const cs89x0_driver_s *cs89x0, int devno) /* Attach the IRQ to the driver */ - if (irq_attach(cs89x0->irq, cs89x0_interrupt)) + if (irq_attach(cs89x0->irq, cs89x0_interrupt, NULL)) { /* We could not attach the ISR to the ISR */ diff --git a/drivers/net/dm90x0.c b/drivers/net/dm90x0.c index c90fc283e61..6416ffb9731 100644 --- a/drivers/net/dm90x0.c +++ b/drivers/net/dm90x0.c @@ -385,7 +385,7 @@ static void dm9x_receive(struct dm9x_driver_s *priv); static void dm9x_txdone(struct dm9x_driver_s *priv); static void dm9x_interrupt_work(FAR void *arg); -static int dm9x_interrupt(int irq, FAR void *context); +static int dm9x_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -1238,7 +1238,7 @@ static void dm9x_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int dm9x_interrupt(int irq, FAR void *context) +static int dm9x_interrupt(int irq, FAR void *context, FAR void *arg) { #if CONFIG_DM9X_NINTERFACES == 1 FAR struct dm9x_driver_s *priv = &g_dm9x[0]; @@ -1952,7 +1952,7 @@ int dm9x_initialize(void) /* Attach the IRQ to the driver */ - if (irq_attach(CONFIG_DM9X_IRQ, dm9x_interrupt)) + if (irq_attach(CONFIG_DM9X_IRQ, dm9x_interrupt, NULL)) { /* We could not attach the ISR to the ISR */ diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index 4ac01decaee..d579b0e4db9 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -210,7 +210,7 @@ static void ftmac100_receive(FAR struct ftmac100_driver_s *priv); static void ftmac100_txdone(FAR struct ftmac100_driver_s *priv); static void ftmac100_interrupt_work(FAR void *arg); -static int ftmac100_interrupt(int irq, FAR void *context); +static int ftmac100_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -990,7 +990,7 @@ out: * ****************************************************************************/ -static int ftmac100_interrupt(int irq, FAR void *context) +static int ftmac100_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct ftmac100_driver_s *priv = &g_ftmac100[0]; FAR struct ftmac100_register_s *iobase = (FAR struct ftmac100_register_s *)priv->iobase; @@ -1579,7 +1579,7 @@ int ftmac100_initialize(int intf) /* Attach the IRQ to the driver */ - if (irq_attach(CONFIG_FTMAC100_IRQ, ftmac100_interrupt)) + if (irq_attach(CONFIG_FTMAC100_IRQ, ftmac100_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ diff --git a/drivers/net/phy_notify.c b/drivers/net/phy_notify.c index 5f202f9ae93..2b552d620de 100644 --- a/drivers/net/phy_notify.c +++ b/drivers/net/phy_notify.c @@ -116,13 +116,13 @@ struct phy_notify_s ****************************************************************************/ static int phy_handler(FAR struct phy_notify_s *client); -static int phy_handler_0(int irq, FAR void *context); +static int phy_handler_0(int irq, FAR void *context, FAR void *arg); #if CONFIG_PHY_NOTIFICATION_NCLIENTS > 1 -static int phy_handler_1(int irq, FAR void *context); +static int phy_handler_1(int irq, FAR void *context, FAR void *arg); #if CONFIG_PHY_NOTIFICATION_NCLIENTS > 2 -static int phy_handler_2(int irq, FAR void *context); +static int phy_handler_2(int irq, FAR void *context, FAR void *arg); #if CONFIG_PHY_NOTIFICATION_NCLIENTS > 3 -static int phy_handler_3(int irq, FAR void *context); +static int phy_handler_3(int irq, FAR void *context, FAR void *arg); #endif #endif #endif @@ -298,27 +298,27 @@ static int phy_handler(FAR struct phy_notify_s *client) * Name: phy_handler_0, phy_handler_1, ... ****************************************************************************/ -static int phy_handler_0(int irq, FAR void *context) +static int phy_handler_0(int irq, FAR void *context, FAR void *arg) { return phy_handler(&g_notify_clients[0]); } #if CONFIG_PHY_NOTIFICATION_NCLIENTS > 1 -static int phy_handler_1(int irq, FAR void *context) +static int phy_handler_1(int irq, FAR void *context, FAR void *arg) { return phy_handler(&g_notify_clients[1]); } #endif #if CONFIG_PHY_NOTIFICATION_NCLIENTS > 2 -static int phy_handler_2(int irq, FAR void *context) +static int phy_handler_2(int irq, FAR void *context, FAR void *arg) { return phy_handler(&g_notify_clients[2]); } #endif #if CONFIG_PHY_NOTIFICATION_NCLIENTS > 3 -static int phy_handler_3(int irq, FAR void *context) +static int phy_handler_3(int irq, FAR void *context, FAR void *arg) { return phy_handler(&g_notify_clients[3]); } diff --git a/drivers/net/skeleton.c b/drivers/net/skeleton.c index b312d3460fe..c11c5e729bb 100644 --- a/drivers/net/skeleton.c +++ b/drivers/net/skeleton.c @@ -157,7 +157,7 @@ static void skel_receive(FAR struct skel_driver_s *priv); static void skel_txdone(FAR struct skel_driver_s *priv); static void skel_interrupt_work(FAR void *arg); -static int skel_interrupt(int irq, FAR void *context); +static int skel_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -566,7 +566,7 @@ static void skel_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int skel_interrupt(int irq, FAR void *context) +static int skel_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct skel_driver_s *priv = &g_skel[0]; @@ -1115,7 +1115,7 @@ int skel_initialize(int intf) /* Attach the IRQ to the driver */ - if (irq_attach(CONFIG_skeleton_IRQ, skel_interrupt)) + if (irq_attach(CONFIG_skeleton_IRQ, skel_interrupt, NULL)) { /* We could not attach the ISR to the interrupt */ diff --git a/drivers/serial/uart_16550.c b/drivers/serial/uart_16550.c index 2d77ea812e8..b1704983f1b 100644 --- a/drivers/serial/uart_16550.c +++ b/drivers/serial/uart_16550.c @@ -94,7 +94,7 @@ static void u16550_shutdown(struct uart_dev_s *dev); static int u16550_attach(struct uart_dev_s *dev); static void u16550_detach(struct uart_dev_s *dev); #ifndef CONFIG_SUPPRESS_SERIAL_INTS -static int u16550_interrupt(int irq, void *context); +static int u16550_interrupt(int irq, void *context, FAR void *arg); #endif static int u16550_ioctl(struct file *filep, int cmd, unsigned long arg); static int u16550_receive(struct uart_dev_s *dev, uint32_t *status); @@ -688,7 +688,7 @@ static int u16550_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, u16550_interrupt); + ret = irq_attach(priv->irq, u16550_interrupt, NULL); #ifndef CONFIG_ARCH_NOINTC if (ret == OK) { @@ -739,7 +739,7 @@ static void u16550_detach(FAR struct uart_dev_s *dev) ****************************************************************************/ #ifndef CONFIG_SUPPRESS_SERIAL_INTS -static int u16550_interrupt(int irq, void *context) +static int u16550_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = NULL; struct u16550_s *priv; diff --git a/drivers/wireless/cc3000/cc3000.c b/drivers/wireless/cc3000/cc3000.c index 2a651cd19c5..80ed10d1fac 100644 --- a/drivers/wireless/cc3000/cc3000.c +++ b/drivers/wireless/cc3000/cc3000.c @@ -142,7 +142,7 @@ static void cc3000_deselect_and_unlock(FAR struct spi_dev_s *spi); static void cc3000_notify(FAR struct cc3000_dev_s *priv); static void *cc3000_worker(FAR void *arg); -static int cc3000_interrupt(int irq, FAR void *context); +static int cc3000_interrupt(int irq, FAR void *context, FAR void *arg); /* Character driver methods */ @@ -746,7 +746,7 @@ static void * cc3000_worker(FAR void *arg) * Name: cc3000_interrupt ****************************************************************************/ -static int cc3000_interrupt(int irq, FAR void *context) +static int cc3000_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct cc3000_dev_s *priv; @@ -1577,7 +1577,7 @@ int cc3000_register(FAR struct spi_dev_s *spi, /* Attach the interrupt handler */ - ret = config->irq_attach(config, cc3000_interrupt); + ret = config->irq_attach(config, cc3000_interrupt, NULL); if (ret < 0) { nerr("ERROR: Failed to attach interrupt\n"); diff --git a/include/nuttx/irq.h b/include/nuttx/irq.h index e5ae0807d9e..45ccb3bb743 100644 --- a/include/nuttx/irq.h +++ b/include/nuttx/irq.h @@ -55,7 +55,7 @@ */ #ifndef __ASSEMBLY__ -# define irq_detach(isr) irq_attach(isr, NULL) +# define irq_detach(isr) irq_attach(isr, NULL, NULL) #endif /**************************************************************************** @@ -65,7 +65,7 @@ /* This struct defines the way the registers are stored */ #ifndef __ASSEMBLY__ -typedef int (*xcpt_t)(int irq, FAR void *context); +typedef int (*xcpt_t)(int irq, FAR void *context, FAR void *arg); #endif /* Now include architecture-specific types */ @@ -94,11 +94,11 @@ extern "C" * * Description: * Configure the IRQ subsystem so that IRQ number 'irq' is dispatched to - * 'isr' + * 'isr' with argument 'arg' * ****************************************************************************/ -int irq_attach(int irq, xcpt_t isr); +int irq_attach(int irq, xcpt_t isr, FAR void * arg); /**************************************************************************** * Name: enter_critical_section diff --git a/sched/irq/irq.h b/sched/irq/irq.h index a7b4b431ab3..780d13347a5 100644 --- a/sched/irq/irq.h +++ b/sched/irq/irq.h @@ -59,7 +59,13 @@ * occurrence of an interrupt. */ -extern FAR xcpt_t g_irqvector[NR_IRQS]; +struct irq +{ + xcpt_t handler; + FAR void * arg; +}; + +extern struct irq g_irqvector[NR_IRQS]; #ifdef CONFIG_SMP /* This is the spinlock that enforces critical sections when interrupts are @@ -109,7 +115,7 @@ void weak_function irq_initialize(void); * ****************************************************************************/ -int irq_unexpected_isr(int irq, FAR void *context); +int irq_unexpected_isr(int irq, FAR void *context, FAR void *arg); /**************************************************************************** * Name: irq_cpu_locked diff --git a/sched/irq/irq_attach.c b/sched/irq/irq_attach.c index d111eeb5c78..c006ea15df4 100644 --- a/sched/irq/irq_attach.c +++ b/sched/irq/irq_attach.c @@ -76,7 +76,7 @@ * ****************************************************************************/ -int irq_attach(int irq, xcpt_t isr) +int irq_attach(int irq, xcpt_t isr, FAR void * arg) { #if NR_IRQS > 0 int ret = ERROR; @@ -111,11 +111,13 @@ int irq_attach(int irq, xcpt_t isr) */ isr = irq_unexpected_isr; + arg = NULL; } /* Save the new ISR in the table. */ - g_irqvector[irq] = isr; + g_irqvector[irq].handler = isr; + g_irqvector[irq].arg = arg; leave_critical_section(flags); ret = OK; } diff --git a/sched/irq/irq_dispatch.c b/sched/irq/irq_dispatch.c index becc5b09795..576e7576289 100644 --- a/sched/irq/irq_dispatch.c +++ b/sched/irq/irq_dispatch.c @@ -62,17 +62,20 @@ void irq_dispatch(int irq, FAR void *context) { xcpt_t vector; + FAR void *arg; /* Perform some sanity checks */ #if NR_IRQS > 0 - if ((unsigned)irq >= NR_IRQS || g_irqvector[irq] == NULL) + if ((unsigned)irq >= NR_IRQS || g_irqvector[irq].handler == NULL) { vector = irq_unexpected_isr; + arg = NULL; } else { - vector = g_irqvector[irq]; + vector = g_irqvector[irq].handler; + arg = g_irqvector[irq].arg; } #else vector = irq_unexpected_isr; @@ -80,5 +83,5 @@ void irq_dispatch(int irq, FAR void *context) /* Then dispatch to the interrupt handler */ - vector(irq, context); + vector(irq, context, arg); } diff --git a/sched/irq/irq_initialize.c b/sched/irq/irq_initialize.c index 50bbc581bf1..e03d27abdc8 100644 --- a/sched/irq/irq_initialize.c +++ b/sched/irq/irq_initialize.c @@ -47,7 +47,7 @@ * Public Data ****************************************************************************/ -FAR xcpt_t g_irqvector[NR_IRQS]; +struct irq g_irqvector[NR_IRQS]; /**************************************************************************** * Public Functions @@ -69,6 +69,7 @@ void irq_initialize(void) for (i = 0; i < NR_IRQS; i++) { - g_irqvector[i] = irq_unexpected_isr; + g_irqvector[i].handler = irq_unexpected_isr; + g_irqvector[i].arg = NULL; } } diff --git a/sched/irq/irq_unexpectedisr.c b/sched/irq/irq_unexpectedisr.c index 9eb250fa491..ae3097786f1 100644 --- a/sched/irq/irq_unexpectedisr.c +++ b/sched/irq/irq_unexpectedisr.c @@ -58,7 +58,7 @@ * ****************************************************************************/ -int irq_unexpected_isr(int irq, FAR void *context) +int irq_unexpected_isr(int irq, FAR void *context, FAR void *arg) { (void)up_irq_save(); _err("ERROR irq: %d\n", irq); From 6e2ee2b07fb2c6d4d02e09a725d5566397643b0a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 07:20:21 -0600 Subject: [PATCH 02/38] Kinetis: GPIO interrupt handling needs handler argument. --- arch/arm/src/kinetis/kinetis.h | 3 ++- arch/arm/src/kinetis/kinetis_pinirq.c | 25 +++++++++++++++++-------- configs/freedom-k64f/src/k64_sdhc.c | 2 +- configs/freedom-k66f/src/k66_buttons.c | 2 +- configs/freedom-k66f/src/k66_sdhc.c | 2 +- configs/kwikstik-k40/src/k40_appinit.c | 2 +- configs/twr-k60n512/src/k60_appinit.c | 2 +- configs/twr-k64f120m/src/k64_sdhc.c | 2 +- 8 files changed, 25 insertions(+), 15 deletions(-) diff --git a/arch/arm/src/kinetis/kinetis.h b/arch/arm/src/kinetis/kinetis.h index 1688014592c..701fed2d3d9 100644 --- a/arch/arm/src/kinetis/kinetis.h +++ b/arch/arm/src/kinetis/kinetis.h @@ -490,6 +490,7 @@ void kinetis_pinirqinitialize(void); * Parameters: * - pinset: Pin configuration * - pinisr: Pin interrupt service routine + * - arg: And argument that will be provided to the interrupt service routine. * * Returns: * The previous value of the interrupt handler function pointer. This value may, @@ -498,7 +499,7 @@ void kinetis_pinirqinitialize(void); * ************************************************************************************/ -xcpt_t kinetis_pinirqattach(uint32_t pinset, xcpt_t pinisr); +xcpt_t kinetis_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg); /************************************************************************************ * Name: kinetis_pinirqenable diff --git a/arch/arm/src/kinetis/kinetis_pinirq.c b/arch/arm/src/kinetis/kinetis_pinirq.c index 81b63bd78ae..bc44b4e05b3 100644 --- a/arch/arm/src/kinetis/kinetis_pinirq.c +++ b/arch/arm/src/kinetis/kinetis_pinirq.c @@ -73,6 +73,12 @@ * Private Types ****************************************************************************/ +struct kinetis_pinirq_s +{ + xcpt_t handler; + void *arg; +}; + /**************************************************************************** * Private Data ****************************************************************************/ @@ -84,19 +90,19 @@ */ #ifdef CONFIG_KINETIS_PORTAINTS -static xcpt_t g_portaisrs[32]; +static struct kinetis_pinirq_s g_portaisrs[32]; #endif #ifdef CONFIG_KINETIS_PORTBINTS -static xcpt_t g_portbisrs[32]; +static struct kinetis_pinirq_s g_portbisrs[32]; #endif #ifdef CONFIG_KINETIS_PORTCINTS -static xcpt_t g_portcisrs[32]; +static struct kinetis_pinirq_s g_portcisrs[32]; #endif #ifdef CONFIG_KINETIS_PORTDINTS -static xcpt_t g_portdisrs[32]; +static struct kinetis_pinirq_s g_portdisrs[32]; #endif #ifdef CONFIG_KINETIS_PORTEINTS -static xcpt_t g_porteisrs[32]; +static struct kinetis_pinirq_s g_porteisrs[32]; #endif /**************************************************************************** @@ -113,7 +119,7 @@ static xcpt_t g_porteisrs[32]; #ifdef HAVE_PORTINTS static int kinetis_portinterrupt(int irq, FAR void *context, - uintptr_t addr, xcpt_t *isrtab) + uintptr_t addr, struct kinetis_pinirq_s *isrtab) { uint32_t isfr = getreg32(addr); int i; @@ -138,9 +144,12 @@ static int kinetis_portinterrupt(int irq, FAR void *context, if (isrtab[i]) { + xcpt_t handler = isrtab[i].handler; + void *arg = isrtab[i].arg; + /* There is a registered interrupt handler... invoke it */ - (void)isrtab[i](irq, context); + (void)handler(irq, context, arg); } /* Writing a one to the ISFR register will clear the pending @@ -263,7 +272,7 @@ void kinetis_pinirqinitialize(void) * ****************************************************************************/ -xcpt_t kinetis_pinirqattach(uint32_t pinset, xcpt_t pinisr) +xcpt_t kinetis_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg) { #ifdef HAVE_PORTINTS xcpt_t *isrtab; diff --git a/configs/freedom-k64f/src/k64_sdhc.c b/configs/freedom-k64f/src/k64_sdhc.c index 4083235048b..7d50118dba6 100644 --- a/configs/freedom-k64f/src/k64_sdhc.c +++ b/configs/freedom-k64f/src/k64_sdhc.c @@ -169,7 +169,7 @@ int k64_sdhc_initialize(void) /* Attached the card detect interrupt (but don't enable it yet) */ - kinetis_pinirqattach(GPIO_SD_CARDDETECT, k64_cdinterrupt); + kinetis_pinirqattach(GPIO_SD_CARDDETECT, k64_cdinterrupt, NULL); /* Configure the write protect GPIO -- None */ diff --git a/configs/freedom-k66f/src/k66_buttons.c b/configs/freedom-k66f/src/k66_buttons.c index 7cb132bd2b3..c772177d1d8 100644 --- a/configs/freedom-k66f/src/k66_buttons.c +++ b/configs/freedom-k66f/src/k66_buttons.c @@ -163,7 +163,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) * Attach the new button handler. */ - oldhandler = kinetis_pinirqattach(pinset, irqhandler); + oldhandler = kinetis_pinirqattach(pinset, irqhandler, NULL); /* Then make sure that interrupts are enabled on the pin */ diff --git a/configs/freedom-k66f/src/k66_sdhc.c b/configs/freedom-k66f/src/k66_sdhc.c index 899cc17870b..53b27915490 100644 --- a/configs/freedom-k66f/src/k66_sdhc.c +++ b/configs/freedom-k66f/src/k66_sdhc.c @@ -170,7 +170,7 @@ int k66_sdhc_initialize(void) /* Attached the card detect interrupt (but don't enable it yet) */ - kinetis_pinirqattach(GPIO_SD_CARDDETECT, k66_cdinterrupt); + kinetis_pinirqattach(GPIO_SD_CARDDETECT, k66_cdinterrupt, NULL); /* Configure the write protect GPIO -- None */ diff --git a/configs/kwikstik-k40/src/k40_appinit.c b/configs/kwikstik-k40/src/k40_appinit.c index befe905af92..a336d96e473 100644 --- a/configs/kwikstik-k40/src/k40_appinit.c +++ b/configs/kwikstik-k40/src/k40_appinit.c @@ -217,7 +217,7 @@ int board_app_initialize(uintptr_t arg) /* Attached the card detect interrupt (but don't enable it yet) */ kinetis_pinconfig(GPIO_SD_CARDDETECT); - kinetis_pinirqattach(GPIO_SD_CARDDETECT, kinetis_cdinterrupt); + kinetis_pinirqattach(GPIO_SD_CARDDETECT, kinetis_cdinterrupt, NULL); /* Mount the SDHC-based MMC/SD block driver */ /* First, get an instance of the SDHC interface */ diff --git a/configs/twr-k60n512/src/k60_appinit.c b/configs/twr-k60n512/src/k60_appinit.c index fde0ef30139..dcf7183d0bc 100644 --- a/configs/twr-k60n512/src/k60_appinit.c +++ b/configs/twr-k60n512/src/k60_appinit.c @@ -224,7 +224,7 @@ int board_app_initialize(uintptr_t arg) /* Attached the card detect interrupt (but don't enable it yet) */ kinetis_pinconfig(GPIO_SD_CARDDETECT); - kinetis_pinirqattach(GPIO_SD_CARDDETECT, kinetis_cdinterrupt); + kinetis_pinirqattach(GPIO_SD_CARDDETECT, kinetis_cdinterrupt, NULL); /* Configure the write protect GPIO */ diff --git a/configs/twr-k64f120m/src/k64_sdhc.c b/configs/twr-k64f120m/src/k64_sdhc.c index 89ed5e3c6a8..e35cfabd791 100644 --- a/configs/twr-k64f120m/src/k64_sdhc.c +++ b/configs/twr-k64f120m/src/k64_sdhc.c @@ -166,7 +166,7 @@ int k64_sdhc_initialize(void) /* Attached the card detect interrupt (but don't enable it yet) */ - kinetis_pinirqattach(GPIO_SD_CARDDETECT, k64_cdinterrupt); + kinetis_pinirqattach(GPIO_SD_CARDDETECT, k64_cdinterrupt, NULL); /* Configure the write protect GPIO -- None */ From 70532f654891bf8e48e0601a204327669f5db24e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 07:24:57 -0600 Subject: [PATCH 03/38] Kinetis: More needed in last pinirq change. --- arch/arm/src/kinetis/kinetis_pinirq.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/src/kinetis/kinetis_pinirq.c b/arch/arm/src/kinetis/kinetis_pinirq.c index bc44b4e05b3..fc2af1679e2 100644 --- a/arch/arm/src/kinetis/kinetis_pinirq.c +++ b/arch/arm/src/kinetis/kinetis_pinirq.c @@ -275,9 +275,9 @@ void kinetis_pinirqinitialize(void) xcpt_t kinetis_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg) { #ifdef HAVE_PORTINTS - xcpt_t *isrtab; - xcpt_t oldisr; - irqstate_t flags; + struct kinetis_pinirq_s *isrtab; + xcpt_t oldisr; + irqstate_t flags; unsigned int port; unsigned int pin; @@ -331,8 +331,9 @@ xcpt_t kinetis_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg) /* Get the old PIN ISR and set the new PIN ISR */ - oldisr = isrtab[pin]; - isrtab[pin] = pinisr; + oldisr = isrtab[pin].handler; + isrtab[pin].handler = pinisr; + isrtab[pin].arg = arg; /* And return the old PIN isr address */ From f15b566254b10839eec6198fe99bb7225055c7e4 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 07:35:34 -0600 Subject: [PATCH 04/38] Button interrupt handler needs argument parameter. --- drivers/input/button_lower.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/button_lower.c b/drivers/input/button_lower.c index 9be0b4a35f7..53f99be9077 100644 --- a/drivers/input/button_lower.c +++ b/drivers/input/button_lower.c @@ -64,7 +64,7 @@ static void btn_enable(FAR const struct btn_lowerhalf_s *lower, btn_handler_t handler, FAR void *arg); static void btn_disable(void); -static int btn_interrupt(int irq, FAR void *context); +static int btn_interrupt(int irq, FAR void *context, FAR void *arg); /**************************************************************************** * Private Data @@ -203,7 +203,7 @@ static void btn_disable(void) * ****************************************************************************/ -static int btn_interrupt(int irq, FAR void *context) +static int btn_interrupt(int irq, FAR void *context, FAR void *arg) { DEBUGASSERT(g_btnhandler); From 2e30b9b25277931607dd21a559ba0df2264051cb Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 07:46:36 -0600 Subject: [PATCH 05/38] More missing argument paramters in interrupt handlers. --- arch/arm/src/stm32/stm32_tim.c | 3 +-- configs/stm32butterfly2/src/stm32_mmcsd.c | 2 +- configs/stm32f4discovery/src/stm32_xen1210.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/stm32/stm32_tim.c b/arch/arm/src/stm32/stm32_tim.c index 7d9ac4efc8b..a07007fae55 100644 --- a/arch/arm/src/stm32/stm32_tim.c +++ b/arch/arm/src/stm32/stm32_tim.c @@ -1484,8 +1484,7 @@ static int stm32_tim_getcapture(FAR struct stm32_tim_dev_s *dev, uint8_t channel * Name: stm32_tim_setisr ************************************************************************************/ -static int stm32_tim_setisr(FAR struct stm32_tim_dev_s *dev, - int (*handler)(int irq, void *context), +static int stm32_tim_setisr(FAR struct stm32_tim_dev_s *dev, xcpt_t handler, int source) { int vectorno; diff --git a/configs/stm32butterfly2/src/stm32_mmcsd.c b/configs/stm32butterfly2/src/stm32_mmcsd.c index 696ad7d0c56..4ccd3516006 100644 --- a/configs/stm32butterfly2/src/stm32_mmcsd.c +++ b/configs/stm32butterfly2/src/stm32_mmcsd.c @@ -124,7 +124,7 @@ static void *stm32_cd_thread(void *arg) * Card detect interrupt handler. ****************************************************************************/ -static int stm32_cd(int irq, void *context) +static int stm32_cd(int irq, void *context, void *arg) { static const int debounce_time = 100; /* [ms] */ static uint32_t now = 0; diff --git a/configs/stm32f4discovery/src/stm32_xen1210.c b/configs/stm32f4discovery/src/stm32_xen1210.c index a8dc104ebe2..edd37f5da51 100644 --- a/configs/stm32f4discovery/src/stm32_xen1210.c +++ b/configs/stm32f4discovery/src/stm32_xen1210.c @@ -154,7 +154,7 @@ static struct stm32_xen1210config_s g_xen1210config = /* This is the XEN1210 Interrupt handler */ -int xen1210_interrupt(int irq, FAR void *context) +int xen1210_interrupt(int irq, FAR void *context, FAR void *arg) { /* Verify that we have a handler attached */ From 232156069056773fbb72f67a766dd9cf14e37a78 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 08:06:07 -0600 Subject: [PATCH 06/38] More missing argument paramters in interrupt handlers. --- arch/arm/src/kinetis/kinetis_i2c.c | 59 ++++----------------------- arch/arm/src/kinetis/kinetis_pinirq.c | 2 +- configs/freedom-k66f/src/k66_sdhc.c | 2 +- configs/twr-k64f120m/src/k64_sdhc.c | 2 +- 4 files changed, 10 insertions(+), 55 deletions(-) diff --git a/arch/arm/src/kinetis/kinetis_i2c.c b/arch/arm/src/kinetis/kinetis_i2c.c index 0edcab92696..06805569eb0 100644 --- a/arch/arm/src/kinetis/kinetis_i2c.c +++ b/arch/arm/src/kinetis/kinetis_i2c.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/kinetis/kinetis_i2c.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved. * Author: Matias v01d * * Redistribution and use in source and binary forms, with or without @@ -129,16 +129,7 @@ static void kinetis_i2c_setfrequency(struct kinetis_i2cdev_s *priv, uint32_t frequency); static int kinetis_i2c_start(struct kinetis_i2cdev_s *priv); static void kinetis_i2c_stop(struct kinetis_i2cdev_s *priv); -static int kinetis_i2c_interrupt(struct kinetis_i2cdev_s *priv); -#ifdef CONFIG_KINETIS_I2C0 -static int kinetis_i2c0_interrupt(int irq, void *context); -#endif -#ifdef CONFIG_KINETIS_I2C1 -static int kinetis_i2c1_interrupt(int irq, void *context); -#endif -#ifdef CONFIG_KINETIS_I2C2 -static int kinetis_i2c2_interrupt(int irq, void *context); -#endif +static int kinetis_i2c_interrupt(int irq, void *context, void *arg); static void kinetis_i2c_timeout(int argc, uint32_t arg, ...); static void kinetis_i2c_setfrequency(struct kinetis_i2cdev_s *priv, uint32_t frequency); @@ -638,14 +629,17 @@ void kinetis_i2c_nextmsg(struct kinetis_i2cdev_s *priv) * ****************************************************************************/ -static int kinetis_i2c_interrupt(struct kinetis_i2cdev_s *priv) +static int kinetis_i2c0_interrupt(int irq, void *context, void *arg) { + struct kinetis_i2cdev_s *priv = (struct kinetis_i2cdev_s *)arg; struct i2c_msg_s *msg; uint32_t state; int regval; int dummy; UNUSED(dummy); + DEBUGASSERT(priv != NULL); + /* Get current state */ state = kinetis_i2c_getreg(priv, KINETIS_I2C_S_OFFSET); @@ -811,38 +805,6 @@ static int kinetis_i2c_interrupt(struct kinetis_i2cdev_s *priv) return OK; } -/**************************************************************************** - * Name: kinetis_i2cN_interrupt - * - * Description: - * The I2CN interrupt handlers - * - ****************************************************************************/ - -#ifdef CONFIG_KINETIS_I2C0 -static int kinetis_i2c0_interrupt(int irq, void *context) -{ - i2cinfo("I2C0 Interrupt...\n"); - return kinetis_i2c_interrupt(&g_i2c0_dev); -} -#endif - -#ifdef CONFIG_KINETIS_I2C1 -static int kinetis_i2c1_interrupt(int irq, void *context) -{ - i2cinfo("I2C1 Interrupt...\n"); - return kinetis_i2c_interrupt(&g_i2c1_dev); -} -#endif - -#ifdef CONFIG_KINETIS_I2C2 -static int kinetis_i2c2_interrupt(int irq, void *context) -{ - i2cinfo("I2C2 Interrupt...\n"); - return kinetis_i2c_interrupt(&g_i2c2_dev); -} -#endif - /**************************************************************************** * Name: kinetis_i2c_transfer * @@ -988,7 +950,6 @@ static int kinetis_i2c_reset(struct i2c_master_s *dev) struct i2c_master_s *kinetis_i2cbus_initialize(int port) { struct kinetis_i2cdev_s *priv; - xcpt_t handler; i2cinfo("port=%d\n", port); @@ -1011,8 +972,6 @@ struct i2c_master_s *kinetis_i2cbus_initialize(int port) priv->irqid = KINETIS_IRQ_I2C0; priv->basefreq = BOARD_BUS_FREQ; - handler = kinetis_i2c0_interrupt; - /* Enable clock */ regval = getreg32(KINETIS_SIM_SCGC4); @@ -1038,8 +997,6 @@ struct i2c_master_s *kinetis_i2cbus_initialize(int port) priv->irqid = KINETIS_IRQ_I2C1; priv->basefreq = BOARD_BUS_FREQ; - handler = kinetis_i2c1_interrupt; - /* Enable clock */ regval = getreg32(KINETIS_SIM_SCGC4); @@ -1065,8 +1022,6 @@ struct i2c_master_s *kinetis_i2cbus_initialize(int port) priv->irqid = KINETIS_IRQ_I2C2; priv->basefreq = BOARD_BUS_FREQ; - handler = kinetis_i2c2_interrupt; - /* Enable clock */ regval = getreg32(KINETIS_SIM_SCGC4); @@ -1124,7 +1079,7 @@ struct i2c_master_s *kinetis_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, handler, NULL); + irq_attach(priv->irqid, kinetis_i2c_interrupt, priv); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/kinetis/kinetis_pinirq.c b/arch/arm/src/kinetis/kinetis_pinirq.c index fc2af1679e2..c8adac1f0aa 100644 --- a/arch/arm/src/kinetis/kinetis_pinirq.c +++ b/arch/arm/src/kinetis/kinetis_pinirq.c @@ -142,7 +142,7 @@ static int kinetis_portinterrupt(int irq, FAR void *context, * interrupt handler for the pin. */ - if (isrtab[i]) + if (isrtab[i].handler != NULL) { xcpt_t handler = isrtab[i].handler; void *arg = isrtab[i].arg; diff --git a/configs/freedom-k66f/src/k66_sdhc.c b/configs/freedom-k66f/src/k66_sdhc.c index 53b27915490..b89c9e93da9 100644 --- a/configs/freedom-k66f/src/k66_sdhc.c +++ b/configs/freedom-k66f/src/k66_sdhc.c @@ -140,7 +140,7 @@ static void k66_mediachange(void) * Name: k66_cdinterrupt ****************************************************************************/ -static int k66_cdinterrupt(int irq, FAR void *context) +static int k66_cdinterrupt(int irq, FAR void *context, FAR void *arg) { /* All of the work is done by k66_mediachange() */ diff --git a/configs/twr-k64f120m/src/k64_sdhc.c b/configs/twr-k64f120m/src/k64_sdhc.c index e35cfabd791..36896e410d5 100644 --- a/configs/twr-k64f120m/src/k64_sdhc.c +++ b/configs/twr-k64f120m/src/k64_sdhc.c @@ -136,7 +136,7 @@ static void k64_mediachange(void) * Name: k64_cdinterrupt ****************************************************************************/ -static int k64_cdinterrupt(int irq, FAR void *context) +static int k64_cdinterrupt(int irq, FAR void *context, FAR void *arg) { /* All of the work is done by k64_mediachange() */ From b651e73057954e380f608571b57bdfef0bc99eae Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 08:18:37 -0600 Subject: [PATCH 07/38] STM32: Fix mismatched prototype --- arch/arm/src/stm32/stm32_tim.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/src/stm32/stm32_tim.c b/arch/arm/src/stm32/stm32_tim.c index a07007fae55..fbba052d546 100644 --- a/arch/arm/src/stm32/stm32_tim.c +++ b/arch/arm/src/stm32/stm32_tim.c @@ -344,8 +344,7 @@ static int stm32_tim_setchannel(FAR struct stm32_tim_dev_s *dev, uint8_t channel static int stm32_tim_setcompare(FAR struct stm32_tim_dev_s *dev, uint8_t channel, uint32_t compare); static int stm32_tim_getcapture(FAR struct stm32_tim_dev_s *dev, uint8_t channel); -static int stm32_tim_setisr(FAR struct stm32_tim_dev_s *dev, - int (*handler)(int irq, void *context), +static int stm32_tim_setisr(FAR struct stm32_tim_dev_s *dev, xcpt_t handler, int source); static void stm32_tim_enableint(FAR struct stm32_tim_dev_s *dev, int source); static void stm32_tim_disableint(FAR struct stm32_tim_dev_s *dev, int source); From 4cd31be19d234b5d9d2f9a2ffd52d2cbf4edbda6 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 08:55:21 -0600 Subject: [PATCH 08/38] Convert some serial drivers to use use irq_attach. --- arch/arm/src/c5471/c5471_serial.c | 21 +++------- arch/arm/src/dm320/dm320_serial.c | 24 +++-------- arch/arm/src/kinetis/kinetis_lpserial.c | 28 +++---------- arch/arm/src/kl/kl_serial.c | 36 +++------------- arch/arm/src/lpc11xx/lpc11_i2c.c | 35 +++------------- arch/arm/src/lpc11xx/lpc11_serial.c | 20 +++------ arch/arm/src/lpc17xx/lpc17_i2c.c | 35 +++------------- arch/arm/src/lpc17xx/lpc17_serial.c | 42 +++---------------- drivers/wireless/cc3000/cc3000.c | 18 ++------ .../wireless/cc3000/include/cc3000_upif.h | 2 +- 10 files changed, 50 insertions(+), 211 deletions(-) diff --git a/arch/arm/src/c5471/c5471_serial.c b/arch/arm/src/c5471/c5471_serial.c index adb654d63c4..44d0dc7fd25 100644 --- a/arch/arm/src/c5471/c5471_serial.c +++ b/arch/arm/src/c5471/c5471_serial.c @@ -108,7 +108,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, unsigned int *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -491,7 +491,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -534,24 +534,13 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; volatile uint32_t cause; - if (g_irdapriv.irq == irq) - { - dev = &g_irdaport; - } - else if (g_modempriv.irq == irq) - { - dev = &g_modemport; - } - else - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; cause = up_inserial(priv, UART_ISR_OFFS) & 0x0000003f; diff --git a/arch/arm/src/dm320/dm320_serial.c b/arch/arm/src/dm320/dm320_serial.c index 8b30fbdd952..964e8923f07 100644 --- a/arch/arm/src/dm320/dm320_serial.c +++ b/arch/arm/src/dm320/dm320_serial.c @@ -1,8 +1,7 @@ /**************************************************************************** * arch/arm/src/dm320/dm320_serial.c - * arch/arm/src/chip/dm320_serial.c * - * Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2012-2013, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -89,7 +88,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -430,7 +429,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -472,25 +471,14 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; uint16_t status; int passes = 0; - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, diff --git a/arch/arm/src/kinetis/kinetis_lpserial.c b/arch/arm/src/kinetis/kinetis_lpserial.c index 57dbf7c50b5..69f4461172a 100644 --- a/arch/arm/src/kinetis/kinetis_lpserial.c +++ b/arch/arm/src/kinetis/kinetis_lpserial.c @@ -163,7 +163,7 @@ static int kinetis_setup(struct uart_dev_s *dev); static void kinetis_shutdown(struct uart_dev_s *dev); static int kinetis_attach(struct uart_dev_s *dev); static void kinetis_detach(struct uart_dev_s *dev); -static int kinetis_interrupt(int irq, void *context); +static int kinetis_interrupt(int irq, void *context, void *arg); static int kinetis_ioctl(struct file *filep, int cmd, unsigned long arg); static int kinetis_receive(struct uart_dev_s *dev, uint32_t *status); static void kinetis_rxint(struct uart_dev_s *dev, bool enable); @@ -427,7 +427,7 @@ static int kinetis_attach(struct uart_dev_s *dev) * disabled in the LPUART_CTRL register. */ - ret = irq_attach(priv->irq, kinetis_interrupt); + ret = irq_attach(priv->irq, kinetis_interrupt, dev); if (ret == OK) { up_enable_irq(priv->irq); @@ -472,33 +472,15 @@ static void kinetis_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int kinetis_interrupt(int irq, void *context) +static int kinetis_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *dev)arg; struct kinetis_dev_s *priv; uint32_t stat; uint32_t ctrl; -#ifdef CONFIG_KINETIS_LPUART0 - if (g_lpuart0priv.irq == irq) - { - dev = &g_lpuart0port; - } - else -#endif -#ifdef CONFIG_KINETIS_LPUART1 - if (g_lpuart1priv.irq == irq) - { - dev = &g_lpuart1port; - } - else -#endif - { - PANIC(); - } - + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct kinetis_dev_s *)dev->priv; - DEBUGASSERT(priv); /* Read status register and qualify it with STAT bit corresponding CTRL IE bits */ diff --git a/arch/arm/src/kl/kl_serial.c b/arch/arm/src/kl/kl_serial.c index 8849c585a8b..a35328345ee 100644 --- a/arch/arm/src/kl/kl_serial.c +++ b/arch/arm/src/kl/kl_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/kl/kl_serial.c * - * Copyright (C) 2013-2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2012, 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -171,7 +171,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupts(int irq, void *context, FAR void *arg); +static int up_interrupts(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -455,7 +455,7 @@ static int up_attach(struct uart_dev_s *dev) * disabled in the C2 register. */ - ret = irq_attach(priv->irq, up_interrupts, NULL); + ret = irq_attach(priv->irq, up_interrupts, dev); if (ret == OK) { up_enable_irq(priv->irq); @@ -500,40 +500,16 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupts(int irq, void *context, FAR void *arg) +static int up_interrupts(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; int passes; uint8_t s1; bool handled; -#ifdef CONFIG_KL_UART0 - if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_KL_UART1 - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_KL_UART2 - if (g_uart2priv.irq == irq) - { - dev = &g_uart2port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; - DEBUGASSERT(priv); /* Loop until there are no characters to be transferred or, * until we have been looping for a long time. diff --git a/arch/arm/src/lpc11xx/lpc11_i2c.c b/arch/arm/src/lpc11xx/lpc11_i2c.c index e5e0c69bc3c..b9d2d107434 100644 --- a/arch/arm/src/lpc11xx/lpc11_i2c.c +++ b/arch/arm/src/lpc11xx/lpc11_i2c.c @@ -129,7 +129,7 @@ struct lpc11_i2cdev_s static int lpc11_i2c_start(struct lpc11_i2cdev_s *priv); static void lpc11_i2c_stop(struct lpc11_i2cdev_s *priv); -static int lpc11_i2c_interrupt(int irq, FAR void *context, FAR void *arg); +static int lpc11_i2c_interrupt(int irq, FAR void *context, void *arg); static void lpc11_i2c_timeout(int argc, uint32_t arg, ...); static void lpc11_i2c_setfrequency(struct lpc11_i2cdev_s *priv, uint32_t frequency); @@ -304,7 +304,7 @@ static int lpc11_i2c_transfer(FAR struct i2c_master_s *dev, } /**************************************************************************** - * Name: lpc11_i2c_interrupt + * Name: lpc11_stopnext * * Description: * Check if we need to issue STOP at the next message @@ -334,36 +334,13 @@ static void lpc11_stopnext(struct lpc11_i2cdev_s *priv) * ****************************************************************************/ -static int lpc11_i2c_interrupt(int irq, FAR void *context, FAR void *arg) +static int lpc11_i2c_interrupt(int irq, FAR void *context, void *arg) { - struct lpc11_i2cdev_s *priv; + struct lpc11_i2cdev_s *priv = (struct lpc11_i2cdev_s *)arg; struct i2c_msg_s *msg; uint32_t state; -#ifdef CONFIG_LPC11_I2C0 - if (irq == LPC11_IRQ_I2C0) - { - priv = &g_i2c0dev; - } - else -#endif -#ifdef CONFIG_LPC11_I2C1 - if (irq == LPC11_IRQ_I2C1) - { - priv = &g_i2c1dev; - } - else -#endif -#ifdef CONFIG_LPC11_I2C2 - if (irq == LPC11_IRQ_I2C2) - { - priv = &g_i2c2dev; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(priv != NULL); /* Reference UM10360 19.10.5 */ @@ -603,7 +580,7 @@ struct i2c_master_s *lpc11_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, lpc11_i2c_interrupt, NULL); + irq_attach(priv->irqid, lpc11_i2c_interrupt, priv); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/lpc11xx/lpc11_serial.c b/arch/arm/src/lpc11xx/lpc11_serial.c index 4d23438b11a..cbef799afe9 100644 --- a/arch/arm/src/lpc11xx/lpc11_serial.c +++ b/arch/arm/src/lpc11xx/lpc11_serial.c @@ -104,7 +104,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -515,7 +515,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -557,24 +557,14 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; uint32_t status; int passes; -#ifdef CONFIG_LPC11_UART0 - if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else -#endif - { - PANIC(); - } - + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, diff --git a/arch/arm/src/lpc17xx/lpc17_i2c.c b/arch/arm/src/lpc17xx/lpc17_i2c.c index 0bd34e36b59..30763fe177a 100644 --- a/arch/arm/src/lpc17xx/lpc17_i2c.c +++ b/arch/arm/src/lpc17xx/lpc17_i2c.c @@ -129,7 +129,7 @@ struct lpc17_i2cdev_s static int lpc17_i2c_start(struct lpc17_i2cdev_s *priv); static void lpc17_i2c_stop(struct lpc17_i2cdev_s *priv); -static int lpc17_i2c_interrupt(int irq, FAR void *context, FAR void *arg); +static int lpc17_i2c_interrupt(int irq, FAR void *context, void *arg); static void lpc17_i2c_timeout(int argc, uint32_t arg, ...); static void lpc17_i2c_setfrequency(struct lpc17_i2cdev_s *priv, uint32_t frequency); @@ -304,7 +304,7 @@ static int lpc17_i2c_transfer(FAR struct i2c_master_s *dev, } /**************************************************************************** - * Name: lpc17_i2c_interrupt + * Name: lpc17_stopnext * * Description: * Check if we need to issue STOP at the next message @@ -334,36 +334,13 @@ static void lpc17_stopnext(struct lpc17_i2cdev_s *priv) * ****************************************************************************/ -static int lpc17_i2c_interrupt(int irq, FAR void *context, FAR void *arg) +static int lpc17_i2c_interrupt(int irq, FAR void *context, void *arg) { - struct lpc17_i2cdev_s *priv; + struct lpc17_i2cdev_s *priv = (struct lpc17_i2cdev_s *)arg; struct i2c_msg_s *msg; uint32_t state; -#ifdef CONFIG_LPC17_I2C0 - if (irq == LPC17_IRQ_I2C0) - { - priv = &g_i2c0dev; - } - else -#endif -#ifdef CONFIG_LPC17_I2C1 - if (irq == LPC17_IRQ_I2C1) - { - priv = &g_i2c1dev; - } - else -#endif -#ifdef CONFIG_LPC17_I2C2 - if (irq == LPC17_IRQ_I2C2) - { - priv = &g_i2c2dev; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(priv != NULL); /* Reference UM10360 19.10.5 */ @@ -608,7 +585,7 @@ struct i2c_master_s *lpc17_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, lpc17_i2c_interrupt, NULL); + irq_attach(priv->irqid, lpc17_i2c_interrupt, priv); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/lpc17xx/lpc17_serial.c b/arch/arm/src/lpc17xx/lpc17_serial.c index 14c7602d24c..9c13a06d4a1 100644 --- a/arch/arm/src/lpc17xx/lpc17_serial.c +++ b/arch/arm/src/lpc17xx/lpc17_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/lpc17xx/lpc17_serial.c * - * Copyright (C) 2010-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2013, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -104,7 +104,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -999,7 +999,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -1041,44 +1041,14 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; uint32_t status; int passes; -#ifdef CONFIG_LPC17_UART0 - if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_LPC17_UART1 - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_LPC17_UART2 - if (g_uart2priv.irq == irq) - { - dev = &g_uart2port; - } - else -#endif -#ifdef CONFIG_LPC17_UART3 - if (g_uart3priv.irq == irq) - { - dev = &g_uart3port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, diff --git a/drivers/wireless/cc3000/cc3000.c b/drivers/wireless/cc3000/cc3000.c index 80ed10d1fac..c3df8e185c2 100644 --- a/drivers/wireless/cc3000/cc3000.c +++ b/drivers/wireless/cc3000/cc3000.c @@ -748,19 +748,9 @@ static void * cc3000_worker(FAR void *arg) static int cc3000_interrupt(int irq, FAR void *context, FAR void *arg) { - FAR struct cc3000_dev_s *priv; + FAR struct cc3000_dev_s *priv = (FAR struct cc3000_dev_s *)arg; - /* Which CC3000 device caused the interrupt? */ - -#ifndef CONFIG_CC3000_MULTIPLE - priv = &g_cc3000; -#else - for (priv = g_cc3000list; - priv && priv->configs->irq != irq; - priv = priv->flink); - - ASSERT(priv != NULL); -#endif + DEBUGASSERT(priv != NULL); /* Run the worker thread */ @@ -1522,7 +1512,7 @@ errout: ****************************************************************************/ int cc3000_register(FAR struct spi_dev_s *spi, - FAR struct cc3000_config_s *config, int minor) + FAR struct cc3000_config_s *config, int minor) { FAR struct cc3000_dev_s *priv; char drvname[DEV_NAMELEN]; @@ -1577,7 +1567,7 @@ int cc3000_register(FAR struct spi_dev_s *spi, /* Attach the interrupt handler */ - ret = config->irq_attach(config, cc3000_interrupt, NULL); + ret = config->irq_attach(config, cc3000_interrupt, priv); if (ret < 0) { nerr("ERROR: Failed to attach interrupt\n"); diff --git a/include/nuttx/wireless/cc3000/include/cc3000_upif.h b/include/nuttx/wireless/cc3000/include/cc3000_upif.h index 26c2e109721..e24d572b009 100644 --- a/include/nuttx/wireless/cc3000/include/cc3000_upif.h +++ b/include/nuttx/wireless/cc3000/include/cc3000_upif.h @@ -138,7 +138,7 @@ struct cc3000_config_s * probe - Debug support */ - int (*irq_attach)(FAR struct cc3000_config_s *state, xcpt_t isr); + int (*irq_attach)(FAR struct cc3000_config_s *state, xcpt_t isr, FAR void *arg); void (*irq_enable)(FAR struct cc3000_config_s *state, bool enable); void (*irq_clear)(FAR struct cc3000_config_s *state); void (*power_enable)(FAR struct cc3000_config_s *state,bool enable); From 221c94e5686e5f441fffd49bfa7c2c740da9c155 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 08:57:21 -0600 Subject: [PATCH 09/38] Fix typo from a previouis commit --- arch/arm/src/kinetis/kinetis_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/src/kinetis/kinetis_i2c.c b/arch/arm/src/kinetis/kinetis_i2c.c index 06805569eb0..6350b18f346 100644 --- a/arch/arm/src/kinetis/kinetis_i2c.c +++ b/arch/arm/src/kinetis/kinetis_i2c.c @@ -629,7 +629,7 @@ void kinetis_i2c_nextmsg(struct kinetis_i2cdev_s *priv) * ****************************************************************************/ -static int kinetis_i2c0_interrupt(int irq, void *context, void *arg) +static int kinetis_i2c_interrupt(int irq, void *context, void *arg) { struct kinetis_i2cdev_s *priv = (struct kinetis_i2cdev_s *)arg; struct i2c_msg_s *msg; From 8b06dc7ee904815249839e20db291430dbd96690 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 09:10:56 -0600 Subject: [PATCH 10/38] Freedom K64F: Fix prototype of interrupt handler. --- configs/freedom-k64f/src/k64_sdhc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/freedom-k64f/src/k64_sdhc.c b/configs/freedom-k64f/src/k64_sdhc.c index 7d50118dba6..d9a25eb19b8 100644 --- a/configs/freedom-k64f/src/k64_sdhc.c +++ b/configs/freedom-k64f/src/k64_sdhc.c @@ -139,7 +139,7 @@ static void k64_mediachange(void) * Name: k64_cdinterrupt ****************************************************************************/ -static int k64_cdinterrupt(int irq, FAR void *context) +static int k64_cdinterrupt(int irq, FAR void *context, FAR void *arg) { /* All of the work is done by k64_mediachange() */ From 3129c7536e7feacfad4cbf74dc47c27c609fbfa1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 09:23:50 -0600 Subject: [PATCH 11/38] CC3000: Add interrupt argument to all CC3000 interrupts. --- configs/freedom-kl25z/src/kl_wifi.c | 8 ++++++-- configs/nucleo-f4x1re/src/stm32_wireless.c | 8 ++++++-- configs/nucleo-l476rg/src/stm32_wireless.c | 8 ++++++-- configs/spark/src/stm32_wireless.c | 8 ++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/configs/freedom-kl25z/src/kl_wifi.c b/configs/freedom-kl25z/src/kl_wifi.c index 56873885718..0bf17b1c8a0 100644 --- a/configs/freedom-kl25z/src/kl_wifi.c +++ b/configs/freedom-kl25z/src/kl_wifi.c @@ -121,7 +121,8 @@ struct kl_config_s * probe - Debug support */ -static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler); +static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler, + FAR void *arg); static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable); static void wl_clear_irq(FAR struct cc3000_config_s *state); static void wl_select(FAR struct cc3000_config_s *state, bool enable); @@ -160,6 +161,7 @@ static struct kl_config_s g_cc3000_info = .dev.probe = probe, /* This is used for debugging */ #endif .handler = NULL, + .arg = NULL, }; /**************************************************************************** @@ -182,13 +184,15 @@ static struct kl_config_s g_cc3000_info = * probe - Debug support */ -static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler) +static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler, + FAR void *arg) { FAR struct kl_config_s *priv = (FAR struct kl_config_s *)state; /* Just save the handler for use when the interrupt is enabled */ priv->handler = handler; + priv->arg = arg; return OK; } diff --git a/configs/nucleo-f4x1re/src/stm32_wireless.c b/configs/nucleo-f4x1re/src/stm32_wireless.c index 0cd4e2e0662..32cfd31775f 100644 --- a/configs/nucleo-f4x1re/src/stm32_wireless.c +++ b/configs/nucleo-f4x1re/src/stm32_wireless.c @@ -118,7 +118,8 @@ struct stm32_config_s * wl_read_irq - Return the state of the interrupt GPIO input */ -static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler); +static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler, + FAR void *arg); static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable); static void wl_clear_irq(FAR struct cc3000_config_s *state); static void wl_select(FAR struct cc3000_config_s *state, bool enable); @@ -157,6 +158,7 @@ static struct stm32_config_s g_cc3000_info = .dev.probe = probe, /* This is used for debugging */ #endif .handler = NULL, + .arg = NULL, }; /**************************************************************************** @@ -175,13 +177,15 @@ static struct stm32_config_s g_cc3000_info = * pendown - Return the state of the pen down GPIO input */ -static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler) +static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler, + FAR void *arg) { FAR struct stm32_config_s *priv = (FAR struct stm32_config_s *)state; /* Just save the handler for use when the interrupt is enabled */ priv->handler = handler; + priv->arg = arg; return OK; } diff --git a/configs/nucleo-l476rg/src/stm32_wireless.c b/configs/nucleo-l476rg/src/stm32_wireless.c index c17da677feb..f28f8d33832 100644 --- a/configs/nucleo-l476rg/src/stm32_wireless.c +++ b/configs/nucleo-l476rg/src/stm32_wireless.c @@ -118,7 +118,8 @@ struct stm32_config_s * wl_read_irq - Return the state of the interrupt GPIO input */ -static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler); +static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler, + FAR void *arg); static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable); static void wl_clear_irq(FAR struct cc3000_config_s *state); static void wl_select(FAR struct cc3000_config_s *state, bool enable); @@ -157,6 +158,7 @@ static struct stm32_config_s g_cc3000_info = .dev.probe = probe, /* This is used for debugging */ #endif .handler = NULL, + .arg = NULL, }; /**************************************************************************** @@ -175,13 +177,15 @@ static struct stm32_config_s g_cc3000_info = * pendown - Return the state of the pen down GPIO input */ -static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler) +static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler, + FAR void *arg) { FAR struct stm32_config_s *priv = (FAR struct stm32_config_s *)state; /* Just save the handler for use when the interrupt is enabled */ priv->handler = handler; + priv->arg = arg; return OK; } diff --git a/configs/spark/src/stm32_wireless.c b/configs/spark/src/stm32_wireless.c index 2d1f6855d82..9e51affd859 100644 --- a/configs/spark/src/stm32_wireless.c +++ b/configs/spark/src/stm32_wireless.c @@ -118,7 +118,8 @@ struct stm32_config_s * wl_read_irq - Return the state of the interrupt GPIO input */ -static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler); +static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler, + FAR void *arg); static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable); static void wl_clear_irq(FAR struct cc3000_config_s *state); static void wl_select(FAR struct cc3000_config_s *state, bool enable); @@ -157,6 +158,7 @@ static struct stm32_config_s g_cc3000_info = .dev.probe = probe, /* This is used for debugging */ #endif .handler = NULL, + .arg = NULL, }; /**************************************************************************** @@ -175,13 +177,15 @@ static struct stm32_config_s g_cc3000_info = * pendown - Return the state of the pen down GPIO input */ -static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler) +static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler, + FAR void *arg) { FAR struct stm32_config_s *priv = (FAR struct stm32_config_s *)state; /* Just save the handler for use when the interrupt is enabled */ priv->handler = handler; + priv->arg = arg; return OK; } From 97b9bb7fa570722a6fe6df0fc36bc56ad8894b0d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 09:36:12 -0600 Subject: [PATCH 12/38] SAMA5D4-EK: Add missing argument to interrupt handler. --- configs/sama5d3-xplained/src/sam_hsmci.c | 4 ---- configs/sama5d3x-ek/src/sam_hsmci.c | 4 ---- configs/sama5d4-ek/src/sam_hsmci.c | 6 +++--- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/configs/sama5d3-xplained/src/sam_hsmci.c b/configs/sama5d3-xplained/src/sam_hsmci.c index c6806034e84..d32f6ab26b5 100644 --- a/configs/sama5d3-xplained/src/sam_hsmci.c +++ b/configs/sama5d3-xplained/src/sam_hsmci.c @@ -86,10 +86,6 @@ #ifdef HAVE_HSMCI -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - /**************************************************************************** * Private Types ****************************************************************************/ diff --git a/configs/sama5d3x-ek/src/sam_hsmci.c b/configs/sama5d3x-ek/src/sam_hsmci.c index 94ba8342973..aedd81d0853 100644 --- a/configs/sama5d3x-ek/src/sam_hsmci.c +++ b/configs/sama5d3x-ek/src/sam_hsmci.c @@ -86,10 +86,6 @@ #ifdef HAVE_HSMCI -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - /**************************************************************************** * Private Types ****************************************************************************/ diff --git a/configs/sama5d4-ek/src/sam_hsmci.c b/configs/sama5d4-ek/src/sam_hsmci.c index 6687176542b..2f23d9b7983 100644 --- a/configs/sama5d4-ek/src/sam_hsmci.c +++ b/configs/sama5d4-ek/src/sam_hsmci.c @@ -136,7 +136,7 @@ static struct sam_hsmci_state_s g_hsmci0 = #endif #ifdef CONFIG_SAMA5_HSMCI1 -static int sam_hsmci1_cardetect(int irq, void *regs); +static int sam_hsmci1_cardetect(int irq, void *regs, FAR void *arg); static struct sam_hsmci_state_s g_hsmci1 = { @@ -202,7 +202,7 @@ static int sam_hsmci_cardetect(struct sam_hsmci_state_s *state) } #ifdef CONFIG_SAMA5_HSMCI0 -static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg) +static int sam_hsmci0_cardetect(int irq, FAR void *regs, FAR void *arg) { int ret; @@ -224,7 +224,7 @@ static int sam_hsmci0_cardetect(int irq, void *regs, FAR void *arg) #endif #ifdef CONFIG_SAMA5_HSMCI1 -static int sam_hsmci1_cardetect(int irq, void *regs) +static int sam_hsmci1_cardetect(int irq, FAR void *regs, FAR void *arg) { int ret; From a581e9206de0a4f41543c40118c9e852c5753818 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 10:27:14 -0600 Subject: [PATCH 13/38] Convert remaining serial drivers to use use irq_attach. --- arch/arm/src/lpc214x/lpc214x_serial.c | 23 ++---- arch/arm/src/lpc2378/lpc23xx_i2c.c | 29 +------ arch/arm/src/lpc2378/lpc23xx_serial.c | 21 ++---- arch/arm/src/lpc31xx/lpc31_i2c.c | 16 ++-- arch/arm/src/lpc43xx/lpc43_i2c.c | 22 +----- arch/arm/src/lpc43xx/lpc43_serial.c | 42 ++--------- arch/arm/src/nuc1xx/nuc_serial.c | 35 ++------- arch/arm/src/sam34/sam4cm_tc.c | 43 ++--------- arch/arm/src/sam34/sam_rtt.c | 6 +- arch/arm/src/sam34/sam_serial.c | 55 ++------------ arch/arm/src/stm32/stm32f20xxx_dma.c | 2 +- arch/arm/src/stm32/stm32f40xxx_dma.c | 4 +- arch/arm/src/stm32f7/stm32_dma.c | 2 +- arch/arm/src/str71x/str71x_serial.c | 44 ++--------- arch/arm/src/tiva/tiva_serial.c | 71 ++---------------- arch/avr/src/at32uc3/at32uc3_serial.c | 36 ++------- arch/hc/src/m9s12/m9s12_serial.c | 28 ++----- arch/mips/src/pic32mx/pic32mx-serial.c | 29 ++----- arch/mips/src/pic32mz/pic32mz-serial.c | 100 ++++--------------------- arch/renesas/src/m16c/m16c_serial.c | 68 +++-------------- arch/z16/src/z16f/z16f_serial.c | 54 +++---------- arch/z80/src/ez80/ez80_serial.c | 30 ++------ arch/z80/src/z8/z8_serial.c | 42 +++-------- 23 files changed, 133 insertions(+), 669 deletions(-) diff --git a/arch/arm/src/lpc214x/lpc214x_serial.c b/arch/arm/src/lpc214x/lpc214x_serial.c index 47d0e8e47a7..92675a538be 100644 --- a/arch/arm/src/lpc214x/lpc214x_serial.c +++ b/arch/arm/src/lpc214x/lpc214x_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/lpc214x/lpc214x_serial.c * - * Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2012-2013, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -88,7 +88,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -413,7 +413,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -456,25 +456,14 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; uint8_t status; int passes; - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, diff --git a/arch/arm/src/lpc2378/lpc23xx_i2c.c b/arch/arm/src/lpc2378/lpc23xx_i2c.c index b877d56279a..8191179f110 100644 --- a/arch/arm/src/lpc2378/lpc23xx_i2c.c +++ b/arch/arm/src/lpc2378/lpc23xx_i2c.c @@ -298,34 +298,11 @@ static void lpc2378_stopnext(struct lpc2378_i2cdev_s *priv) static int lpc2378_i2c_interrupt(int irq, FAR void *context, FAR void *arg) { - struct lpc2378_i2cdev_s *priv; + struct lpc2378_i2cdev_s *priv = (struct lpc2378_i2cdev_s *)arg; struct i2c_msg_s *msg; uint32_t state; -#ifdef CONFIG_LPC2378_I2C0 - if (irq == I2C0_IRQ) - { - priv = &g_i2c0dev; - } - else -#endif -#ifdef CONFIG_LPC2378_I2C1 - if (irq == I2C1_IRQ) - { - priv = &g_i2c1dev; - } - else -#endif -#ifdef CONFIG_LPC2378_I2C2 - if (irq == I2C2_IRQ) - { - priv = &g_i2c2dev; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(priv != NULL); /* Reference UM10360 19.10.5 */ @@ -619,7 +596,7 @@ struct i2c_master_s *lpc2378_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, lpc2378_i2c_interrupt, NULL); + irq_attach(priv->irqid, lpc2378_i2c_interrupt, priv); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/lpc2378/lpc23xx_serial.c b/arch/arm/src/lpc2378/lpc23xx_serial.c index c74b0594f50..c927b07a2c0 100644 --- a/arch/arm/src/lpc2378/lpc23xx_serial.c +++ b/arch/arm/src/lpc2378/lpc23xx_serial.c @@ -96,7 +96,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t * status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -533,7 +533,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled in the @@ -581,25 +581,14 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; uint8_t status; int passes; - if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else if (g_uart2priv.irq == irq) - { - dev = &g_uart2port; - } - else - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, until we have diff --git a/arch/arm/src/lpc31xx/lpc31_i2c.c b/arch/arm/src/lpc31xx/lpc31_i2c.c index 0e4ff893278..8d79ac56e3d 100644 --- a/arch/arm/src/lpc31xx/lpc31_i2c.c +++ b/arch/arm/src/lpc31xx/lpc31_i2c.c @@ -3,7 +3,7 @@ * * Author: David Hewson * - * Copyright (C) 2010-2011, 2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2014, 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -186,16 +186,10 @@ static void i2c_setfrequency(struct lpc31_i2cdev_s *priv, uint32_t frequency) static int i2c_interrupt(int irq, FAR void *context, FAR void *arg) { - if (irq == LPC31_IRQ_I2C0) - { - i2c_progress(&i2cdevices[0]); - } - - if (irq == LPC31_IRQ_I2C1) - { - i2c_progress(&i2cdevices[1]); - } + struct lpc31_i2cdev_s *priv = (struct lpc31_i2cdev_s *)arg; + DEBUGASSERT(priv != NULL); + i2c_progress(priv); return OK; } @@ -585,7 +579,7 @@ struct i2c_master_s *lpc31_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, i2c_interrupt, NULL); + irq_attach(priv->irqid, i2c_interrupt, priv); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/lpc43xx/lpc43_i2c.c b/arch/arm/src/lpc43xx/lpc43_i2c.c index 15a23fe1ddb..2c8fcb63bee 100644 --- a/arch/arm/src/lpc43xx/lpc43_i2c.c +++ b/arch/arm/src/lpc43xx/lpc43_i2c.c @@ -279,27 +279,11 @@ void lpc32_i2c_nextmsg(struct lpc43_i2cdev_s *priv) static int lpc43_i2c_interrupt(int irq, FAR void *context, FAR void *arg) { - struct lpc43_i2cdev_s *priv; + struct lpc43_i2cdev_s *priv = (struct lpc43_i2cdev_s *)arg; struct i2c_msg_s *msg; uint32_t state; -#ifdef CONFIG_LPC43_I2C0 - if (irq == LPC43M0_IRQ_I2C0) - { - priv = &g_i2c0dev; - } - else -#endif -#ifdef CONFIG_LPC43_I2C1 - if (irq == LPC43_IRQ_I2C1) - { - priv = &g_i2c1dev; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(priv != NULL); /* Reference UM10360 19.10.5 */ @@ -558,7 +542,7 @@ struct i2c_master_s *lpc43_i2cbus_initialize(int port) /* Attach Interrupt Handler */ - irq_attach(priv->irqid, lpc43_i2c_interrupt, NULL); + irq_attach(priv->irqid, lpc43_i2c_interrupt, priv); /* Enable Interrupt Handler */ diff --git a/arch/arm/src/lpc43xx/lpc43_serial.c b/arch/arm/src/lpc43xx/lpc43_serial.c index 151c17ba29d..bf3e9613bfb 100644 --- a/arch/arm/src/lpc43xx/lpc43_serial.c +++ b/arch/arm/src/lpc43xx/lpc43_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/lpc43xx/lpc43_serial.c * - * Copyright (C) 2012-2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013, 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -106,7 +106,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); #ifdef HAVE_RS485 static inline int up_set_rs485_mode(struct up_dev_s *priv, @@ -661,7 +661,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -702,44 +702,14 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; uint32_t status; int passes; -#ifdef CONFIG_LPC43_USART0 - if (g_usart0priv.irq == irq) - { - dev = &g_usart0port; - } - else -#endif -#ifdef CONFIG_LPC43_UART1 - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_LPC43_USART2 - if (g_usart2priv.irq == irq) - { - dev = &g_usart2port; - } - else -#endif -#ifdef CONFIG_LPC43_USART3 - if (g_usart3priv.irq == irq) - { - dev = &g_usart3port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, diff --git a/arch/arm/src/nuc1xx/nuc_serial.c b/arch/arm/src/nuc1xx/nuc_serial.c index 1adb0ce8315..0932cfaf99d 100644 --- a/arch/arm/src/nuc1xx/nuc_serial.c +++ b/arch/arm/src/nuc1xx/nuc_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/nuc1xx/nuc_serial.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -101,7 +101,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -568,7 +568,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -610,9 +610,9 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct nuc_dev_s *priv; uint32_t isr; uint32_t regval; @@ -620,30 +620,7 @@ static int up_interrupt(int irq, void *context, FAR void *arg) bool rxto; bool rxfe; -#ifdef CONFIG_NUC_UART0 - if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_NUC_UART1 - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_NUC_UART2 - if (g_uart2priv.irq == irq) - { - dev = &g_uart2port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct nuc_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, diff --git a/arch/arm/src/sam34/sam4cm_tc.c b/arch/arm/src/sam34/sam4cm_tc.c index 330f9382b66..c366118f4d0 100644 --- a/arch/arm/src/sam34/sam4cm_tc.c +++ b/arch/arm/src/sam34/sam4cm_tc.c @@ -147,8 +147,7 @@ static inline void sam_chan_putreg(struct sam_chan_s *chan, /* Interrupt Handling *******************************************************/ -static int sam_tc_interrupt(struct sam_chan_s *tc); -static int sam_raw_interrupt(int irq, void *context, FAR void *arg); +static int sam_tc_interrupt(int irq, void *context, FAR void *arg); /* Initialization ***********************************************************/ @@ -535,14 +534,17 @@ static inline void sam_chan_putreg(struct sam_chan_s *chan, unsigned int offset, * ****************************************************************************/ -static int sam_tc_interrupt(struct sam_chan_s *chan) +static int sam_tc_interrupt(int irq, void *context, FAR void *arg) { + struct sam_chan_s *chan = (struct sam_chan_s *)arg; uint32_t sr; uint32_t imr; uint32_t pending; /* Process interrupts */ + DEBUGASSERT(chan != NULL); + /* Get the interrupt status for this channel */ sr = sam_chan_getreg(chan, SAM_TC_SR_OFFSET); @@ -575,41 +577,10 @@ static int sam_tc_interrupt(struct sam_chan_s *chan) return OK; } -/**************************************************************************** - * Name: sam_raw_interrupt - * - * Description: - * Timer block interrupt handlers - * - * Input Parameters: - * irq - * context - * - * Returned Value: - * - ****************************************************************************/ - -static int sam_raw_interrupt(int irq, void *context, FAR void *arg) -{ - int i; - struct sam_chan_s *chan; - - for (i = 0; i < ENABLED_CHANNELS; i++) - { - chan = &g_channels[i]; - - if (chan->irq == irq) - { - return sam_tc_interrupt(chan); - } - } - - return OK; -} - /**************************************************************************** * Initialization ****************************************************************************/ + /**************************************************************************** * Name: sam_tc_mckdivider * @@ -816,7 +787,7 @@ static inline struct sam_chan_s *sam_tc_initialize(int channel) /* Attach the timer interrupt handler and enable the timer interrupts */ - (void)irq_attach(chan->irq, sam_raw_interrupt, NULL); + (void)irq_attach(chan->irq, sam_tc_interrupt, chan); up_enable_irq(chan->irq); /* Now the channel is initialized */ diff --git a/arch/arm/src/sam34/sam_rtt.c b/arch/arm/src/sam34/sam_rtt.c index 8b7120cfc32..7978b01bf38 100644 --- a/arch/arm/src/sam34/sam_rtt.c +++ b/arch/arm/src/sam34/sam_rtt.c @@ -277,10 +277,10 @@ static void sam34_putreg(uint32_t val, uint32_t addr) static int sam34_interrupt(int irq, FAR void *context, FAR void *arg) { - FAR struct sam34_lowerhalf_s *priv = &g_tcdev; + FAR struct sam34_lowerhalf_s *priv = (FAR struct sam34_lowerhalf_s *)arg; tmrinfo("Entry\n"); - DEBUGASSERT(irq == SAM_IRQ_RTT); + DEBUGASSERT(priv != NULL); /* Check if the interrupt is really pending */ @@ -650,7 +650,7 @@ void sam_rttinitialize(FAR const char *devpath) priv->ops = &g_tcops; - (void)irq_attach(SAM_IRQ_RTT, sam34_interrupt, NULL); + (void)irq_attach(SAM_IRQ_RTT, sam34_interrupt, priv); /* Enable NVIC interrupt. */ diff --git a/arch/arm/src/sam34/sam_serial.c b/arch/arm/src/sam34/sam_serial.c index b3b5854878a..60f074dbf53 100644 --- a/arch/arm/src/sam34/sam_serial.c +++ b/arch/arm/src/sam34/sam_serial.c @@ -370,7 +370,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -872,7 +872,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -913,61 +913,16 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; uint32_t pending; uint32_t imr; int passes; bool handled; -#ifdef CONFIG_SAM34_UART0 - if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_SAM34_UART1 - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_SAM34_USART0 - if (g_usart0priv.irq == irq) - { - dev = &g_usart0port; - } - else -#endif -#ifdef CONFIG_SAM34_USART1 - if (g_usart1priv.irq == irq) - { - dev = &g_usart1port; - } - else -#endif -#ifdef CONFIG_SAM34_USART2 - if (g_usart2priv.irq == irq) - { - dev = &g_usart2port; - } - else -#endif -#ifdef CONFIG_SAM34_USART3 - if (g_usart3priv.irq == irq) - { - dev = &g_usart3port; - } - else -#endif - { - PANIC(); - } - + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, until we have diff --git a/arch/arm/src/stm32/stm32f20xxx_dma.c b/arch/arm/src/stm32/stm32f20xxx_dma.c index 4ab975de781..6fb9d33cee1 100644 --- a/arch/arm/src/stm32/stm32f20xxx_dma.c +++ b/arch/arm/src/stm32/stm32f20xxx_dma.c @@ -482,7 +482,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vectors */ - (void)irq_attach(dmast->irq, stm32_dmainterrupt, NULL); + (void)irq_attach(dmast->irq, stm32_dmainterrupt, dmast); /* Disable the DMA stream */ diff --git a/arch/arm/src/stm32/stm32f40xxx_dma.c b/arch/arm/src/stm32/stm32f40xxx_dma.c index aec0712cc74..1824c76bf46 100644 --- a/arch/arm/src/stm32/stm32f40xxx_dma.c +++ b/arch/arm/src/stm32/stm32f40xxx_dma.c @@ -369,7 +369,7 @@ static void stm32_dmastreamdisable(struct stm32_dma_s *dmast) * ************************************************************************************/ -static int stm32_dmainterrupt(int irq, void *context, FAR void *arg) +static int stm32_dmainterrupt(int irq, void *context, void *arg) { struct stm32_dma_s *dmast; uint32_t status; @@ -481,7 +481,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vectors */ - (void)irq_attach(dmast->irq, stm32_dmainterrupt, NULL); + (void)irq_attach(dmast->irq, stm32_dmainterrupt, dmast); /* Disable the DMA stream */ diff --git a/arch/arm/src/stm32f7/stm32_dma.c b/arch/arm/src/stm32f7/stm32_dma.c index 8f405b0594e..e1d8256f091 100644 --- a/arch/arm/src/stm32f7/stm32_dma.c +++ b/arch/arm/src/stm32f7/stm32_dma.c @@ -482,7 +482,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vectors */ - (void)irq_attach(dmast->irq, stm32_dmainterrupt, NULL); + (void)irq_attach(dmast->irq, stm32_dmainterrupt, dmast); /* Disable the DMA stream */ diff --git a/arch/arm/src/str71x/str71x_serial.c b/arch/arm/src/str71x/str71x_serial.c index 3e5076648ed..f1688ae3838 100644 --- a/arch/arm/src/str71x/str71x_serial.c +++ b/arch/arm/src/str71x/str71x_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/str71x/str71x_serial.c * - * Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2012-2013, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -254,7 +254,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -618,7 +618,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -667,47 +667,15 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; int passes; bool handled; -#ifdef CONFIG_STR71X_UART0 - if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_STR71X_UART1 - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_STR71X_UART2 - if (g_uart2priv.irq == irq) - { - dev = &g_uart2port; - } - else -#endif -#ifdef CONFIG_STR71X_UART3 - if (g_uart3priv.irq == irq) - { - dev = &g_uart3port; - } - else -#endif - { - PANIC(); - } - + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; - DEBUGASSERT(priv && dev); /* Loop until there are no characters to be transferred or, * until we have been looping for a long time. diff --git a/arch/arm/src/tiva/tiva_serial.c b/arch/arm/src/tiva/tiva_serial.c index 6a2f3e055b1..da2aedf70f4 100644 --- a/arch/arm/src/tiva/tiva_serial.c +++ b/arch/arm/src/tiva/tiva_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/tiva/tiva_serial.c * - * Copyright (C) 2009-2010, 2012-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2012-2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -322,7 +322,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -903,7 +903,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -946,74 +946,15 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; uint32_t mis; int passes; bool handled; -#ifdef CONFIG_TIVA_UART0 - if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_TIVA_UART1 - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_TIVA_UART2 - if (g_uart2priv.irq == irq) - { - dev = &g_uart2port; - } - else -#endif -#ifdef CONFIG_TIVA_UART3 - if (g_uart3priv.irq == irq) - { - dev = &g_uart3port; - } - else -#endif -#ifdef CONFIG_TIVA_UART4 - if (g_uart4priv.irq == irq) - { - dev = &g_uart4port; - } - else -#endif -#ifdef CONFIG_TIVA_UART5 - if (g_uart5priv.irq == irq) - { - dev = &g_uart5port; - } - else -#endif -#ifdef CONFIG_TIVA_UART6 - if (g_uart6priv.irq == irq) - { - dev = &g_uart6port; - } - else -#endif -#ifdef CONFIG_TIVA_UART7 - if (g_uart7priv.irq == irq) - { - dev = &g_uart7port; - } - else -#endif - { - PANIC(); - } - + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, diff --git a/arch/avr/src/at32uc3/at32uc3_serial.c b/arch/avr/src/at32uc3/at32uc3_serial.c index eaf1c8432d7..db10ae31c4d 100644 --- a/arch/avr/src/at32uc3/at32uc3_serial.c +++ b/arch/avr/src/at32uc3/at32uc3_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/avr/src/at32uc3/at32uc3_serial.c * - * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2012, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -160,7 +160,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -408,7 +408,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach the IRQ */ - return irq_attach(priv->irq, up_interrupt, NULL); + return irq_attach(priv->irq, up_interrupt, dev); } /**************************************************************************** @@ -440,40 +440,16 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; uint32_t csr; int passes; bool handled; -#ifdef CONFIG_AVR32_USART0_RS232 - if (g_usart0priv.irq == irq) - { - dev = &g_usart0port; - } - else -#endif -#ifdef CONFIG_AVR32_USART1_RS232 - if (g_usart1priv.irq == irq) - { - dev = &g_usart1port; - } - else -#endif -#ifdef CONFIG_AVR32_USART2_RS232 - if (g_usart2priv.irq == irq) - { - dev = &g_usart2port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; - DEBUGASSERT(priv); /* Loop until there are no characters to be transferred or, * until we have been looping for a long time. diff --git a/arch/hc/src/m9s12/m9s12_serial.c b/arch/hc/src/m9s12/m9s12_serial.c index 885514c3ab6..a6524534bda 100644 --- a/arch/hc/src/m9s12/m9s12_serial.c +++ b/arch/hc/src/m9s12/m9s12_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/hc/src/m9s12/m9s12_serial.c * - * Copyright (C) 2009, 2011-2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011-2012, 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -123,7 +123,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -422,7 +422,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, up_interrupt, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the Rx interrupt (the TX interrupt is still disabled @@ -465,30 +465,14 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; int passes; bool handled; -#ifndef CONFIG_SCI0_DISABLE - if (g_sci0priv.irq == irq) - { - dev = &g_sci0port; - } - else -#endif -#ifndef CONFIG_SCI1_DISABLE - if (g_sci1priv.irq == irq) - { - dev = &g_sci1port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s*)dev->priv; /* Loop until there are no characters to be transferred or, diff --git a/arch/mips/src/pic32mx/pic32mx-serial.c b/arch/mips/src/pic32mx/pic32mx-serial.c index 3558ee1da3b..8e6582a1452 100644 --- a/arch/mips/src/pic32mx/pic32mx-serial.c +++ b/arch/mips/src/pic32mx/pic32mx-serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/mips/src/pic32mx/pic32mx-serial.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -173,7 +173,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_interrupt(int irq, void *context, FAR void *arg); +static int up_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -413,7 +413,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach the IRQ */ - return irq_attach(priv->irq, up_interrupt, NULL); + return irq_attach(priv->irq, up_interrupt, dev); } /**************************************************************************** @@ -451,32 +451,15 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(int irq, void *context, FAR void *arg) +static int up_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; int passes; bool handled; -#ifdef CONFIG_PIC32MX_UART1 - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_PIC32MX_UART2 - if (g_uart2priv.irq == irq) - { - dev = &g_uart2port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; - DEBUGASSERT(priv); /* Loop until there are no characters to be transferred or, * until we have been looping for a long time. diff --git a/arch/mips/src/pic32mz/pic32mz-serial.c b/arch/mips/src/pic32mz/pic32mz-serial.c index 9e4b23d9d37..cfce690614e 100644 --- a/arch/mips/src/pic32mz/pic32mz-serial.c +++ b/arch/mips/src/pic32mz/pic32mz-serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/mips/src/pic32mz/pic32mz-serial.c * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -248,7 +248,6 @@ struct up_dev_s { uintptr_t uartbase; /* Base address of UART registers */ - xcpt_t handler; /* UART interrupt handler */ uint32_t baud; /* Configured baud */ uint8_t irqe; /* Error IRQ associated with this UART (for enable) */ uint8_t irqrx; /* RX IRQ associated with this UART (for enable) */ @@ -276,27 +275,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); - -static int up_interrupt(struct uart_dev_s *priv); -#ifdef CONFIG_PIC32MZ_UART1 -static int up_uart1_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_PIC32MZ_UART2 -static int up_uart2_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_PIC32MZ_UART3 -static int up_uart3_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_PIC32MZ_UART4 -static int up_uart4_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_PIC32MZ_UART5 -static int up_uart5_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_PIC32MZ_UART6 -static int up_uart6_interrupt(int irq, void *context, FAR void *arg); -#endif - +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_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -362,7 +341,6 @@ static char g_uart6txbuffer[CONFIG_UART6_TXBUFSIZE]; static struct up_dev_s g_uart1priv = { .uartbase = PIC32MZ_UART1_K1BASE, - .handler = up_uart1_interrupt, .baud = CONFIG_UART1_BAUD, .irqe = PIC32MZ_IRQ_U1E, .irqrx = PIC32MZ_IRQ_U1RX, @@ -395,7 +373,6 @@ static uart_dev_t g_uart1port = static struct up_dev_s g_uart2priv = { .uartbase = PIC32MZ_UART2_K1BASE, - .handler = up_uart2_interrupt, .baud = CONFIG_UART2_BAUD, .irqe = PIC32MZ_IRQ_U2E, .irqrx = PIC32MZ_IRQ_U2RX, @@ -428,7 +405,6 @@ static uart_dev_t g_uart2port = static struct up_dev_s g_uart3priv = { .uartbase = PIC32MZ_UART3_K1BASE, - .handler = up_uart3_interrupt, .baud = CONFIG_UART3_BAUD, .irqe = PIC32MZ_IRQ_U3E, .irqrx = PIC32MZ_IRQ_U3RX, @@ -461,7 +437,6 @@ static uart_dev_t g_uart3port = static struct up_dev_s g_uart4priv = { .uartbase = PIC32MZ_UART4_K1BASE, - .handler = up_uart4_interrupt, .baud = CONFIG_UART4_BAUD, .irqe = PIC32MZ_IRQ_U4E, .irqrx = PIC32MZ_IRQ_U4RX, @@ -494,7 +469,6 @@ static uart_dev_t g_uart4port = static struct up_dev_s g_uart5priv = { .uartbase = PIC32MZ_UART5_K1BASE, - .handler = up_uart5_interrupt, .baud = CONFIG_UART5_BAUD, .irqe = PIC32MZ_IRQ_U5E, .irqrx = PIC32MZ_IRQ_U5RX, @@ -527,7 +501,6 @@ static uart_dev_t g_uart5port = static struct up_dev_s g_uart6priv = { .uartbase = PIC32MZ_UART6_K1BASE, - .handler = up_uart6_interrupt, .baud = CONFIG_UART6_BAUD, .irqe = PIC32MZ_IRQ_U6E, .irqrx = PIC32MZ_IRQ_U6RX, @@ -675,17 +648,19 @@ static int up_attach(struct uart_dev_s *dev) struct up_dev_s *priv = (struct up_dev_s *)dev->priv; int ret; - /* Attach the IRQs */ + DEBUGASSERT(dev != NULL && dev->priv != NULL); - ret = irq_attach(priv->irqrx, priv->handler, NULL); + /* Attach the IRQ */ + + ret = irq_attach(priv->irqrx, up_interrupt, dev); if (ret == 0) { - ret = irq_attach(priv->irqtx, priv->handler, NULL); + ret = irq_attach(priv->irqtx, up_interrupt, dev); } if (ret == 0) { - ret = irq_attach(priv->irqe, priv->handler, NULL); + ret = irq_attach(priv->irqe, up_interrupt, dev); } return ret; @@ -727,13 +702,14 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_interrupt(struct uart_dev_s *dev) +static int up_interrupt(int irq, void *context, FAR void *arg) { + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; - int passes; - bool handled; + int passes; + bool handled; - DEBUGASSERT(dev && dev->priv); + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, @@ -830,56 +806,6 @@ static int up_interrupt(struct uart_dev_s *dev) return OK; } -/**************************************************************************** - * Name: up_uartn_interrupt - * - * Description: - * These the UART-specific interrupt handlers. They simply invoke the - * common uart interrupt handler with the correct state data. - * - ****************************************************************************/ - -#ifdef CONFIG_PIC32MZ_UART1 -static int up_uart1_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_uart1port); -} -#endif - -#ifdef CONFIG_PIC32MZ_UART2 -static int up_uart2_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_uart2port); -} -#endif - -#ifdef CONFIG_PIC32MZ_UART3 -static int up_uart3_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_uart3port); -} -#endif - -#ifdef CONFIG_PIC32MZ_UART4 -static int up_uart4_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_uart4port); -} -#endif - -#ifdef CONFIG_PIC32MZ_UART5 -static int up_uart5_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_uart5port); -} -#endif -#ifdef CONFIG_PIC32MZ_UART6 -static int up_uart6_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_uart6port); -} -#endif - /**************************************************************************** * Name: up_ioctl * diff --git a/arch/renesas/src/m16c/m16c_serial.c b/arch/renesas/src/m16c/m16c_serial.c index dad01c46050..72cf64a3a5d 100644 --- a/arch/renesas/src/m16c/m16c_serial.c +++ b/arch/renesas/src/m16c/m16c_serial.c @@ -267,12 +267,12 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int up_rcvinterrupt(int irq, void *context, FAR void *arg); +static int up_rcvinterrupt(int irq, void *context, void *arg); static int up_receive(struct uart_dev_s *dev, unsigned int *status); static void m16c_rxint(struct up_dev_s *dev, bool enable); static void up_rxint(struct uart_dev_s *dev, bool enable); static bool up_rxavailable(struct uart_dev_s *dev); -static int up_xmtinterrupt(int irq, void *context, FAR void *arg); +static int up_xmtinterrupt(int irq, void *context, void *arg); static void up_send(struct uart_dev_s *dev, int ch); static void m16c_txint(struct up_dev_s *dev, bool enable); static void up_txint(struct uart_dev_s *dev, bool enable); @@ -711,12 +711,12 @@ static int up_attach(struct uart_dev_s *dev) /* Attach the UART receive data available IRQ */ - ret = irq_attach(priv->rcvirq, up_rcvinterrupt, NULL); + ret = irq_attach(priv->rcvirq, up_rcvinterrupt, dev); if (ret == OK) { /* Attach the UART transmit complete IRQ */ - ret = irq_attach(priv->xmtirq, up_xmtinterrupt, NULL); + ret = irq_attach(priv->xmtirq, up_xmtinterrupt, dev); if (ret != OK) { /* Detach the ERI interrupt on failure */ @@ -764,34 +764,11 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int up_rcvinterrupt(int irq, void *context, FAR void *arg) +static int up_rcvinterrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; -#ifdef CONFIG_M16C_UART0 - if (irq == g_uart0priv.rcvirq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_M16C_UART1 - if (irq == g_uart1priv.rcvirq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_M16C_UART2 - if (irq = g_uart2priv.rcvirq) - { - dev = &g_uart2port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); /* Handle incoming, receive bytes (RDRF: Receive Data Register Full) */ @@ -924,40 +901,17 @@ static bool up_rxavailable(struct uart_dev_s *dev) * This is the UART receive interrupt handler. It will be invoked * when an interrupt received on the 'irq' It should call * uart_transmitchars or uart_receivechar to perform the - * appropriate data transfers. The interrupt handling logic\ + * appropriate data transfers. The interrupt handling logic * must be able to map the 'irq' number into the approprite * up_dev_s structure in order to call these functions. * ****************************************************************************/ -static int up_xmtinterrupt(int irq, void *context, FAR void *arg) +static int up_xmtinterrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; -#ifdef CONFIG_M16C_UART0 - if (irq == g_uart0priv.xmtirq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_M16C_UART1 - if (irq == g_uart1priv.xmtirq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_M16C_UART2 - if (irq == g_uart2priv.xmtirq) - { - dev = &g_uart1port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); /* Handle outgoing, transmit bytes */ diff --git a/arch/z16/src/z16f/z16f_serial.c b/arch/z16/src/z16f/z16f_serial.c index c12f34392b9..1e24c165d17 100644 --- a/arch/z16/src/z16f/z16f_serial.c +++ b/arch/z16/src/z16f/z16f_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/z16/src/z16f/z16f_serial.c * - * Copyright (C) 2008-2009, 2012, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2012, 2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -95,8 +95,8 @@ static int z16f_setup(struct uart_dev_s *dev); static void z16f_shutdown(struct uart_dev_s *dev); static int z16f_attach(struct uart_dev_s *dev); static void z16f_detach(struct uart_dev_s *dev); -static int z16f_rxinterrupt(int irq, void *context, FAR void *arg); -static int z16f_txinterrupt(int irq, void *context, FAR void *arg); +static int z16f_rxinterrupt(int irq, void *context, void *arg); +static int z16f_txinterrupt(int irq, void *context, void *arg); static int z16f_ioctl(struct file *filep, int cmd, unsigned long arg); static int z16f_receive(struct uart_dev_s *dev, uint32_t *status); static void z16f_rxint(struct uart_dev_s *dev, bool enable); @@ -426,12 +426,12 @@ static int z16f_attach(struct uart_dev_s *dev) /* Attach the RX IRQ */ - ret = irq_attach(priv->rxirq, z16f_rxinterrupt, NULL); + ret = irq_attach(priv->rxirq, z16f_rxinterrupt, dev); if (ret == OK) { /* Attach the TX IRQ */ - ret = irq_attach(priv->txirq, z16f_txinterrupt, NULL); + ret = irq_attach(priv->txirq, z16f_txinterrupt, dev); if (ret != OK) { irq_detach(priv->rxirq); @@ -471,30 +471,13 @@ static void z16f_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int z16f_rxinterrupt(int irq, void *context, FAR void *arg) +static int z16f_rxinterrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct z16f_uart_s *priv; uint8_t status; -#ifdef CONFIG_Z16F_UART1 - if (g_uart1priv.rxirq == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_Z16F_UART0 - if (g_uart0priv.rxirq == irq) - { - dev = &g_uart0port; - } - else -#endif - { - PANIC(); - } - + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct z16f_uart_s*)dev->priv; /* Check the LIN-UART status 0 register to determine whether the source of @@ -528,28 +511,11 @@ static int z16f_rxinterrupt(int irq, void *context, FAR void *arg) static int z16f_txinterrupt(int irq, void *context, FAR void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct z16f_uart_s *priv; uint8_t status; -#ifdef CONFIG_Z16F_UART1 - if (g_uart1priv.txirq == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_Z16F_UART0 - if (g_uart0priv.txirq == irq) - { - dev = &g_uart0port; - } - else -#endif - { - PANIC(); - } - + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct z16f_uart_s*)dev->priv; /* Verify that the transmit data register is empty */ diff --git a/arch/z80/src/ez80/ez80_serial.c b/arch/z80/src/ez80/ez80_serial.c index 6f52e86df24..fa64bb32c2b 100644 --- a/arch/z80/src/ez80/ez80_serial.c +++ b/arch/z80/src/ez80/ez80_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/z80/src/ez08/ez80_serial.c * - * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2012, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -85,7 +85,7 @@ static int ez80_setup(struct uart_dev_s *dev); static void ez80_shutdown(struct uart_dev_s *dev); static int ez80_attach(struct uart_dev_s *dev); static void ez80_detach(struct uart_dev_s *dev); -static int ez80_interrupt(int irq, void *context, FAR void *arg); +static int ez80_interrupt(int irq, void *context, void *arg); static int ez80_ioctl(struct file *filep, int cmd, unsigned long arg); static int ez80_receive(struct uart_dev_s *dev, unsigned int *status); static void ez80_rxint(struct uart_dev_s *dev, bool enable); @@ -438,7 +438,7 @@ static int ez80_attach(struct uart_dev_s *dev) /* Attach the IRQ */ - return irq_attach(priv->irq, ez80_interrupt, NULL); + return irq_attach(priv->irq, ez80_interrupt, dev); } /**************************************************************************** @@ -471,29 +471,13 @@ static void ez80_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int ez80_interrupt(int irq, void *context, FAR void *arg) +static int ez80_interrupt(int irq, void *context, void *arg) { - struct uart_dev_s *dev = NULL; - struct ez80_dev_s *priv; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; + struct ez80_dev_s *priv; volatile uint32_t cause; -#ifdef CONFIG_EZ80_UART0 - if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_EZ80_UART1 - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct ez80_dev_s*)dev->priv; cause = ez80_serialin(priv, EZ80_UART_IIR) & EZ80_UARTIIR_CAUSEMASK; diff --git a/arch/z80/src/z8/z8_serial.c b/arch/z80/src/z8/z8_serial.c index bbd7b07fd30..6f6df0efae9 100644 --- a/arch/z80/src/z8/z8_serial.c +++ b/arch/z80/src/z8/z8_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/z80/src/z8/z8_serial.c * - * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2012, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -446,12 +446,12 @@ static int z8_attach(FAR struct uart_dev_s *dev) /* Attach the RX IRQ */ - ret = irq_attach(priv->rxirq, z8_rxinterrupt, NULL); + ret = irq_attach(priv->rxirq, z8_rxinterrupt, dev); if (ret == OK) { /* Attach the TX IRQ */ - ret = irq_attach(priv->txirq, z8_txinterrupt, NULL); + ret = irq_attach(priv->txirq, z8_txinterrupt, dev); if (ret != OK) { irq_detach(priv->rxirq); @@ -490,23 +490,11 @@ static void z8_detach(FAR struct uart_dev_s *dev) static int z8_rxinterrupt(int irq, FAR void *context, FAR void *arg) { - struct uart_dev_s *dev = NULL; - struct z8_uart_s *priv; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; + struct z8_uart_s *priv; uint8_t status; - if (g_uart1priv.rxirq == irq) - { - dev = &g_uart1port; - } - else if (g_uart0priv.rxirq == irq) - { - dev = &g_uart0port; - } - else - { - PANIC(); - } - + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct z8_uart_s*)dev->priv; /* Check the LIN-UART status 0 register to determine whether the source of @@ -539,23 +527,11 @@ static int z8_rxinterrupt(int irq, FAR void *context, FAR void *arg) static int z8_txinterrupt(int irq, FAR void *context, FAR void *arg) { - struct uart_dev_s *dev = NULL; - struct z8_uart_s *priv; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; + struct z8_uart_s *priv; uint8_t status; - if (g_uart1priv.txirq == irq) - { - dev = &g_uart1port; - } - else if (g_uart0priv.txirq == irq) - { - dev = &g_uart0port; - } - else - { - PANIC(); - } - + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct z8_uart_s*)dev->priv; /* Verify that the transmit data register is empty */ From b4ff7391f811b35cf62cde23613ff21e431ff096 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 10:44:13 -0600 Subject: [PATCH 14/38] Convert more drivers to use use irq_attach with argument. --- configs/mikroe-stm32f4/src/stm32_vs1053.c | 9 +- drivers/audio/vs1053.c | 60 ++----------- drivers/net/cs89x0.c | 56 +----------- drivers/serial/uart_16550.c | 105 +++++----------------- include/nuttx/audio/vs1053.h | 3 +- 5 files changed, 37 insertions(+), 196 deletions(-) diff --git a/configs/mikroe-stm32f4/src/stm32_vs1053.c b/configs/mikroe-stm32f4/src/stm32_vs1053.c index 74e7d4310c1..15f35bc839c 100644 --- a/configs/mikroe-stm32f4/src/stm32_vs1053.c +++ b/configs/mikroe-stm32f4/src/stm32_vs1053.c @@ -78,13 +78,15 @@ struct stm32_lower_s { const struct vs1053_lower_s lower; /* Low-level MCU interface */ xcpt_t handler; /* VS1053 interrupt handler */ + FAR void *arg; /* Interrupt handler argument */ }; /**************************************************************************** * Private Function Prototypes ****************************************************************************/ -static int up_attach(FAR const struct vs1053_lower_s *lower, xcpt_t handler); +static int up_attach(FAR const struct vs1053_lower_s *lower, xcpt_t handler, + FAR void *arg); static void up_enable(FAR const struct vs1053_lower_s *lower); static void up_disable(FAR const struct vs1053_lower_s *lower); static void up_reset(FAR const struct vs1053_lower_s *lower, bool state); @@ -110,6 +112,7 @@ static struct stm32_lower_s g_vs1053lower = .irq = GPIO_VS1053_DREQ_IRQ }, .handler = NULL, + .arg = NULL, }; /**************************************************************************** @@ -120,11 +123,13 @@ static struct stm32_lower_s g_vs1053lower = * Name: struct vs1053_lower_s methods ****************************************************************************/ -static int up_attach(FAR const struct vs1053_lower_s *lower, xcpt_t handler) +static int up_attach(FAR const struct vs1053_lower_s *lower, xcpt_t handler, + FAR void *arg) { FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower; priv->handler = handler; /* Save the handler for later */ + priv->arg = arg; /* Along with the handler argument */ return 0; } diff --git a/drivers/audio/vs1053.c b/drivers/audio/vs1053.c index aa4eb861a79..3582bf98e1c 100644 --- a/drivers/audio/vs1053.c +++ b/drivers/audio/vs1053.c @@ -217,13 +217,6 @@ static const struct audio_ops_s g_audioops = vs1053_release /* release */ }; -/* ISR context pointers */ - -static struct vs1053_struct_s *g_isrdata[CONFIG_VS1053_DEVICE_COUNT] = -{ - NULL, -}; - /* Volume control log table. This table is in increments of 2% of * requested volume level and is the register value that should be * programmed to the VS1053 to achieve that volume pecentage. @@ -1215,32 +1208,12 @@ err_out: * ****************************************************************************/ -static int vs1053_dreq_isr(int irq, FAR void *context) +static int vs1053_dreq_isr(int irq, FAR void *context, FAR void *arg) { - struct vs1053_struct_s *dev = NULL; + struct vs1053_struct_s *dev = (struct vs1053_struct_s *)arg; struct audio_msg_s msg; - /* Get the driver context */ - -#if CONFIG_VS1053_DEVICE_COUNT == 1 - dev = g_isrdata[0]; /* Simple case */ -#else - /* More complex case */ - { - int x; - - for (x = 0; x < CONFIG_VS1053_DEVICE_COUNT; x++) - { - if (g_isrdata[x]->hw_lower->irq == irq) - { - dev = g_isrdata[x]; - break; - } - } - - DEBUGASSERT(dev); - } -#endif + DEBUGASSERT(dev != NULL); /* Now create a message and send it to the workerthread */ @@ -1909,33 +1882,10 @@ struct audio_lowerhalf_s *vs1053_initialize(FAR struct spi_dev_s *spi, } /* Attach our ISR to this device */ - dev->hw_lower->attach(dev->hw_lower, vs1053_dreq_isr); - /* Find a slot to save the device context for ISR lookup */ + dev->hw_lower->attach(dev->hw_lower, vs1053_dreq_isr, dev); -#if CONFIG_VS1053_DEVICE_COUNT == 1 - g_isrdata[0] = dev; /* The simple case */ -#else - /* The more complex case */ - { - int x; - - /* Initialize the ISR data if not alrady */ - - for (x = 0; x < CONFIG_VS1053_DEVICE_COUNT; x++) - { - /* Find an empty slot */ - - if (g_isrdata[x] == NULL) - { - g_isrdata[x] = dev; - break; - } - } - } -#endif - - /* Do some initialization of the codec */ + /* Do some initialization of the codec */ vs1053_shutdown(&dev->lower); /* Go to shutdown state */ } diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index a883370bbf8..ef2f7f46aed 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -85,14 +85,6 @@ #define BUF ((struct eth_hdr_s *)cs89x0->cs_dev.d_buf) -/* If there is only one CS89x0 instance, then mapping the CS89x0 IRQ to - * a driver state instance is trivial. - */ - -#if CONFIG_CS89x0_NINTERFACES == 1 -# define cs89x0_mapirq(irq) g_cs89x0[0] -#endif - #define PKTBUF_SIZE (MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE) /**************************************************************************** @@ -123,9 +115,6 @@ static int cs89x0_txpoll(struct net_driver_s *dev); static void cs89x0_receive(struct cs89x0_driver_s *cs89x0); static void cs89x0_txdone(struct cs89x0_driver_s *cs89x0, uint16_t isq); -#if CONFIG_CS89x0_NINTERFACES > 1 -static inline FAR struct cs89x0_driver_s *cs89x0_mapirq(int irq); -#endif static int cs89x0_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -621,40 +610,6 @@ static void cs89x0_txdone(struct cs89x0_driver_s *cs89x0, uint16_t isq) (void)devif_poll(&cs89x0->cs_dev, cs89x0_txpoll); } -/**************************************************************************** - * Function: cs89x0_mapirq - * - * Description: - * Map an IRQ number to a CS89x0 device state instance. This is only - * necessary to handler the case where the architecture includes more than - * on CS89x0 chip. - * - * Parameters: - * irq - Number of the IRQ that generated the interrupt - * - * Returned Value: - * A reference to device state structure (NULL if irq does not correspond - * to any CS89x0 device). - * - * Assumptions: - * - ****************************************************************************/ - -#if CONFIG_CS89x0_NINTERFACES > 1 -static inline FAR struct cs89x0_driver_s *cs89x0_mapirq(int irq) -{ - int i; - for (i = 0; i < CONFIG_CS89x0_NINTERFACES; i++) - { - if (g_cs89x0[i] && g_cs89x0[i].irq == irq) - { - return g_cs89x0[i]; - } - } - return NULL; -} -#endif - /**************************************************************************** * Function: cs89x0_interrupt * @@ -674,15 +629,10 @@ static inline FAR struct cs89x0_driver_s *cs89x0_mapirq(int irq) static int cs89x0_interrupt(int irq, FAR void *context, FAR void *arg) { - register struct cs89x0_driver_s *cs89x0 = s89x0_mapirq(irq); + FAR struct cs89x0_driver_s *cs89x0 = (FAR struct cs89x0_driver_s *)arg; uint16_t isq; -#ifdef CONFIG_DEBUG_FEATURES - if (!cs89x0) - { - return -ENODEV; - } -#endif + DEBUGASSERT(cs89x0 != NULL); /* Read and process all of the events from the ISQ */ @@ -1023,7 +973,7 @@ int cs89x0_initialize(FAR const cs89x0_driver_s *cs89x0, int devno) /* Attach the IRQ to the driver */ - if (irq_attach(cs89x0->irq, cs89x0_interrupt, NULL)) + if (irq_attach(cs89x0->irq, cs89x0_interrupt, cs89x0)) { /* We could not attach the ISR to the ISR */ diff --git a/drivers/serial/uart_16550.c b/drivers/serial/uart_16550.c index b1704983f1b..ab532a49db3 100644 --- a/drivers/serial/uart_16550.c +++ b/drivers/serial/uart_16550.c @@ -2,7 +2,7 @@ * drivers/serial/uart_16550.c * Serial driver for 16550 UART * - * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -74,10 +74,8 @@ struct u16550_s uint32_t baud; /* Configured baud */ uint32_t uartclk; /* UART clock frequency */ #endif -#ifndef CONFIG_SUPPRESS_SERIAL_INTS uart_datawidth_t ier; /* Saved IER value */ uint8_t irq; /* IRQ associated with this UART */ -#endif #ifndef CONFIG_16550_SUPRESS_CONFIG uint8_t parity; /* 0=none, 1=odd, 2=even */ uint8_t bits; /* Number of bits (7 or 8) */ @@ -89,21 +87,19 @@ struct u16550_s * Private Function Prototypes ****************************************************************************/ -static int u16550_setup(struct uart_dev_s *dev); -static void u16550_shutdown(struct uart_dev_s *dev); -static int u16550_attach(struct uart_dev_s *dev); -static void u16550_detach(struct uart_dev_s *dev); -#ifndef CONFIG_SUPPRESS_SERIAL_INTS -static int u16550_interrupt(int irq, void *context, FAR void *arg); -#endif -static int u16550_ioctl(struct file *filep, int cmd, unsigned long arg); -static int u16550_receive(struct uart_dev_s *dev, uint32_t *status); -static void u16550_rxint(struct uart_dev_s *dev, bool enable); -static bool u16550_rxavailable(struct uart_dev_s *dev); -static void u16550_send(struct uart_dev_s *dev, int ch); -static void u16550_txint(struct uart_dev_s *dev, bool enable); -static bool u16550_txready(struct uart_dev_s *dev); -static bool u16550_txempty(struct uart_dev_s *dev); +static int u16550_setup(FAR struct uart_dev_s *dev); +static void u16550_shutdown(FAR struct uart_dev_s *dev); +static int u16550_attach(FAR struct uart_dev_s *dev); +static void u16550_detachFAR struct uart_dev_s *dev); +static int u16550_interrupt(int irq, FAR void *context, FAR void *arg); +static int u16550_ioctl(FAR struct file *filep, int cmd, unsigned long arg); +static int u16550_receive(FAR struct uart_dev_s *dev, uint32_t *status); +static void u16550_rxint(FAR struct uart_dev_s *dev, bool enable); +static bool u16550_rxavailable(FAR struct uart_dev_s *dev); +static void u16550_send(FAR struct uart_dev_s *dev, int ch); +static void u16550_txint(FAR struct uart_dev_s *dev, bool enable); +static bool u16550_txready(FAR struct uart_dev_s *dev); +static bool u16550_txempty(FAR struct uart_dev_s *dev); /**************************************************************************** * Private Data @@ -157,9 +153,7 @@ static struct u16550_s g_uart0priv = .baud = CONFIG_16550_UART0_BAUD, .uartclk = CONFIG_16550_UART0_CLOCK, #endif -#ifndef CONFIG_SUPPRESS_SERIAL_INTS .irq = CONFIG_16550_UART0_IRQ, -#endif #ifndef CONFIG_16550_SUPRESS_CONFIG .parity = CONFIG_16550_UART0_PARITY, .bits = CONFIG_16550_UART0_BITS, @@ -194,9 +188,7 @@ static struct u16550_s g_uart1priv = .baud = CONFIG_16550_UART1_BAUD, .uartclk = CONFIG_16550_UART1_CLOCK, #endif -#ifndef CONFIG_SUPPRESS_SERIAL_INTS .irq = CONFIG_16550_UART1_IRQ, -#endif #ifndef CONFIG_16550_SUPRESS_CONFIG .parity = CONFIG_16550_UART1_PARITY, .bits = CONFIG_16550_UART1_BITS, @@ -231,9 +223,7 @@ static struct u16550_s g_uart2priv = .baud = CONFIG_16550_UART2_BAUD, .uartclk = CONFIG_16550_UART2_CLOCK, #endif -#ifndef CONFIG_SUPPRESS_SERIAL_INTS .irq = CONFIG_16550_UART2_IRQ, -#endif #ifndef CONFIG_16550_SUPRESS_CONFIG .parity = CONFIG_16550_UART2_PARITY, .bits = CONFIG_16550_UART2_BITS, @@ -268,9 +258,7 @@ static struct u16550_s g_uart3priv = .baud = CONFIG_16550_UART3_BAUD, .uartclk = CONFIG_16550_UART3_CLOCK, #endif -#ifndef CONFIG_SUPPRESS_SERIAL_INTS .irq = CONFIG_16550_UART3_IRQ, -#endif #ifndef CONFIG_16550_SUPRESS_CONFIG .parity = CONFIG_16550_UART3_PARITY, .bits = CONFIG_16550_UART3_BITS, @@ -483,7 +471,6 @@ static inline void u16550_serialout(FAR struct u16550_s *priv, int offset, * Name: u16550_disableuartint ****************************************************************************/ -#ifndef CONFIG_SUPPRESS_SERIAL_INTS static inline void u16550_disableuartint(FAR struct u16550_s *priv, FAR uart_datawidth_t *ier) { @@ -495,23 +482,16 @@ static inline void u16550_disableuartint(FAR struct u16550_s *priv, priv->ier &= ~UART_IER_ALLIE; u16550_serialout(priv, UART_IER_OFFSET, priv->ier); } -#else -# define u16550_disableuartint(priv,ier) -#endif /**************************************************************************** * Name: u16550_restoreuartint ****************************************************************************/ -#ifndef CONFIG_SUPPRESS_SERIAL_INTS static inline void u16550_restoreuartint(FAR struct u16550_s *priv, uint32_t ier) { priv->ier |= ier & UART_IER_ALLIE; u16550_serialout(priv, UART_IER_OFFSET, priv->ier); } -#else -# define u16550_restoreuartint(priv,ier) -#endif /**************************************************************************** * Name: u16550_enablebreaks @@ -586,9 +566,7 @@ static int u16550_setup(struct uart_dev_s *dev) /* Set up the IER */ -#ifndef CONFIG_SUPPRESS_SERIAL_INTS priv->ier = u16550_serialin(priv, UART_IER_OFFSET); -#endif /* Set up the LCR */ @@ -682,13 +660,12 @@ static void u16550_shutdown(struct uart_dev_s *dev) static int u16550_attach(struct uart_dev_s *dev) { -#ifndef CONFIG_SUPPRESS_SERIAL_INTS FAR struct u16550_s *priv = (FAR struct u16550_s *)dev->priv; int ret; /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, u16550_interrupt, NULL); + ret = irq_attach(priv->irq, u16550_interrupt, dev); #ifndef CONFIG_ARCH_NOINTC if (ret == OK) { @@ -700,9 +677,6 @@ static int u16550_attach(struct uart_dev_s *dev) } #endif return ret; -#else - return OK; -#endif } /**************************************************************************** @@ -717,13 +691,10 @@ static int u16550_attach(struct uart_dev_s *dev) static void u16550_detach(FAR struct uart_dev_s *dev) { -#ifndef CONFIG_SUPPRESS_SERIAL_INTS FAR struct u16550_s *priv = (FAR struct u16550_s *)dev->priv; -#ifndef CONFIG_ARCH_NOINTC + up_disable_irq(priv->irq); -#endif irq_detach(priv->irq); -#endif } /**************************************************************************** @@ -738,42 +709,14 @@ static void u16550_detach(FAR struct uart_dev_s *dev) * ****************************************************************************/ -#ifndef CONFIG_SUPPRESS_SERIAL_INTS -static int u16550_interrupt(int irq, void *context, FAR void *arg) +static int u16550_interrupt(int irq, FAR void *context, FAR void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct u16550_s *priv; uint32_t status; int passes; -#ifdef CONFIG_16550_UART0 - if (g_uart0priv.irq == irq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_16550_UART1 - if (g_uart1priv.irq == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_16550_UART2 - if (g_uart2priv.irq == irq) - { - dev = &g_uart2port; - } - else -#endif -#ifdef CONFIG_16550_UART3 - if (g_uart3priv.irq == irq) - { - dev = &g_uart3port; - } -#endif - ASSERT(dev != NULL); + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (FAR struct u16550_s *)dev->priv; /* Loop until there are no characters to be transferred or, @@ -856,7 +799,6 @@ static int u16550_interrupt(int irq, void *context, FAR void *arg) return OK; } -#endif /**************************************************************************** * Name: u16550_ioctl @@ -959,7 +901,6 @@ static int u16550_receive(struct uart_dev_s *dev, uint32_t *status) static void u16550_rxint(struct uart_dev_s *dev, bool enable) { -#ifndef CONFIG_SUPPRESS_SERIAL_INTS FAR struct u16550_s *priv = (FAR struct u16550_s *)dev->priv; if (enable) { @@ -969,8 +910,8 @@ static void u16550_rxint(struct uart_dev_s *dev, bool enable) { priv->ier &= ~UART_IER_ERBFI; } + u16550_serialout(priv, UART_IER_OFFSET, priv->ier); -#endif } /**************************************************************************** @@ -1011,7 +952,6 @@ static void u16550_send(struct uart_dev_s *dev, int ch) static void u16550_txint(struct uart_dev_s *dev, bool enable) { -#ifndef CONFIG_SUPPRESS_SERIAL_INTS FAR struct u16550_s *priv = (FAR struct u16550_s *)dev->priv; irqstate_t flags; @@ -1034,7 +974,6 @@ static void u16550_txint(struct uart_dev_s *dev, bool enable) } leave_critical_section(flags); -#endif } /**************************************************************************** @@ -1161,11 +1100,9 @@ void up_serialinit(void) int up_putc(int ch) { FAR struct u16550_s *priv = (FAR struct u16550_s *)CONSOLE_DEV.priv; -#ifndef CONFIG_SUPPRESS_SERIAL_INTS uart_datawidth_t ier; u16550_disableuartint(priv, &ier); -#endif /* Check for LF */ @@ -1177,9 +1114,7 @@ int up_putc(int ch) } u16550_putc(priv, ch); -#ifndef CONFIG_SUPPRESS_SERIAL_INTS u16550_restoreuartint(priv, ier); -#endif return ch; } #endif diff --git a/include/nuttx/audio/vs1053.h b/include/nuttx/audio/vs1053.h index aa08b7c04c1..75cc291674a 100644 --- a/include/nuttx/audio/vs1053.h +++ b/include/nuttx/audio/vs1053.h @@ -66,7 +66,8 @@ struct vs1053_lower_s { - int (*attach)(FAR const struct vs1053_lower_s *lower, xcpt_t handler); + int (*attach)(FAR const struct vs1053_lower_s *lower, xcpt_t handler, + FAR void *arg); void (*enable)(FAR const struct vs1053_lower_s *lower); void (*disable)(FAR const struct vs1053_lower_s *lower); void (*reset)(FAR const struct vs1053_lower_s *lower, bool state); From 6a3add72307bbbb24e583ab496e56650f1a5535a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 11:03:10 -0600 Subject: [PATCH 15/38] STM32 TIM: Correct function prototype. --- arch/arm/src/stm32/stm32_tim.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/stm32/stm32_tim.h b/arch/arm/src/stm32/stm32_tim.h index e31250537b4..57fd2475c1e 100644 --- a/arch/arm/src/stm32/stm32_tim.h +++ b/arch/arm/src/stm32/stm32_tim.h @@ -50,6 +50,8 @@ #include "chip.h" #include "chip/stm32_tim.h" +#include + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ @@ -172,8 +174,8 @@ struct stm32_tim_ops_s /* Timer interrupts */ - int (*setisr)(FAR struct stm32_tim_dev_s *dev, - int (*handler)(int irq, void *context), int source); + int (*setisr)(FAR struct stm32_tim_dev_s *dev, xcpt_t handler, + int source); void (*enableint)(FAR struct stm32_tim_dev_s *dev, int source); void (*disableint)(FAR struct stm32_tim_dev_s *dev, int source); void (*ackint)(FAR struct stm32_tim_dev_s *dev, int source); From 7e8e869352a97ffbf190f1826538d97ef37ddc7b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 11:14:21 -0600 Subject: [PATCH 16/38] Add more missing arguments to interrupt handling functions. --- arch/arm/src/sama5/sam_hsmci.c | 14 +++++++------- configs/spark/src/stm32_wireless.c | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/arm/src/sama5/sam_hsmci.c b/arch/arm/src/sama5/sam_hsmci.c index 8caa71157a9..254baa0dd6f 100644 --- a/arch/arm/src/sama5/sam_hsmci.c +++ b/arch/arm/src/sama5/sam_hsmci.c @@ -539,13 +539,13 @@ static void sam_notransfer(struct sam_dev_s *priv); static int sam_hsmci_interrupt(struct sam_dev_s *priv); #ifdef CONFIG_SAMA5_HSMCI0 -static int sam_hsmci0_interrupt(int irq, void *context); +static int sam_hsmci0_interrupt(int irq, void *context, void *arg); #endif #ifdef CONFIG_SAMA5_HSMCI1 -static int sam_hsmci1_interrupt(int irq, void *context); +static int sam_hsmci1_interrupt(int irq, void *context, void *arg); #endif #ifdef CONFIG_SAMA5_HSMCI2 -static int sam_hsmci2_interrupt(int irq, void *context); +static int sam_hsmci2_interrupt(int irq, void *context, void *arg); #endif /* SDIO interface methods ***************************************************/ @@ -1677,21 +1677,21 @@ static int sam_hsmci_interrupt(struct sam_dev_s *priv) ****************************************************************************/ #ifdef CONFIG_SAMA5_HSMCI0 -static int sam_hsmci0_interrupt(int irq, void *context) +static int sam_hsmci0_interrupt(int irq, void *context, void *arg) { return sam_hsmci_interrupt(&g_hsmci0); } #endif #ifdef CONFIG_SAMA5_HSMCI1 -static int sam_hsmci1_interrupt(int irq, void *context) +static int sam_hsmci1_interrupt(int irq, void *context, void *arg) { return sam_hsmci_interrupt(&g_hsmci1); } #endif #ifdef CONFIG_SAMA5_HSMCI2 -static int sam_hsmci2_interrupt(int irq, void *context) +static int sam_hsmci2_interrupt(int irq, void *context, void *arg) { return sam_hsmci_interrupt(&g_hsmci2); } @@ -1984,7 +1984,7 @@ static int sam_attach(FAR struct sdio_dev_s *dev) /* Attach the HSMCI interrupt handler */ - ret = irq_attach(irq, handler, NULL); + ret = irq_attach(irq, handler, priv); if (ret == OK) { diff --git a/configs/spark/src/stm32_wireless.c b/configs/spark/src/stm32_wireless.c index 9e51affd859..962faa93549 100644 --- a/configs/spark/src/stm32_wireless.c +++ b/configs/spark/src/stm32_wireless.c @@ -96,6 +96,7 @@ struct stm32_config_s { struct cc3000_config_s dev; xcpt_t handler; + void *arg; }; /**************************************************************************** From a773f9412a39ae4868df03af19ee89d54577a756 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 11:41:48 -0600 Subject: [PATCH 17/38] STMPE811 driver needs argument in interrupt handler --- configs/stm3220g-eval/src/stm32_stmpe811.c | 9 ++++-- configs/stm3240g-eval/src/stm32_stmpe811.c | 9 ++++-- configs/stm32f429i-disco/src/stm32_stmpe811.c | 9 ++++-- drivers/input/stmpe811_base.c | 32 ++++--------------- drivers/wireless/nrf24l01.c | 24 ++++---------- include/nuttx/input/stmpe811.h | 4 +-- include/nuttx/wireless/nrf24l01.h | 6 ---- 7 files changed, 35 insertions(+), 58 deletions(-) diff --git a/configs/stm3220g-eval/src/stm32_stmpe811.c b/configs/stm3220g-eval/src/stm32_stmpe811.c index 5748600e957..7b3ffc332ab 100644 --- a/configs/stm3220g-eval/src/stm32_stmpe811.c +++ b/configs/stm3220g-eval/src/stm32_stmpe811.c @@ -137,6 +137,7 @@ struct stm32_stmpe811config_s STMPE811_HANDLE handle; /* The STMPE811 driver handle */ xcpt_t handler; /* The STMPE811 interrupt handler */ + void *arg; /* Interrupt handler argument */ }; /**************************************************************************** @@ -152,7 +153,8 @@ struct stm32_stmpe811config_s * clear - Acknowledge/clear any pending GPIO interrupt */ -static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr); +static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr, + FAR void *arg); static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable); static void stmpe811_clear(FAR struct stmpe811_config_s *state); @@ -191,6 +193,7 @@ static struct stm32_stmpe811config_s g_stmpe811config = .clear = stmpe811_clear, }, .handler = NULL, + .arg = NULL, }; #endif @@ -207,7 +210,8 @@ static struct stm32_stmpe811config_s g_stmpe811config = * clear - Acknowledge/clear any pending GPIO interrupt */ -static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr) +static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr, + FAR void *arg) { FAR struct stm32_stmpe811config_s *priv = (FAR struct stm32_stmpe811config_s *)state; @@ -217,6 +221,7 @@ static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr) /* Just save the handler. We will use it when EXTI interruptsare enabled */ priv->handler = isr; + priv->arg = arg; return OK; } diff --git a/configs/stm3240g-eval/src/stm32_stmpe811.c b/configs/stm3240g-eval/src/stm32_stmpe811.c index 0bb25376fa3..147bf4f9523 100644 --- a/configs/stm3240g-eval/src/stm32_stmpe811.c +++ b/configs/stm3240g-eval/src/stm32_stmpe811.c @@ -137,6 +137,7 @@ struct stm32_stmpe811config_s STMPE811_HANDLE handle; /* The STMPE811 driver handle */ xcpt_t handler; /* The STMPE811 interrupt handler */ + FAR void *arg; /* Interrupt handler argument */ }; /**************************************************************************** @@ -152,7 +153,8 @@ struct stm32_stmpe811config_s * clear - Acknowledge/clear any pending GPIO interrupt */ -static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr); +static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr, + FAR void *arg); static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable); static void stmpe811_clear(FAR struct stmpe811_config_s *state); @@ -191,6 +193,7 @@ static struct stm32_stmpe811config_s g_stmpe811config = .clear = stmpe811_clear, }, .handler = NULL, + .arg = NULL, }; #endif @@ -207,7 +210,8 @@ static struct stm32_stmpe811config_s g_stmpe811config = * clear - Acknowledge/clear any pending GPIO interrupt */ -static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr) +static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr, + FAR void *arg) { FAR struct stm32_stmpe811config_s *priv = (FAR struct stm32_stmpe811config_s *)state; @@ -217,6 +221,7 @@ static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr) /* Just save the handler. We will use it when EXTI interruptsare enabled */ priv->handler = isr; + priv->arg = arg; return OK; } diff --git a/configs/stm32f429i-disco/src/stm32_stmpe811.c b/configs/stm32f429i-disco/src/stm32_stmpe811.c index 4e678cef0e8..7cd8b08db71 100644 --- a/configs/stm32f429i-disco/src/stm32_stmpe811.c +++ b/configs/stm32f429i-disco/src/stm32_stmpe811.c @@ -137,6 +137,7 @@ struct stm32_stmpe811config_s STMPE811_HANDLE handle; /* The STMPE811 driver handle */ xcpt_t handler; /* The STMPE811 interrupt handler */ + FAR void *arg; /* Interrupt handler argument */ }; /**************************************************************************** @@ -153,7 +154,8 @@ struct stm32_stmpe811config_s * clear - Acknowledge/clear any pending GPIO interrupt */ -static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr); +static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr, + FAR void *arg); static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable); static void stmpe811_clear(FAR struct stmpe811_config_s *state); @@ -192,6 +194,7 @@ static struct stm32_stmpe811config_s g_stmpe811config = .clear = stmpe811_clear, }, .handler = NULL, + .arg = NULL, }; #endif @@ -208,7 +211,8 @@ static struct stm32_stmpe811config_s g_stmpe811config = * clear - Acknowledge/clear any pending GPIO interrupt */ -static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr) +static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr, + FAR void *arg) { FAR struct stm32_stmpe811config_s *priv = (FAR struct stm32_stmpe811config_s *)state; @@ -219,6 +223,7 @@ static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr) /* Just save the handler. We will use it when EXTI interruptsare enabled */ priv->handler = isr; + priv->arg = arg; return OK; } diff --git a/drivers/input/stmpe811_base.c b/drivers/input/stmpe811_base.c index dca84ae76a8..62b86a420fd 100644 --- a/drivers/input/stmpe811_base.c +++ b/drivers/input/stmpe811_base.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/input/stmpe811_base.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -54,10 +54,6 @@ #if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_STMPE811) -/**************************************************************************** - * Private Types - ****************************************************************************/ - /**************************************************************************** * Private Data ****************************************************************************/ @@ -155,30 +151,14 @@ static void stmpe811_worker(FAR void *arg) * ****************************************************************************/ -static int stmpe811_interrupt(int irq, FAR void *context) +static int stmpe811_interrupt(int irq, FAR void *context, FAR void *arg) { - FAR struct stmpe811_dev_s *priv; + FAR struct stmpe811_dev_s *priv = (FAR struct stmpe811_dev_s *)arg; FAR struct stmpe811_config_s *config; - int ret; - - /* Which STMPE811 device caused the interrupt? */ - -#ifndef CONFIG_STMPE811_MULTIPLE - priv = &g_stmpe811; -#else - for (priv = g_stmpe811list; - priv && priv->config->irq != irq; - priv = priv->flink); - - ASSERT(priv != NULL); -#endif - - /* Get a pointer the callbacks for convenience (and so the code is not so - * ugly). - */ + int ret; + DEBUGASSERT(priv != NULL && priv->config != NULL); config = priv->config; - DEBUGASSERT(config != NULL); /* Disable further interrupts */ @@ -359,7 +339,7 @@ STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_master_s *dev, /* Attach the STMPE811 interrupt handler. */ - config->attach(config, stmpe811_interrupt); + config->attach(config, stmpe811_interrupt, priv); /* Clear any pending interrupts */ diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c index 166ab5c4ed1..01c1f016981 100644 --- a/drivers/wireless/nrf24l01.c +++ b/drivers/wireless/nrf24l01.c @@ -185,7 +185,7 @@ static uint8_t nrf24l01_setregbit(FAR struct nrf24l01_dev_s *dev, uint8_t reg, static void nrf24l01_tostate(FAR struct nrf24l01_dev_s *dev, nrf24l01_state_t state); -static int nrf24l01_irqhandler(FAR int irq, FAR void *context); +static int nrf24l01_irqhandler(FAR int irq, FAR void *context, FAR void *arg); static inline int nrf24l01_attachirq(FAR struct nrf24l01_dev_s *dev, xcpt_t isr); @@ -222,8 +222,6 @@ static int nrf24l01_poll(FAR struct file *filep, FAR struct pollfd *fds, * Private Data ****************************************************************************/ -static FAR struct nrf24l01_dev_s *g_nrf24l01dev; - static const struct file_operations nrf24l01_fops = { nrf24l01_open, /* open */ @@ -491,9 +489,9 @@ uint8_t fifoget(struct nrf24l01_dev_s *dev, uint8_t *buffer, uint8_t buflen, uin #endif -static int nrf24l01_irqhandler(int irq, FAR void *context) +static int nrf24l01_irqhandler(int irq, FAR void *context, FAR void *arg) { - FAR struct nrf24l01_dev_s *dev = g_nrf24l01dev; + FAR struct nrf24l01_dev_s *dev = (FAR struct nrf24l01_dev_s *)arg; winfo("*IRQ*"); @@ -501,7 +499,7 @@ static int nrf24l01_irqhandler(int irq, FAR void *context) /* If RX is enabled we delegate the actual work to bottom-half handler */ - work_queue(HPWORK, &g_nrf24l01dev->irq_work, nrf24l01_worker, dev, 0); + work_queue(HPWORK, &priv->irq_work, nrf24l01_worker, dev, 0); #else /* Otherwise we simply wake up the send function */ @@ -1179,9 +1177,8 @@ static int nrf24l01_unregister(FAR struct nrf24l01_dev_s *dev) nrf24l01_attachirq(dev, NULL); - g_nrf24l01dev = NULL; - /* Free memory */ + #ifdef CONFIG_WL_NRF24L01_RXSUPPORT kmm_free(dev->rx_fifo); #endif @@ -1244,13 +1241,9 @@ int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *c sem_setprotocol(&dev->sem_rx, SEM_PRIO_NONE); #endif - /* Set the global reference */ - - g_nrf24l01dev = dev; - /* Configure IRQ pin (falling edge) */ - nrf24l01_attachirq(dev, nrf24l01_irqhandler); + nrf24l01_attachirq(dev, nrf24l01_irqhandler, dev); /* Register the device as an input device */ @@ -1266,11 +1259,6 @@ int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *c return result; } -FAR struct nrf24l01_dev_s * nrf24l01_getinstance(void) -{ - return g_nrf24l01dev; -} - /* (re)set the device in a default initial state */ int nrf24l01_init(FAR struct nrf24l01_dev_s *dev) diff --git a/include/nuttx/input/stmpe811.h b/include/nuttx/input/stmpe811.h index 08b7e6f3cf9..861377e81e4 100644 --- a/include/nuttx/input/stmpe811.h +++ b/include/nuttx/input/stmpe811.h @@ -1,7 +1,7 @@ /******************************************************************************************** * include/nuttx/input/stmpe811.h * - * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -500,7 +500,7 @@ struct stmpe811_config_s * clear - Acknowledge/clear any pending GPIO interrupt */ - int (*attach)(FAR struct stmpe811_config_s *state, xcpt_t isr); + int (*attach)(FAR struct stmpe811_config_s *state, xcpt_t isr, FAR void *arg); void (*enable)(FAR struct stmpe811_config_s *state, bool enable); void (*clear)(FAR struct stmpe811_config_s *state); }; diff --git a/include/nuttx/wireless/nrf24l01.h b/include/nuttx/wireless/nrf24l01.h index 7b85c79a258..eae95d95d4d 100644 --- a/include/nuttx/wireless/nrf24l01.h +++ b/include/nuttx/wireless/nrf24l01.h @@ -235,12 +235,6 @@ int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *c int nrf24l01_init(FAR struct nrf24l01_dev_s *dev); -/************************************************************************************ - * Get a pointer to the registered device - ************************************************************************************/ - -FAR struct nrf24l01_dev_s * nrf24l01_getinstance(void); - /************************************************************************************ * Set the default TX address. * From 840c5935a3beb412766c673df1650f711520520b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 11:58:20 -0600 Subject: [PATCH 18/38] Correct a typo from one of the preceding commits. --- drivers/wireless/nrf24l01.c | 2 +- sched/irq/irq_attach.c | 20 -------------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c index 01c1f016981..d1b6767f675 100644 --- a/drivers/wireless/nrf24l01.c +++ b/drivers/wireless/nrf24l01.c @@ -499,7 +499,7 @@ static int nrf24l01_irqhandler(int irq, FAR void *context, FAR void *arg) /* If RX is enabled we delegate the actual work to bottom-half handler */ - work_queue(HPWORK, &priv->irq_work, nrf24l01_worker, dev, 0); + work_queue(HPWORK, &dev->irq_work, nrf24l01_worker, dev, 0); #else /* Otherwise we simply wake up the send function */ diff --git a/sched/irq/irq_attach.c b/sched/irq/irq_attach.c index c006ea15df4..ae147e2004b 100644 --- a/sched/irq/irq_attach.c +++ b/sched/irq/irq_attach.c @@ -43,26 +43,6 @@ #include "irq/irq.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Type Declarations - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ From 6002393b2d73a90ccd1fbd952ec0be91ee46ff8a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 12:06:15 -0600 Subject: [PATCH 19/38] Fix some interrupt argument issues associated with NRF21L01 --- configs/stm32_tiny/src/stm32_wireless.c | 6 ++++-- configs/stm32f103-minimum/src/stm32_wireless.c | 7 ++++--- include/nuttx/wireless/nrf24l01.h | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/configs/stm32_tiny/src/stm32_wireless.c b/configs/stm32_tiny/src/stm32_wireless.c index bbfdedc13b1..cebd1a3e5ae 100644 --- a/configs/stm32_tiny/src/stm32_wireless.c +++ b/configs/stm32_tiny/src/stm32_wireless.c @@ -57,7 +57,7 @@ * Private Function Prototypes ************************************************************************************/ -static int stm32tiny_wl_irq_attach(xcpt_t isr); +static int stm32tiny_wl_irq_attach(xcpt_t isr, FAR void *arg); static void stm32tiny_wl_chip_enable(bool enable); @@ -72,15 +72,17 @@ static FAR struct nrf24l01_config_s nrf_cfg = }; static xcpt_t g_isr; +static FAR void *g_arg; /************************************************************************************ * Private Functions ************************************************************************************/ -static int stm32tiny_wl_irq_attach(xcpt_t isr) +static int stm32tiny_wl_irq_attach(xcpt_t isr, FAR void *arg) { _info("Attach IRQ\n"); g_isr = isr; + g_arg = arg; stm32_gpiosetevent(GPIO_NRF24L01_IRQ, false, true, false, g_isr); return OK; } diff --git a/configs/stm32f103-minimum/src/stm32_wireless.c b/configs/stm32f103-minimum/src/stm32_wireless.c index 51802585f63..6a25abaa87e 100644 --- a/configs/stm32f103-minimum/src/stm32_wireless.c +++ b/configs/stm32f103-minimum/src/stm32_wireless.c @@ -60,8 +60,7 @@ * Private Function Prototypes ************************************************************************************/ -static int stm32tiny_wl_irq_attach(xcpt_t isr); - +static int stm32tiny_wl_irq_attach(xcpt_t isr, FAR void *arg); static void stm32tiny_wl_chip_enable(bool enable); /************************************************************************************ @@ -75,15 +74,17 @@ static FAR struct nrf24l01_config_s nrf_cfg = }; static xcpt_t g_isr; +static FAR void *g_arg; /************************************************************************************ * Private Functions ************************************************************************************/ -static int stm32tiny_wl_irq_attach(xcpt_t isr) +static int stm32tiny_wl_irq_attach(xcpt_t isr, FAR void *arg) { winfo("Attach IRQ\n"); g_isr = isr; + g_arg = arg; stm32_gpiosetevent(GPIO_NRF24L01_IRQ, false, true, false, g_isr); return OK; } diff --git a/include/nuttx/wireless/nrf24l01.h b/include/nuttx/wireless/nrf24l01.h index eae95d95d4d..af17428d237 100644 --- a/include/nuttx/wireless/nrf24l01.h +++ b/include/nuttx/wireless/nrf24l01.h @@ -199,7 +199,7 @@ struct nrf24l01_config_s * chipenable - Enable or disable the chip (CE line) */ - int (*irqattach)(xcpt_t isr); + int (*irqattach)(xcpt_t isr, FAR void *arg); void (*chipenable)(bool enable); }; From 7bd8da19b908769990eea5fb5bc7a939b2e0a206 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 12:11:35 -0600 Subject: [PATCH 20/38] Missed some changes in the last commit. --- drivers/wireless/nrf24l01.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c index d1b6767f675..d20860fc34a 100644 --- a/drivers/wireless/nrf24l01.c +++ b/drivers/wireless/nrf24l01.c @@ -510,11 +510,12 @@ static int nrf24l01_irqhandler(int irq, FAR void *context, FAR void *arg) return OK; } -/* Configure IRQ pin (falling edge) */ +/* Configure IRQ pin (falling edge) */ -static inline int nrf24l01_attachirq(FAR struct nrf24l01_dev_s *dev, xcpt_t isr) +static inline int nrf24l01_attachirq(FAR struct nrf24l01_dev_s *dev, xcpt_t isr, + FAR void *arg) { - return dev->config->irqattach(isr); + return dev->config->irqattach(isr, arg); } static inline bool nrf24l01_chipenable(FAR struct nrf24l01_dev_s *dev, bool enable) @@ -1175,7 +1176,7 @@ static int nrf24l01_unregister(FAR struct nrf24l01_dev_s *dev) /* Release IRQ */ - nrf24l01_attachirq(dev, NULL); + nrf24l01_attachirq(dev, NULL, NULL); /* Free memory */ From 69c26cca50277228a9c645c8f02e1096e7580d7d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 12:24:34 -0600 Subject: [PATCH 21/38] Correct mimatched function prototype. --- drivers/wireless/nrf24l01.c | 58 +++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c index d20860fc34a..61378b19287 100644 --- a/drivers/wireless/nrf24l01.c +++ b/drivers/wireless/nrf24l01.c @@ -163,42 +163,40 @@ static void nrf24l01_lock(FAR struct spi_dev_s *spi); static void nrf24l01_unlock(FAR struct spi_dev_s *spi); static uint8_t nrf24l01_access(FAR struct nrf24l01_dev_s *dev, - nrf24l01_access_mode_t mode, uint8_t cmd, uint8_t *buf, int length); + nrf24l01_access_mode_t mode, uint8_t cmd, uint8_t *buf, + int length); static uint8_t nrf24l01_flush_rx(FAR struct nrf24l01_dev_s *dev); static uint8_t nrf24l01_flush_tx(FAR struct nrf24l01_dev_s *dev); /* Read register from nrf24 */ static uint8_t nrf24l01_readreg(FAR struct nrf24l01_dev_s *dev, uint8_t reg, - uint8_t *value, int len); + FAR uint8_t *value, int len); /* Read single byte value from a register of nrf24 */ static uint8_t nrf24l01_readregbyte(FAR struct nrf24l01_dev_s *dev, - uint8_t reg); - -static void nrf24l01_writeregbyte(FAR struct nrf24l01_dev_s *dev, uint8_t reg, - uint8_t value); - -static uint8_t nrf24l01_setregbit(FAR struct nrf24l01_dev_s *dev, uint8_t reg, - uint8_t value, bool set); - -static void nrf24l01_tostate(FAR struct nrf24l01_dev_s *dev, nrf24l01_state_t state); - -static int nrf24l01_irqhandler(FAR int irq, FAR void *context, FAR void *arg); - -static inline int nrf24l01_attachirq(FAR struct nrf24l01_dev_s *dev, xcpt_t isr); - -static int dosend(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, size_t datalen); - + uint8_t reg); +static void nrf24l01_writeregbyte(FAR struct nrf24l01_dev_s *dev, + uint8_t reg, uint8_t value); +static uint8_t nrf24l01_setregbit(FAR struct nrf24l01_dev_s *dev, + uint8_t reg, uint8_t value, bool set); +static void nrf24l01_tostate(FAR struct nrf24l01_dev_s *dev, + nrf24l01_state_t state); +static int nrf24l01_irqhandler(FAR int irq, FAR void *context, + FAR void *arg); +static inline int nrf24l01_attachirq(FAR struct nrf24l01_dev_s *dev, + xcpt_t isr, FAR void *arg); +static int dosend(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, + size_t datalen); static int nrf24l01_unregister(FAR struct nrf24l01_dev_s *dev); #ifdef CONFIG_WL_NRF24L01_RXSUPPORT -void fifoput(struct nrf24l01_dev_s *dev, uint8_t pipeno, uint8_t *buffer, uint8_t buflen); - -uint8_t fifoget(struct nrf24l01_dev_s *dev, uint8_t *buffer, uint8_t buflen, uint8_t *pipeno); - +void fifoput(struct nrf24l01_dev_s *dev, uint8_t pipeno, + FAR uint8_t *buffer, uint8_t buflen); +uint8_t fifoget(struct nrf24l01_dev_s *dev, FAR uint8_t *buffer, + uint8_t buflen, FAR uint8_t *pipeno); static void nrf24l01_worker(FAR void *arg); #endif @@ -206,17 +204,15 @@ static void nrf24l01_worker(FAR void *arg); /* POSIX API */ static int nrf24l01_open(FAR struct file *filep); - static int nrf24l01_close(FAR struct file *filep); - -static ssize_t nrf24l01_read(FAR struct file *filep, FAR char *buffer, size_t buflen); - -static ssize_t nrf24l01_write(FAR struct file *filep, FAR const char *buffer, size_t buflen); - -static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg); - +static ssize_t nrf24l01_read(FAR struct file *filep, FAR char *buffer, + size_t buflen); +static ssize_t nrf24l01_write(FAR struct file *filep, + FAR const char *buffer, size_t buflen); +static int nrf24l01_ioctl(FAR struct file *filep, int cmd, + unsigned long arg); static int nrf24l01_poll(FAR struct file *filep, FAR struct pollfd *fds, - bool setup); + bool setup); /**************************************************************************** * Private Data From 67de2e5f66678e2564d902e28542957daa284fbe Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 14:21:30 -0600 Subject: [PATCH 22/38] Add argument to STM32 EXTI interrupt handlers. --- arch/arm/src/stm32/stm32_exti.h | 9 ++- arch/arm/src/stm32/stm32_exti_alarm.c | 15 ++-- arch/arm/src/stm32/stm32_exti_gpio.c | 75 +++++++++++++------ arch/arm/src/stm32/stm32_exti_pwr.c | 17 ++--- arch/arm/src/stm32/stm32_exti_pwr.h | 3 +- arch/arm/src/stm32f7/stm32_exti.h | 7 +- arch/arm/src/stm32f7/stm32_exti_alarm.c | 15 ++-- arch/arm/src/stm32f7/stm32_exti_gpio.c | 72 ++++++++++++------ arch/arm/src/stm32f7/stm32_exti_pwr.c | 12 +-- arch/arm/src/stm32f7/stm32_exti_pwr.h | 3 +- arch/arm/src/stm32l4/stm32l4_exti.h | 20 +++-- arch/arm/src/stm32l4/stm32l4_exti_alarm.c | 14 ++-- arch/arm/src/stm32l4/stm32l4_exti_comp.c | 32 +++++--- arch/arm/src/stm32l4/stm32l4_exti_gpio.c | 75 +++++++++++++------ arch/arm/src/stm32l4/stm32l4_exti_pwr.c | 14 ++-- configs/avr32dev1/src/avr32_buttons.c | 16 +--- configs/bambino-200e/src/lpc43_buttons.c | 2 +- configs/cloudctrl/src/stm32_buttons.c | 6 +- configs/dk-tm4c129x/src/tm4c_buttons.c | 2 +- configs/fire-stm32v2/src/stm32_buttons.c | 4 +- configs/fire-stm32v2/src/stm32_enc28j60.c | 3 +- configs/freedom-k64f/src/k64_buttons.c | 2 +- configs/freedom-k66f/src/k66_buttons.c | 2 +- configs/hymini-stm32v/src/stm32_appinit.c | 2 +- configs/hymini-stm32v/src/stm32_buttons.c | 6 +- configs/hymini-stm32v/src/stm32_ts.c | 2 +- configs/kwikstik-k40/src/k40_buttons.c | 2 +- .../launchxl-tms57004/src/tms570_buttons.c | 9 ++- configs/lincoln60/src/lpc17_buttons.c | 2 +- configs/lpc4330-xplorer/src/lpc43_buttons.c | 2 +- configs/lpc4357-evb/src/lpc43_buttons.c | 2 +- configs/mikroe-stm32f4/src/stm32_usb.c | 2 +- configs/mikroe-stm32f4/src/stm32_vs1053.c | 5 +- configs/nucleo-144/src/stm32_buttons.c | 5 +- configs/nucleo-144/src/stm32_sdio.c | 3 +- configs/nucleo-144/src/stm32_usb.c | 2 +- configs/nucleo-f303re/src/stm32_buttons.c | 4 +- configs/nucleo-f4x1re/src/stm32_ajoystick.c | 4 +- configs/nucleo-f4x1re/src/stm32_buttons.c | 5 +- configs/nucleo-f4x1re/src/stm32_io.c | 6 +- configs/nucleo-f4x1re/src/stm32_wireless.c | 6 +- configs/nucleo-l476rg/src/stm32_ajoystick.c | 4 +- configs/nucleo-l476rg/src/stm32_buttons.c | 5 +- configs/nucleo-l476rg/src/stm32_io.c | 6 +- configs/nucleo-l476rg/src/stm32_wireless.c | 6 +- .../src/efm32_buttons.c | 2 +- configs/olimex-lpc1766stk/src/lpc17_buttons.c | 2 +- configs/olimex-stm32-e407/src/stm32_buttons.c | 4 +- configs/olimex-stm32-e407/src/stm32_usb.c | 2 +- configs/olimex-stm32-h405/src/stm32_buttons.c | 5 +- configs/olimex-stm32-h407/src/stm32_buttons.c | 5 +- configs/olimex-stm32-h407/src/stm32_sdio.c | 3 +- configs/olimex-stm32-h407/src/stm32_usb.c | 2 +- .../olimex-stm32-p107/src/stm32_encx24j600.c | 6 +- configs/olimex-stm32-p207/src/stm32_buttons.c | 5 +- configs/olimex-stm32-p207/src/stm32_usb.c | 2 +- configs/olimex-stm32-p407/src/stm32_buttons.c | 5 +- configs/olimex-stm32-p407/src/stm32_usb.c | 2 +- configs/olimexino-stm32/src/stm32_buttons.c | 5 +- configs/olimexino-stm32/src/stm32_usbdev.c | 2 +- configs/open1788/src/lpc17_buttons.c | 2 +- configs/pcduino-a10/src/a1x_buttons.c | 2 +- .../pic32mz-starterkit/src/pic32mz_buttons.c | 2 +- configs/sam3u-ek/src/sam_buttons.c | 10 +-- configs/sam4e-ek/src/sam_buttons.c | 14 ++-- configs/sam4l-xplained/src/sam_buttons.c | 2 +- configs/sam4s-xplained-pro/src/sam_buttons.c | 2 +- configs/sam4s-xplained/src/sam_buttons.c | 2 +- configs/sama5d2-xult/src/sam_buttons.c | 2 +- configs/sama5d3-xplained/src/sam_buttons.c | 2 +- configs/sama5d3x-ek/src/sam_buttons.c | 2 +- configs/sama5d4-ek/src/sam_buttons.c | 2 +- configs/samd20-xplained/src/sam_buttons.c | 2 +- configs/samd21-xplained/src/sam_buttons.c | 2 +- configs/same70-xplained/src/sam_buttons.c | 8 +- configs/saml21-xplained/src/sam_buttons.c | 2 +- configs/samv71-xult/src/sam_buttons.c | 10 +-- configs/shenzhou/src/stm32_buttons.c | 5 +- configs/shenzhou/src/stm32_touchscreen.c | 5 +- configs/spark/src/stm32_buttons.c | 5 +- configs/spark/src/stm32_io.c | 6 +- configs/spark/src/stm32_wireless.c | 6 +- configs/stm3210e-eval/src/stm32_buttons.c | 5 +- configs/stm3210e-eval/src/stm32_djoystick.c | 4 +- configs/stm3210e-eval/src/stm32_idle.c | 4 +- configs/stm3210e-eval/src/stm32_lm75.c | 2 +- configs/stm3220g-eval/src/stm32_buttons.c | 6 +- configs/stm3220g-eval/src/stm32_stmpe811.c | 7 +- configs/stm3220g-eval/src/stm32_usb.c | 2 +- configs/stm3240g-eval/src/stm32_buttons.c | 6 +- configs/stm3240g-eval/src/stm32_stmpe811.c | 7 +- configs/stm3240g-eval/src/stm32_usb.c | 2 +- configs/stm32_tiny/src/stm32_wireless.c | 2 +- configs/stm32butterfly2/src/stm32_mmcsd.c | 2 +- configs/stm32f103-minimum/src/stm32_buttons.c | 4 +- .../stm32f103-minimum/src/stm32_wireless.c | 2 +- configs/stm32f3discovery/src/stm32_buttons.c | 5 +- configs/stm32f429i-disco/src/stm32_buttons.c | 6 +- configs/stm32f429i-disco/src/stm32_l3gd20.c | 4 +- configs/stm32f429i-disco/src/stm32_stmpe811.c | 6 +- configs/stm32f429i-disco/src/stm32_usb.c | 2 +- configs/stm32f4discovery/src/stm32_buttons.c | 6 +- configs/stm32f4discovery/src/stm32_ethernet.c | 6 +- configs/stm32f4discovery/src/stm32_sdio.c | 3 +- configs/stm32f4discovery/src/stm32_usb.c | 2 +- configs/stm32f4discovery/src/stm32_xen1210.c | 5 +- .../stm32f4discovery/src/stm32_zerocross.c | 2 +- configs/stm32f746-ws/src/stm32_sdmmc.c | 3 +- configs/stm32f746-ws/src/stm32_usb.c | 2 +- configs/stm32f746g-disco/src/stm32_buttons.c | 2 +- configs/stm32l476-mdk/src/stm32_buttons.c | 2 +- configs/stm32l476vg-disco/src/stm32_buttons.c | 2 +- configs/stm32ldiscovery/src/stm32_buttons.c | 5 +- configs/stm32vldiscovery/src/stm32_buttons.c | 6 +- configs/sure-pic32mx/src/pic32mx_buttons.c | 2 +- configs/tm4c123g-launchpad/src/tm4c_buttons.c | 2 +- configs/twr-k60n512/src/k60_buttons.c | 2 +- configs/ubw32/src/pic32_buttons.c | 2 +- .../viewtool-stm32f107/src/stm32_buttons.c | 5 +- .../src/stm32_touchscreen.c | 6 +- configs/zkit-arm-1769/src/lpc17_buttons.c | 2 +- drivers/input/button_lower.c | 6 +- include/nuttx/board.h | 4 +- 123 files changed, 497 insertions(+), 315 deletions(-) diff --git a/arch/arm/src/stm32/stm32_exti.h b/arch/arm/src/stm32/stm32_exti.h index 6a34582c676..3a395abe372 100644 --- a/arch/arm/src/stm32/stm32_exti.h +++ b/arch/arm/src/stm32/stm32_exti.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/stm32/stm32_exti.h * - * Copyright (C) 2009, 2012, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2012, 2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -77,6 +77,7 @@ extern "C" * - rising/falling edge: enables * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This value may, @@ -86,7 +87,7 @@ extern "C" ************************************************************************************/ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func); + bool event, xcpt_t func, void *arg); /************************************************************************************ * Name: stm32_exti_alarm @@ -98,6 +99,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, * - rising/falling edge: enables interrupt on rising/falling edges * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This value may, @@ -107,7 +109,8 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, ************************************************************************************/ #ifdef CONFIG_RTC_ALARM -xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t func); +xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t func, + void *arg); #endif #undef EXTERN diff --git a/arch/arm/src/stm32/stm32_exti_alarm.c b/arch/arm/src/stm32/stm32_exti_alarm.c index ba60faabe4a..67902e11c8e 100644 --- a/arch/arm/src/stm32/stm32_exti_alarm.c +++ b/arch/arm/src/stm32/stm32_exti_alarm.c @@ -59,7 +59,8 @@ /* Interrupt handlers attached to the ALARM EXTI */ -static xcpt_t stm32_exti_callback; +static xcpt_t g_alarm_callback; +static void *g_callback_arg; /**************************************************************************** * Private Functions @@ -83,9 +84,9 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callback) + if (g_alarm_callback) { - ret = stm32_exti_callback(irq, context); + ret = g_alarm_callback(irq, context, g_callback_arg); } return ret; @@ -105,6 +106,7 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg) * - rising/falling edge: enables interrupt on rising/falling edget * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -114,14 +116,15 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg) ****************************************************************************/ xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, - xcpt_t func) + xcpt_t func, void *arg) { xcpt_t oldhandler; /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = stm32_exti_callback; - stm32_exti_callback = func; + oldhandler = g_alarm_callback; + g_alarm_callback = func; + g_callback_arg = arg; /* Install external interrupt handlers (if not already attached) */ diff --git a/arch/arm/src/stm32/stm32_exti_gpio.c b/arch/arm/src/stm32/stm32_exti_gpio.c index dbf0691597f..86000eac762 100644 --- a/arch/arm/src/stm32/stm32_exti_gpio.c +++ b/arch/arm/src/stm32/stm32_exti_gpio.c @@ -55,13 +55,23 @@ #include "stm32_gpio.h" #include "stm32_exti.h" +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct gpio_callback_s +{ + xcptr_t callback; + void *arg; +}; + /**************************************************************************** * Private Data ****************************************************************************/ /* Interrupt handlers attached to each EXTI */ -static xcpt_t stm32_exti_callbacks[16]; +static struct gpio_callback_s g_gpio_callbacks[16]; /**************************************************************************** * Private Functions @@ -81,9 +91,12 @@ static int stm32_exti0_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[0]) + if (g_gpio_callbacks[0].callback != NULL) { - ret = stm32_exti_callbacks[0](irq, context, arg); + xcpt_t callback = g_gpio_callbacks[0].callback; + void *cbarg = g_gpio_callbacks[0].arg; + + ret = callback(irq, context, cbarg); } return ret; @@ -99,9 +112,12 @@ static int stm32_exti1_isr(int irq, void *context, void *arg) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[1]) + if (g_gpio_callbacks[1].callback != NULL) { - ret = stm32_exti_callbacks[1](irq, context, arg); + xcpt_t callback = g_gpio_callbacks[1].callback; + void *cbarg = g_gpio_callbacks[1].arg; + + ret = callback(irq, context, cbarg); } return ret; @@ -117,9 +133,12 @@ static int stm32_exti2_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[2]) + if (g_gpio_callbacks[2].callback != NULL) { - ret = stm32_exti_callbacks[2](irq, context, arg); + xcpt_t callback = g_gpio_callbacks[2].callback; + void *cbarg = g_gpio_callbacks[2].arg; + + ret = callback(irq, context, cbarg); } return ret; @@ -135,9 +154,12 @@ static int stm32_exti3_isr(int irq, void *context, void * arg) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[3]) + if (g_gpio_callbacks[3].callback != NULL) { - ret = stm32_exti_callbacks[3](irq, context, arg); + xcpt_t callback = g_gpio_callbacks[3].callback; + void *cbarg = g_gpio_callbacks[3].arg; + + ret = callback(irq, context, cbarg); } return ret; @@ -153,9 +175,12 @@ static int stm32_exti4_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[4]) + if (g_gpio_callbacks[4].callback != NULL) { - ret = stm32_exti_callbacks[4](irq, context, arg); + xcpt_t callback = g_gpio_callbacks[4].callback; + void *cbarg = g_gpio_callbacks[4].arg; + + ret = callback(irq, context, cbarg); } return ret; @@ -186,10 +211,14 @@ static int stm32_exti_multiisr(int irq, void *context, FAR void *arg, int first, /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[pin]) + if (g_gpio_callbacks[pin].callback != NULL) { - int tmp = stm32_exti_callbacks[pin](irq, context, arg); - if (tmp != OK) + xcpt_t callback = g_gpio_callbacks[pin].callback; + void *cbarg = g_gpio_callbacks[pin].arg; + int tmp; + + tmp = callback(irq, context, cbarg); + if (tmp < 0) { ret = tmp; } @@ -226,6 +255,7 @@ static int stm32_exti1510_isr(int irq, void *context, void *arg) * - fallingedge: Enables interrupt on falling edges * - event: Generate event when set * - func: When non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -235,15 +265,15 @@ static int stm32_exti1510_isr(int irq, void *context, void *arg) ****************************************************************************/ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func) + bool event, xcpt_t func, void *arg) { + FAR struct gpio_callback_s *shared_cbs; uint32_t pin = pinset & GPIO_PIN_MASK; uint32_t exti = STM32_EXTI_BIT(pin); int irq; xcpt_t handler; xcpt_t oldhandler = NULL; int nshared; - xcpt_t *shared_cbs; int i; /* Select the interrupt handler for this EXTI pin */ @@ -252,7 +282,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, { irq = pin + STM32_IRQ_EXTI0; nshared = 1; - shared_cbs = &stm32_exti_callbacks[pin]; + shared_cbs = &g_gpio_callbacks[pin]; switch (pin) { case 0: @@ -280,21 +310,22 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, { irq = STM32_IRQ_EXTI95; handler = stm32_exti95_isr; - shared_cbs = &stm32_exti_callbacks[5]; + shared_cbs = &g_gpio_callbacks[5]; nshared = 5; } else { irq = STM32_IRQ_EXTI1510; handler = stm32_exti1510_isr; - shared_cbs = &stm32_exti_callbacks[10]; + shared_cbs = &g_gpio_callbacks[10]; nshared = 6; } /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = stm32_exti_callbacks[pin]; - stm32_exti_callbacks[pin] = func; + oldhandler = g_gpio_callbacks[pin].callback; + g_gpio_callbacks[pin].callback = func; + g_gpio_callbacks[pin].arg = arg; /* Install external interrupt handlers */ @@ -311,7 +342,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, for (i = 0; i < nshared; i++) { - if (shared_cbs[i] != NULL) + if (shared_cbs[i].handler != NULL) { break; } diff --git a/arch/arm/src/stm32/stm32_exti_pwr.c b/arch/arm/src/stm32/stm32_exti_pwr.c index 8da33e2c43c..9e3429f98fc 100644 --- a/arch/arm/src/stm32/stm32_exti_pwr.c +++ b/arch/arm/src/stm32/stm32_exti_pwr.c @@ -65,11 +65,8 @@ /* Interrupt handlers attached to the PVD EXTI */ -static xcpt_t stm32_exti_pvd_callback; - -/**************************************************************************** - * Public Data - ****************************************************************************/ +static xcpt_t g_pvd_callback; +static void *g_callback_arg; /**************************************************************************** * Private Functions @@ -93,9 +90,9 @@ static int stm32_exti_pvd_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32_exti_pvd_callback) + if (g_pvd_callback != NULL) { - ret = stm32_exti_pvd_callback(irq, context, arg); + ret = g_pvd_callback(irq, context, g_callback_arg); } return ret; @@ -115,6 +112,7 @@ static int stm32_exti_pvd_isr(int irq, void *context, FAR void *arg) * - rising/falling edge: enables interrupt on rising/falling edge * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -130,8 +128,9 @@ xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = stm32_exti_pvd_callback; - stm32_exti_pvd_callback = func; + oldhandler = g_pvd_callback; + g_pvd_callback = func; + g_callback_arg = arg; /* Install external interrupt handlers (if not already attached) */ diff --git a/arch/arm/src/stm32/stm32_exti_pwr.h b/arch/arm/src/stm32/stm32_exti_pwr.h index 4955045a2f1..26be9bb0ef6 100644 --- a/arch/arm/src/stm32/stm32_exti_pwr.h +++ b/arch/arm/src/stm32/stm32_exti_pwr.h @@ -57,6 +57,7 @@ * - rising/falling edge: enables interrupt on rising/falling edge * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -66,6 +67,6 @@ ****************************************************************************/ xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, - xcpt_t func); + xcpt_t func, void *arg); #endif /* STM32_EXTI_PWR_H_ */ diff --git a/arch/arm/src/stm32f7/stm32_exti.h b/arch/arm/src/stm32f7/stm32_exti.h index 38ed8a1d6ed..1d32f0fd21b 100644 --- a/arch/arm/src/stm32f7/stm32_exti.h +++ b/arch/arm/src/stm32f7/stm32_exti.h @@ -78,6 +78,7 @@ extern "C" * - fallingedge: Enables interrupt on falling edges * - event: Generate event when set * - func: When non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -87,7 +88,7 @@ extern "C" ****************************************************************************/ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func); + bool event, xcpt_t func, void *arg); /**************************************************************************** * Name: stm32_exti_alarm @@ -100,6 +101,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, * - fallingedge: Enables interrupt on falling edges * - event: Generate event when set * - func: When non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -109,7 +111,8 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t func); +xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, + xcpt_t func, void *arg); #endif #undef EXTERN diff --git a/arch/arm/src/stm32f7/stm32_exti_alarm.c b/arch/arm/src/stm32f7/stm32_exti_alarm.c index 3ad112d7a44..363166cfec0 100644 --- a/arch/arm/src/stm32f7/stm32_exti_alarm.c +++ b/arch/arm/src/stm32f7/stm32_exti_alarm.c @@ -67,7 +67,8 @@ /* Interrupt handlers attached to the ALARM EXTI */ -static xcpt_t stm32_exti_callback; +static xcpt_t g_alarm_callback; +static void *g_callback_arg; /**************************************************************************** * Public Data @@ -95,9 +96,9 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callback) + if (g_alarm_callback != NULL) { - ret = stm32_exti_callback(irq, context); + ret = g_alarm_callback(irq, context, g_callback_arg); } return ret; @@ -117,6 +118,7 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg) * - rising/falling edge: enables interrupt on rising/falling edget * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -126,14 +128,15 @@ static int stm32_exti_alarm_isr(int irq, void *context, FAR void *arg) ****************************************************************************/ xcpt_t stm32_exti_alarm(bool risingedge, bool fallingedge, bool event, - xcpt_t func) + xcpt_t func, void *arg) { xcpt_t oldhandler; /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = stm32_exti_callback; - stm32_exti_callback = func; + oldhandler = g_alarm_callback; + g_alarm_callback = func; + g_callback_arg = arg; /* Install external interrupt handlers (if not already attached) */ diff --git a/arch/arm/src/stm32f7/stm32_exti_gpio.c b/arch/arm/src/stm32f7/stm32_exti_gpio.c index 283ec89286d..6bee1834a46 100644 --- a/arch/arm/src/stm32f7/stm32_exti_gpio.c +++ b/arch/arm/src/stm32f7/stm32_exti_gpio.c @@ -68,13 +68,23 @@ #if defined(CONFIG_STM32F7_STM32F74XX) || defined(CONFIG_STM32F7_STM32F75XX) \ || defined(CONFIG_STM32F7_STM32F76XX) || defined(CONFIG_STM32F7_STM32F77XX) +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct gpio_callback_s +{ + xcptr_t callback; + void *arg; +}; + /**************************************************************************** * Private Data ****************************************************************************/ /* Interrupt handlers attached to each EXTI */ -static xcpt_t stm32_exti_callbacks[16]; +static struct gpio_callback_s g_gpio_callbacks[16]; /**************************************************************************** * Private Functions @@ -94,9 +104,12 @@ static int stm32_exti0_isr(int irq, void *context) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[0]) + if (g_gpio_callbacks[0].callback != NULL) { - ret = stm32_exti_callbacks[0](irq, context); + xcptr_t callback = g_gpio_callbacks[0].callback; + void *arg = g_gpio_callbacks[0].arg; + + ret = callback(irq, context, arg); } return ret; @@ -112,9 +125,12 @@ static int stm32_exti1_isr(int irq, void *context) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[1]) + if (g_gpio_callbacks[1].callback != NULL) { - ret = stm32_exti_callbacks[1](irq, context); + xcptr_t callback = g_gpio_callbacks[1].callback; + void *arg = g_gpio_callbacks[1].arg; + + ret = callback(irq, context, arg); } return ret; @@ -130,9 +146,12 @@ static int stm32_exti2_isr(int irq, void *context) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[2]) + if (g_gpio_callbacks[2].callback != NULL) { - ret = stm32_exti_callbacks[2](irq, context); + xcptr_t callback = g_gpio_callbacks[2].callback; + void *arg = g_gpio_callbacks[2].arg; + + ret = callback(irq, context, arg); } return ret; @@ -148,9 +167,12 @@ static int stm32_exti3_isr(int irq, void *context) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[3]) + if (g_gpio_callbacks[3].callback != NULL) { - ret = stm32_exti_callbacks[3](irq, context); + xcptr_t callback = g_gpio_callbacks[3].callback; + void *arg = g_gpio_callbacks[3].arg; + + ret = callback(irq, context, arg); } return ret; @@ -166,9 +188,12 @@ static int stm32_exti4_isr(int irq, void *context) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[4]) + if (g_gpio_callbacks[4].callback != NULL) { - ret = stm32_exti_callbacks[4](irq, context); + xcptr_t callback = g_gpio_callbacks[4].callback; + void *arg = g_gpio_callbacks[4].arg; + + ret = callback(irq, context, arg); } return ret; @@ -199,10 +224,14 @@ static int stm32_exti_multiisr(int irq, void *context, int first, int last) /* And dispatch the interrupt to the handler */ - if (stm32_exti_callbacks[pin]) + if (g_gpio_callbacks[pin].callback != NULL) { - int tmp = stm32_exti_callbacks[pin](irq, context); - if (tmp != OK) + xcptr_t callback = g_gpio_callbacks[pin].callback; + void *arg = g_gpio_callbacks[pin].arg; + int tmp; + + tmp = callback(irq, context, arg); + if (tmp < 0) { ret = tmp; } @@ -250,13 +279,13 @@ static int stm32_exti1510_isr(int irq, void *context) xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, bool event, xcpt_t func) { + struct gpio_callback_s *shared_cbs; uint32_t pin = pinset & GPIO_PIN_MASK; uint32_t exti = STM32_EXTI_BIT(pin); int irq; xcpt_t handler; xcpt_t oldhandler = NULL; int nshared; - xcpt_t *shared_cbs; int i; /* Select the interrupt handler for this EXTI pin */ @@ -265,7 +294,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, { irq = pin + STM32_IRQ_EXTI0; nshared = 1; - shared_cbs = &stm32_exti_callbacks[pin]; + shared_cbs = &g_gpio_callbacks[pin]; switch (pin) { case 0: @@ -293,21 +322,22 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, { irq = STM32_IRQ_EXTI95; handler = stm32_exti95_isr; - shared_cbs = &stm32_exti_callbacks[5]; + shared_cbs = &g_gpio_callbacks[5]; nshared = 5; } else { irq = STM32_IRQ_EXTI1510; handler = stm32_exti1510_isr; - shared_cbs = &stm32_exti_callbacks[10]; + shared_cbs = &g_gpio_callbacks[10]; nshared = 6; } /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = stm32_exti_callbacks[pin]; - stm32_exti_callbacks[pin] = func; + oldhandler = g_gpio_callbacks[pin].callback; + g_gpio_callbacks[pin].callback = func; + g_gpio_callbacks[pin].arg = arg; /* Install external interrupt handlers */ @@ -324,7 +354,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, for (i = 0; i < nshared; i++) { - if (shared_cbs[i] != NULL) + if (shared_cbs[i].handler != NULL) { break; } diff --git a/arch/arm/src/stm32f7/stm32_exti_pwr.c b/arch/arm/src/stm32f7/stm32_exti_pwr.c index 5b6419fba0f..0dafb120ba2 100644 --- a/arch/arm/src/stm32f7/stm32_exti_pwr.c +++ b/arch/arm/src/stm32f7/stm32_exti_pwr.c @@ -70,7 +70,8 @@ /* Interrupt handlers attached to the PVD EXTI */ -static xcpt_t stm32_exti_pvd_callback; +static xcpt_t g_pvd_callback; +static void *g_callback_arg; /**************************************************************************** * Public Data @@ -98,9 +99,9 @@ static int stm32_exti_pvd_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32_exti_pvd_callback) + if (g_pvd_callback) { - ret = stm32_exti_pvd_callback(irq, context); + ret = g_pvd_callback(irq, context, g_callback_arg); } return ret; @@ -135,8 +136,9 @@ xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = stm32_exti_pvd_callback; - stm32_exti_pvd_callback = func; + oldhandler = g_pvd_callback; + g_pvd_callback = func; + g_callback_arg = arg; /* Install external interrupt handlers (if not already attached) */ diff --git a/arch/arm/src/stm32f7/stm32_exti_pwr.h b/arch/arm/src/stm32f7/stm32_exti_pwr.h index b72acd5cc9f..521e7a7b2a7 100644 --- a/arch/arm/src/stm32f7/stm32_exti_pwr.h +++ b/arch/arm/src/stm32f7/stm32_exti_pwr.h @@ -58,6 +58,7 @@ * - rising/falling edge: enables interrupt on rising/falling edge * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -67,6 +68,6 @@ ****************************************************************************/ xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, - xcpt_t func); + xcpt_t func, void *arg); #endif /* __ARCH_ARM_SRC_STM32F7_STM32_EXTI_PWR_H */ diff --git a/arch/arm/src/stm32l4/stm32l4_exti.h b/arch/arm/src/stm32l4/stm32l4_exti.h index 36c7fffdd96..0e0a63cf6f0 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti.h +++ b/arch/arm/src/stm32l4/stm32l4_exti.h @@ -77,6 +77,7 @@ extern "C" * - rising/falling edge: enables * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This value may, @@ -86,9 +87,9 @@ extern "C" ************************************************************************************/ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func); + bool event, xcpt_t func, void *arg); -/************************************************************************************ +/**************************************************************************** * Name: stm32l4_exti_alarm * * Description: @@ -98,16 +99,18 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, * - rising/falling edge: enables interrupt on rising/falling edges * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: - * The previous value of the interrupt handler function pointer. This value may, - * for example, be used to restore the previous handler when multiple handlers are - * used. + * The previous value of the interrupt handler function pointer. This + * value may, for example, be used to restore the previous handler when + * multiple handlers are used. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t func); +xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event, + xcpt_t func, void *arg); #endif /**************************************************************************** @@ -121,6 +124,7 @@ xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t * - rising/falling edge: enables interrupt on rising/falling edget * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -131,7 +135,7 @@ xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event, xcpt_t #ifdef CONFIG_STM32L4_COMP xcpt_t stm32l4_exti_comp(int cmp, bool risingedge, bool fallingedge, - bool event, xcpt_t func); + bool event, xcpt_t func, void *arg); #endif #undef EXTERN diff --git a/arch/arm/src/stm32l4/stm32l4_exti_alarm.c b/arch/arm/src/stm32l4/stm32l4_exti_alarm.c index 5aec102d178..2cfcbe052e0 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_alarm.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_alarm.c @@ -60,7 +60,8 @@ /* Interrupt handlers attached to the ALARM EXTI */ -static xcpt_t stm32l4_exti_callback; +static xcpt_t g_alarm_callback; +static void *g_callback_arg; /**************************************************************************** * Private Functions @@ -80,9 +81,9 @@ static int stm32l4_exti_alarm_isr(int irq, void *context, FAR void *arg) /* Dispatch the interrupt to the handler */ - if (stm32l4_exti_callback) + if (g_alarm_callback != NULL) { - ret = stm32l4_exti_callback(irq, context, arg); + ret = g_alarm_callback(irq, context, g_callback_arg); } /* Clear the pending EXTI interrupt */ @@ -115,14 +116,15 @@ static int stm32l4_exti_alarm_isr(int irq, void *context, FAR void *arg) ****************************************************************************/ xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event, - xcpt_t func) + xcpt_t func, void *arg) { xcpt_t oldhandler; /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = stm32l4_exti_callback; - stm32l4_exti_callback = func; + oldhandler = g_alarm_callback; + g_alarm_callback = func; + g__callback_arg = arg; /* Install external interrupt handlers (if not already attached) */ diff --git a/arch/arm/src/stm32l4/stm32l4_exti_comp.c b/arch/arm/src/stm32l4/stm32l4_exti_comp.c index 4eaa412603d..bb25e5b0962 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_comp.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_comp.c @@ -47,17 +47,27 @@ #include "stm32l4_exti.h" #include "chip/stm32l4_exti.h" +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct comp_callback_s +{ + xcptr_t callback; + void *arg; +}; + /**************************************************************************** * Private Data ****************************************************************************/ /* Interrupt handlers attached to the COMP EXTI lines */ -static xcpt_t stm32l4_exti_comp_handlers[STM32L4_COMP_NUM]; +static struct comp_callback_s g_comp_handlers[STM32L4_COMP_NUM]; /* Comparator EXTI lines */ -static const uint32_t stm32l4_exti_comp_lines[STM32L4_COMP_NUM] = +static const uint32_t g_comp_lines[STM32L4_COMP_NUM] = { #if defined(CONFIG_STM32L4_STM32L4X3) || defined (CONFIG_STM32L4_STM32L4X6) EXTI1_COMP1, @@ -83,15 +93,17 @@ static int stm32l4_exti_comp_isr(int irq, void *context) pr = getreg32(STM32L4_EXTI1_PR); for (i = 0; i < STM32L4_COMP_NUM; i++) { - ln = stm32l4_exti_comp_lines[i]; + ln = g_comp_lines[i]; if ((pr & ln) != 0) { /* Clear the pending interrupt */ putreg32(ln, STM32L4_EXTI1_PR); - if (stm32l4_exti_comp_handlers[i]) + if (g_comp_handlers[i].callback != NULL) { - ret = stm32l4_exti_comp_handlers[i](irq, context); + xcpt_t callback = g_comp_handlers[i].callback; + vid *arg = g_comp_handlers[i].arg; + ret = callback(irq, context, arg); } } } @@ -114,6 +126,7 @@ static int stm32l4_exti_comp_isr(int irq, void *context) * - rising/falling edge: enables interrupt on rising/falling edget * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -123,11 +136,11 @@ static int stm32l4_exti_comp_isr(int irq, void *context) ****************************************************************************/ xcpt_t stm32l4_exti_comp(int cmp, bool risingedge, bool fallingedge, - bool event, xcpt_t func) + bool event, xcpt_t func, void *arg) { xcpt_t oldhandler; irqstate_t flags; - uint32_t ln = stm32l4_exti_comp_lines[cmp]; + uint32_t ln = g_comp_lines[cmp]; /* Perform the following within a critical section so that the handler gets * installed correctly before the next interrupt is received. @@ -159,8 +172,9 @@ xcpt_t stm32l4_exti_comp(int cmp, bool risingedge, bool fallingedge, /* Get the previous IRQ handler and save the new IRQ handler. */ - oldhandler = stm32l4_exti_comp_handlers[cmp]; - stm32l4_exti_comp_handlers[cmp] = func; + oldhandler = g_comp_handlers[cmp].callback; + g_comp_handlers[cmp].callback = func; + g_comp_handlers[cmp].arg = arg; /* Leave the critical section */ diff --git a/arch/arm/src/stm32l4/stm32l4_exti_gpio.c b/arch/arm/src/stm32l4/stm32l4_exti_gpio.c index 985d6588c4b..298237fbfd5 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_gpio.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_gpio.c @@ -55,13 +55,23 @@ #include "stm32l4_gpio.h" #include "stm32l4_exti.h" +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct gpio_callback_s +{ + xcptr_t callback; + void *arg; +}; + /**************************************************************************** * Private Data ****************************************************************************/ /* Interrupt handlers attached to each EXTI */ -static xcpt_t stm32l4_exti_callbacks[16]; +static struct gpio_callback_s g_gpio_handlers[16]; /**************************************************************************** * Private Functions @@ -81,9 +91,12 @@ static int stm32l4_exti0_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32l4_exti_callbacks[0]) + if (g_gpio_handlers[0].callback != NULL) { - ret = stm32l4_exti_callbacks[0](irq, context, arg); + xcpt_t callback = g_gpio_handlers[0].callback; + void *cbarg = g_gpio_handlers[0].arg; + + ret = callback(irq, context, cbarg); } return ret; @@ -99,9 +112,12 @@ static int stm32l4_exti1_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32l4_exti_callbacks[1]) + if (g_gpio_handlers[1].callback != NULL) { - ret = stm32l4_exti_callbacks[1](irq, context, arg); + xcpt_t callback = g_gpio_handlers[1].callback; + void *cbarg = g_gpio_handlers[1].arg; + + ret = callback(irq, context, cbarg); } return ret; @@ -117,9 +133,12 @@ static int stm32l4_exti2_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32l4_exti_callbacks[2]) + if (g_gpio_handlers[2].callback != NULL) { - ret = stm32l4_exti_callbacks[2](irq, context, arg); + xcpt_t callback = g_gpio_handlers[2].callback; + void *cbarg = g_gpio_handlers[2].arg; + + ret = callback(irq, context, cbarg); } return ret; @@ -135,9 +154,12 @@ static int stm32l4_exti3_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32l4_exti_callbacks[3]) + if (g_gpio_handlers[3].callback != NULL) { - ret = stm32l4_exti_callbacks[3](irq, context, arg); + xcpt_t callback = g_gpio_handlers[3].callback; + void *cbarg = g_gpio_handlers[3].arg; + + ret = callback(irq, context, cbarg); } return ret; @@ -153,9 +175,12 @@ static int stm32l4_exti4_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32l4_exti_callbacks[4]) + if (g_gpio_handlers[4].callback != NULL) { - ret = stm32l4_exti_callbacks[4](irq, context, arg); + xcpt_t callback = g_gpio_handlers[4].callback; + void *cbarg = g_gpio_handlers[4].arg; + + ret = callback(irq, context, cbarg); } return ret; @@ -186,10 +211,14 @@ static int stm32l4_exti_multiisr(int irq, void *context, void *arg, int first, i /* And dispatch the interrupt to the handler */ - if (stm32l4_exti_callbacks[pin]) + if (g_gpio_handlers[pin].callback != NULL) { - int tmp = stm32l4_exti_callbacks[pin](irq, context, arg); - if (tmp != OK) + xcpt_t callback = g_gpio_handlers[pin].callback; + void *cbarg = g_gpio_handlers[pin].arg; + int tmp; + + tmp = callback(irq, context, cbarg); + if (tmp < 0) { ret = tmp; } @@ -226,6 +255,7 @@ static int stm32l4_exti1510_isr(int irq, void *context, FAR void *arg) * - fallingedge: Enables interrupt on falling edges * - event: Generate event when set * - func: When non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -235,15 +265,15 @@ static int stm32l4_exti1510_isr(int irq, void *context, FAR void *arg) ****************************************************************************/ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func) + bool event, xcpt_t func, void *arg) { + struct gpio_callback_s *shared_cbs; uint32_t pin = pinset & GPIO_PIN_MASK; uint32_t exti = STM32L4_EXTI1_BIT(pin); int irq; xcpt_t handler; xcpt_t oldhandler = NULL; int nshared; - xcpt_t *shared_cbs; int i; /* Select the interrupt handler for this EXTI pin */ @@ -252,7 +282,7 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, { irq = pin + STM32L4_IRQ_EXTI0; nshared = 1; - shared_cbs = &stm32l4_exti_callbacks[pin]; + shared_cbs = &g_gpio_handlers[pin]; switch (pin) { case 0: @@ -280,21 +310,22 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, { irq = STM32L4_IRQ_EXTI95; handler = stm32l4_exti95_isr; - shared_cbs = &stm32l4_exti_callbacks[5]; + shared_cbs = &g_gpio_handlers[5]; nshared = 5; } else { irq = STM32L4_IRQ_EXTI1510; handler = stm32l4_exti1510_isr; - shared_cbs = &stm32l4_exti_callbacks[10]; + shared_cbs = &g_gpio_handlers[10]; nshared = 6; } /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = stm32l4_exti_callbacks[pin]; - stm32l4_exti_callbacks[pin] = func; + oldhandler = g_gpio_handlers[pin].callback; + g_gpio_handlers[pin].callback = func; + g_gpio_handlers[pin].arg = arg; /* Install external interrupt handlers */ @@ -311,7 +342,7 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, for (i = 0; i < nshared; i++) { - if (shared_cbs[i] != NULL) + if (shared_cbs[i].callback != NULL) { break; } diff --git a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c index 535183316e3..4f8541817d1 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c @@ -65,7 +65,8 @@ /* Interrupt handlers attached to the PVD EXTI */ -static xcpt_t stm32l4_exti_pvd_callback; +static xcpt_t g_pvd_callback; +static void *g_callback_arg /**************************************************************************** * Public Data @@ -93,9 +94,9 @@ static int stm32l4_exti_pvd_isr(int irq, void *context, FAR void *arg) /* And dispatch the interrupt to the handler */ - if (stm32l4_exti_pvd_callback) + if (g_pvd_callback != NULL) { - ret = stm32l4_exti_pvd_callback(irq, context, arg); + ret = g_pvd_callback(irq, context, g_callback_arg); } return ret; @@ -124,14 +125,15 @@ static int stm32l4_exti_pvd_isr(int irq, void *context, FAR void *arg) ****************************************************************************/ xcpt_t stm32l4_exti_pvd(bool risingedge, bool fallingedge, bool event, - xcpt_t func) + xcpt_t func, void *arg) { xcpt_t oldhandler; /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = stm32l4_exti_pvd_callback; - stm32l4_exti_pvd_callback = func; + oldhandler = g_pvd_callback; + g_pvd_callback = func; + g_callback_arg = arg; /* Install external interrupt handlers (if not already attached) */ diff --git a/configs/avr32dev1/src/avr32_buttons.c b/configs/avr32dev1/src/avr32_buttons.c index 49a227d8a10..228a43098a9 100644 --- a/configs/avr32dev1/src/avr32_buttons.c +++ b/configs/avr32dev1/src/avr32_buttons.c @@ -55,14 +55,6 @@ #ifdef CONFIG_ARCH_BUTTONS -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -77,7 +69,7 @@ #if defined(CONFIG_AVR32_GPIOIRQ) && defined(CONFIG_ARCH_IRQBUTTONS) && \ (defined(CONFIG_AVR32DEV_BUTTON1_IRQ) || defined(CONFIG_AVR32DEV_BUTTON2_IRQ)) -static xcpt_t board_button_irqx(int irq, xcpt_t irqhandler) +static xcpt_t board_button_irqx(int irq, xcpt_t irqhandler, void *arg) { xcpt_t oldhandler; @@ -164,19 +156,19 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_AVR32_GPIOIRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { #ifdef CONFIG_AVR32DEV_BUTTON1_IRQ if (id == BUTTON1) { - return board_button_irqx(GPIO_BUTTON1_IRQ, irqhandler); + return board_button_irqx(GPIO_BUTTON1_IRQ, irqhandler, arg); } else #endif #ifdef CONFIG_AVR32DEV_BUTTON2_IRQ if (id == BUTTON2) { - return board_button_irqx(GPIO_BUTTON2_IRQ, irqhandler); + return board_button_irqx(GPIO_BUTTON2_IRQ, irqhandler, arg); } else #endif diff --git a/configs/bambino-200e/src/lpc43_buttons.c b/configs/bambino-200e/src/lpc43_buttons.c index b84a0744399..dbaf33d1b53 100644 --- a/configs/bambino-200e/src/lpc43_buttons.c +++ b/configs/bambino-200e/src/lpc43_buttons.c @@ -172,7 +172,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC43_GPIO_IRQ) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; irqstate_t flags; diff --git a/configs/cloudctrl/src/stm32_buttons.c b/configs/cloudctrl/src/stm32_buttons.c index 43a090b05b2..5766e8ca331 100644 --- a/configs/cloudctrl/src/stm32_buttons.c +++ b/configs/cloudctrl/src/stm32_buttons.c @@ -159,7 +159,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -167,8 +167,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } + return oldhandler; } #endif diff --git a/configs/dk-tm4c129x/src/tm4c_buttons.c b/configs/dk-tm4c129x/src/tm4c_buttons.c index 3e08a92512e..69b1766a116 100644 --- a/configs/dk-tm4c129x/src/tm4c_buttons.c +++ b/configs/dk-tm4c129x/src/tm4c_buttons.c @@ -150,7 +150,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_TIVA_GPIOP_IRQS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { static xcpt_t handler = NULL; xcpt_t oldhandler = handler; diff --git a/configs/fire-stm32v2/src/stm32_buttons.c b/configs/fire-stm32v2/src/stm32_buttons.c index fe1d35f5165..aac98c1973a 100644 --- a/configs/fire-stm32v2/src/stm32_buttons.c +++ b/configs/fire-stm32v2/src/stm32_buttons.c @@ -134,7 +134,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { uint16_t gpio; @@ -151,7 +151,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) return NULL; } - return stm32_gpiosetevent(gpio, true, true, true, irqhandler); + return stm32_gpiosetevent(gpio, true, true, true, irqhandler, arg); } #endif #endif /* CONFIG_ARCH_BUTTONS */ diff --git a/configs/fire-stm32v2/src/stm32_enc28j60.c b/configs/fire-stm32v2/src/stm32_enc28j60.c index cd5ee2c6b31..7ce3f4de651 100644 --- a/configs/fire-stm32v2/src/stm32_enc28j60.c +++ b/configs/fire-stm32v2/src/stm32_enc28j60.c @@ -159,7 +159,8 @@ static void up_enable(FAR const struct enc_lower_s *lower) FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower; DEBUGASSERT(priv->handler); - (void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, false, true, true, priv->handler); + (void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, false, true, true, + priv->handler, NULL); } static void up_disable(FAR const struct enc_lower_s *lower) diff --git a/configs/freedom-k64f/src/k64_buttons.c b/configs/freedom-k64f/src/k64_buttons.c index f1f4ba88477..659b55497b5 100644 --- a/configs/freedom-k64f/src/k64_buttons.c +++ b/configs/freedom-k64f/src/k64_buttons.c @@ -133,7 +133,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler; uint32_t pinset; diff --git a/configs/freedom-k66f/src/k66_buttons.c b/configs/freedom-k66f/src/k66_buttons.c index c772177d1d8..caa7da5bad7 100644 --- a/configs/freedom-k66f/src/k66_buttons.c +++ b/configs/freedom-k66f/src/k66_buttons.c @@ -137,7 +137,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler; uint32_t pinset; diff --git a/configs/hymini-stm32v/src/stm32_appinit.c b/configs/hymini-stm32v/src/stm32_appinit.c index 843660880a4..2697adcb213 100644 --- a/configs/hymini-stm32v/src/stm32_appinit.c +++ b/configs/hymini-stm32v/src/stm32_appinit.c @@ -182,7 +182,7 @@ int board_app_initialize(uintptr_t arg) /* Register an interrupt handler for the card detect pin */ - stm32_gpiosetevent(GPIO_SD_CD, true, true, true, nsh_cdinterrupt); + stm32_gpiosetevent(GPIO_SD_CD, true, true, true, nsh_cdinterrupt, NULL); /* Mount the SDIO-based MMC/SD block driver */ diff --git a/configs/hymini-stm32v/src/stm32_buttons.c b/configs/hymini-stm32v/src/stm32_buttons.c index a31b38f923a..578b2fa5b43 100644 --- a/configs/hymini-stm32v/src/stm32_buttons.c +++ b/configs/hymini-stm32v/src/stm32_buttons.c @@ -128,7 +128,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; uint32_t pinset = GPIO_BTN_KEYA; @@ -139,8 +139,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) } if (id < 2) { - oldhandler = stm32_gpiosetevent(pinset, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(pinset, true, true, true, + irqhandler, arg); } + return oldhandler; } #endif diff --git a/configs/hymini-stm32v/src/stm32_ts.c b/configs/hymini-stm32v/src/stm32_ts.c index 16f91c3fd0e..a4abc234db7 100644 --- a/configs/hymini-stm32v/src/stm32_ts.c +++ b/configs/hymini-stm32v/src/stm32_ts.c @@ -98,7 +98,7 @@ static int hymini_ts_irq_attach(FAR struct ads7843e_config_s *state, xcpt_t isr) iinfo("hymini_ts_irq_attach\n"); tc_isr = isr; - stm32_gpiosetevent(GPIO_TS_IRQ, true, true, true, isr); + stm32_gpiosetevent(GPIO_TS_IRQ, true, true, true, isr, NULL); return OK; } diff --git a/configs/kwikstik-k40/src/k40_buttons.c b/configs/kwikstik-k40/src/k40_buttons.c index f3bf65d3d14..3fff4a2333f 100644 --- a/configs/kwikstik-k40/src/k40_buttons.c +++ b/configs/kwikstik-k40/src/k40_buttons.c @@ -117,7 +117,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { /* The KwikStik-K40 board has no standard GPIO contact buttons */ diff --git a/configs/launchxl-tms57004/src/tms570_buttons.c b/configs/launchxl-tms57004/src/tms570_buttons.c index d59368aacbb..68c8231926c 100644 --- a/configs/launchxl-tms57004/src/tms570_buttons.c +++ b/configs/launchxl-tms57004/src/tms570_buttons.c @@ -85,7 +85,7 @@ static xcpt_t g_irq_button; #ifdef HAVE_IRQBUTTONS static xcpt_t board_button_irqx(gio_pinset_t pinset, int irq, - xcpt_t irqhandler, xcpt_t *store) + xcpt_t irqhandler, xcpt_t *store, void *arg) { xcpt_t oldhandler; irqstate_t flags; @@ -108,7 +108,7 @@ static xcpt_t board_button_irqx(gio_pinset_t pinset, int irq, /* Configure the interrupt */ tms570_gioirq(pinset); - (void)irq_attach(irq, irqhandler, NULL); + (void)irq_attach(irq, irqhandler, arg); tms570_gioirqenable(irq); } else @@ -183,12 +183,13 @@ uint8_t board_buttons(void) * ****************************************************************************/ -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { #ifdef HAVE_IRQBUTTONS if (id == BUTTON_GIOA7) { - return board_button_irqx(GIO_BUTTON, IRQ_BUTTON, irqhandler, &g_irq_button); + return board_button_irqx(GIO_BUTTON, IRQ_BUTTON, irqhandler,i + &g_irq_button, arg); } #endif diff --git a/configs/lincoln60/src/lpc17_buttons.c b/configs/lincoln60/src/lpc17_buttons.c index 8b24ff5f3ad..5764415e4e1 100644 --- a/configs/lincoln60/src/lpc17_buttons.c +++ b/configs/lincoln60/src/lpc17_buttons.c @@ -179,7 +179,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC17_GPIOIRQ) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; irqstate_t flags; diff --git a/configs/lpc4330-xplorer/src/lpc43_buttons.c b/configs/lpc4330-xplorer/src/lpc43_buttons.c index c74d6dae60e..33431b6f0ab 100644 --- a/configs/lpc4330-xplorer/src/lpc43_buttons.c +++ b/configs/lpc4330-xplorer/src/lpc43_buttons.c @@ -178,7 +178,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC43_GPIO_IRQ) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; irqstate_t flags; diff --git a/configs/lpc4357-evb/src/lpc43_buttons.c b/configs/lpc4357-evb/src/lpc43_buttons.c index 410b942c76b..feeab979a06 100644 --- a/configs/lpc4357-evb/src/lpc43_buttons.c +++ b/configs/lpc4357-evb/src/lpc43_buttons.c @@ -184,7 +184,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC43_GPIO_IRQ) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { #if 0 /* Not yet implemented */ xcpt_t oldhandler = NULL; diff --git a/configs/mikroe-stm32f4/src/stm32_usb.c b/configs/mikroe-stm32f4/src/stm32_usb.c index 001d6e0930a..44321bd7d36 100644 --- a/configs/mikroe-stm32f4/src/stm32_usb.c +++ b/configs/mikroe-stm32f4/src/stm32_usb.c @@ -282,7 +282,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) #ifdef CONFIG_USBHOST xcpt_t stm32_setup_overcurrent(xcpt_t handler) { - return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler); + return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); } #endif diff --git a/configs/mikroe-stm32f4/src/stm32_vs1053.c b/configs/mikroe-stm32f4/src/stm32_vs1053.c index 15f35bc839c..182c559fa63 100644 --- a/configs/mikroe-stm32f4/src/stm32_vs1053.c +++ b/configs/mikroe-stm32f4/src/stm32_vs1053.c @@ -138,12 +138,13 @@ static void up_enable(FAR const struct vs1053_lower_s *lower) FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower; DEBUGASSERT(priv->handler); - (void)stm32_gpiosetevent(GPIO_VS1053_DREQ, true, false, false, priv->handler); + (void)stm32_gpiosetevent(GPIO_VS1053_DREQ, true, false, false, + priv->handler, priv->arg); } static void up_disable(FAR const struct vs1053_lower_s *lower) { - (void)stm32_gpiosetevent(GPIO_VS1053_DREQ, false, false, false, NULL); + (void)stm32_gpiosetevent(GPIO_VS1053_DREQ, false, false, false, NULL, NULL); } static void up_reset(FAR const struct vs1053_lower_s *lower, bool state) diff --git a/configs/nucleo-144/src/stm32_buttons.c b/configs/nucleo-144/src/stm32_buttons.c index ff0e64d7642..7745758cb9d 100644 --- a/configs/nucleo-144/src/stm32_buttons.c +++ b/configs/nucleo-144/src/stm32_buttons.c @@ -105,13 +105,14 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; if (id == BUTTON_USER) { - oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/nucleo-144/src/stm32_sdio.c b/configs/nucleo-144/src/stm32_sdio.c index 7904f8c2eba..0a79f9258dc 100644 --- a/configs/nucleo-144/src/stm32_sdio.c +++ b/configs/nucleo-144/src/stm32_sdio.c @@ -132,7 +132,8 @@ int stm32_sdio_initialize(void) /* Register an interrupt handler for the card detect pin */ - stm32_gpiosetevent(GPIO_SDMMC1_NCD, true, true, true, stm32_ncd_interrupt); + stm32_gpiosetevent(GPIO_SDMMC1_NCD, true, true, true, + stm32_ncd_interrupt, NULL); #endif /* Mount the SDIO-based MMC/SD block driver */ diff --git a/configs/nucleo-144/src/stm32_usb.c b/configs/nucleo-144/src/stm32_usb.c index 1cb422a78c4..a1a2059176d 100644 --- a/configs/nucleo-144/src/stm32_usb.c +++ b/configs/nucleo-144/src/stm32_usb.c @@ -304,7 +304,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) #ifdef CONFIG_USBHOST xcpt_t stm32_setup_overcurrent(xcpt_t handler) { - return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler); + return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); } #endif diff --git a/configs/nucleo-f303re/src/stm32_buttons.c b/configs/nucleo-f303re/src/stm32_buttons.c index 82e9c9eff25..f5dcc7224f2 100644 --- a/configs/nucleo-f303re/src/stm32_buttons.c +++ b/configs/nucleo-f303re/src/stm32_buttons.c @@ -126,14 +126,14 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; if (id == BUTTON_USER) { oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, - irqhandler); + irqhandler, arg); } return oldhandler; diff --git a/configs/nucleo-f4x1re/src/stm32_ajoystick.c b/configs/nucleo-f4x1re/src/stm32_ajoystick.c index 5fc611bb020..fc5b5cc237e 100644 --- a/configs/nucleo-f4x1re/src/stm32_ajoystick.c +++ b/configs/nucleo-f4x1re/src/stm32_ajoystick.c @@ -377,7 +377,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower, i, rising, falling); (void)stm32_gpiosetevent(g_joygpio[i], rising, falling, - true, ajoy_interrupt); + true, ajoy_interrupt, NULL); } } } @@ -403,7 +403,7 @@ static void ajoy_disable(void) flags = enter_critical_section(); for (i = 0; i < AJOY_NGPIOS; i++) { - (void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL); + (void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL, NULL); } leave_critical_section(flags); diff --git a/configs/nucleo-f4x1re/src/stm32_buttons.c b/configs/nucleo-f4x1re/src/stm32_buttons.c index 2960344c62e..c93b03d21a9 100644 --- a/configs/nucleo-f4x1re/src/stm32_buttons.c +++ b/configs/nucleo-f4x1re/src/stm32_buttons.c @@ -123,13 +123,14 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; if (id == BUTTON_USER) { - oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/nucleo-f4x1re/src/stm32_io.c b/configs/nucleo-f4x1re/src/stm32_io.c index 72563330d6c..ba190495454 100644 --- a/configs/nucleo-f4x1re/src/stm32_io.c +++ b/configs/nucleo-f4x1re/src/stm32_io.c @@ -184,11 +184,13 @@ xcpt_t up_irqio(int id, xcpt_t irqhandler) if (id == 0) { - oldhandler = stm32_gpiosetevent(GPIO_D14, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(GPIO_D14, true, true, true, + irqhandler, arg); } else if (id == 1) { - oldhandler = stm32_gpiosetevent(GPIO_D15, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(GPIO_D15, true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/nucleo-f4x1re/src/stm32_wireless.c b/configs/nucleo-f4x1re/src/stm32_wireless.c index 32cfd31775f..c5012f04388 100644 --- a/configs/nucleo-f4x1re/src/stm32_wireless.c +++ b/configs/nucleo-f4x1re/src/stm32_wireless.c @@ -204,11 +204,13 @@ static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable) iinfo("enable:%d\n", enable); if (enable) { - (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, true, false, priv->handler); + (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, true, false, + priv->handler, priv->arg); } else { - (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, false, false, NULL); + (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, false, false, + NULL, NULL); } } diff --git a/configs/nucleo-l476rg/src/stm32_ajoystick.c b/configs/nucleo-l476rg/src/stm32_ajoystick.c index b524d82279c..3c20ebca2ec 100644 --- a/configs/nucleo-l476rg/src/stm32_ajoystick.c +++ b/configs/nucleo-l476rg/src/stm32_ajoystick.c @@ -376,7 +376,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower, i, rising, falling); (void)stm32_gpiosetevent(g_joygpio[i], rising, falling, - true, ajoy_interrupt); + true, ajoy_interrupt, NULL); } } } @@ -402,7 +402,7 @@ static void ajoy_disable(void) flags = up_irq_save(); for (i = 0; i < AJOY_NGPIOS; i++) { - (void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL); + (void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL, NULL); } up_irq_restore(flags); diff --git a/configs/nucleo-l476rg/src/stm32_buttons.c b/configs/nucleo-l476rg/src/stm32_buttons.c index f9211a13c7d..63a96d7a92c 100644 --- a/configs/nucleo-l476rg/src/stm32_buttons.c +++ b/configs/nucleo-l476rg/src/stm32_buttons.c @@ -123,13 +123,14 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; if (id == BUTTON_USER) { - oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/nucleo-l476rg/src/stm32_io.c b/configs/nucleo-l476rg/src/stm32_io.c index d98f2985bf2..d6468c5d053 100644 --- a/configs/nucleo-l476rg/src/stm32_io.c +++ b/configs/nucleo-l476rg/src/stm32_io.c @@ -184,11 +184,13 @@ xcpt_t up_irqio(int id, xcpt_t irqhandler) if (id == 0) { - oldhandler = stm32_gpiosetevent(GPIO_D14, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(GPIO_D14, true, true, true, + irqhandler, NULL); } else if (id == 1) { - oldhandler = stm32_gpiosetevent(GPIO_D15, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(GPIO_D15, true, true, true, + irqhandler, NULL); } return oldhandler; diff --git a/configs/nucleo-l476rg/src/stm32_wireless.c b/configs/nucleo-l476rg/src/stm32_wireless.c index f28f8d33832..b65a5eaae5f 100644 --- a/configs/nucleo-l476rg/src/stm32_wireless.c +++ b/configs/nucleo-l476rg/src/stm32_wireless.c @@ -204,11 +204,13 @@ static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable) iinfo("enable:%d\n", enable); if (enable) { - (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, true, false, priv->handler); + (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, true, false, + priv->handler, priv->arg); } else { - (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, false, false, NULL); + (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, false, false, + NULL, NULL); } } diff --git a/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c b/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c index 7b3f6228abd..10c0df1ae00 100644 --- a/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c +++ b/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c @@ -168,7 +168,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_EFM32_GPIO_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/olimex-lpc1766stk/src/lpc17_buttons.c b/configs/olimex-lpc1766stk/src/lpc17_buttons.c index 36b54237ac4..3b541d94024 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_buttons.c +++ b/configs/olimex-lpc1766stk/src/lpc17_buttons.c @@ -182,7 +182,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC17_GPIOIRQ) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; irqstate_t flags; diff --git a/configs/olimex-stm32-e407/src/stm32_buttons.c b/configs/olimex-stm32-e407/src/stm32_buttons.c index 951df8ef1c4..32681e5e2d9 100644 --- a/configs/olimex-stm32-e407/src/stm32_buttons.c +++ b/configs/olimex-stm32-e407/src/stm32_buttons.c @@ -133,7 +133,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -142,7 +142,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { oldhandler = - stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg); } return oldhandler; diff --git a/configs/olimex-stm32-e407/src/stm32_usb.c b/configs/olimex-stm32-e407/src/stm32_usb.c index db93fcbf178..55df883ba8d 100644 --- a/configs/olimex-stm32-e407/src/stm32_usb.c +++ b/configs/olimex-stm32-e407/src/stm32_usb.c @@ -311,7 +311,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) #ifdef CONFIG_USBHOST xcpt_t stm32_setup_overcurrent(xcpt_t handler) { - return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler); + return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); } #endif diff --git a/configs/olimex-stm32-h405/src/stm32_buttons.c b/configs/olimex-stm32-h405/src/stm32_buttons.c index aefe40fc8c3..03092eaece8 100644 --- a/configs/olimex-stm32-h405/src/stm32_buttons.c +++ b/configs/olimex-stm32-h405/src/stm32_buttons.c @@ -141,7 +141,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -149,7 +149,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/olimex-stm32-h407/src/stm32_buttons.c b/configs/olimex-stm32-h407/src/stm32_buttons.c index 47873bf39b5..da8c5657654 100644 --- a/configs/olimex-stm32-h407/src/stm32_buttons.c +++ b/configs/olimex-stm32-h407/src/stm32_buttons.c @@ -133,7 +133,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -141,7 +141,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/olimex-stm32-h407/src/stm32_sdio.c b/configs/olimex-stm32-h407/src/stm32_sdio.c index 05df07dee81..f87e76c741e 100644 --- a/configs/olimex-stm32-h407/src/stm32_sdio.c +++ b/configs/olimex-stm32-h407/src/stm32_sdio.c @@ -128,7 +128,8 @@ int stm32_sdio_initialize(void) /* Register an interrupt handler for the card detect pin */ - stm32_gpiosetevent(GPIO_SDIO_NCD, true, true, true, stm32_ncd_interrupt); + stm32_gpiosetevent(GPIO_SDIO_NCD, true, true, true, + stm32_ncd_interrupt, NULL); #endif /* Mount the SDIO-based MMC/SD block driver */ diff --git a/configs/olimex-stm32-h407/src/stm32_usb.c b/configs/olimex-stm32-h407/src/stm32_usb.c index d948604a3b2..10cb1c16d46 100644 --- a/configs/olimex-stm32-h407/src/stm32_usb.c +++ b/configs/olimex-stm32-h407/src/stm32_usb.c @@ -289,7 +289,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) #ifdef CONFIG_USBHOST xcpt_t stm32_setup_overcurrent(xcpt_t handler) { - return stm32_gpiosetevent(GPIO_OTGHS_OVER, true, true, true, handler); + return stm32_gpiosetevent(GPIO_OTGHS_OVER, true, true, true, handler, NULL); } #endif diff --git a/configs/olimex-stm32-p107/src/stm32_encx24j600.c b/configs/olimex-stm32-p107/src/stm32_encx24j600.c index c5ec3b96636..6654c7bd329 100644 --- a/configs/olimex-stm32-p107/src/stm32_encx24j600.c +++ b/configs/olimex-stm32-p107/src/stm32_encx24j600.c @@ -151,12 +151,14 @@ static void up_enable(FAR const struct enc_lower_s *lower) FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower; DEBUGASSERT(priv->handler); - (void)stm32_gpiosetevent(GPIO_ENCX24J600_INTR, false, true, true, priv->handler); + (void)stm32_gpiosetevent(GPIO_ENCX24J600_INTR, false, true, true, + priv->handler, NULL); } static void up_disable(FAR const struct enc_lower_s *lower) { - (void)stm32_gpiosetevent(GPIO_ENCX24J600_INTR, false, true, true, NULL); + (void)stm32_gpiosetevent(GPIO_ENCX24J600_INTR, false, true, true, + NULL, NULL); } /**************************************************************************** diff --git a/configs/olimex-stm32-p207/src/stm32_buttons.c b/configs/olimex-stm32-p207/src/stm32_buttons.c index 5caaeab8351..17c0cc50ff4 100644 --- a/configs/olimex-stm32-p207/src/stm32_buttons.c +++ b/configs/olimex-stm32-p207/src/stm32_buttons.c @@ -177,7 +177,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -185,7 +185,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/olimex-stm32-p207/src/stm32_usb.c b/configs/olimex-stm32-p207/src/stm32_usb.c index 65198bf0041..9996da8b7fe 100644 --- a/configs/olimex-stm32-p207/src/stm32_usb.c +++ b/configs/olimex-stm32-p207/src/stm32_usb.c @@ -247,7 +247,7 @@ int stm32_usbhost_initialize(void) #ifdef CONFIG_USBHOST xcpt_t stm32_setup_overcurrent(xcpt_t handler) { - return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler); + return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); } #endif diff --git a/configs/olimex-stm32-p407/src/stm32_buttons.c b/configs/olimex-stm32-p407/src/stm32_buttons.c index 94580ec5a1c..463048055ef 100644 --- a/configs/olimex-stm32-p407/src/stm32_buttons.c +++ b/configs/olimex-stm32-p407/src/stm32_buttons.c @@ -177,7 +177,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -185,7 +185,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/olimex-stm32-p407/src/stm32_usb.c b/configs/olimex-stm32-p407/src/stm32_usb.c index e6340dcc50f..4c3799e3af0 100644 --- a/configs/olimex-stm32-p407/src/stm32_usb.c +++ b/configs/olimex-stm32-p407/src/stm32_usb.c @@ -247,7 +247,7 @@ int stm32_usbhost_setup(void) #ifdef CONFIG_USBHOST xcpt_t stm32_setup_overcurrent(xcpt_t handler) { - return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler); + return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); } #endif diff --git a/configs/olimexino-stm32/src/stm32_buttons.c b/configs/olimexino-stm32/src/stm32_buttons.c index 85066d568f6..55021c3a948 100644 --- a/configs/olimexino-stm32/src/stm32_buttons.c +++ b/configs/olimexino-stm32/src/stm32_buttons.c @@ -133,7 +133,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -141,7 +141,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id == IRQBUTTON) { - oldhandler = stm32_gpiosetevent(BUTTON_BOOT0n, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(BUTTON_BOOT0n, true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/olimexino-stm32/src/stm32_usbdev.c b/configs/olimexino-stm32/src/stm32_usbdev.c index dd0846ae48c..148ae443129 100644 --- a/configs/olimexino-stm32/src/stm32_usbdev.c +++ b/configs/olimexino-stm32/src/stm32_usbdev.c @@ -77,7 +77,7 @@ void stm32_usb_set_pwr_callback(xcpt_t pwr_changed_handler) { - (void) stm32_gpiosetevent(GPIO_USB_VBUS, true, true, true, pwr_changed_handler); + (void)stm32_gpiosetevent(GPIO_USB_VBUS, true, true, true, pwr_changed_handler, NULL); } /************************************************************************************ diff --git a/configs/open1788/src/lpc17_buttons.c b/configs/open1788/src/lpc17_buttons.c index ca8f99278b9..c9313525524 100644 --- a/configs/open1788/src/lpc17_buttons.c +++ b/configs/open1788/src/lpc17_buttons.c @@ -200,7 +200,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC17_GPIOIRQ) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; irqstate_t flags; diff --git a/configs/pcduino-a10/src/a1x_buttons.c b/configs/pcduino-a10/src/a1x_buttons.c index b9e1deff0fc..2cc53b81d6b 100644 --- a/configs/pcduino-a10/src/a1x_buttons.c +++ b/configs/pcduino-a10/src/a1x_buttons.c @@ -120,7 +120,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/pic32mz-starterkit/src/pic32mz_buttons.c b/configs/pic32mz-starterkit/src/pic32mz_buttons.c index 4e26b559507..d5e06bd3104 100644 --- a/configs/pic32mz-starterkit/src/pic32mz_buttons.c +++ b/configs/pic32mz-starterkit/src/pic32mz_buttons.c @@ -152,7 +152,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { #ifdef CONFIG_PIC32MZ_GPIOIRQ_PORTB xcpt_t oldhandler = NULL; diff --git a/configs/sam3u-ek/src/sam_buttons.c b/configs/sam3u-ek/src/sam_buttons.c index a995f19ab62..6bfdf269d54 100644 --- a/configs/sam3u-ek/src/sam_buttons.c +++ b/configs/sam3u-ek/src/sam_buttons.c @@ -80,7 +80,7 @@ static xcpt_t g_irqbutton2; #if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, - xcpt_t irqhandler, xcpt_t *store) + xcpt_t irqhandler, xcpt_t *store, void *arg) { xcpt_t oldhandler; irqstate_t flags; @@ -103,7 +103,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, /* Configure the interrupt */ sam_gpioirq(pinset); - (void)irq_attach(irq, irqhandler, NULL); + (void)irq_attach(irq, irqhandler, arg); sam_gpioirqenable(irq); } else @@ -183,17 +183,17 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { if (id == BUTTON1) { return board_button_irqx(GPIO_BUTTON1, IRQ_BUTTON1, - irqhandler, &g_irqbutton1); + irqhandler, &g_irqbutton1, arg); } else if (id == BUTTON2) { return board_button_irqx(GPIO_BUTTON2, IRQ_BUTTON2, - irqhandler, &g_irqbutton2); + irqhandler, &g_irqbutton2, arg); } else { diff --git a/configs/sam4e-ek/src/sam_buttons.c b/configs/sam4e-ek/src/sam_buttons.c index 46ab285bd59..23851d10832 100644 --- a/configs/sam4e-ek/src/sam_buttons.c +++ b/configs/sam4e-ek/src/sam_buttons.c @@ -82,7 +82,7 @@ static xcpt_t g_irq_tamp; #if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, - xcpt_t irqhandler, xcpt_t *store) + xcpt_t irqhandler, xcpt_t *store, void *arg) { xcpt_t oldhandler; irqstate_t flags; @@ -105,7 +105,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, /* Configure the interrupt */ sam_gpioirq(pinset); - (void)irq_attach(irq, irqhandler, NULL); + (void)irq_attach(irq, irqhandler, arg); sam_gpioirqenable(irq); } else @@ -189,25 +189,25 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { switch (id) { case BUTTON_SCROLLUP: return board_button_irqx(GPIO_SCROLLUP, IRQ_SCROLLUP, - irqhandler, &g_irq_scrollup); + irqhandler, &g_irq_scrollup, arg); case BUTTON_SCROLLDOWN: return board_button_irqx(GPIO_SCROLLDWN, IRQ_SCROLLDWN, - irqhandler, &g_irq_scrolldown); + irqhandler, &g_irq_scrolldown, arg); case BUTTON_WAKU: return board_button_irqx(GPIO_WAKU, IRQ_WAKU, - irqhandler, &g_irq_waku); + irqhandler, &g_irq_waku, arg); case BUTTON_TAMP: return board_button_irqx(GPIO_TAMP, IRQ_TAMP, - irqhandler, &g_irq_tamp); + irqhandler, &g_irq_tamp, arg); default: return NULL; diff --git a/configs/sam4l-xplained/src/sam_buttons.c b/configs/sam4l-xplained/src/sam_buttons.c index 63cc85efd77..9095bd820b5 100644 --- a/configs/sam4l-xplained/src/sam_buttons.c +++ b/configs/sam4l-xplained/src/sam_buttons.c @@ -124,7 +124,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/sam4s-xplained-pro/src/sam_buttons.c b/configs/sam4s-xplained-pro/src/sam_buttons.c index 11b19b87b43..0a4f057dd8a 100644 --- a/configs/sam4s-xplained-pro/src/sam_buttons.c +++ b/configs/sam4s-xplained-pro/src/sam_buttons.c @@ -123,7 +123,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/sam4s-xplained/src/sam_buttons.c b/configs/sam4s-xplained/src/sam_buttons.c index 3efa1df16e9..4ce25925927 100644 --- a/configs/sam4s-xplained/src/sam_buttons.c +++ b/configs/sam4s-xplained/src/sam_buttons.c @@ -124,7 +124,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/sama5d2-xult/src/sam_buttons.c b/configs/sama5d2-xult/src/sam_buttons.c index dddab61307a..3dd77011814 100644 --- a/configs/sama5d2-xult/src/sam_buttons.c +++ b/configs/sama5d2-xult/src/sam_buttons.c @@ -133,7 +133,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_SAMA5_PIOB_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/sama5d3-xplained/src/sam_buttons.c b/configs/sama5d3-xplained/src/sam_buttons.c index 93b51edaa2a..b2d0af924ea 100644 --- a/configs/sama5d3-xplained/src/sam_buttons.c +++ b/configs/sama5d3-xplained/src/sam_buttons.c @@ -137,7 +137,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_SAMA5_PIOE_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/sama5d3x-ek/src/sam_buttons.c b/configs/sama5d3x-ek/src/sam_buttons.c index 180d80fcf96..d9ea68baa42 100644 --- a/configs/sama5d3x-ek/src/sam_buttons.c +++ b/configs/sama5d3x-ek/src/sam_buttons.c @@ -137,7 +137,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_SAMA5_PIOE_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/sama5d4-ek/src/sam_buttons.c b/configs/sama5d4-ek/src/sam_buttons.c index 9b4fd75a8ca..b0fa42ecde3 100644 --- a/configs/sama5d4-ek/src/sam_buttons.c +++ b/configs/sama5d4-ek/src/sam_buttons.c @@ -133,7 +133,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_SAMA5_PIOE_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/samd20-xplained/src/sam_buttons.c b/configs/samd20-xplained/src/sam_buttons.c index 59ffa0bd41b..5edeb965d8a 100644 --- a/configs/samd20-xplained/src/sam_buttons.c +++ b/configs/samd20-xplained/src/sam_buttons.c @@ -124,7 +124,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_PORTA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/samd21-xplained/src/sam_buttons.c b/configs/samd21-xplained/src/sam_buttons.c index ee63c024d6b..cb5806f748a 100644 --- a/configs/samd21-xplained/src/sam_buttons.c +++ b/configs/samd21-xplained/src/sam_buttons.c @@ -124,7 +124,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_PORTA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/same70-xplained/src/sam_buttons.c b/configs/same70-xplained/src/sam_buttons.c index 46813e9ae4d..251cf113c0e 100644 --- a/configs/same70-xplained/src/sam_buttons.c +++ b/configs/same70-xplained/src/sam_buttons.c @@ -89,7 +89,7 @@ static xcpt_t g_irq_sw0; #ifdef HAVE_IRQBUTTONS static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, - xcpt_t irqhandler, xcpt_t *store) + xcpt_t irqhandler, xcpt_t *store, void *arg) { xcpt_t oldhandler; irqstate_t flags; @@ -112,7 +112,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, /* Configure the interrupt */ sam_gpioirq(pinset); - (void)irq_attach(irq, irqhandler, NULL); + (void)irq_attach(irq, irqhandler, arg); sam_gpioirqenable(irq); } else @@ -188,12 +188,12 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { #ifdef HAVE_IRQBUTTONS if (id == BUTTON_SW0) { - return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0); + return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0, arg); } #endif diff --git a/configs/saml21-xplained/src/sam_buttons.c b/configs/saml21-xplained/src/sam_buttons.c index c5f3226d4f7..303a95a084f 100644 --- a/configs/saml21-xplained/src/sam_buttons.c +++ b/configs/saml21-xplained/src/sam_buttons.c @@ -124,7 +124,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #if defined(CONFIG_PORTA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/samv71-xult/src/sam_buttons.c b/configs/samv71-xult/src/sam_buttons.c index 70df9a1b6da..7e2ecd1b404 100644 --- a/configs/samv71-xult/src/sam_buttons.c +++ b/configs/samv71-xult/src/sam_buttons.c @@ -92,7 +92,7 @@ static xcpt_t g_irq_sw1; #ifdef HAVE_IRQBUTTONS static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, - xcpt_t irqhandler, xcpt_t *store) + xcpt_t irqhandler, xcpt_t *store, void *arg) { xcpt_t oldhandler; irqstate_t flags; @@ -115,7 +115,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, /* Configure the interrupt */ sam_gpioirq(pinset); - (void)irq_attach(irq, irqhandler, NULL); + (void)irq_attach(irq, irqhandler, arg); sam_gpioirqenable(irq); } else @@ -208,7 +208,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { #ifdef HAVE_IRQBUTTONS @@ -216,12 +216,12 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) { #ifdef CONFIG_SAMV7_GPIOA_IRQ case BUTTON_SW0: - return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0); + return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0, arg); #endif #ifdef CONFIG_SAMV7_GPIOB_IRQ case BUTTON_SW1: - return board_button_irqx(GPIO_SW1, IRQ_SW1, irqhandler, &g_irq_sw1); + return board_button_irqx(GPIO_SW1, IRQ_SW1, irqhandler, &g_irq_sw1, arg); #endif default: diff --git a/configs/shenzhou/src/stm32_buttons.c b/configs/shenzhou/src/stm32_buttons.c index cf31d666e82..2d90fafcc16 100644 --- a/configs/shenzhou/src/stm32_buttons.c +++ b/configs/shenzhou/src/stm32_buttons.c @@ -156,7 +156,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -164,7 +164,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } return oldhandler; } diff --git a/configs/shenzhou/src/stm32_touchscreen.c b/configs/shenzhou/src/stm32_touchscreen.c index dec42e95ffa..99b3971df80 100644 --- a/configs/shenzhou/src/stm32_touchscreen.c +++ b/configs/shenzhou/src/stm32_touchscreen.c @@ -185,11 +185,12 @@ static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable) if (enable) { (void)stm32_gpiosetevent(GPIO_TP_INT, true, true, false, - priv->handler); + priv->handler, NULL); } else { - (void)stm32_gpiosetevent(GPIO_TP_INT, false, false, false, NULL); + (void)stm32_gpiosetevent(GPIO_TP_INT, false, false, false, + NULL, NULL); } } diff --git a/configs/spark/src/stm32_buttons.c b/configs/spark/src/stm32_buttons.c index 4f4224146ed..d38a868cc59 100644 --- a/configs/spark/src/stm32_buttons.c +++ b/configs/spark/src/stm32_buttons.c @@ -120,7 +120,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -128,8 +128,9 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id == BUTTON_USER) { - oldhandler = stm32_gpiosetevent(GPIO_BTN, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(GPIO_BTN, true, true, true, irqhandler, arg); } + return oldhandler; } #endif diff --git a/configs/spark/src/stm32_io.c b/configs/spark/src/stm32_io.c index 404cd4143ae..5730abe689d 100644 --- a/configs/spark/src/stm32_io.c +++ b/configs/spark/src/stm32_io.c @@ -183,11 +183,13 @@ xcpt_t up_irqio(int id, xcpt_t irqhandler) if (id == 0) { - oldhandler = stm32_gpiosetevent(GPIO_D0, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(GPIO_D0, true, true, true, + irqhandler, NULL); } else if (id == 1) { - oldhandler = stm32_gpiosetevent(GPIO_D1, true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(GPIO_D1, true, true, true, + irqhandler, NULL); } return oldhandler; diff --git a/configs/spark/src/stm32_wireless.c b/configs/spark/src/stm32_wireless.c index 962faa93549..afd0f9a819d 100644 --- a/configs/spark/src/stm32_wireless.c +++ b/configs/spark/src/stm32_wireless.c @@ -205,11 +205,13 @@ static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable) iinfo("enable:%d\n", enable); if (enable) { - (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, true, false, priv->handler); + (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, true, false, + priv->handler, priv->arg); } else { - (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, false, false, NULL); + (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, false, false, + NULL, NULL); } } diff --git a/configs/stm3210e-eval/src/stm32_buttons.c b/configs/stm3210e-eval/src/stm32_buttons.c index 526309f0178..a2dc1c6cf7e 100644 --- a/configs/stm3210e-eval/src/stm32_buttons.c +++ b/configs/stm3210e-eval/src/stm32_buttons.c @@ -161,7 +161,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -169,7 +169,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/stm3210e-eval/src/stm32_djoystick.c b/configs/stm3210e-eval/src/stm32_djoystick.c index 72d5009e705..40e8e3bf265 100644 --- a/configs/stm3210e-eval/src/stm32_djoystick.c +++ b/configs/stm3210e-eval/src/stm32_djoystick.c @@ -213,7 +213,7 @@ static void djoy_enable(FAR const struct djoy_lowerhalf_s *lower, i, rising, falling); (void)stm32_gpiosetevent(g_joygpio[i], rising, falling, - true, djoy_interrupt); + true, djoy_interrupt, NULL); } } } @@ -239,7 +239,7 @@ static void djoy_disable(void) flags = enter_critical_section(); for (i = 0; i < DJOY_NGPIOS; i++) { - (void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL); + (void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL, NULL); } leave_critical_section(flags); diff --git a/configs/stm3210e-eval/src/stm32_idle.c b/configs/stm3210e-eval/src/stm32_idle.c index e50aac3c854..5073218ad0a 100644 --- a/configs/stm3210e-eval/src/stm32_idle.c +++ b/configs/stm3210e-eval/src/stm32_idle.c @@ -177,7 +177,7 @@ static int stm32_alarm_exti(int irq, FAR void *context) #if defined(CONFIG_PM) && defined(CONFIG_RTC_ALARM) static void stm32_exti_cancel(void) { - (void)stm32_exti_alarm(false, false, false, NULL); + (void)stm32_exti_alarm(false, false, false, NULL, NULL); } #endif @@ -201,7 +201,7 @@ static int stm32_rtc_alarm(time_t tv_sec, time_t tv_nsec, bool exti) { /* TODO: Make sure that that is no pending EXTI interrupt */ - (void)stm32_exti_alarm(true, true, true, stm32_alarm_exti); + (void)stm32_exti_alarm(true, true, true, stm32_alarm_exti, NULL); } /* Configure the RTC alarm to Auto Wake the system */ diff --git a/configs/stm3210e-eval/src/stm32_lm75.c b/configs/stm3210e-eval/src/stm32_lm75.c index ba0591fb87c..a238bf7d637 100644 --- a/configs/stm3210e-eval/src/stm32_lm75.c +++ b/configs/stm3210e-eval/src/stm32_lm75.c @@ -114,7 +114,7 @@ int stm32_lm75initialize(FAR const char *devpath) xcpt_t stm32_lm75attach(xcpt_t irqhandler) { - return stm32_gpiosetevent(GPIO_LM75_OSINT, true, true, true, irqhandler); + return stm32_gpiosetevent(GPIO_LM75_OSINT, true, true, true, irqhandler, NULL); } #endif /* CONFIG_I2C && CONFIG_I2C_LM75 && CONFIG_STM32_I2C1 */ diff --git a/configs/stm3220g-eval/src/stm32_buttons.c b/configs/stm3220g-eval/src/stm32_buttons.c index 85db973fa55..ec5428eb069 100644 --- a/configs/stm3220g-eval/src/stm32_buttons.c +++ b/configs/stm3220g-eval/src/stm32_buttons.c @@ -157,7 +157,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -165,8 +165,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } + return oldhandler; } #endif diff --git a/configs/stm3220g-eval/src/stm32_stmpe811.c b/configs/stm3220g-eval/src/stm32_stmpe811.c index 7b3ffc332ab..ec79a318644 100644 --- a/configs/stm3220g-eval/src/stm32_stmpe811.c +++ b/configs/stm3220g-eval/src/stm32_stmpe811.c @@ -240,14 +240,17 @@ static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable) { /* Configure the EXTI interrupt using the SAVED handler */ - (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, true, true, true, priv->handler); + (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, true, true, true, + priv->handler, priv->arg); } else { /* Configure the EXTI interrupt with a NULL handler to disable it */ - (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, false, false, false, NULL); + (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, false, false, false, + NULL, NULL); } + leave_critical_section(flags); } diff --git a/configs/stm3220g-eval/src/stm32_usb.c b/configs/stm3220g-eval/src/stm32_usb.c index adecafb76df..371daed38ad 100644 --- a/configs/stm3220g-eval/src/stm32_usb.c +++ b/configs/stm3220g-eval/src/stm32_usb.c @@ -282,7 +282,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) #ifdef CONFIG_USBHOST xcpt_t stm32_setup_overcurrent(xcpt_t handler) { - return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler); + return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); } #endif diff --git a/configs/stm3240g-eval/src/stm32_buttons.c b/configs/stm3240g-eval/src/stm32_buttons.c index e3e761b217b..db034d5a4e3 100644 --- a/configs/stm3240g-eval/src/stm32_buttons.c +++ b/configs/stm3240g-eval/src/stm32_buttons.c @@ -157,7 +157,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -165,8 +165,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } + return oldhandler; } #endif diff --git a/configs/stm3240g-eval/src/stm32_stmpe811.c b/configs/stm3240g-eval/src/stm32_stmpe811.c index 147bf4f9523..b1b8126c579 100644 --- a/configs/stm3240g-eval/src/stm32_stmpe811.c +++ b/configs/stm3240g-eval/src/stm32_stmpe811.c @@ -240,14 +240,17 @@ static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable) { /* Configure the EXTI interrupt using the SAVED handler */ - (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, true, true, true, priv->handler); + (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, true, true, true, + priv->handler, priv->arg); } else { /* Configure the EXTI interrupt with a NULL handler to disable it */ - (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, false, false, false, NULL); + (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, false, false, false, + NULL, NULL); } + leave_critical_section(flags); } diff --git a/configs/stm3240g-eval/src/stm32_usb.c b/configs/stm3240g-eval/src/stm32_usb.c index 71d51ce9ed4..7c5494a501b 100644 --- a/configs/stm3240g-eval/src/stm32_usb.c +++ b/configs/stm3240g-eval/src/stm32_usb.c @@ -282,7 +282,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) #ifdef CONFIG_USBHOST xcpt_t stm32_setup_overcurrent(xcpt_t handler) { - return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler); + return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); } #endif diff --git a/configs/stm32_tiny/src/stm32_wireless.c b/configs/stm32_tiny/src/stm32_wireless.c index cebd1a3e5ae..ef3fc3f54cb 100644 --- a/configs/stm32_tiny/src/stm32_wireless.c +++ b/configs/stm32_tiny/src/stm32_wireless.c @@ -83,7 +83,7 @@ static int stm32tiny_wl_irq_attach(xcpt_t isr, FAR void *arg) _info("Attach IRQ\n"); g_isr = isr; g_arg = arg; - stm32_gpiosetevent(GPIO_NRF24L01_IRQ, false, true, false, g_isr); + stm32_gpiosetevent(GPIO_NRF24L01_IRQ, false, true, false, g_isr, g_arg); return OK; } diff --git a/configs/stm32butterfly2/src/stm32_mmcsd.c b/configs/stm32butterfly2/src/stm32_mmcsd.c index 4ccd3516006..d045d05c710 100644 --- a/configs/stm32butterfly2/src/stm32_mmcsd.c +++ b/configs/stm32butterfly2/src/stm32_mmcsd.c @@ -196,7 +196,7 @@ int stm32_mmcsd_initialize(int minor) return rv; } - stm32_gpiosetevent(GPIO_SD_CD, true, true, true, stm32_cd); + stm32_gpiosetevent(GPIO_SD_CD, true, true, true, stm32_cd, NULL); sem_init(&g_cdsem, 0, 0); pthread_attr_init(&pattr); diff --git a/configs/stm32f103-minimum/src/stm32_buttons.c b/configs/stm32f103-minimum/src/stm32_buttons.c index d611bf44fb2..96fd053eef3 100644 --- a/configs/stm32f103-minimum/src/stm32_buttons.c +++ b/configs/stm32f103-minimum/src/stm32_buttons.c @@ -152,7 +152,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -161,7 +161,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, - irqhandler); + irqhandler, arg); } return oldhandler; diff --git a/configs/stm32f103-minimum/src/stm32_wireless.c b/configs/stm32f103-minimum/src/stm32_wireless.c index 6a25abaa87e..e5d7c21073d 100644 --- a/configs/stm32f103-minimum/src/stm32_wireless.c +++ b/configs/stm32f103-minimum/src/stm32_wireless.c @@ -85,7 +85,7 @@ static int stm32tiny_wl_irq_attach(xcpt_t isr, FAR void *arg) winfo("Attach IRQ\n"); g_isr = isr; g_arg = arg; - stm32_gpiosetevent(GPIO_NRF24L01_IRQ, false, true, false, g_isr); + stm32_gpiosetevent(GPIO_NRF24L01_IRQ, false, true, false, g_isr, g_arg); return OK; } diff --git a/configs/stm32f3discovery/src/stm32_buttons.c b/configs/stm32f3discovery/src/stm32_buttons.c index db0d6418313..f15c22f8a9c 100644 --- a/configs/stm32f3discovery/src/stm32_buttons.c +++ b/configs/stm32f3discovery/src/stm32_buttons.c @@ -152,7 +152,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -160,7 +160,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/stm32f429i-disco/src/stm32_buttons.c b/configs/stm32f429i-disco/src/stm32_buttons.c index 6dbe3cba7a9..396b8750546 100644 --- a/configs/stm32f429i-disco/src/stm32_buttons.c +++ b/configs/stm32f429i-disco/src/stm32_buttons.c @@ -152,7 +152,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -160,8 +160,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } + return oldhandler; } #endif diff --git a/configs/stm32f429i-disco/src/stm32_l3gd20.c b/configs/stm32f429i-disco/src/stm32_l3gd20.c index 0bf73ce9f92..1d6dd2cc2d5 100644 --- a/configs/stm32f429i-disco/src/stm32_l3gd20.c +++ b/configs/stm32f429i-disco/src/stm32_l3gd20.c @@ -87,9 +87,7 @@ static struct l3gd20_config_s g_l3gd20_config = static int l3gd20_attach(FAR struct l3gd20_config_s * cfg, xcpt_t irq) { - stm32_gpiosetevent(GPIO_L3GD20_DREADY, true, false, true, irq); - - return OK; + stm32_gpiosetevent(GPIO_L3GD20_DREADY, true, false, true, irq, NULL); } /**************************************************************************** diff --git a/configs/stm32f429i-disco/src/stm32_stmpe811.c b/configs/stm32f429i-disco/src/stm32_stmpe811.c index 7cd8b08db71..13c0a91dc79 100644 --- a/configs/stm32f429i-disco/src/stm32_stmpe811.c +++ b/configs/stm32f429i-disco/src/stm32_stmpe811.c @@ -244,14 +244,16 @@ static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable) /* Configure the EXTI interrupt using the SAVED handler */ (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, true, true, true, - priv->handler); + priv->handler, priv->arg); } else { /* Configure the EXTI interrupt with a NULL handler to disable it */ - (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, false, false, false, NULL); + (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, false, false, false, + NULL, NULL); } +` leave_critical_section(flags); } diff --git a/configs/stm32f429i-disco/src/stm32_usb.c b/configs/stm32f429i-disco/src/stm32_usb.c index 011726a69b1..3daa643edca 100644 --- a/configs/stm32f429i-disco/src/stm32_usb.c +++ b/configs/stm32f429i-disco/src/stm32_usb.c @@ -288,7 +288,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) #ifdef CONFIG_USBHOST xcpt_t stm32_setup_overcurrent(xcpt_t handler) { - return stm32_gpiosetevent(GPIO_OTGHS_OVER, true, true, true, handler); + return stm32_gpiosetevent(GPIO_OTGHS_OVER, true, true, true, handler, NULL); } #endif diff --git a/configs/stm32f4discovery/src/stm32_buttons.c b/configs/stm32f4discovery/src/stm32_buttons.c index b068e03dad2..5143fd8eca0 100644 --- a/configs/stm32f4discovery/src/stm32_buttons.c +++ b/configs/stm32f4discovery/src/stm32_buttons.c @@ -152,7 +152,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -160,8 +160,10 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } + return oldhandler; } #endif diff --git a/configs/stm32f4discovery/src/stm32_ethernet.c b/configs/stm32f4discovery/src/stm32_ethernet.c index 67b7b9e95e3..0cc23c60167 100644 --- a/configs/stm32f4discovery/src/stm32_ethernet.c +++ b/configs/stm32f4discovery/src/stm32_ethernet.c @@ -112,13 +112,15 @@ static void stm32_emac0_phy_enable(bool enable) { /* Attach and enable GPIO interrupt (and event) on the falling edge */ - (void)stm32_gpiosetevent(GPIO_EMAC_NINT, false, true, true, g_ethmac_handler); + (void)stm32_gpiosetevent(GPIO_EMAC_NINT, false, true, true, + g_ethmac_handler, NULL); } else { /* Detach and disable GPIO interrupt */ - (void)stm32_gpiosetevent(GPIO_EMAC_NINT, false, false, false, NULL); + (void)stm32_gpiosetevent(GPIO_EMAC_NINT, false, false, false, + NULL, NULL); } } #endif diff --git a/configs/stm32f4discovery/src/stm32_sdio.c b/configs/stm32f4discovery/src/stm32_sdio.c index a82a38d3488..d7271c7cab9 100644 --- a/configs/stm32f4discovery/src/stm32_sdio.c +++ b/configs/stm32f4discovery/src/stm32_sdio.c @@ -128,7 +128,8 @@ int stm32_sdio_initialize(void) /* Register an interrupt handler for the card detect pin */ - stm32_gpiosetevent(GPIO_SDIO_NCD, true, true, true, stm32_ncd_interrupt); + stm32_gpiosetevent(GPIO_SDIO_NCD, true, true, true, + stm32_ncd_interrupt, NULL); #endif /* Mount the SDIO-based MMC/SD block driver */ diff --git a/configs/stm32f4discovery/src/stm32_usb.c b/configs/stm32f4discovery/src/stm32_usb.c index 397aaff76df..f6571406540 100644 --- a/configs/stm32f4discovery/src/stm32_usb.c +++ b/configs/stm32f4discovery/src/stm32_usb.c @@ -311,7 +311,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) #ifdef CONFIG_USBHOST xcpt_t stm32_setup_overcurrent(xcpt_t handler) { - return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler); + return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); } #endif diff --git a/configs/stm32f4discovery/src/stm32_xen1210.c b/configs/stm32f4discovery/src/stm32_xen1210.c index edd37f5da51..b6363a1e2ec 100644 --- a/configs/stm32f4discovery/src/stm32_xen1210.c +++ b/configs/stm32f4discovery/src/stm32_xen1210.c @@ -211,13 +211,14 @@ static void xen1210_enable(FAR struct xen1210_config_s *state, bool enable) stm32_configgpio(GPIO_XEN1210_INT); (void)stm32_gpiosetevent(GPIO_XEN1210_INT, false, true, - true, xen1210_interrupt); + true, xen1210_interrupt, NULL); } else { /* Configure the interrupt with a NULL handler to disable it */ - (void)stm32_gpiosetevent(GPIO_XEN1210_INT, false, false, false, NULL); + (void)stm32_gpiosetevent(GPIO_XEN1210_INT, false, false, false, + NULL, NULL); } leave_critical_section(flags); diff --git a/configs/stm32f4discovery/src/stm32_zerocross.c b/configs/stm32f4discovery/src/stm32_zerocross.c index af0b99b860a..92703f56615 100644 --- a/configs/stm32f4discovery/src/stm32_zerocross.c +++ b/configs/stm32f4discovery/src/stm32_zerocross.c @@ -120,7 +120,7 @@ static void zcross_enable(FAR const struct zc_lowerhalf_s *lower, } (void)stm32_gpiosetevent(GPIO_ZEROCROSS, rising, falling, - true, zcross_interrupt); + true, zcross_interrupt, NULL); leave_critical_section(flags); } diff --git a/configs/stm32f746-ws/src/stm32_sdmmc.c b/configs/stm32f746-ws/src/stm32_sdmmc.c index 9dfaaa34a71..dce13b291da 100644 --- a/configs/stm32f746-ws/src/stm32_sdmmc.c +++ b/configs/stm32f746-ws/src/stm32_sdmmc.c @@ -126,7 +126,8 @@ int stm32_sdio_initialize(void) /* Register an interrupt handler for the card detect pin */ - stm32_gpiosetevent(GPIO_SDIO_NCD, true, true, true, stm32_ncd_interrupt); + stm32_gpiosetevent(GPIO_SDIO_NCD, true, true, true, + stm32_ncd_interrupt, NULL); #endif /* Mount the SDIO-based MMC/SD block driver */ diff --git a/configs/stm32f746-ws/src/stm32_usb.c b/configs/stm32f746-ws/src/stm32_usb.c index 770f950fa06..84f782c5ef9 100644 --- a/configs/stm32f746-ws/src/stm32_usb.c +++ b/configs/stm32f746-ws/src/stm32_usb.c @@ -314,7 +314,7 @@ void stm32_usbhost_vbusdrive(int iface, bool enable) #ifdef CONFIG_USBHOST xcpt_t stm32_setup_overcurrent(xcpt_t handler) { - return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler); + return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); } #endif diff --git a/configs/stm32f746g-disco/src/stm32_buttons.c b/configs/stm32f746g-disco/src/stm32_buttons.c index 8578c0794ed..43051e49604 100644 --- a/configs/stm32f746g-disco/src/stm32_buttons.c +++ b/configs/stm32f746g-disco/src/stm32_buttons.c @@ -104,7 +104,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { #warning Missing logic } diff --git a/configs/stm32l476-mdk/src/stm32_buttons.c b/configs/stm32l476-mdk/src/stm32_buttons.c index a59430ec82b..a44849bf4a1 100644 --- a/configs/stm32l476-mdk/src/stm32_buttons.c +++ b/configs/stm32l476-mdk/src/stm32_buttons.c @@ -150,7 +150,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/stm32l476vg-disco/src/stm32_buttons.c b/configs/stm32l476vg-disco/src/stm32_buttons.c index b113718c9a1..ca96eecf71f 100644 --- a/configs/stm32l476vg-disco/src/stm32_buttons.c +++ b/configs/stm32l476vg-disco/src/stm32_buttons.c @@ -325,7 +325,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/stm32ldiscovery/src/stm32_buttons.c b/configs/stm32ldiscovery/src/stm32_buttons.c index 5427ac751b1..b703bf8d2de 100644 --- a/configs/stm32ldiscovery/src/stm32_buttons.c +++ b/configs/stm32ldiscovery/src/stm32_buttons.c @@ -152,7 +152,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -160,7 +160,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/stm32vldiscovery/src/stm32_buttons.c b/configs/stm32vldiscovery/src/stm32_buttons.c index 87442c115e1..63be9ee2a17 100644 --- a/configs/stm32vldiscovery/src/stm32_buttons.c +++ b/configs/stm32vldiscovery/src/stm32_buttons.c @@ -107,12 +107,14 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; if (id == 0) - oldhandler = stm32_gpiosetevent(GPIO_BTN_0, true, true, true, irqhandler); + { + oldhandler = stm32_gpiosetevent(GPIO_BTN_0, true, true, true, irqhandler, arg); + } return oldhandler; } diff --git a/configs/sure-pic32mx/src/pic32mx_buttons.c b/configs/sure-pic32mx/src/pic32mx_buttons.c index 62e0330c410..8de2633e2f6 100644 --- a/configs/sure-pic32mx/src/pic32mx_buttons.c +++ b/configs/sure-pic32mx/src/pic32mx_buttons.c @@ -206,7 +206,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/tm4c123g-launchpad/src/tm4c_buttons.c b/configs/tm4c123g-launchpad/src/tm4c_buttons.c index 57c285ea60b..a151bce0caf 100644 --- a/configs/tm4c123g-launchpad/src/tm4c_buttons.c +++ b/configs/tm4c123g-launchpad/src/tm4c_buttons.c @@ -149,7 +149,7 @@ uint8_t board_buttons(void) ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; uint32_t pinset= 0; diff --git a/configs/twr-k60n512/src/k60_buttons.c b/configs/twr-k60n512/src/k60_buttons.c index 0cda4324838..6a936935da1 100644 --- a/configs/twr-k60n512/src/k60_buttons.c +++ b/configs/twr-k60n512/src/k60_buttons.c @@ -134,7 +134,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler; uint32_t pinset; diff --git a/configs/ubw32/src/pic32_buttons.c b/configs/ubw32/src/pic32_buttons.c index 290832c3690..dec8fe416eb 100644 --- a/configs/ubw32/src/pic32_buttons.c +++ b/configs/ubw32/src/pic32_buttons.c @@ -181,7 +181,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; diff --git a/configs/viewtool-stm32f107/src/stm32_buttons.c b/configs/viewtool-stm32f107/src/stm32_buttons.c index cff85be4c6e..97b02d1c5c3 100644 --- a/configs/viewtool-stm32f107/src/stm32_buttons.c +++ b/configs/viewtool-stm32f107/src/stm32_buttons.c @@ -152,7 +152,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t oldhandler = NULL; @@ -160,7 +160,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/viewtool-stm32f107/src/stm32_touchscreen.c b/configs/viewtool-stm32f107/src/stm32_touchscreen.c index 6abba71e5cd..8d6bc3c2593 100644 --- a/configs/viewtool-stm32f107/src/stm32_touchscreen.c +++ b/configs/viewtool-stm32f107/src/stm32_touchscreen.c @@ -201,13 +201,15 @@ static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable) { /* Configure the EXTI interrupt using the SAVED handler */ - (void)stm32_gpiosetevent(GPIO_LCDTP_IRQ, true, true, true, priv->handler); + (void)stm32_gpiosetevent(GPIO_LCDTP_IRQ, true, true, true, + priv->handler, NULL); } else { /* Configure the EXTI interrupt with a NULL handler to disable it */ - (void)stm32_gpiosetevent(GPIO_LCDTP_IRQ, false, false, false, NULL); + (void)stm32_gpiosetevent(GPIO_LCDTP_IRQ, false, false, false, + NULL, NULL); } leave_critical_section(flags); diff --git a/configs/zkit-arm-1769/src/lpc17_buttons.c b/configs/zkit-arm-1769/src/lpc17_buttons.c index f8a479f8cca..24d60216938 100644 --- a/configs/zkit-arm-1769/src/lpc17_buttons.c +++ b/configs/zkit-arm-1769/src/lpc17_buttons.c @@ -160,7 +160,7 @@ uint8_t board_buttons(void) ************************************************************************************/ #if defined CONFIG_ARCH_IRQBUTTONS && CONFIG_LPC17_GPIOIRQ -xcpt_t board_button_irq(int id, xcpt_t irqhandler) +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { xcpt_t rethandler = NULL; irqstate_t flags; diff --git a/drivers/input/button_lower.c b/drivers/input/button_lower.c index 53f99be9077..b2b830f8f56 100644 --- a/drivers/input/button_lower.c +++ b/drivers/input/button_lower.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/input/button_lower.c * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -159,7 +159,7 @@ static void btn_enable(FAR const struct btn_lowerhalf_s *lower, mask = (1 << id); if ((either & mask) != 0) { - (void)board_button_irq(id, btn_interrupt); + (void)board_button_irq(id, btn_interrupt, NULL); } } } @@ -185,7 +185,7 @@ static void btn_disable(void) flags = enter_critical_section(); for (id = 0; id < NUM_BUTTONS; id++) { - (void)board_button_irq(id, NULL); + (void)board_button_irq(id, NULL, NULL); } /* Nullify the handler and argument */ diff --git a/include/nuttx/board.h b/include/nuttx/board.h index f31398548d4..633ea9c6839 100644 --- a/include/nuttx/board.h +++ b/include/nuttx/board.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/board.h * - * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -614,7 +614,7 @@ uint8_t board_buttons(void); ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t board_button_irq(int id, xcpt_t irqhandler); +xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg); #endif /**************************************************************************** From d9fec7fe4cf97e898de324281ea955b84f436af0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 14:26:04 -0600 Subject: [PATCH 23/38] More missing arguments to interrupt handling. --- arch/arm/src/sam34/sam_wdt.c | 2 +- configs/maple/src/stm32_lcd.c | 2 +- configs/sam4s-xplained-pro/src/sam_wdt.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/src/sam34/sam_wdt.c b/arch/arm/src/sam34/sam_wdt.c index 12ed956f514..cf88b37fec1 100644 --- a/arch/arm/src/sam34/sam_wdt.c +++ b/arch/arm/src/sam34/sam_wdt.c @@ -275,7 +275,7 @@ static int sam34_interrupt(int irq, FAR void *context, FAR void *arg) * upon return. */ - priv->handler(irq, context); + priv->handler(irq, context, NULL); } /* The EWI interrupt is cleared by the WDT_SR register. */ diff --git a/configs/maple/src/stm32_lcd.c b/configs/maple/src/stm32_lcd.c index 64f506563ba..e6693add9ae 100644 --- a/configs/maple/src/stm32_lcd.c +++ b/configs/maple/src/stm32_lcd.c @@ -90,7 +90,7 @@ static int up_lcdextcominisr(int irq, void *context) return OK; } - return g_isr(irq, context); + return g_isr(irq, context, NULL); } static int up_lcdirqattach(xcpt_t isr) diff --git a/configs/sam4s-xplained-pro/src/sam_wdt.c b/configs/sam4s-xplained-pro/src/sam_wdt.c index 4223671f395..fd3e01fe440 100644 --- a/configs/sam4s-xplained-pro/src/sam_wdt.c +++ b/configs/sam4s-xplained-pro/src/sam_wdt.c @@ -1,5 +1,5 @@ /************************************************************************************ - * configs/sam4s-xplained-pro/src/up_watchdog.c + * configs/sam4s-xplained-pro/src/up_wdt.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt From aa8d4422a50a0f1ec3d8cd943557190d7f0f9c04 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 14:43:10 -0600 Subject: [PATCH 24/38] Fix some mismatched function prototypes --- arch/arm/src/stm32/stm32_gpio.h | 3 ++- arch/arm/src/stm32f7/stm32_exti.h | 2 +- arch/arm/src/stm32f7/stm32_gpio.h | 22 ++++++++++++---------- arch/arm/src/stm32l4/stm32l4_exti.h | 2 +- arch/arm/src/stm32l4/stm32l4_gpio.h | 3 ++- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/arch/arm/src/stm32/stm32_gpio.h b/arch/arm/src/stm32/stm32_gpio.h index a635536c386..06e09efc2b2 100644 --- a/arch/arm/src/stm32/stm32_gpio.h +++ b/arch/arm/src/stm32/stm32_gpio.h @@ -492,6 +492,7 @@ bool stm32_gpioread(uint32_t pinset); * - rising/falling edge: enables * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This value may, @@ -501,7 +502,7 @@ bool stm32_gpioread(uint32_t pinset); ************************************************************************************/ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func); + bool event, xcpt_t func, void *arg); /************************************************************************************ * Function: stm32_dumpgpio diff --git a/arch/arm/src/stm32f7/stm32_exti.h b/arch/arm/src/stm32f7/stm32_exti.h index 1d32f0fd21b..03c621f7b6b 100644 --- a/arch/arm/src/stm32f7/stm32_exti.h +++ b/arch/arm/src/stm32f7/stm32_exti.h @@ -78,7 +78,7 @@ extern "C" * - fallingedge: Enables interrupt on falling edges * - event: Generate event when set * - func: When non-NULL, generate interrupt - * - arg: Argument passed to the interrupt callback + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This diff --git a/arch/arm/src/stm32f7/stm32_gpio.h b/arch/arm/src/stm32f7/stm32_gpio.h index f79b398b7a1..70bb15897a4 100644 --- a/arch/arm/src/stm32f7/stm32_gpio.h +++ b/arch/arm/src/stm32f7/stm32_gpio.h @@ -315,27 +315,29 @@ void stm32_gpiowrite(uint32_t pinset, bool value); bool stm32_gpioread(uint32_t pinset); -/************************************************************************************ +/**************************************************************************** * Name: stm32_gpiosetevent * * Description: * Sets/clears GPIO based event and interrupt triggers. * * Parameters: - * - pinset: gpio pin configuration - * - rising/falling edge: enables - * - event: generate event when set - * - func: when non-NULL, generate interrupt + * - pinset: GPIO pin configuration + * - risingedge: Enables interrupt on rising edges + * - fallingedge: Enables interrupt on falling edges + * - event: Generate event when set + * - func: When non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: - * The previous value of the interrupt handler function pointer. This value may, - * for example, be used to restore the previous handler when multiple handlers are - * used. + * The previous value of the interrupt handler function pointer. This + * value may, for example, be used to restore the previous handler when + * multiple handlers are used. * - ************************************************************************************/ + ****************************************************************************/ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func); + bool event, xcpt_t func, void *arg); /************************************************************************************ * Function: stm32_dumpgpio diff --git a/arch/arm/src/stm32l4/stm32l4_exti.h b/arch/arm/src/stm32l4/stm32l4_exti.h index 0e0a63cf6f0..d090ea7d483 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti.h +++ b/arch/arm/src/stm32l4/stm32l4_exti.h @@ -87,7 +87,7 @@ extern "C" ************************************************************************************/ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func, void *arg); + bool event, xcpt_t func, void *arg); /**************************************************************************** * Name: stm32l4_exti_alarm diff --git a/arch/arm/src/stm32l4/stm32l4_gpio.h b/arch/arm/src/stm32l4/stm32l4_gpio.h index 04dbc5679b1..17ce32162fb 100644 --- a/arch/arm/src/stm32l4/stm32l4_gpio.h +++ b/arch/arm/src/stm32l4/stm32l4_gpio.h @@ -331,6 +331,7 @@ bool stm32l4_gpioread(uint32_t pinset); * - rising/falling edge: enables * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This value may, @@ -340,7 +341,7 @@ bool stm32l4_gpioread(uint32_t pinset); ************************************************************************************/ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func); + bool event, xcpt_t func, void *arg); /************************************************************************************ * Function: stm32l4_dumpgpio From 44abbe60aac8fa6612005d808865224f5403ec2f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 14:51:29 -0600 Subject: [PATCH 25/38] Fix typo in name of callback field. --- arch/arm/src/stm32/stm32_exti_gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/src/stm32/stm32_exti_gpio.c b/arch/arm/src/stm32/stm32_exti_gpio.c index 86000eac762..cc61b2a1a01 100644 --- a/arch/arm/src/stm32/stm32_exti_gpio.c +++ b/arch/arm/src/stm32/stm32_exti_gpio.c @@ -342,7 +342,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, for (i = 0; i < nshared; i++) { - if (shared_cbs[i].handler != NULL) + if (shared_cbs[i].callback != NULL) { break; } From 2ef4433220c2ff0c8d288c8a5027c70760ab75c6 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 14:53:37 -0600 Subject: [PATCH 26/38] Missing interrupt argument parameter. --- arch/arm/src/stm32/stm32_exti_pwr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/src/stm32/stm32_exti_pwr.c b/arch/arm/src/stm32/stm32_exti_pwr.c index 9e3429f98fc..81cad7b5008 100644 --- a/arch/arm/src/stm32/stm32_exti_pwr.c +++ b/arch/arm/src/stm32/stm32_exti_pwr.c @@ -122,7 +122,7 @@ static int stm32_exti_pvd_isr(int irq, void *context, FAR void *arg) ****************************************************************************/ xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, - xcpt_t func) + xcpt_t func, void *arg) { xcpt_t oldhandler; From 80dba27434bc5ec5ed8d4b5c880b637788d325f2 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 15:00:42 -0600 Subject: [PATCH 27/38] Fix copy past type: xcptr_t -> xcpt_t --- arch/arm/src/stm32/stm32_exti_gpio.c | 4 ++-- arch/arm/src/stm32f7/stm32_exti_gpio.c | 28 ++++++++++++------------ arch/arm/src/stm32l4/stm32l4_exti_comp.c | 2 +- arch/arm/src/stm32l4/stm32l4_exti_gpio.c | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/arch/arm/src/stm32/stm32_exti_gpio.c b/arch/arm/src/stm32/stm32_exti_gpio.c index cc61b2a1a01..2e882986ec1 100644 --- a/arch/arm/src/stm32/stm32_exti_gpio.c +++ b/arch/arm/src/stm32/stm32_exti_gpio.c @@ -61,8 +61,8 @@ struct gpio_callback_s { - xcptr_t callback; - void *arg; + xcpt_t callback; + void *arg; }; /**************************************************************************** diff --git a/arch/arm/src/stm32f7/stm32_exti_gpio.c b/arch/arm/src/stm32f7/stm32_exti_gpio.c index 6bee1834a46..a4ec7a3d866 100644 --- a/arch/arm/src/stm32f7/stm32_exti_gpio.c +++ b/arch/arm/src/stm32f7/stm32_exti_gpio.c @@ -74,8 +74,8 @@ struct gpio_callback_s { - xcptr_t callback; - void *arg; + xcpt_t callback; + void *arg; }; /**************************************************************************** @@ -106,8 +106,8 @@ static int stm32_exti0_isr(int irq, void *context) if (g_gpio_callbacks[0].callback != NULL) { - xcptr_t callback = g_gpio_callbacks[0].callback; - void *arg = g_gpio_callbacks[0].arg; + xcpt_t callback = g_gpio_callbacks[0].callback; + void *arg = g_gpio_callbacks[0].arg; ret = callback(irq, context, arg); } @@ -127,8 +127,8 @@ static int stm32_exti1_isr(int irq, void *context) if (g_gpio_callbacks[1].callback != NULL) { - xcptr_t callback = g_gpio_callbacks[1].callback; - void *arg = g_gpio_callbacks[1].arg; + xcpt_t callback = g_gpio_callbacks[1].callback; + void *arg = g_gpio_callbacks[1].arg; ret = callback(irq, context, arg); } @@ -148,8 +148,8 @@ static int stm32_exti2_isr(int irq, void *context) if (g_gpio_callbacks[2].callback != NULL) { - xcptr_t callback = g_gpio_callbacks[2].callback; - void *arg = g_gpio_callbacks[2].arg; + xcpt_t callback = g_gpio_callbacks[2].callback; + void *arg = g_gpio_callbacks[2].arg; ret = callback(irq, context, arg); } @@ -169,8 +169,8 @@ static int stm32_exti3_isr(int irq, void *context) if (g_gpio_callbacks[3].callback != NULL) { - xcptr_t callback = g_gpio_callbacks[3].callback; - void *arg = g_gpio_callbacks[3].arg; + xcpt_t callback = g_gpio_callbacks[3].callback; + void *arg = g_gpio_callbacks[3].arg; ret = callback(irq, context, arg); } @@ -190,8 +190,8 @@ static int stm32_exti4_isr(int irq, void *context) if (g_gpio_callbacks[4].callback != NULL) { - xcptr_t callback = g_gpio_callbacks[4].callback; - void *arg = g_gpio_callbacks[4].arg; + xcpt_t callback = g_gpio_callbacks[4].callback; + void *arg = g_gpio_callbacks[4].arg; ret = callback(irq, context, arg); } @@ -226,8 +226,8 @@ static int stm32_exti_multiisr(int irq, void *context, int first, int last) if (g_gpio_callbacks[pin].callback != NULL) { - xcptr_t callback = g_gpio_callbacks[pin].callback; - void *arg = g_gpio_callbacks[pin].arg; + xcpt_t callback = g_gpio_callbacks[pin].callback; + void *arg = g_gpio_callbacks[pin].arg; int tmp; tmp = callback(irq, context, arg); diff --git a/arch/arm/src/stm32l4/stm32l4_exti_comp.c b/arch/arm/src/stm32l4/stm32l4_exti_comp.c index bb25e5b0962..b3aeb1e592a 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_comp.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_comp.c @@ -53,7 +53,7 @@ struct comp_callback_s { - xcptr_t callback; + xcpt_t callback; void *arg; }; diff --git a/arch/arm/src/stm32l4/stm32l4_exti_gpio.c b/arch/arm/src/stm32l4/stm32l4_exti_gpio.c index 298237fbfd5..c41fc7a8e6c 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_gpio.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_gpio.c @@ -61,7 +61,7 @@ struct gpio_callback_s { - xcptr_t callback; + xcpt_t callback; void *arg; }; From 95856946d21cb9bb6f8955c4ad5c4197cebb8af4 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 15:22:35 -0600 Subject: [PATCH 28/38] Interrupt argument bugfixes --- arch/arm/src/stm32l4/stm32l4_exti_comp.c | 2 +- arch/arm/src/stm32l4/stm32l4_exti_gpio.c | 2 +- arch/arm/src/stm32l4/stm32l4_exti_pwr.c | 2 +- arch/arm/src/stm32l4/stm32l4_rtcc.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/stm32l4/stm32l4_exti_comp.c b/arch/arm/src/stm32l4/stm32l4_exti_comp.c index b3aeb1e592a..7c508a11668 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_comp.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_comp.c @@ -54,7 +54,7 @@ struct comp_callback_s { xcpt_t callback; - void *arg; + void *arg; }; /**************************************************************************** diff --git a/arch/arm/src/stm32l4/stm32l4_exti_gpio.c b/arch/arm/src/stm32l4/stm32l4_exti_gpio.c index c41fc7a8e6c..e0eeabe529f 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_gpio.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_gpio.c @@ -62,7 +62,7 @@ struct gpio_callback_s { xcpt_t callback; - void *arg; + void *arg; }; /**************************************************************************** diff --git a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c index 4f8541817d1..9ac88be2dc0 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c @@ -66,7 +66,7 @@ /* Interrupt handlers attached to the PVD EXTI */ static xcpt_t g_pvd_callback; -static void *g_callback_arg +static void *g_callback_arg; /**************************************************************************** * Public Data diff --git a/arch/arm/src/stm32l4/stm32l4_rtcc.c b/arch/arm/src/stm32l4/stm32l4_rtcc.c index d783804c084..0d2627123be 100644 --- a/arch/arm/src/stm32l4/stm32l4_rtcc.c +++ b/arch/arm/src/stm32l4/stm32l4_rtcc.c @@ -801,7 +801,7 @@ static inline void rtc_enable_alarm(void) * 3. Configure the RTC to generate RTC alarms (Alarm A or Alarm B). */ - stm32l4_exti_alarm(true, false, true, stm32l4_rtc_alarm_handler); + stm32l4_exti_alarm(true, false, true, stm32l4_rtc_alarm_handler, NULL); g_alarm_enabled = true; } } From 704df7bd3932cdcf6c9bd6dd6be64dfce0c6bed0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 19:28:24 -0600 Subject: [PATCH 29/38] IRQ arguments: Fix errors discovered in build testing --- arch/arm/src/stm32/stm32f40xxx_rtcc.c | 2 +- arch/arm/src/stm32l4/stm32l4_exti_alarm.c | 2 +- arch/arm/src/stm32l4/stm32l4_exti_pwr.c | 4 ---- arch/arm/src/stm32l4/stm32l4_exti_pwr.h | 3 ++- configs/fire-stm32v2/src/stm32_enc28j60.c | 3 ++- configs/hymini-stm32v/src/stm32_ts.c | 2 +- configs/stm32f4discovery/src/stm32_pmbuttons.c | 4 ++-- configs/stm32l476-mdk/src/stm32_buttons.c | 4 ++-- configs/stm32l476vg-disco/src/stm32_buttons.c | 5 +++-- configs/stm32l476vg-disco/src/stm32_usb.c | 2 +- drivers/input/ads7843e.c | 4 ++-- drivers/net/enc28j60.c | 4 ++-- 12 files changed, 19 insertions(+), 20 deletions(-) diff --git a/arch/arm/src/stm32/stm32f40xxx_rtcc.c b/arch/arm/src/stm32/stm32f40xxx_rtcc.c index cbd136d6d53..c0801a4a8f8 100644 --- a/arch/arm/src/stm32/stm32f40xxx_rtcc.c +++ b/arch/arm/src/stm32/stm32f40xxx_rtcc.c @@ -847,7 +847,7 @@ static inline void rtc_enable_alarm(void) * 3. Configure the RTC to generate RTC alarms (Alarm A or Alarm B). */ - stm32_exti_alarm(true, false, true, stm32_rtc_alarm_handler); + stm32_exti_alarm(true, false, true, stm32_rtc_alarm_handler, NULL); g_alarm_enabled = true; } } diff --git a/arch/arm/src/stm32l4/stm32l4_exti_alarm.c b/arch/arm/src/stm32l4/stm32l4_exti_alarm.c index 2cfcbe052e0..af0dac1bd93 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_alarm.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_alarm.c @@ -124,7 +124,7 @@ xcpt_t stm32l4_exti_alarm(bool risingedge, bool fallingedge, bool event, oldhandler = g_alarm_callback; g_alarm_callback = func; - g__callback_arg = arg; + g_callback_arg = arg; /* Install external interrupt handlers (if not already attached) */ diff --git a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c index 9ac88be2dc0..62c1dcfa572 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c @@ -68,10 +68,6 @@ static xcpt_t g_pvd_callback; static void *g_callback_arg; -/**************************************************************************** - * Public Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4_exti_pwr.h b/arch/arm/src/stm32l4/stm32l4_exti_pwr.h index 5789e370764..109da434588 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_pwr.h +++ b/arch/arm/src/stm32l4/stm32l4_exti_pwr.h @@ -57,6 +57,7 @@ * - rising/falling edge: enables interrupt on rising/falling edge * - event: generate event when set * - func: when non-NULL, generate interrupt + * - arg: Argument passed to the interrupt callback * * Returns: * The previous value of the interrupt handler function pointer. This @@ -66,6 +67,6 @@ ****************************************************************************/ xcpt_t stm32l4_exti_pvd(bool risingedge, bool fallingedge, bool event, - xcpt_t func); + xcpt_t func, void *arg); #endif /* STM32L4_EXTI_PWR_H_ */ diff --git a/configs/fire-stm32v2/src/stm32_enc28j60.c b/configs/fire-stm32v2/src/stm32_enc28j60.c index 7ce3f4de651..9ac4040e4ba 100644 --- a/configs/fire-stm32v2/src/stm32_enc28j60.c +++ b/configs/fire-stm32v2/src/stm32_enc28j60.c @@ -165,7 +165,8 @@ static void up_enable(FAR const struct enc_lower_s *lower) static void up_disable(FAR const struct enc_lower_s *lower) { - (void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, false, true, true, NULL); + (void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, false, true, true, + NULL, NULL); } /**************************************************************************** diff --git a/configs/hymini-stm32v/src/stm32_ts.c b/configs/hymini-stm32v/src/stm32_ts.c index a4abc234db7..e8889571d2b 100644 --- a/configs/hymini-stm32v/src/stm32_ts.c +++ b/configs/hymini-stm32v/src/stm32_ts.c @@ -108,7 +108,7 @@ static void hymini_ts_irq_enable(FAR struct ads7843e_config_s *state, { iinfo("%d\n", enable); - stm32_gpiosetevent(GPIO_TS_IRQ, true, true, true, enable? tc_isr:NULL); + stm32_gpiosetevent(GPIO_TS_IRQ, true, true, true, enable ? tc_isr : NULL, NULL); } /* Acknowledge/clear any pending GPIO interrupt */ diff --git a/configs/stm32f4discovery/src/stm32_pmbuttons.c b/configs/stm32f4discovery/src/stm32_pmbuttons.c index 750eaadbbe1..12d3e21e514 100644 --- a/configs/stm32f4discovery/src/stm32_pmbuttons.c +++ b/configs/stm32f4discovery/src/stm32_pmbuttons.c @@ -96,7 +96,7 @@ static int button_handler(int irq, FAR void *context); ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -static int button_handler(int irq, FAR void *context) +static int button_handler(int irq, FAR void *context, FAR void *arg) { /* At this point the MCU should have already awakened. The state * change will be handled in the IDLE loop when the system is re-awakened @@ -130,7 +130,7 @@ void stm32_pm_buttons(void) board_button_initialize(); #ifdef CONFIG_ARCH_IRQBUTTONS - xcpt_t oldhandler = board_button_irq(0, button_handler); + xcpt_t oldhandler = board_button_irq(0, button_handler, NULL); if (oldhandler != NULL) { diff --git a/configs/stm32l476-mdk/src/stm32_buttons.c b/configs/stm32l476-mdk/src/stm32_buttons.c index a44849bf4a1..7dfc0469418 100644 --- a/configs/stm32l476-mdk/src/stm32_buttons.c +++ b/configs/stm32l476-mdk/src/stm32_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm32l476-mdk/src/stm32_buttons.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved. * Author: dev@ziggurat29.com * * Redistribution and use in source and binary forms, with or without @@ -157,7 +157,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { oldhandler = stm32l4_gpiosetevent(g_buttons[id], true, true, true, - irqhandler); + irqhandler, arg); } return oldhandler; diff --git a/configs/stm32l476vg-disco/src/stm32_buttons.c b/configs/stm32l476vg-disco/src/stm32_buttons.c index ca96eecf71f..1151003c7d2 100644 --- a/configs/stm32l476vg-disco/src/stm32_buttons.c +++ b/configs/stm32l476vg-disco/src/stm32_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm32l476vg-disco/src/stm32_buttons.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved. * Author: dev@ziggurat29.com * * Redistribution and use in source and binary forms, with or without @@ -333,7 +333,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32l4_gpiosetevent(g_buttons[id], true, true, true, irqhandler); + oldhandler = stm32l4_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } return oldhandler; diff --git a/configs/stm32l476vg-disco/src/stm32_usb.c b/configs/stm32l476vg-disco/src/stm32_usb.c index de9f08c4eeb..0b08a9264d2 100644 --- a/configs/stm32l476vg-disco/src/stm32_usb.c +++ b/configs/stm32l476vg-disco/src/stm32_usb.c @@ -311,7 +311,7 @@ void stm32l4_usbhost_vbusdrive(int iface, bool enable) #ifdef CONFIG_USBHOST xcpt_t stm32l4_setup_overcurrent(xcpt_t handler) { - return stm32l4_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler); + return stm32l4_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); } #endif diff --git a/drivers/input/ads7843e.c b/drivers/input/ads7843e.c index f7019639de3..d9c2c3b9882 100644 --- a/drivers/input/ads7843e.c +++ b/drivers/input/ads7843e.c @@ -109,7 +109,7 @@ static int ads7843e_sample(FAR struct ads7843e_dev_s *priv, static int ads7843e_waitsample(FAR struct ads7843e_dev_s *priv, FAR struct ads7843e_sample_s *sample); static void ads7843e_worker(FAR void *arg); -static int ads7843e_interrupt(int irq, FAR void *context); +static int ads7843e_interrupt(int irq, FAR void *context, FAR void *arg); /* Character driver methods */ @@ -703,7 +703,7 @@ ignored: * Name: ads7843e_interrupt ****************************************************************************/ -static int ads7843e_interrupt(int irq, FAR void *context) +static int ads7843e_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct ads7843e_dev_s *priv; FAR struct ads7843e_config_s *config; diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 9289a1bb337..8f2ab3ff02f 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -327,7 +327,7 @@ static void enc_rxerif(FAR struct enc_driver_s *priv); static void enc_rxdispatch(FAR struct enc_driver_s *priv); static void enc_pktif(FAR struct enc_driver_s *priv); static void enc_irqworker(FAR void *arg); -static int enc_interrupt(int irq, FAR void *context); +static int enc_interrupt(int irq, FAR void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -1853,7 +1853,7 @@ static void enc_irqworker(FAR void *arg) * ****************************************************************************/ -static int enc_interrupt(int irq, FAR void *context) +static int enc_interrupt(int irq, FAR void *context, FAR void *arg) { register FAR struct enc_driver_s *priv = &g_enc28j60[0]; From 7d2d541c70b6ef7d71582c19b302e69332d14dbf Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Feb 2017 20:54:18 -0600 Subject: [PATCH 30/38] Adapt some drivers to utilize the IRQ argument feature. --- arch/arm/src/a1x/a1x_serial.c | 103 ++------------------- arch/arm/src/efm32/efm32_leserial.c | 35 ++----- arch/arm/src/efm32/efm32_pwm.c | 98 +++----------------- arch/arm/src/imx6/imx_ecspi.c | 79 +--------------- arch/arm/src/imx6/imx_serial.c | 75 ++------------- arch/arm/src/sam34/sam_twi.c | 36 ++------ arch/arm/src/sama5/sam_can.c | 70 ++------------ arch/arm/src/sama5/sam_dmac.c | 31 ++----- arch/arm/src/sama5/sam_emacb.c | 51 ++--------- arch/arm/src/sama5/sam_flexcom_serial.c | 80 ++-------------- arch/arm/src/sama5/sam_hsmci.c | 76 +++------------- arch/arm/src/sama5/sam_serial.c | 110 +--------------------- arch/arm/src/sama5/sam_twi.c | 55 ++--------- arch/arm/src/sama5/sam_xdmac.c | 31 ++----- arch/arm/src/samdl/sam_serial.c | 90 ++---------------- arch/arm/src/samdl/sam_spi.c | 100 ++------------------ arch/arm/src/samv7/sam_emac.c | 52 ++--------- arch/arm/src/samv7/sam_hsmci.c | 54 ++--------- arch/arm/src/samv7/sam_mcan.c | 68 ++------------ arch/arm/src/samv7/sam_serial.c | 116 ++---------------------- arch/arm/src/samv7/sam_spi_slave.c | 67 ++------------ 21 files changed, 169 insertions(+), 1308 deletions(-) diff --git a/arch/arm/src/a1x/a1x_serial.c b/arch/arm/src/a1x/a1x_serial.c index 656e55f2723..ec8de5e0090 100644 --- a/arch/arm/src/a1x/a1x_serial.c +++ b/arch/arm/src/a1x/a1x_serial.c @@ -93,7 +93,6 @@ struct up_dev_s uint32_t uartbase; /* Base address of UART registers */ uint32_t baud; /* Configured baud */ uint32_t ier; /* Saved IER value */ - xcpt_t handler; /* UART interrupt handler */ uint8_t irq; /* IRQ associated with this UART */ uint8_t parity; /* 0=none, 1=odd, 2=even */ uint8_t bits; /* Number of bits (7 or 8) */ @@ -108,31 +107,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static int uart_interrupt(struct uart_dev_s *dev); -#ifdef CONFIG_A1X_UART0 -static int uart0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_A1X_UART1 -static int uart1_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_A1X_UART2 -static int uart2_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_A1X_UART3 -static int uart3_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_A1X_UART4 -static int uart4_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_A1X_UART5 -static int uart5_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_A1X_UART6 -static int uart6_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_A1X_UART7 -static int uart7_interrupt(int irq, void *context, FAR void *arg); -#endif +static int uart_interrupt(int irq, void *context, void *arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, uint32_t *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -214,7 +189,6 @@ static struct up_dev_s g_uart0priv = { .uartbase = A1X_UART0_VADDR, .baud = CONFIG_UART0_BAUD, - .handler = uart0_interrupt, .irq = A1X_IRQ_UART0, .parity = CONFIG_UART0_PARITY, .bits = CONFIG_UART0_BITS, @@ -245,7 +219,6 @@ static struct up_dev_s g_uart1priv = { .uartbase = A1X_UART1_VADDR, .baud = CONFIG_UART1_BAUD, - .handler = uart1_interrupt, .irq = A1X_IRQ_UART1, .parity = CONFIG_UART1_PARITY, .bits = CONFIG_UART1_BITS, @@ -276,7 +249,6 @@ static struct up_dev_s g_uart2priv = { .uartbase = A1X_UART2_VADDR, .baud = CONFIG_UART2_BAUD, - .handler = uart2_interrupt, .irq = A1X_IRQ_UART2, .parity = CONFIG_UART2_PARITY, .bits = CONFIG_UART2_BITS, @@ -307,7 +279,6 @@ static struct up_dev_s g_uart3priv = { .uartbase = A1X_UART3_VADDR, .baud = CONFIG_UART3_BAUD, - .handler = uart3_interrupt, .irq = A1X_IRQ_UART3, .parity = CONFIG_UART3_PARITY, .bits = CONFIG_UART3_BITS, @@ -338,7 +309,6 @@ static struct up_dev_s g_uart4priv = { .uartbase = A1X_UART4_VADDR, .baud = CONFIG_UART4_BAUD, - .handler = uart4_interrupt, .irq = A1X_IRQ_UART4, .parity = CONFIG_UART4_PARITY, .bits = CONFIG_UART4_BITS, @@ -369,7 +339,6 @@ static struct up_dev_s g_uart5priv = { .uartbase = A1X_UART5_VADDR, .baud = CONFIG_UART5_BAUD, - .handler = uart5_interrupt, .irq = A1X_IRQ_UART5, .parity = CONFIG_UART5_PARITY, .bits = CONFIG_UART5_BITS, @@ -400,7 +369,6 @@ static struct up_dev_s g_uart6priv = { .uartbase = A1X_UART6_VADDR, .baud = CONFIG_UART6_BAUD, - .handler = uart6_interrupt, .irq = A1X_IRQ_UART6, .parity = CONFIG_UART6_PARITY, .bits = CONFIG_UART6_BITS, @@ -431,7 +399,6 @@ static struct up_dev_s g_uart7priv = { .uartbase = A1X_UART7_VADDR, .baud = CONFIG_UART7_BAUD, - .handler = uart7_interrupt, .irq = A1X_IRQ_UART7, .parity = CONFIG_UART7_PARITY, .bits = CONFIG_UART7_BITS, @@ -1068,7 +1035,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler, NULL); + ret = irq_attach(priv->irq, uart_interrupt, priv); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -1110,12 +1077,14 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int uart_interrupt(struct uart_dev_s *dev) +static int uart_interrupt(int irq, void *context, void *arg) { - struct up_dev_s *priv; - uint32_t status; - int passes; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; + struct up_dev_s *priv = (struct up_dev_s *)arg; + uint32_t status; + int passes; + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, @@ -1201,62 +1170,6 @@ static int uart_interrupt(struct uart_dev_s *dev) return OK; } -#ifdef CONFIG_A1X_UART0 -static int uart0_interrupt(int irq, void *context, FAR void *arg) -{ - return uart_interrupt(&g_uart0port); -} -#endif - -#ifdef CONFIG_A1X_UART1 -static int uart1_interrupt(int irq, void *context, FAR void *arg) -{ - return uart_interrupt(&g_uart1port); -} -#endif - -#ifdef CONFIG_A1X_UART2 -static int uart2_interrupt(int irq, void *context, FAR void *arg) -{ - return uart_interrupt(&g_uart2port); -} -#endif - -#ifdef CONFIG_A1X_UART3 -static int uart3_interrupt(int irq, void *context, FAR void *arg) -{ - return uart_interrupt(&g_uart3port); -} -#endif - -#ifdef CONFIG_A1X_UART4 -static int uart4_interrupt(int irq, void *context, FAR void *arg) -{ - return uart_interrupt(&g_uart4port); -} -#endif - -#ifdef CONFIG_A1X_UART5 -static int uart5_interrupt(int irq, void *context, FAR void *arg) -{ - return uart_interrupt(&g_uart5port); -} -#endif - -#ifdef CONFIG_A1X_UART6 -static int uart6_interrupt(int irq, void *context, FAR void *arg) -{ - return uart_interrupt(&g_uart6port); -} -#endif - -#ifdef CONFIG_A1X_UART7 -static int uart7_interrupt(int irq, void *context, FAR void *arg) -{ - return uart_interrupt(&g_uart7port); -} -#endif - /**************************************************************************** * Name: up_ioctl * diff --git a/arch/arm/src/efm32/efm32_leserial.c b/arch/arm/src/efm32/efm32_leserial.c index 0a9e5e41a04..de8d157c8ab 100644 --- a/arch/arm/src/efm32/efm32_leserial.c +++ b/arch/arm/src/efm32/efm32_leserial.c @@ -134,7 +134,6 @@ struct efm32_config_s { uintptr_t uartbase; /* Base address of UART registers */ - xcpt_t handler; /* Interrupt handler */ uint32_t baud; /* Configured baud */ uint8_t irq; /* IRQ associated with this LEUART (for enable) */ uint8_t parity; /* 0=none, 1=odd, 2=even */ @@ -163,13 +162,7 @@ static int efm32_setup(struct uart_dev_s *dev); static void efm32_shutdown(struct uart_dev_s *dev); static int efm32_attach(struct uart_dev_s *dev); static void efm32_detach(struct uart_dev_s *dev); -static int efm32_interrupt(struct uart_dev_s *dev); -#if defined(CONFIG_EFM32_LEUART0) -static int efm32_leuart0_interrupt(int irq, void *context, FAR void *arg); -#endif -#if defined(CONFIG_EFM32_LEUART1) -static int efm32_leuart1_interrupt(int irq, void *context, FAR void *arg); -#endif +static int efm32_interrupt(int irq, void *context, FAR void *arg); static int efm32_ioctl(struct file *filep, int cmd, unsigned long arg); static int efm32_receive(struct uart_dev_s *dev, uint32_t *status); static void efm32_rxint(struct uart_dev_s *dev, bool enable); @@ -219,7 +212,6 @@ static char g_leuart1txbuffer[CONFIG_LEUART1_TXBUFSIZE]; static const struct efm32_config_s g_leuart0config = { .uartbase = EFM32_LEUART0_BASE, - .handler = efm32_leuart0_interrupt, .baud = CONFIG_LEUART0_BAUD, .irq = EFM32_IRQ_LEUART0, .parity = CONFIG_LEUART0_PARITY, @@ -255,7 +247,6 @@ static struct uart_dev_s g_leuart0port = static struct efm32_config_s g_leuart1config = { .uartbase = EFM32_LEUART1_BASE, - .handler = efm32_leuart1_interrupt, .baud = CONFIG_LEUART1_BAUD, .irq = EFM32_IRQ_LEUART1, .parity = CONFIG_LEUART1_PARITY, @@ -429,7 +420,7 @@ static int efm32_attach(struct uart_dev_s *dev) * disabled in the C2 register. */ - ret = irq_attach(config->irq, config->handler, NULL); + ret = irq_attach(config->irq, efm32_interrupt, dev); if (ret >= 0) { up_enable_irq(config->irq); @@ -471,12 +462,14 @@ static void efm32_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int efm32_interrupt(struct uart_dev_s *dev) +static int efm32_interrupt(int irq, void *context, FAR void *arg) { - struct efm32_leuart_s *priv = (struct efm32_leuart_s *)dev->priv; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; + struct efm32_leuart_s *priv; uint32_t intflags; - DEBUGASSERT(priv); + DEBUGASSERT(dev != NULL && dev->priv != NULL); + priv = (struct efm32_leuart_s *)dev->priv; /* Read the interrupt flags register */ @@ -534,20 +527,6 @@ static int efm32_interrupt(struct uart_dev_s *dev) return OK; } -#if defined(CONFIG_EFM32_LEUART0) -static int efm32_leuart0_interrupt(int irq, void *context, FAR void *arg) -{ - return efm32_interrupt(&g_leuart0port); -} -#endif - -#if defined(CONFIG_EFM32_LEUART1) -static int efm32_leuart1_interrupt(int irq, void *context, FAR void *arg) -{ - return efm32_interrupt(&g_leuart1port); -} -#endif - /**************************************************************************** * Name: efm32_ioctl * diff --git a/arch/arm/src/efm32/efm32_pwm.c b/arch/arm/src/efm32/efm32_pwm.c index adaa3edd670..180fe04e00c 100644 --- a/arch/arm/src/efm32/efm32_pwm.c +++ b/arch/arm/src/efm32/efm32_pwm.c @@ -133,19 +133,7 @@ static int pwm_timer(FAR struct efm32_pwmtimer_s *priv, defined(CONFIG_EFM32_TIMER2_PWM) || \ defined(CONFIG_EFM32_TIMER3_PWM) \ ) -static int pwm_interrupt(struct efm32_pwmtimer_s *priv); -#if defined(CONFIG_EFM32_TIMER0_PWM) -static int pwm_timer0_interrupt(int irq, void *context, FAR void *arg); -#endif -#if defined(CONFIG_EFM32_TIMER1_PWM) -static int pwm_timer1_interrupt(int irq, void *context); -#endif -#if defined(CONFIG_EFM32_TIMER2_PWM) -static int pwm_timer2_interrupt(int irq, void *context, FAR void *arg); -#endif -#if defined(CONFIG_EFM32_TIMER3_PWM) -static int pwm_timer3_interrupt(int irq, void *context, FAR void *arg); -#endif +static int pwm_interrupt(int irq, void *context, FAR void *arg); static uint8_t pwm_pulsecount(uint32_t count); #endif @@ -446,7 +434,7 @@ static int pwm_timer(FAR struct efm32_pwmtimer_s *priv, * Handle timer interrupts. * * Input parameters: - * priv - A reference to the lower half PWM driver state structure + * Standard interrupt handler arguments. * * Returned Value: * Zero on success; a negated errno value on failure @@ -459,12 +447,15 @@ static int pwm_timer(FAR struct efm32_pwmtimer_s *priv, defined(CONFIG_EFM32_TIMER3_PWM) \ ) #warning "not yet implemented" -static int pwm_interrupt(struct efm32_pwmtimer_s *priv) +static int pwm_interrupt(int irq, void *context, FAR void *arg) { /* TODO pwm_interrupt */ #if 0 + struct efm32_pwmtimer_s *priv = (struct efm32_pwmtimer_s *)arg; uint32_t regval; + DEBUGASSERT(priv != NULL); + /* Verify that this is an update interrupt. Nothing else is expected. */ regval = pwm_getreg(priv, STM32_ATIM_SR_OFFSET); @@ -532,48 +523,6 @@ static int pwm_interrupt(struct efm32_pwmtimer_s *priv) } #endif -/**************************************************************************** - * Name: pwm_timer1/3_interrupt - * - * Description: - * Handle timer 1..3 interrupts. - * - * Input parameters: - * Standard NuttX interrupt inputs - * - * Returned Value: - * Zero on success; a negated errno value on failure - * - ****************************************************************************/ - -#if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_EFM32_TIMER0_PWM) -static int pwm_timer0_interrupt(int irq, void *context, FAR void *arg) -{ - return pwm_interrupt(&g_pwm0dev); -} -#endif - -#if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_EFM32_TIMER1_PWM) -static int pwm_timer1_interrupt(int irq, void *context) -{ - return pwm_interrupt(&g_pwm1dev); -} -#endif - -#if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_EFM32_TIMER2_PWM) -static int pwm_timer2_interrupt(int irq, void *context, FAR void *arg) -{ - return pwm_interrupt(&g_pwm2dev); -} -#endif - -#if defined(CONFIG_PWM_PULSECOUNT) && defined(CONFIG_EFM32_TIMER3_PWM) -static int pwm_timer3_interrupt(int irq, void *context, FAR void *arg) -{ - return pwm_interrupt(&g_pwm3dev); -} -#endif - /**************************************************************************** * Name: pwm_pulsecount * @@ -866,50 +815,22 @@ FAR struct pwm_lowerhalf_s *efm32_pwminitialize(int timer) #ifdef CONFIG_EFM32_TIMER0_PWM case 0: lower = &g_pwm0dev; - - /* Attach but disable the TIM1 update interrupt */ - -#ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, pwm_timer0_interrupt, NULL); - up_disable_irq(lower->irq); -#endif break; #endif #ifdef CONFIG_EFM32_TIMER1_PWM case 1: lower = &g_pwm1dev; - - /* Attach but disable the TIM1 update interrupt */ - -#ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, pwm_timer0_interrupt, NULL); - up_disable_irq(lower->irq); -#endif break; #endif #ifdef CONFIG_EFM32_TIMER2_PWM case 2: lower = &g_pwm2dev; - - /* Attach but disable the TIM1 update interrupt */ - -#ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, pwm_timer2_interrupt, NULL); - up_disable_irq(lower->irq); -#endif break; #endif #ifdef CONFIG_EFM32_TIMER3_PWM case 3: lower = &g_pwm3dev; - - /* Attach but disable the TIM1 update interrupt */ - -#ifdef CONFIG_PWM_PULSECOUNT - irq_attach(lower->irq, pwm_timer3_interrupt, NULL); - up_disable_irq(lower->irq); -#endif break; #endif @@ -918,6 +839,13 @@ FAR struct pwm_lowerhalf_s *efm32_pwminitialize(int timer) return NULL; } + /* Attach but disable the timer update interrupt */ + +#ifdef CONFIG_PWM_PULSECOUNT + irq_attach(lower->irq, pwm_interrupt, lower); + up_disable_irq(lower->irq); +#endif + return (FAR struct pwm_lowerhalf_s *)lower; } diff --git a/arch/arm/src/imx6/imx_ecspi.c b/arch/arm/src/imx6/imx_ecspi.c index 328b72a2e5b..01994196817 100644 --- a/arch/arm/src/imx6/imx_ecspi.c +++ b/arch/arm/src/imx6/imx_ecspi.c @@ -186,7 +186,6 @@ struct imx_spidev_s uint8_t spindx; /* SPI index */ #ifndef CONFIG_SPI_POLLWAIT uint8_t irq; /* SPI IRQ number */ - xcpt_t handler; /* ECSPI interrupt handler */ #endif /* Per SPI callouts to board-specific logic */ @@ -223,22 +222,7 @@ static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer, /* Interrupt handling */ #ifndef CONFIG_SPI_POLLWAIT -static int spi_interrupt(struct imx_spidev_s *priv); -#ifdef CONFIG_IMX6_ECSPI1 -static int ecspi1_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_IMX6_ECSPI2 -static int ecspi2_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_IMX6_ECSPI3 -static int ecspi3_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_IMX6_ECSPI4 -static int ecspi4_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_IMX6_ECSPI5 -static int ecspi5_interrupt(int irq, void *context, FAR void *arg); -#endif +static int spi_interrupt(int irq, void *context, FAR void *arg); #endif /* SPI methods */ @@ -307,7 +291,6 @@ static struct imx_spidev_s g_spidev[] = .spindx = SPI1_NDX, #ifndef CONFIG_SPI_POLLWAIT .irq = IMX_IRQ_ECSPI1, - .handler = ecspi1_interrupt, #endif .select = imx_spi1select, .status = imx_spi1status, @@ -324,7 +307,6 @@ static struct imx_spidev_s g_spidev[] = .spindx = SPI2_NDX, #ifndef CONFIG_SPI_POLLWAIT .irq = IMX_IRQ_ECSPI2, - .handler = ecspi2_interrupt, #endif .select = imx_spi2select, .status = imx_spi2status, @@ -341,7 +323,6 @@ static struct imx_spidev_s g_spidev[] = .spindx = SPI3_NDX, #ifndef CONFIG_SPI_POLLWAIT .irq = IMX_IRQ_ECSPI3, - .handler = ecspi3_interrupt, #endif .select = imx_spi3select, .status = imx_spi3status, @@ -358,7 +339,6 @@ static struct imx_spidev_s g_spidev[] = .spindx = SPI4_NDX, #ifndef CONFIG_SPI_POLLWAIT .irq = IMX_IRQ_ECSPI4, - .handler = ecspi4_interrupt, #endif .select = imx_spi4select, .status = imx_spi4status, @@ -375,7 +355,6 @@ static struct imx_spidev_s g_spidev[] = .spindx = SPI5_NDX, #ifndef CONFIG_SPI_POLLWAIT .irq = IMX_IRQ_ECSPI5, - .handler = ecspi5_interrupt, #endif .select = imx_spi5select, .status = imx_spi5status, @@ -759,8 +738,9 @@ static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer, ****************************************************************************/ #ifndef CONFIG_SPI_POLLWAIT -static int spi_interrupt(struct imx_spidev_s *priv) +static int spi_interrupt(int irq, void *context, FAR void *arg) { + struct imx_spidev_s *priv = (struct imx_spidev_s *)arg; int ntxd; DEBUGASSERT(priv != NULL); @@ -790,57 +770,6 @@ static int spi_interrupt(struct imx_spidev_s *priv) } #endif -/**************************************************************************** - * Name: ecspiN_interrupt, N=1..5 - * - * Description: - * Individual ECPSI interrupt handlers. - * - * Input Parameters: - * Standard interrupt handler inputs - * - * Returned Value: - * 0: success, <0:Negated error number on failure - * - ****************************************************************************/ - -#ifndef CONFIG_SPI_POLLWAIT -#ifdef CONFIG_IMX6_ECSPI1 -static int ecspi1_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spidev[SPI1_NDX]); -} -#endif - -#ifdef CONFIG_IMX6_ECSPI2 -static int ecspi2_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spidev[SPI2_NDX]); -} -#endif - -#ifdef CONFIG_IMX6_ECSPI3 -static int ecspi3_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spidev[SPI3_NDX]); -} -#endif - -#ifdef CONFIG_IMX6_ECSPI4 -static int ecspi4_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spidev[SPI4_NDX]); -} -#endif - -#ifdef CONFIG_IMX6_ECSPI5 -static int ecspi5_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spidev[SPI5_NDX]); -} -#endif -#endif - /**************************************************************************** * Name: spi_lock * @@ -1425,7 +1354,7 @@ FAR struct spi_dev_s *imx_spibus_initialize(int port) /* Attach the interrupt */ #ifndef CONFIG_SPI_POLLWAIT - DEBUGVERIFY(irq_attach(priv->irq, priv->handler, NULL)); + DEBUGVERIFY(irq_attach(priv->irq, spi_interrupt, priv)); #endif /* Enable SPI */ diff --git a/arch/arm/src/imx6/imx_serial.c b/arch/arm/src/imx6/imx_serial.c index cfae168cd2d..8ae64136b52 100644 --- a/arch/arm/src/imx6/imx_serial.c +++ b/arch/arm/src/imx6/imx_serial.c @@ -199,7 +199,6 @@ struct imx_uart_s { - xcpt_t handler; /* Interrupt handler */ uint32_t uartbase; /* Base address of UART registers */ uint32_t baud; /* Configured baud */ uint32_t ucr1; /* Saved UCR1 value */ @@ -229,24 +228,7 @@ static int imx_setup(struct uart_dev_s *dev); static void imx_shutdown(struct uart_dev_s *dev); static int imx_attach(struct uart_dev_s *dev); static void imx_detach(struct uart_dev_s *dev); - -static int imx_interrupt(struct uart_dev_s *dev); -#ifdef CONFIG_IMX6_UART1 -static int imx_uart1_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_IMX6_UART2 -static int imx_uart2_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_IMX6_UART3 -static int imx_uart3_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_IMX6_UART4 -static int imx_uart4_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_IMX6_UART5 -static int imx_uart5_interrupt(int irq, void *context, FAR void *arg); -#endif - +static int imx_interrupt(int irq, void *context, FAR void *arg); static int imx_ioctl(struct file *filep, int cmd, unsigned long arg); static int imx_receive(struct uart_dev_s *dev, uint32_t *status); static void imx_rxint(struct uart_dev_s *dev, bool enable); @@ -317,7 +299,6 @@ static char g_uart5txbuffer[CONFIG_UART5_TXBUFSIZE]; #ifdef CONFIG_IMX6_UART1 static struct imx_uart_s g_uart1priv = { - .handler = imx_uart1_interrupt, .uartbase = IMX_UART1_VBASE, .baud = CONFIG_UART1_BAUD, .irq = IMX_IRQ_UART1, @@ -348,7 +329,6 @@ static struct uart_dev_s g_uart1port = #ifdef CONFIG_IMX6_UART2 static struct imx_uart_s g_uart2priv = { - .handler = imx_uart2_interrupt, .uartbase = IMX_UART2_VBASE, .baud = CONFIG_UART2_BAUD, .irq = IMX_IRQ_UART2, @@ -377,7 +357,6 @@ static struct uart_dev_s g_uart2port = #ifdef CONFIG_IMX6_UART3 static struct imx_uart_s g_uart3priv = { - .handler = imx_uart3_interrupt, .uartbase = IMX_UART3_REGISTER_BASE, .baud = IMX_UART3_VBASE, .irq = IMX_IRQ_UART3, @@ -406,7 +385,6 @@ static struct uart_dev_s g_uart3port = #ifdef CONFIG_IMX6_UART4 static struct imx_uart_s g_uart4priv = { - .handler = imx_uart4_interrupt, .uartbase = IMX_UART4_REGISTER_BASE, .baud = IMX_UART4_VBASE, .irq = IMX_IRQ_UART4, @@ -435,7 +413,6 @@ static struct uart_dev_s g_uart4port = #ifdef CONFIG_IMX6_UART5 static struct imx_uart_s g_uart5priv = { - .handler = imx_uart5_interrupt, .uartbase = IMX_UART5_REGISTER_BASE, .baud = IMX_UART5_VBASE, .irq = IMX_IRQ_UART5, @@ -618,7 +595,7 @@ static int imx_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler, NULL); + ret = irq_attach(priv->irq, imx_interrupt, priv); if (ret == OK) { /* Configure as a (high) level interrupt */ @@ -663,12 +640,16 @@ static void imx_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int imx_interrupt(struct uart_dev_s *dev) +static int imx_interrupt(int irq, void *context, FAR void *arg) { - struct imx_uart_s *priv = (struct imx_uart_s *)dev->priv; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; + struct imx_uart_s *priv; uint32_t usr1; int passes = 0; + DEBUGASSERT(dev != NULL && dev->priv != NULL); + priv = (struct imx_uart_s *)dev->priv; + /* Loop until there are no characters to be transferred or, * until we have been looping for a long time. */ @@ -710,46 +691,6 @@ static int imx_interrupt(struct uart_dev_s *dev) } } -/**************************************************************************** - * Name: imx_uart[n]_interrupt - * - * Description: - * UART-specific interrupt handlers just transfer control to the common - * UART interrupt handler, passing the relevant driver state structure. - * - ****************************************************************************/ - -#ifdef CONFIG_IMX6_UART1 -static int imx_uart1_interrupt(int irq, void *context, FAR void *arg) -{ - return imx_interrupt(&g_uart1port); -} -#endif -#ifdef CONFIG_IMX6_UART2 -static int imx_uart2_interrupt(int irq, void *context, FAR void *arg) -{ - return imx_interrupt(&g_uart2port); -} -#endif -#ifdef CONFIG_IMX6_UART3 -static int imx_uart3_interrupt(int irq, void *context, FAR void *arg) -{ - return imx_interrupt(&g_uart3port); -} -#endif -#ifdef CONFIG_IMX6_UART4 -static int imx_uart4_interrupt(int irq, void *context, FAR void *arg) -{ - return imx_interrupt(&g_uart4port); -} -#endif -#ifdef CONFIG_IMX6_UART5 -static int imx_uart5_interrupt(int irq, void *context, FAR void *arg) -{ - return imx_interrupt(&g_uart5port); -} -#endif - /**************************************************************************** * Name: imx_ioctl * diff --git a/arch/arm/src/sam34/sam_twi.c b/arch/arm/src/sam34/sam_twi.c index 611be3be7f4..7242f4744d6 100644 --- a/arch/arm/src/sam34/sam_twi.c +++ b/arch/arm/src/sam34/sam_twi.c @@ -162,13 +162,7 @@ static inline void twi_putrel(struct twi_dev_s *priv, unsigned int offset, static int twi_wait(struct twi_dev_s *priv); static void twi_wakeup(struct twi_dev_s *priv, int result); -static int twi_interrupt(struct twi_dev_s *priv); -#ifdef CONFIG_SAM34_TWI0 -static int twi0_interrupt(int irq, FAR void *context); -#endif -#ifdef CONFIG_SAM34_TWI1 -static int twi1_interrupt(int irq, FAR void *context); -#endif +static int twi_interrupt(int irq, FAR void *context, FAR void *arg); static void twi_timeout(int argc, uint32_t arg, ...); static void twi_startread(struct twi_dev_s *priv, struct i2c_msg_s *msg); @@ -436,14 +430,17 @@ static void twi_wakeup(struct twi_dev_s *priv, int result) * ****************************************************************************/ -static int twi_interrupt(struct twi_dev_s *priv) +static int twi_interrupt(int irq, FAR void *context, FAR void *arg); { + struct twi_dev_s *priv = (struct twi_dev_s *)arg; struct i2c_msg_s *msg; uint32_t sr; uint32_t imr; uint32_t pending; uint32_t regval; + DEBUGASSERT(priv != NULL); + /* Retrieve masked interrupt status */ sr = twi_getrel(priv, SAM_TWI_SR_OFFSET); @@ -554,20 +551,6 @@ static int twi_interrupt(struct twi_dev_s *priv) return OK; } -#ifdef CONFIG_SAM34_TWI0 -static int twi0_interrupt(int irq, FAR void *context) -{ - return twi_interrupt(&g_twi0); -} -#endif - -#ifdef CONFIG_SAM34_TWI1 -static int twi1_interrupt(int irq, FAR void *context) -{ - return twi_interrupt(&g_twi1); -} -#endif - /**************************************************************************** * Name: twi_timeout * @@ -910,7 +893,6 @@ static void twi_hw_initialize(struct twi_dev_s *priv, unsigned int pid, struct i2c_master_s *sam_i2cbus_initialize(int bus) { struct twi_dev_s *priv; - xcpt_t handler; irqstate_t flags; uint32_t frequency; unsigned int pid; @@ -938,9 +920,8 @@ struct i2c_master_s *sam_i2cbus_initialize(int bus) sam_configgpio(GPIO_TWI0_CK); sam_configgpio(GPIO_TWI0_D); - /* Select the interrupt handler, TWI frequency, and peripheral ID */ + /* Select the TWI frequency, and peripheral ID */ - handler = twi0_interrupt; frequency = CONFIG_SAM34_TWI0_FREQUENCY; pid = SAM_PID_TWI0; } @@ -965,9 +946,8 @@ struct i2c_master_s *sam_i2cbus_initialize(int bus) sam_configgpio(GPIO_TWI1_CK); sam_configgpio(GPIO_TWI1_D); - /* Select the interrupt handler, TWI frequency, and peripheral ID */ + /* Select the TWI frequency, and peripheral ID */ - handler = twi1_interrupt; frequency = CONFIG_SAMA5_TWI1_FREQUENCY; pid = SAM_PID_TWI1; } @@ -1006,7 +986,7 @@ struct i2c_master_s *sam_i2cbus_initialize(int bus) /* Attach Interrupt Handler */ - irq_attach(priv->irq, handler, NULL); + irq_attach(priv->irq, twi_interrupt, priv); /* Enable Interrupts */ diff --git a/arch/arm/src/sama5/sam_can.c b/arch/arm/src/sama5/sam_can.c index 09559c3e8eb..4020055e89a 100644 --- a/arch/arm/src/sama5/sam_can.c +++ b/arch/arm/src/sama5/sam_can.c @@ -150,7 +150,6 @@ struct sam_config_s uint8_t port; /* CAN port number (1 or 2) */ uint8_t pid; /* CAN periperal ID/IRQ number */ uint8_t nrecvmb; /* Number of receive mailboxes */ - xcpt_t handler; /* CAN interrupt handler */ uintptr_t base; /* Base address of the CAN control registers */ uint32_t baud; /* Configured baud */ pio_pinset_t rxpinset; /* RX pin configuration */ @@ -225,13 +224,7 @@ static inline void can_rxinterrupt(FAR struct can_dev_s *dev, int mbndx, uint32_t msr); static inline void can_txinterrupt(FAR struct can_dev_s *dev, int mbndx); static inline void can_mbinterrupt(FAR struct can_dev_s *dev, int mbndx); -static void can_interrupt(FAR struct can_dev_s *dev); -#ifdef CONFIG_SAMA5_CAN0 -static int can0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMA5_CAN1 -static int can1_interrupt(int irq, void *context, FAR void *arg); -#endif +static void can_interrupt(int irq, void *context, FAR void *arg); /* Hardware initialization */ @@ -265,7 +258,6 @@ static const struct sam_config_s g_can0const = .port = 0, .pid = SAM_PID_CAN0, .nrecvmb = CONFIG_SAMA5_CAN0_NRECVMB, - .handler = can0_interrupt, .base = SAM_CAN0_VBASE, .baud = CONFIG_SAMA5_CAN0_BAUD, .rxpinset = PIO_CAN0_RX, @@ -301,7 +293,6 @@ static const struct sam_config_s g_can1const = .port = 1, .pid = SAM_PID_CAN1, .nrecvmb = CONFIG_SAMA5_CAN1_NRECVMB, - .handler = can1_interrupt, .base = SAM_CAN1_VBASE, .baud = CONFIG_SAMA5_CAN1_BAUD, .rxpinset = PIO_CAN1_RX, @@ -860,7 +851,7 @@ static int can_setup(FAR struct can_dev_s *dev) /* Attach the CAN interrupt handler */ - ret = irq_attach(config->pid, config->handler, NULL); + ret = irq_attach(config->pid, can_interrupt, dev); if (ret < 0) { canerr("ERROR: Failed to attach CAN%d IRQ (%d)", config->port, config->pid); @@ -1437,21 +1428,24 @@ static inline void can_mbinterrupt(FAR struct can_dev_s *dev, int mbndx) * Common CAN interrupt handler * * Input Parameters: - * priv - CAN-specific private data + * Standard interrupt handler inputs * * Returned Value: * None * ****************************************************************************/ -static void can_interrupt(FAR struct can_dev_s *dev) +static void can_interrupt(int irq, void *context, FAR void *arg) { - FAR struct sam_can_s *priv = dev->cd_priv; + FAR struct can_dev_s *dev = (FAR struct can_dev_s *)arg; + FAR struct sam_can_s *priv; uint32_t sr; uint32_t imr; uint32_t pending; - DEBUGASSERT(priv && priv->config); + DEBUGASSERT(dev != NULL); + FAR struct sam_can_s *priv = dev->cd_priv; + DEBUGASSERT(priv != NULL && priv->config != NULL); /* Get the set of pending interrupts. * @@ -1520,52 +1514,6 @@ static void can_interrupt(FAR struct can_dev_s *dev) } } -/**************************************************************************** - * Name: can0_interrupt - * - * Description: - * CAN0 interrupt handler - * - * Input Parameters: - * irq - The IRQ number of the interrupt. - * context - The register state save array at the time of the interrupt. - * - * Returned Value: - * Zero on success; a negated errno on failure - * - ****************************************************************************/ - -#ifdef CONFIG_SAMA5_CAN0 -static int can0_interrupt(int irq, void *context, FAR void *arg) -{ - can_interrupt(&g_can0dev); - return OK; -} -#endif - -/**************************************************************************** - * Name: can0_interrupt - * - * Description: - * CAN0 interrupt handler - * - * Input Parameters: - * irq - The IRQ number of the interrupt. - * context - The register state save array at the time of the interrupt. - * - * Returned Value: - * Zero on success; a negated errno on failure - * - ****************************************************************************/ - -#ifdef CONFIG_SAMA5_CAN1 -static int can1_interrupt(int irq, void *context, FAR void *arg) -{ - can_interrupt(&g_can1dev); - return OK; -} -#endif - /**************************************************************************** * Name: can_bittiming * diff --git a/arch/arm/src/sama5/sam_dmac.c b/arch/arm/src/sama5/sam_dmac.c index 0cc3c60cb19..a1002395db9 100644 --- a/arch/arm/src/sama5/sam_dmac.c +++ b/arch/arm/src/sama5/sam_dmac.c @@ -1785,12 +1785,15 @@ static void sam_dmaterminate(struct sam_dmach_s *dmach, int result) * ****************************************************************************/ -static int sam_dmac_interrupt(struct sam_dmac_s *dmac) +static int sam_dmac_interrupt(int irq, void *context, FAR void *arg) { + struct sam_dmac_s *dmac = (struct sam_dmac_s *)arg; struct sam_dmach_s *dmach; unsigned int chndx; uint32_t regval; + DEBUGASSERT(dmac != NULL); + /* Get the DMAC status register value. Ignore all masked interrupt * status bits. */ @@ -1849,28 +1852,6 @@ static int sam_dmac_interrupt(struct sam_dmac_s *dmac) return OK; } -/**************************************************************************** - * Name: sam_dmac0_interrupt and sam_dmac1_interrupt - * - * Description: - * DMA interrupt handler - * - ****************************************************************************/ - -#ifdef CONFIG_SAMA5_DMAC0 -static int sam_dmac0_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_dmac_interrupt(&g_dmac0); -} -#endif - -#ifdef CONFIG_SAMA5_DMAC1 -static int sam_dmac1_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_dmac_interrupt(&g_dmac1); -} -#endif - /**************************************************************************** * Name: sam_dmainitialize * @@ -1928,7 +1909,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(SAM_IRQ_DMAC0, sam_dmac0_interrupt, NULL); + (void)irq_attach(SAM_IRQ_DMAC0, sam_dmac_interrupt, &g_dmac0); /* Initialize the controller */ @@ -1948,7 +1929,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(SAM_IRQ_DMAC1, sam_dmac1_interrupt, NULL); + (void)irq_attach(SAM_IRQ_DMAC1, sam_dmac_interrupt, &g_dmac1); /* Initialize the controller */ diff --git a/arch/arm/src/sama5/sam_emacb.c b/arch/arm/src/sama5/sam_emacb.c index 688053c7b82..31fae778d2f 100644 --- a/arch/arm/src/sama5/sam_emacb.c +++ b/arch/arm/src/sama5/sam_emacb.c @@ -349,7 +349,6 @@ struct sam_emacattr_s /* Basic hardware information */ uint32_t base; /* EMAC Register base address */ - xcpt_t handler; /* EMAC interrupt handler */ uint8_t emac; /* EMACn, n=0 or 1 */ uint8_t irq; /* EMAC interrupt number */ @@ -481,13 +480,7 @@ static void sam_receive(struct sam_emac_s *priv); static void sam_txdone(struct sam_emac_s *priv); static void sam_interrupt_work(FAR void *arg); -static int sam_emac_interrupt(struct sam_emac_s *priv); -#ifdef CONFIG_SAMA5_EMAC0 -static int sam_emac0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMA5_EMAC1 -static int sam_emac1_interrupt(int irq, void *context, FAR void *arg); -#endif +static int sam_emac_interrupt(int irq, void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -633,7 +626,6 @@ static const struct sam_emacattr_s g_emac0_attr = /* Basic hardware information */ .base = SAM_EMAC0_VBASE, - .handler = sam_emac0_interrupt, .emac = EMAC0_INTF, .irq = SAM_IRQ_EMAC0, @@ -714,7 +706,6 @@ static const struct sam_emacattr_s g_emac1_attr = /* Basic hardware information */ .base = SAM_EMAC1_VBASE, - .handler = sam_emac1_interrupt, .emac = EMAC1_INTF, .irq = SAM_IRQ_EMAC1, @@ -2012,7 +2003,7 @@ static void sam_interrupt_work(FAR void *arg) * Common hardware interrupt handler * * Parameters: - * priv - Reference to the EMAC private state structure + * Standard interrupt handler inputs * * Returned Value: * OK on success @@ -2021,10 +2012,13 @@ static void sam_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int sam_emac_interrupt(struct sam_emac_s *priv) +static int sam_emac_interrupt(int irq, void *context, FAR void *arg); { + struct sam_emac_s *priv = (struct sam_emac_s *)arg; uint32_t tsr; + DEBUGASSERT(priv != NULL); + /* Disable further Ethernet interrupts. Because Ethernet interrupts are * also disabled if the TX timeout event occurs, there can be no race * condition here. @@ -2084,37 +2078,6 @@ static int sam_emac_interrupt(struct sam_emac_s *priv) return OK; } -/**************************************************************************** - * Function: sam_emac0/1_interrupt - * - * Description: - * EMAC hardware interrupt handler - * - * Parameters: - * irq - Number of the IRQ that generated the interrupt - * context - Interrupt register state save info (architecture-specific) - * - * Returned Value: - * OK on success - * - * Assumptions: - * - ****************************************************************************/ - -#ifdef CONFIG_SAMA5_EMAC0 -static int sam_emac0_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_emac_interrupt(&g_emac0); -} -#endif - -#ifdef CONFIG_SAMA5_EMAC1 -static int sam_emac1_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_emac_interrupt(&g_emac1); -} -#endif - /**************************************************************************** * Function: sam_txtimeout_work * @@ -4485,7 +4448,7 @@ int sam_emac_initialize(int intf) * the interface is in the 'up' state. */ - ret = irq_attach(priv->attr->irq, priv->attr->handler, NULL); + ret = irq_attach(priv->attr->irq, sam_emac_interrupt, priv); if (ret < 0) { nerr("ERROR: Failed to attach the handler to the IRQ%d\n", priv->attr->irq); diff --git a/arch/arm/src/sama5/sam_flexcom_serial.c b/arch/arm/src/sama5/sam_flexcom_serial.c index e44793214d3..9f4ee3b528d 100644 --- a/arch/arm/src/sama5/sam_flexcom_serial.c +++ b/arch/arm/src/sama5/sam_flexcom_serial.c @@ -216,7 +216,6 @@ struct flexus_dev_s { - xcpt_t handler; /* Interrupt handler */ uint32_t usartbase; /* Base address of USART registers */ uint32_t baud; /* Configured baud */ uint32_t sr; /* Saved status bits */ @@ -233,23 +232,7 @@ struct flexus_dev_s * Private Function Prototypes ****************************************************************************/ -static int flexus_interrupt(struct uart_dev_s *dev); -#ifdef CONFIG_USART0_SERIALDRIVER -static int flexus0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_USART1_SERIALDRIVER -static int flexus1_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_USART2_SERIALDRIVER -static int flexus2_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_USART3_SERIALDRIVER -static int flexus3_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_USART4_SERIALDRIVER -static int flexus4_interrupt(int irq, void *context, FAR void *arg); -#endif - +static int flexus_interrupt(int irq, void *context, FAR void *arg); static int flexus_setup(struct uart_dev_s *dev); static void flexus_shutdown(struct uart_dev_s *dev); static int flexus_attach(struct uart_dev_s *dev); @@ -314,7 +297,6 @@ static char g_flexus4txbuffer[CONFIG_USART4_TXBUFSIZE]; #ifdef CONFIG_USART0_SERIALDRIVER static struct flexus_dev_s g_flexus0priv = { - .handler = flexus0_interrupt, .usartbase = SAM_FLEXCOM0_VBASE, .baud = CONFIG_USART0_BAUD, .irq = SAM_IRQ_FLEXCOM0, @@ -348,7 +330,6 @@ static uart_dev_t g_flexus0port = #ifdef CONFIG_USART1_SERIALDRIVER static struct flexus_dev_s g_flexus1priv = { - .handler = flexus1_interrupt, .usartbase = SAM_FLEXCOM1_VBASE, .baud = CONFIG_USART1_BAUD, .irq = SAM_IRQ_FLEXCOM1, @@ -382,7 +363,6 @@ static uart_dev_t g_flexus1port = #ifdef CONFIG_USART2_SERIALDRIVER static struct flexus_dev_s g_flexus2priv = { - .handler = flexus2_interrupt, .usartbase = SAM_FLEXCOM2_VBASE, .baud = CONFIG_USART2_BAUD, .irq = SAM_IRQ_FLEXCOM2, @@ -416,7 +396,6 @@ static uart_dev_t g_flexus2port = #ifdef CONFIG_USART3_SERIALDRIVER static struct flexus_dev_s g_flexus3priv = { - .handler = flexus3_interrupt, .usartbase = SAM_FLEXCOM3_VBASE, .baud = CONFIG_USART3_BAUD, .irq = SAM_IRQ_FLEXCOM3, @@ -450,7 +429,6 @@ static uart_dev_t g_flexus3port = #ifdef CONFIG_USART4_SERIALDRIVER static struct flexus_dev_s g_flexus4priv = { - .handler = flexus4_interrupt, .usartbase = SAM_FLEXCOM4_VBASE, .baud = CONFIG_USART4_BAUD, .irq = SAM_IRQ_FLEXCOM4, @@ -549,13 +527,14 @@ static void flexus_disableallints(struct flexus_dev_s *priv, uint32_t *imr) * ****************************************************************************/ -static int flexus_interrupt(struct uart_dev_s *dev) +static int flexus_interrupt(int irq, void *context, FAR void *arg); { - struct flexus_dev_s *priv; - uint32_t pending; - uint32_t imr; - int passes; - bool handled; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; + struct flexus_dev_s *priv; + uint32_t pending; + uint32_t imr; + int passes; + bool handled; DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct flexus_dev_s *)dev->priv; @@ -603,47 +582,6 @@ static int flexus_interrupt(struct uart_dev_s *dev) return OK; } -/**************************************************************************** - * Name: flexus*_interrupt - * - * Description: - * This is the specific UART/USART interrupt handler. These simply map - * the interrupt to the device-specific data and passes control to the - * common interrupt handler. - * - ****************************************************************************/ - -#ifdef CONFIG_USART0_SERIALDRIVER -static int flexus0_interrupt(int irq, void *context, FAR void *arg) -{ - return flexus_interrupt(&g_flexus0port); -} -#endif -#ifdef CONFIG_USART1_SERIALDRIVER -static int flexus1_interrupt(int irq, void *context, FAR void *arg) -{ - return flexus_interrupt(&g_flexus1port); -} -#endif -#ifdef CONFIG_USART2_SERIALDRIVER -static int flexus2_interrupt(int irq, void *context, FAR void *arg) -{ - return flexus_interrupt(&g_flexus2port); -} -#endif -#ifdef CONFIG_USART3_SERIALDRIVER -static int flexus3_interrupt(int irq, void *context, FAR void *arg) -{ - return flexus_interrupt(&g_flexus3port); -} -#endif -#ifdef CONFIG_USART4_SERIALDRIVER -static int flexus4_interrupt(int irq, void *context, FAR void *arg) -{ - return flexus_interrupt(&g_flexus4port); -} -#endif - /**************************************************************************** * Name: flexus_setup * @@ -803,7 +741,7 @@ static int flexus_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler, NULL); + ret = irq_attach(priv->irq, flexus_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled diff --git a/arch/arm/src/sama5/sam_hsmci.c b/arch/arm/src/sama5/sam_hsmci.c index 254baa0dd6f..3aa006d8722 100644 --- a/arch/arm/src/sama5/sam_hsmci.c +++ b/arch/arm/src/sama5/sam_hsmci.c @@ -436,17 +436,17 @@ struct sam_dev_s /* Debug stuff */ #ifdef CONFIG_SAMA5_HSMCI_REGDEBUG - bool wrlast; /* Last was a write */ - uint32_t addrlast; /* Last address */ - uint32_t vallast; /* Last value */ - int ntimes; /* Number of times */ + bool wrlast; /* Last was a write */ + uint32_t addrlast; /* Last address */ + uint32_t vallast; /* Last value */ + int ntimes; /* Number of times */ #endif /* Register logging support */ #if defined(CONFIG_SAMA5_HSMCI_CMDDEBUG) && defined(CONFIG_SAMA5_HSMCI_XFRDEBUG) - bool xfrinitialized; - bool cmdinitialized; + bool xfrinitialized; + bool cmdinitialized; #endif #ifdef CONFIG_SAMA5_HSMCI_XFRDEBUG uint8_t smplset; @@ -537,16 +537,7 @@ static void sam_notransfer(struct sam_dev_s *priv); /* Interrupt Handling *******************************************************/ -static int sam_hsmci_interrupt(struct sam_dev_s *priv); -#ifdef CONFIG_SAMA5_HSMCI0 -static int sam_hsmci0_interrupt(int irq, void *context, void *arg); -#endif -#ifdef CONFIG_SAMA5_HSMCI1 -static int sam_hsmci1_interrupt(int irq, void *context, void *arg); -#endif -#ifdef CONFIG_SAMA5_HSMCI2 -static int sam_hsmci2_interrupt(int irq, void *context, void *arg); -#endif +static int sam_hsmci_interrupt(int irq, void *context, void *arg); /* SDIO interface methods ***************************************************/ @@ -1512,12 +1503,15 @@ static void sam_notransfer(struct sam_dev_s *priv) * ****************************************************************************/ -static int sam_hsmci_interrupt(struct sam_dev_s *priv) +static int sam_hsmci_interrupt(int irq, void *context, void *arg) { + struct sam_dev_s *priv = (struct sam_dev_s *)arg; uint32_t sr; uint32_t enabled; uint32_t pending; + DEBUGASSERT(priv != NULL); + /* Loop while there are pending interrupts. */ for (; ; ) @@ -1661,42 +1655,6 @@ static int sam_hsmci_interrupt(struct sam_dev_s *priv) return OK; } -/**************************************************************************** - * Name: sam_hsmci0_interrupt, sam_hsmci1_interrupt, and sam_hsmci2_interrupt - * - * Description: - * HSMCI interrupt handler - * - * Input Parameters: - * irq - IRQ number of the interrupts - * context - Saved machine context at the time of the interrupt - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_SAMA5_HSMCI0 -static int sam_hsmci0_interrupt(int irq, void *context, void *arg) -{ - return sam_hsmci_interrupt(&g_hsmci0); -} -#endif - -#ifdef CONFIG_SAMA5_HSMCI1 -static int sam_hsmci1_interrupt(int irq, void *context, void *arg) -{ - return sam_hsmci_interrupt(&g_hsmci1); -} -#endif - -#ifdef CONFIG_SAMA5_HSMCI2 -static int sam_hsmci2_interrupt(int irq, void *context, void *arg) -{ - return sam_hsmci_interrupt(&g_hsmci2); -} -#endif - /**************************************************************************** * SDIO Interface Methods ****************************************************************************/ @@ -1947,7 +1905,6 @@ static void sam_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate) static int sam_attach(FAR struct sdio_dev_s *dev) { struct sam_dev_s *priv = (struct sam_dev_s *)dev; - xcpt_t handler; int irq; int ret; @@ -1956,24 +1913,21 @@ static int sam_attach(FAR struct sdio_dev_s *dev) #ifdef CONFIG_SAMA5_HSMCI0 if (priv->hsmci == 0) { - handler = sam_hsmci0_interrupt; - irq = SAM_IRQ_HSMCI0; + irq = SAM_IRQ_HSMCI0; } else #endif #ifdef CONFIG_SAMA5_HSMCI1 if (priv->hsmci == 1) { - handler = sam_hsmci1_interrupt; - irq = SAM_IRQ_HSMCI1; + irq = SAM_IRQ_HSMCI1; } else #endif #ifdef CONFIG_SAMA5_HSMCI2 if (priv->hsmci == 2) { - handler = sam_hsmci2_interrupt; - irq = SAM_IRQ_HSMCI2; + irq = SAM_IRQ_HSMCI2; } else #endif @@ -1984,7 +1938,7 @@ static int sam_attach(FAR struct sdio_dev_s *dev) /* Attach the HSMCI interrupt handler */ - ret = irq_attach(irq, handler, priv); + ret = irq_attach(irq, sam_hsmci_interrupt, priv); if (ret == OK) { diff --git a/arch/arm/src/sama5/sam_serial.c b/arch/arm/src/sama5/sam_serial.c index 49573981db1..b9da00d8555 100644 --- a/arch/arm/src/sama5/sam_serial.c +++ b/arch/arm/src/sama5/sam_serial.c @@ -418,7 +418,6 @@ struct up_dev_s { - xcpt_t handler; /* Interrupt handler */ uint32_t usartbase; /* Base address of USART registers */ uint32_t baud; /* Configured baud */ uint32_t sr; /* Saved status bits */ @@ -435,38 +434,7 @@ struct up_dev_s * Private Function Prototypes ****************************************************************************/ -static int up_interrupt(struct uart_dev_s *dev); -#ifdef CONFIG_SAMA5_UART0 -static int up_uart0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMA5_UART1 -static int up_uart1_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMA5_UART2 -static int up_uart2_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMA5_UART3 -static int up_uart3_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMA5_UART4 -static int up_uart4_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_USART0_SERIALDRIVER -static int up_usart0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_USART1_SERIALDRIVER -static int up_usart1_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_USART2_SERIALDRIVER -static int up_usart2_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_USART3_SERIALDRIVER -static int up_usart3_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_USART4_SERIALDRIVER -static int up_usart4_interrupt(int irq, void *context, FAR void *arg); -#endif - +static int up_interrupt(int irq, void *context, FAR void *arg); static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); @@ -561,7 +529,6 @@ static char g_usart4txbuffer[CONFIG_USART4_TXBUFSIZE]; static struct up_dev_s g_uart0priv = { - .handler = up_uart0_interrupt, .usartbase = SAM_UART0_VBASE, .baud = CONFIG_UART0_BAUD, .irq = SAM_IRQ_UART0, @@ -602,7 +569,6 @@ static uart_dev_t g_uart0port = static struct up_dev_s g_uart1priv = { - .handler = up_uart1_interrupt, .usartbase = SAM_UART1_VBASE, .baud = CONFIG_UART1_BAUD, .irq = SAM_IRQ_UART1, @@ -643,7 +609,6 @@ static uart_dev_t g_uart1port = static struct up_dev_s g_uart2priv = { - .handler = up_uart2_interrupt, .usartbase = SAM_UART2_VBASE, .baud = CONFIG_UART2_BAUD, .irq = SAM_IRQ_UART2, @@ -684,7 +649,6 @@ static uart_dev_t g_uart2port = static struct up_dev_s g_uart3priv = { - .handler = up_uart3_interrupt, .usartbase = SAM_UART3_VBASE, .baud = CONFIG_UART3_BAUD, .irq = SAM_IRQ_UART3, @@ -725,7 +689,6 @@ static uart_dev_t g_uart3port = static struct up_dev_s g_uart4priv = { - .handler = up_uart4_interrupt, .usartbase = SAM_UART4_VBASE, .baud = CONFIG_UART4_BAUD, .irq = SAM_IRQ_UART4, @@ -756,7 +719,6 @@ static uart_dev_t g_uart4port = #ifdef CONFIG_USART0_SERIALDRIVER static struct up_dev_s g_usart0priv = { - .handler = up_usart0_interrupt, .usartbase = SAM_USART0_VBASE, .baud = CONFIG_USART0_BAUD, .irq = SAM_IRQ_USART0, @@ -790,7 +752,6 @@ static uart_dev_t g_usart0port = #ifdef CONFIG_USART1_SERIALDRIVER static struct up_dev_s g_usart1priv = { - .handler = up_usart1_interrupt, .usartbase = SAM_USART1_VBASE, .baud = CONFIG_USART1_BAUD, .irq = SAM_IRQ_USART1, @@ -824,7 +785,6 @@ static uart_dev_t g_usart1port = #ifdef CONFIG_USART2_SERIALDRIVER static struct up_dev_s g_usart2priv = { - .handler = up_usart2_interrupt, .usartbase = SAM_USART2_VBASE, .baud = CONFIG_USART2_BAUD, .irq = SAM_IRQ_USART2, @@ -858,7 +818,6 @@ static uart_dev_t g_usart2port = #ifdef CONFIG_USART3_SERIALDRIVER static struct up_dev_s g_usart3priv = { - .handler = up_usart3_interrupt, .usartbase = SAM_USART3_VBASE, .baud = CONFIG_USART3_BAUD, .irq = SAM_IRQ_USART3, @@ -892,7 +851,6 @@ static uart_dev_t g_usart3port = #ifdef CONFIG_USART4_SERIALDRIVER static struct up_dev_s g_usart4priv = { - .handler = up_usart4_interrupt, .usartbase = SAM_USART4_VBASE, .baud = CONFIG_USART4_BAUD, .irq = SAM_IRQ_USART4, @@ -989,8 +947,9 @@ static void up_disableallints(struct up_dev_s *priv, uint32_t *imr) * ****************************************************************************/ -static int up_interrupt(struct uart_dev_s *dev) +static int up_interrupt(int irq, void *context, FAR void *arg) { + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; uint32_t pending; uint32_t imr; @@ -1043,67 +1002,6 @@ static int up_interrupt(struct uart_dev_s *dev) return OK; } -#ifdef CONFIG_SAMA5_UART0 -static int up_uart0_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_uart0port); -} -#endif -#ifdef CONFIG_SAMA5_UART1 -static int up_uart1_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_uart1port); -} -#endif -#ifdef CONFIG_SAMA5_UART2 -static int up_uart2_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_uart2port); -} -#endif -#ifdef CONFIG_SAMA5_UART3 -static int up_uart3_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_uart3port); -} -#endif -#ifdef CONFIG_SAMA5_UART4 -static int up_uart4_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_uart4port); -} -#endif -#ifdef CONFIG_USART0_SERIALDRIVER -static int up_usart0_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_usart0port); -} -#endif -#ifdef CONFIG_USART1_SERIALDRIVER -static int up_usart1_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_usart1port); -} -#endif -#ifdef CONFIG_USART2_SERIALDRIVER -static int up_usart2_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_usart2port); -} -#endif -#ifdef CONFIG_USART3_SERIALDRIVER -static int up_usart3_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_usart3port); -} -#endif -#ifdef CONFIG_USART4_SERIALDRIVER -static int up_usart4_interrupt(int irq, void *context, FAR void *arg) -{ - return up_interrupt(&g_usart4port); -} -#endif - /**************************************************************************** * Name: up_setup * @@ -1294,7 +1192,7 @@ static int up_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler, NULL); + ret = irq_attach(priv->irq, up_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled diff --git a/arch/arm/src/sama5/sam_twi.c b/arch/arm/src/sama5/sam_twi.c index 65bb0e118b3..aea50295589 100644 --- a/arch/arm/src/sama5/sam_twi.c +++ b/arch/arm/src/sama5/sam_twi.c @@ -199,21 +199,9 @@ static inline void twi_putrel(struct twi_dev_s *priv, unsigned int offset, /* I2C transfer helper functions */ -static int twi_wait(struct twi_dev_s *priv, unsigned int size); +static int twi_wait(struct twi_dev_s *priv, unsigned int size); static void twi_wakeup(struct twi_dev_s *priv, int result); -static int twi_interrupt(struct twi_dev_s *priv); -#ifdef CONFIG_SAMA5_TWI0 -static int twi0_interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#ifdef CONFIG_SAMA5_TWI1 -static int twi1_interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#ifdef CONFIG_SAMA5_TWI2 -static int twi2_interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#ifdef CONFIG_SAMA5_TWI3 -static int twi3_interrupt(int irq, FAR void *context, FAR void * arg); -#endif +static int twi_interrupt(int irq, FAR void *context, FAR void * arg); static void twi_timeout(int argc, uint32_t arg, ...); static void twi_startread(struct twi_dev_s *priv, struct i2c_msg_s *msg); @@ -246,7 +234,6 @@ static const struct twi_attr_s g_twi0attr = .sclcfg = PIO_TWI0_CK, .sdacfg = PIO_TWI0_D, .base = SAM_TWI0_VBASE, - .handler = twi0_interrupt, }; static struct twi_dev_s g_twi0; @@ -261,7 +248,6 @@ static const struct twi_attr_s g_twi1attr = .sclcfg = PIO_TWI1_CK, .sdacfg = PIO_TWI1_D, .base = SAM_TWI1_VBASE, - .handler = twi1_interrupt, }; static struct twi_dev_s g_twi1; @@ -276,7 +262,6 @@ static const struct twi_attr_s g_twi2attr = .sclcfg = PIO_TWI2_CK, .sdacfg = PIO_TWI2_D, .base = SAM_TWI2_VBASE, - .handler = twi2_interrupt, }; static struct twi_dev_s g_twi2; @@ -291,7 +276,6 @@ static const struct twi_attr_s g_twi3attr = .sclcfg = PIO_TWI3_CK, .sdacfg = PIO_TWI3_D, .base = SAM_TWI3_VBASE, - .handler = twi3_interrupt, }; static struct twi_dev_s g_twi3; @@ -550,14 +534,17 @@ static void twi_wakeup(struct twi_dev_s *priv, int result) * ****************************************************************************/ -static int twi_interrupt(struct twi_dev_s *priv) +static int twi_interrupt(int irq, FAR void *context, FAR void * arg) { + struct twi_dev_s *priv = (struct twi_dev_s *)arg; struct i2c_msg_s *msg; uint32_t sr; uint32_t imr; uint32_t pending; uint32_t regval; + DEBUGASSERT(priv != NULL); + /* Retrieve masked interrupt status */ sr = twi_getrel(priv, SAM_TWI_SR_OFFSET); @@ -667,34 +654,6 @@ static int twi_interrupt(struct twi_dev_s *priv) return OK; } -#ifdef CONFIG_SAMA5_TWI0 -static int twi0_interrupt(int irq, FAR void *context, FAR void * arg) -{ - return twi_interrupt(&g_twi0); -} -#endif - -#ifdef CONFIG_SAMA5_TWI1 -static int twi1_interrupt(int irq, FAR void *context, FAR void * arg) -{ - return twi_interrupt(&g_twi1); -} -#endif - -#ifdef CONFIG_SAMA5_TWI2 -static int twi2_interrupt(int irq, FAR void *context, FAR void * arg) -{ - return twi_interrupt(&g_twi2); -} -#endif - -#ifdef CONFIG_SAMA5_TWI3 -static int twi3_interrupt(int irq, FAR void *context, FAR void * arg) -{ - return twi_interrupt(&g_twi3); -} -#endif - /**************************************************************************** * Name: twi_timeout * @@ -1296,7 +1255,7 @@ struct i2c_master_s *sam_i2cbus_initialize(int bus) /* Attach Interrupt Handler */ - ret = irq_attach(priv->attr->irq, priv->attr->handler, NULL); + ret = irq_attach(priv->attr->irq, twi_interrupt, priv); if (ret < 0) { ierr("ERROR: Failed to attach irq %d\n", priv->attr->irq); diff --git a/arch/arm/src/sama5/sam_xdmac.c b/arch/arm/src/sama5/sam_xdmac.c index 5a229f77e96..54386d92e19 100644 --- a/arch/arm/src/sama5/sam_xdmac.c +++ b/arch/arm/src/sama5/sam_xdmac.c @@ -1825,14 +1825,17 @@ static void sam_dmaterminate(struct sam_xdmach_s *xdmach, int result) * ****************************************************************************/ -static int sam_xdmac_interrupt(struct sam_xdmac_s *xdmac) +static int sam_xdmac_interrupt(int irq, void *context, FAR void *arg) { + struct sam_xdmac_s *xdmac = (struct sam_xdmac_s *)arg; struct sam_xdmach_s *xdmach; unsigned int chndx; uint32_t gpending; uint32_t chpending; uint32_t bit; + DEBUGASSERT(xdmac != NULL); + /* Get the set of pending, unmasked global XDMAC interrupts */ gpending = sam_getdmac(xdmac, SAM_XDMAC_GIS_OFFSET) & @@ -1890,28 +1893,6 @@ static int sam_xdmac_interrupt(struct sam_xdmac_s *xdmac) return OK; } -/**************************************************************************** - * Name: sam_xdmac0_interrupt and sam_xdmac1_interrupt - * - * Description: - * DMA interrupt handler - * - ****************************************************************************/ - -#ifdef CONFIG_SAMA5_XDMAC0 -static int sam_xdmac0_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_xdmac_interrupt(&g_xdmac0); -} -#endif - -#ifdef CONFIG_SAMA5_XDMAC1 -static int sam_xdmac1_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_xdmac_interrupt(&g_xdmac1); -} -#endif - /**************************************************************************** * Name: sam_dmainitialize * @@ -1965,7 +1946,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(SAM_IRQ_XDMAC0, sam_xdmac0_interrupt, NULL); + (void)irq_attach(SAM_IRQ_XDMAC0, sam_xdmac_interrupt, &g_xdmac0); /* Initialize the controller */ @@ -1985,7 +1966,7 @@ void weak_function up_dmainitialize(void) /* Attach DMA interrupt vector */ - (void)irq_attach(SAM_IRQ_XDMAC1, sam_xdmac1_interrupt, NULL); + (void)irq_attach(SAM_IRQ_XDMAC1, sam_xdmac_interrupt, &g_xdmac1); /* Initialize the controller */ diff --git a/arch/arm/src/samdl/sam_serial.c b/arch/arm/src/samdl/sam_serial.c index 9bdf6e85f7f..71571ea9a9f 100644 --- a/arch/arm/src/samdl/sam_serial.c +++ b/arch/arm/src/samdl/sam_serial.c @@ -228,8 +228,6 @@ struct sam_dev_s const struct sam_usart_config_s * const config; /* Information unique to the serial driver */ - - xcpt_t handler; /* Interrupt handler */ }; /**************************************************************************** @@ -249,26 +247,7 @@ static inline void sam_serialout16(struct sam_dev_s *priv, int offset, uint16_t regval); static void sam_disableallints(struct sam_dev_s *priv); -static int sam_interrupt(struct uart_dev_s *dev); - -#ifdef SAMDL_HAVE_USART0 -static int sam_usart0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef SAMDL_HAVE_USART1 -static int sam_usart1_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef SAMDL_HAVE_USART2 -static int sam_usart2_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef SAMDL_HAVE_USART3 -static int sam_usart3_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef SAMDL_HAVE_USART4 -static int sam_usart4_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef SAMDL_HAVE_USART5 -static int sam_usart5_interrupt(int irq, void *context, FAR void *arg); -#endif +static int sam_interrupt(int irq, void *context, FAR void *arg); /* UART methods */ @@ -340,7 +319,6 @@ static char g_usart5txbuffer[CONFIG_USART5_TXBUFSIZE]; static struct sam_dev_s g_usart0priv = { .config = &g_usart0config, - .handler = sam_usart0_interrupt, }; static uart_dev_t g_usart0port = @@ -366,7 +344,6 @@ static uart_dev_t g_usart0port = static struct sam_dev_s g_usart1priv = { .config = &g_usart1config, - .handler = sam_usart1_interrupt, }; static uart_dev_t g_usart1port = @@ -392,7 +369,6 @@ static uart_dev_t g_usart1port = static struct sam_dev_s g_usart2priv = { .config = &g_usart2config, - .handler = sam_usart2_interrupt, }; static uart_dev_t g_usart2port = @@ -418,7 +394,6 @@ static uart_dev_t g_usart2port = static struct sam_dev_s g_usart3priv = { .config = &g_usart3config, - .handler = sam_usart3_interrupt, }; static uart_dev_t g_usart3port = @@ -444,7 +419,6 @@ static uart_dev_t g_usart3port = static struct sam_dev_s g_usart4priv = { .config = &g_usart4config, - .handler = sam_usart4_interrupt, }; static uart_dev_t g_usart4port = @@ -470,7 +444,6 @@ static uart_dev_t g_usart4port = static struct sam_dev_s g_usart5priv = { .config = &g_usart5config, - .handler = sam_usart5_interrupt, }; static uart_dev_t g_usart5port = @@ -555,13 +528,17 @@ static void sam_disableallints(struct sam_dev_s *priv) * ****************************************************************************/ -static int sam_interrupt(struct uart_dev_s *dev) +static int sam_interrupt(int irq, void *context, FAR void *arg) { - struct sam_dev_s *priv = (struct sam_dev_s *)dev->priv; + struct uart_dev_s *dev = (struct uart_dev_s )arg; + struct sam_dev_s *priv; uint8_t pending; uint8_t intflag; uint8_t inten; + DEBUGASSERT(dev != NULL && dev->priv != NULL); + priv = (struct sam_dev_s *)dev->priv; + /* Get the set of pending USART interrupts (we are only interested in the * unmasked interrupts). */ @@ -599,57 +576,6 @@ static int sam_interrupt(struct uart_dev_s *dev) return OK; } -/**************************************************************************** - * Name: sam_usartN_interrupt - * - * Description: - * Handle each SERCOM USART interrupt by calling the common interrupt - * handling logic with the USART-specific state. - * - ****************************************************************************/ - -#ifdef SAMDL_HAVE_USART0 -static int sam_usart0_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_usart0port); -} -#endif - -#ifdef SAMDL_HAVE_USART1 -static int sam_usart1_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_usart1port); -} -#endif - -#ifdef SAMDL_HAVE_USART2 -static int sam_usart2_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_usart2port); -} -#endif - -#ifdef SAMDL_HAVE_USART3 -static int sam_usart3_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_usart3port); -} -#endif - -#ifdef SAMDL_HAVE_USART4 -static int sam_usart4_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_usart4port); -} -#endif - -#ifdef SAMDL_HAVE_USART5 -static int sam_usart5_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_usart5port); -} -#endif - /**************************************************************************** * Name: sam_setup * @@ -726,7 +652,7 @@ static int sam_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(config->irq, priv->handler, NULL); + ret = irq_attach(config->irq, sam_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled diff --git a/arch/arm/src/samdl/sam_spi.c b/arch/arm/src/samdl/sam_spi.c index 702a55fadf3..cc17758d86a 100644 --- a/arch/arm/src/samdl/sam_spi.c +++ b/arch/arm/src/samdl/sam_spi.c @@ -163,26 +163,7 @@ static void spi_dumpregs(struct sam_spidev_s *priv, const char *msg); /* Interrupt handling */ #if 0 /* Not used */ -static int spi_interrupt(struct sam_spidev_s *dev); - -#ifdef SAMDL_HAVE_SPI0 -static int spi0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef SAMDL_HAVE_SPI1 -static int spi1_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef SAMDL_HAVE_SPI2 -static int spi2_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef SAMDL_HAVE_SPI3 -static int spi3_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef SAMDL_HAVE_SPI4 -static int spi4_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef SAMDL_HAVE_SPI5 -static int spi5_interrupt(int irq, void *context, FAR void *arg); -#endif +static int spi_interrupt(int irq, void *context, FAR void *arg); #endif /* SPI methods */ @@ -255,9 +236,6 @@ static struct sam_spidev_s g_spi0dev = .muxconfig = BOARD_SERCOM0_MUXCONFIG, .srcfreq = BOARD_SERCOM0_FREQUENCY, .base = SAM_SERCOM0_BASE, -#if 0 /* Not used */ - .handler = spi0_interrupt, -#endif .spilock = SEM_INITIALIZER(1), }; #endif @@ -304,9 +282,6 @@ static struct sam_spidev_s g_spi1dev = .muxconfig = BOARD_SERCOM1_MUXCONFIG, .srcfreq = BOARD_SERCOM1_FREQUENCY, .base = SAM_SERCOM1_BASE, -#if 0 /* Not used */ - .handler = spi1_interrupt, -#endif .spilock = SEM_INITIALIZER(1), }; #endif @@ -353,9 +328,6 @@ static struct sam_spidev_s g_spi2dev = .muxconfig = BOARD_SERCOM2_MUXCONFIG, .srcfreq = BOARD_SERCOM2_FREQUENCY, .base = SAM_SERCOM2_BASE, -#if 0 /* Not used */ - .handler = spi2_interrupt, -#endif .spilock = SEM_INITIALIZER(1), }; #endif @@ -402,9 +374,6 @@ static struct sam_spidev_s g_spi3dev = .muxconfig = BOARD_SERCOM3_MUXCONFIG, .srcfreq = BOARD_SERCOM3_FREQUENCY, .base = SAM_SERCOM3_BASE, -#if 0 /* Not used */ - .handler = spi3_interrupt, -#endif .spilock = SEM_INITIALIZER(1), }; #endif @@ -451,9 +420,6 @@ static struct sam_spidev_s g_spi4dev = .muxconfig = BOARD_SERCOM4_MUXCONFIG, .srcfreq = BOARD_SERCOM4_FREQUENCY, .base = SAM_SERCOM4_BASE, -#if 0 /* Not used */ - .handler = spi4_interrupt, -#endif .spilock = SEM_INITIALIZER(1), }; #endif @@ -500,9 +466,6 @@ static struct sam_spidev_s g_spi5dev = .muxconfig = BOARD_SERCOM5_MUXCONFIG, .srcfreq = BOARD_SERCOM5_FREQUENCY, .base = SAM_SERCOM5_BASE, -#if 0 /* Not used */ - .handler = spi5_interrupt, -#endif .spilock = SEM_INITIALIZER(1), }; #endif @@ -748,13 +711,15 @@ static void spi_dumpregs(struct sam_spidev_s *priv, const char *msg) ****************************************************************************/ #if 0 /* Not used */ -static int spi_interrupt(struct sam_spidev_s *dev) +static int spi_interrupt(int irq, void *context, FAR void *arg) { - struct sam_dev_s *priv = (struct sam_dev_s *)dev->priv; + struct sam_dev_s *priv = (struct sam_dev_s *)arg uint8_t pending; uint8_t intflag; uint8_t inten; + DEBUGASSERT(priv != NULL); + /* Get the set of pending SPI interrupts (we are only interested in the * unmasked interrupts). */ @@ -791,59 +756,6 @@ static int spi_interrupt(struct sam_spidev_s *dev) } #endif -/**************************************************************************** - * Name: spiN_interrupt - * - * Description: - * Handle each SERCOM SPI interrupt by calling the common interrupt - * handling logic with the SPI-specific state. - * - ****************************************************************************/ - -#if 0 /* Not used */ -#ifdef SAMDL_HAVE_SPI0 -static int spi0_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spi0dev); -} -#endif - -#ifdef SAMDL_HAVE_SPI1 -static int spi1_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spi1dev); -} -#endif - -#ifdef SAMDL_HAVE_SPI2 -static int spi2_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spi2dev); -} -#endif - -#ifdef SAMDL_HAVE_SPI3 -static int spi3_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spi3dev); -} -#endif - -#ifdef SAMDL_HAVE_SPI4 -static int spi4_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spi4dev); -} -#endif - -#ifdef SAMDL_HAVE_SPI5 -static int spi5_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spi5dev); -} -#endif -#endif - /**************************************************************************** * Name: spi_lock * @@ -1546,7 +1458,7 @@ struct spi_dev_s *sam_spibus_initialize(int port) #if 0 /* Not used */ /* Attach and enable the SERCOM interrupt handler */ - ret = irq_attach(priv->irq, priv->handler, NULL); + ret = irq_attach(priv->irq, spi_interrupt, priv); if (ret < 0) { spierr("ERROR: Failed to attach interrupt: %d\n", irq); diff --git a/arch/arm/src/samv7/sam_emac.c b/arch/arm/src/samv7/sam_emac.c index 9a59a9b3173..6357758b4d3 100644 --- a/arch/arm/src/samv7/sam_emac.c +++ b/arch/arm/src/samv7/sam_emac.c @@ -431,7 +431,6 @@ struct sam_emacattr_s /* Basic hardware information */ uint32_t base; /* EMAC Register base address */ - xcpt_t handler; /* EMAC interrupt handler */ uint8_t emac; /* EMACn, n=0 or 1 */ uint8_t irq; /* EMAC interrupt number */ @@ -583,13 +582,7 @@ static void sam_txdone(struct sam_emac_s *priv, int qid); static void sam_txerr_interrupt(FAR struct sam_emac_s *priv, int qid); static void sam_interrupt_work(FAR void *arg); -static int sam_emac_interrupt(struct sam_emac_s *priv); -#ifdef CONFIG_SAMV7_EMAC0 -static int sam_emac0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMV7_EMAC1 -static int sam_emac1_interrupt(int irq, void *context, FAR void *arg); -#endif +static int sam_emac_interrupt(int irq, void *context, FAR void *arg); /* Watchdog timer expirations */ @@ -778,7 +771,6 @@ static const struct sam_emacattr_s g_emac0_attr = /* Basic hardware information */ .base = SAM_EMAC0_BASE, - .handler = sam_emac0_interrupt, .emac = EMAC0_INTF, .irq = SAM_IRQ_EMAC0, @@ -859,7 +851,6 @@ static const struct sam_emacattr_s g_emac1_attr = /* Basic hardware information */ .base = SAM_EMAC1_BASE, - .handler = sam_emac1_interrupt, .emac = EMAC1_INTF, .irq = SAM_IRQ_EMAC1, @@ -2467,10 +2458,13 @@ static void sam_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int sam_emac_interrupt(struct sam_emac_s *priv) +static int sam_emac_interrupt(int irq, void *context, FAR void *arg) { + struct sam_emac_s *priv = (struct sam_emac_s *)arg; uint32_t tsr; + DEBUGASSERT(priv != NULL); + /* Disable further Ethernet interrupts. Because Ethernet interrupts are * also disabled if the TX timeout event occurs, there can be no race * condition here. @@ -2530,37 +2524,6 @@ static int sam_emac_interrupt(struct sam_emac_s *priv) return OK; } -/**************************************************************************** - * Function: sam_emac0/1_interrupt - * - * Description: - * EMAC hardware interrupt handler - * - * Parameters: - * irq - Number of the IRQ that generated the interrupt - * context - Interrupt register state save info (architecture-specific) - * - * Returned Value: - * OK on success - * - * Assumptions: - * - ****************************************************************************/ - -#ifdef CONFIG_SAMV7_EMAC0 -static int sam_emac0_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_emac_interrupt(&g_emac0); -} -#endif - -#ifdef CONFIG_SAMV7_EMAC1 -static int sam_emac1_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_emac_interrupt(&g_emac1); -} -#endif - /**************************************************************************** * Function: sam_txtimeout_work * @@ -5052,10 +5015,11 @@ int sam_emac_initialize(int intf) * the interface is in the 'up' state. */ - ret = irq_attach(priv->attr->irq, priv->attr->handler, NULL); + ret = irq_attach(priv->attr->irq, sam_emac_interrupt, priv); if (ret < 0) { - nerr("ERROR: Failed to attach the handler to the IRQ%d\n", priv->attr->irq); + nerr("ERROR: Failed to attach the handler to the IRQ%d\n", + priv->attr->irq); goto errout_with_buffers; } diff --git a/arch/arm/src/samv7/sam_hsmci.c b/arch/arm/src/samv7/sam_hsmci.c index 436b3b231d2..a83a51ecc0b 100644 --- a/arch/arm/src/samv7/sam_hsmci.c +++ b/arch/arm/src/samv7/sam_hsmci.c @@ -472,13 +472,7 @@ static void sam_notransfer(struct sam_dev_s *priv); /* Interrupt Handling *******************************************************/ -static int sam_hsmci_interrupt(struct sam_dev_s *priv); -#ifdef CONFIG_SAMV7_HSMCI0 -static int sam_hsmci0_interrupt(int irq, void *context); -#endif -#ifdef CONFIG_SAMV7_HSMCI1 -static int sam_hsmci1_interrupt(int irq, void *context); -#endif +static int sam_hsmci_interrupt(int irq, void *context, void *arg); /* SDIO interface methods ***************************************************/ @@ -1437,20 +1431,22 @@ static void sam_notransfer(struct sam_dev_s *priv) * HSMCI interrupt handler * * Input Parameters: - * irq - IRQ number of the interrupts - * context - Saved machine context at the time of the interrupt + * Standard interrupt handler arguments. * * Returned Value: * None * ****************************************************************************/ -static int sam_hsmci_interrupt(struct sam_dev_s *priv) +static int sam_hsmci_interrupt(int irq, void *context, void *arg) { + struct sam_dev_s *priv = (struct sam_dev_s *)arg; uint32_t sr; uint32_t enabled; uint32_t pending; + DEBUGASSERT(priv != NULL); + /* Loop while there are pending interrupts. */ for (; ; ) @@ -1643,35 +1639,6 @@ static int sam_hsmci_interrupt(struct sam_dev_s *priv) return OK; } -/**************************************************************************** - * Name: sam_hsmci0_interrupt, sam_hsmci1_interrupt, and sam_hsmci2_interrupt - * - * Description: - * HSMCI interrupt handler - * - * Input Parameters: - * irq - IRQ number of the interrupts - * context - Saved machine context at the time of the interrupt - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_SAMV7_HSMCI0 -static int sam_hsmci0_interrupt(int irq, void *context) -{ - return sam_hsmci_interrupt(&g_hsmci0); -} -#endif - -#ifdef CONFIG_SAMV7_HSMCI1 -static int sam_hsmci1_interrupt(int irq, void *context) -{ - return sam_hsmci_interrupt(&g_hsmci1); -} -#endif - /**************************************************************************** * SDIO Interface Methods ****************************************************************************/ @@ -1922,7 +1889,6 @@ static void sam_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate) static int sam_attach(FAR struct sdio_dev_s *dev) { struct sam_dev_s *priv = (struct sam_dev_s *)dev; - xcpt_t handler; int irq; int ret; @@ -1931,16 +1897,14 @@ static int sam_attach(FAR struct sdio_dev_s *dev) #ifdef CONFIG_SAMV7_HSMCI0 if (priv->hsmci == 0) { - handler = sam_hsmci0_interrupt; - irq = SAM_IRQ_HSMCI0; + irq = SAM_IRQ_HSMCI0; } else #endif #ifdef CONFIG_SAMV7_HSMCI1 if (priv->hsmci == 1) { - handler = sam_hsmci1_interrupt; - irq = SAM_IRQ_HSMCI1; + irq = SAM_IRQ_HSMCI1; } else #endif @@ -1951,7 +1915,7 @@ static int sam_attach(FAR struct sdio_dev_s *dev) /* Attach the HSMCI interrupt handler */ - ret = irq_attach(irq, handler, NULL); + ret = irq_attach(irq, sam_hsmci_interrupt, priv); if (ret == OK) { diff --git a/arch/arm/src/samv7/sam_mcan.c b/arch/arm/src/samv7/sam_mcan.c index be66ea55211..7d16f0898df 100644 --- a/arch/arm/src/samv7/sam_mcan.c +++ b/arch/arm/src/samv7/sam_mcan.c @@ -841,7 +841,6 @@ struct sam_config_s { gpio_pinset_t rxpinset; /* RX pin configuration */ gpio_pinset_t txpinset; /* TX pin configuration */ - xcpt_t handler; /* MCAN common interrupt handler */ uintptr_t base; /* Base address of the MCAN registers */ uint32_t baud; /* Configured baud */ uint32_t btp; /* Bit timing/prescaler register setting */ @@ -973,13 +972,7 @@ static void mcan_error(FAR struct can_dev_s *dev, uint32_t status, #endif static void mcan_receive(FAR struct can_dev_s *dev, FAR uint32_t *rxbuffer, unsigned long nwords); -static void mcan_interrupt(FAR struct can_dev_s *dev); -#ifdef CONFIG_SAMV7_MCAN0 -static int mcan0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMV7_MCAN1 -static int mcan1_interrupt(int irq, void *context, FAR void *arg); -#endif +static int mcan_interrupt(int irq, void *context, FAR void *arg); /* Hardware initialization */ @@ -1019,7 +1012,6 @@ static const struct sam_config_s g_mcan0const = { .rxpinset = GPIO_MCAN0_RX, .txpinset = GPIO_MCAN0_TX, - .handler = mcan0_interrupt, .base = SAM_MCAN0_BASE, .baud = CONFIG_SAMV7_MCAN0_BITRATE, .btp = MCAN_BTP_BRP(MCAN0_BRP) | MCAN_BTP_TSEG1(MCAN0_TSEG1) | @@ -1096,7 +1088,6 @@ static const struct sam_config_s g_mcan1const = { .rxpinset = GPIO_MCAN1_RX, .txpinset = GPIO_MCAN1_TX, - .handler = mcan1_interrupt, .base = SAM_MCAN1_BASE, .baud = CONFIG_SAMV7_MCAN1_BITRATE, .btp = MCAN_BTP_BRP(MCAN1_BRP) | MCAN_BTP_TSEG1(MCAN1_TSEG1) | @@ -2340,7 +2331,7 @@ static int mcan_setup(FAR struct can_dev_s *dev) /* Attach the MCAN interrupt handlers */ - ret = irq_attach(config->irq0, config->handler, NULL); + ret = irq_attach(config->irq0, mcan_interrupt, dev); if (ret < 0) { canerr("ERROR: Failed to attach MCAN%d line 0 IRQ (%d)", @@ -2348,7 +2339,7 @@ static int mcan_setup(FAR struct can_dev_s *dev) return ret; } - ret = irq_attach(config->irq1, config->handler, NULL); + ret = irq_attach(config->irq1, mcan_interrupt, dev); if (ret < 0) { canerr("ERROR: Failed to attach MCAN%d line 1 IRQ (%d)", @@ -3378,9 +3369,10 @@ static void mcan_receive(FAR struct can_dev_s *dev, FAR uint32_t *rxbuffer, * ****************************************************************************/ -static void mcan_interrupt(FAR struct can_dev_s *dev) +static int mcan_interrupt(int irq, void *context, FAR void *arg) { - FAR struct sam_mcan_s *priv = dev->cd_priv; + FAR struct can_dev_s *dev = (FAR struct can_dev_s *)arg; + FAR struct sam_mcan_s *priv; FAR const struct sam_config_s *config; uint32_t ir; uint32_t ie; @@ -3390,6 +3382,8 @@ static void mcan_interrupt(FAR struct can_dev_s *dev) unsigned int ndx; bool handled; + DEBUGASSERT(dev != NULL); + priv = dev->cd_priv; DEBUGASSERT(priv && priv->config); config = priv->config; @@ -3675,52 +3669,6 @@ static void mcan_interrupt(FAR struct can_dev_s *dev) while (handled); } -/**************************************************************************** - * Name: mcan0_interrupt - * - * Description: - * MCAN0 interrupt handler - * - * Input Parameters: - * irq - The IRQ number of the interrupt. - * context - The register state save array at the time of the interrupt. - * - * Returned Value: - * Zero on success; a negated errno on failure - * - ****************************************************************************/ - -#ifdef CONFIG_SAMV7_MCAN0 -static int mcan0_interrupt(int irq, void *context, FAR void *arg) -{ - mcan_interrupt(&g_mcan0dev); - return OK; -} -#endif - -/**************************************************************************** - * Name: mcan1_interrupt - * - * Description: - * MCAN1 interrupt handler - * - * Input Parameters: - * irq - The IRQ number of the interrupt. - * context - The register state save array at the time of the interrupt. - * - * Returned Value: - * Zero on success; a negated errno on failure - * - ****************************************************************************/ - -#ifdef CONFIG_SAMV7_MCAN1 -static int mcan1_interrupt(int irq, void *context, FAR void *arg) -{ - mcan_interrupt(&g_mcan1dev); - return OK; -} -#endif - /**************************************************************************** * Name: mcan_hw_initialize * diff --git a/arch/arm/src/samv7/sam_serial.c b/arch/arm/src/samv7/sam_serial.c index 47ca07e1b1a..ad81eb94765 100644 --- a/arch/arm/src/samv7/sam_serial.c +++ b/arch/arm/src/samv7/sam_serial.c @@ -333,7 +333,6 @@ struct sam_dev_s { const uint32_t usartbase; /* Base address of USART registers */ - xcpt_t handler; /* Interrupt handler */ uint32_t baud; /* Configured baud */ uint32_t sr; /* Saved status bits */ uint8_t irq; /* IRQ associated with this USART */ @@ -353,31 +352,7 @@ static int sam_setup(struct uart_dev_s *dev); static void sam_shutdown(struct uart_dev_s *dev); static int sam_attach(struct uart_dev_s *dev); static void sam_detach(struct uart_dev_s *dev); -static int sam_interrupt(struct uart_dev_s *dev); -#ifdef CONFIG_SAMV7_UART0 -static int sam_uart0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMV7_UART1 -static int sam_uart1_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMV7_UART2 -static int sam_uart2_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMV7_UART3 -static int sam_uart3_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMV7_UART4 -static int sam_uart4_interrupt(int irq, void *context, FAR void *arg); -#endif -#if defined(CONFIG_SAMV7_USART0) && defined(CONFIG_USART0_SERIALDRIVER) -static int sam_usart0_interrupt(int irq, void *context, FAR void *arg); -#endif -#if defined(CONFIG_SAMV7_USART1) && defined(CONFIG_USART1_SERIALDRIVER) -static int sam_usart1_interrupt(int irq, void *context, FAR void *arg); -#endif -#if defined(CONFIG_SAMV7_USART2) && defined(CONFIG_USART2_SERIALDRIVER) -static int sam_usart2_interrupt(int irq, void *context, FAR void *arg); -#endif +static int sam_interrupt(int irq, void *context, FAR void *arg); static int sam_ioctl(struct file *filep, int cmd, unsigned long arg); static int sam_receive(struct uart_dev_s *dev, uint32_t *status); static void sam_rxint(struct uart_dev_s *dev, bool enable); @@ -451,7 +426,6 @@ static char g_usart2txbuffer[CONFIG_USART2_TXBUFSIZE]; static struct sam_dev_s g_uart0priv = { .usartbase = SAM_UART0_BASE, - .handler = sam_uart0_interrupt, .baud = CONFIG_UART0_BAUD, .irq = SAM_IRQ_UART0, .parity = CONFIG_UART0_PARITY, @@ -482,7 +456,6 @@ static uart_dev_t g_uart0port = static struct sam_dev_s g_uart1priv = { .usartbase = SAM_UART1_BASE, - .handler = sam_uart1_interrupt, .baud = CONFIG_UART1_BAUD, .irq = SAM_IRQ_UART1, .parity = CONFIG_UART1_PARITY, @@ -513,7 +486,6 @@ static uart_dev_t g_uart1port = static struct sam_dev_s g_uart2priv = { .usartbase = SAM_UART2_BASE, - .handler = sam_uart2_interrupt, .baud = CONFIG_UART2_BAUD, .irq = SAM_IRQ_UART2, .parity = CONFIG_UART2_PARITY, @@ -544,7 +516,6 @@ static uart_dev_t g_uart2port = static struct sam_dev_s g_uart3priv = { .usartbase = SAM_UART3_BASE, - .handler = sam_uart3_interrupt, .baud = CONFIG_UART3_BAUD, .irq = SAM_IRQ_UART3, .parity = CONFIG_UART3_PARITY, @@ -575,7 +546,6 @@ static uart_dev_t g_uart3port = static struct sam_dev_s g_uart4priv = { .usartbase = SAM_UART4_BASE, - .handler = sam_uart4_interrupt, .baud = CONFIG_UART4_BAUD, .irq = SAM_IRQ_UART4, .parity = CONFIG_UART4_PARITY, @@ -606,7 +576,6 @@ static uart_dev_t g_uart4port = static struct sam_dev_s g_usart0priv = { .usartbase = SAM_USART0_BASE, - .handler = sam_usart0_interrupt, .baud = CONFIG_USART0_BAUD, .irq = SAM_IRQ_USART0, .parity = CONFIG_USART0_PARITY, @@ -640,7 +609,6 @@ static uart_dev_t g_usart0port = static struct sam_dev_s g_usart1priv = { .usartbase = SAM_USART1_BASE, - .handler = sam_usart1_interrupt, .baud = CONFIG_USART1_BAUD, .irq = SAM_IRQ_USART1, .parity = CONFIG_USART1_PARITY, @@ -674,7 +642,6 @@ static uart_dev_t g_usart1port = static struct sam_dev_s g_usart2priv = { .usartbase = SAM_USART2_BASE, - .handler = sam_usart2_interrupt, .baud = CONFIG_USART2_BAUD, .irq = SAM_IRQ_USART2, .parity = CONFIG_USART2_PARITY, @@ -973,7 +940,7 @@ static int sam_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler, NULL); + ret = irq_attach(priv->irq, sam_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -1014,15 +981,16 @@ static void sam_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int sam_interrupt(struct uart_dev_s *dev) +static int sam_interrupt(int irq, void *context, FAR void *arg) { + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct sam_dev_s *priv; - uint32_t pending; - uint32_t imr; - int passes; - bool handled; + uint32_t pending; + uint32_t imr; + int passes; + bool handled; - DEBUGASSERT(dev && dev->priv); + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct sam_dev_s *)dev->priv; /* Loop until there are no characters to be transferred or, until we have @@ -1068,72 +1036,6 @@ static int sam_interrupt(struct uart_dev_s *dev) return OK; } -/**************************************************************************** - * Name: sam_uart[n]_interrupt - * - * Description: - * UART interrupt handlers - * - ****************************************************************************/ - -#ifdef CONFIG_SAMV7_UART0 -static int sam_uart0_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_uart0port); -} -#endif -#ifdef CONFIG_SAMV7_UART1 -static int sam_uart1_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_uart1port); -} -#endif -#ifdef CONFIG_SAMV7_UART2 -static int sam_uart2_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_uart2port); -} -#endif -#ifdef CONFIG_SAMV7_UART3 -static int sam_uart3_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_uart3port); -} -#endif -#ifdef CONFIG_SAMV7_UART4 -static int sam_uart4_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_uart4port); -} -#endif - -/**************************************************************************** - * Name: sam_usart[n]_interrupt - * - * Description: - * USART interrupt handlers - * - ****************************************************************************/ - -#if defined(CONFIG_SAMV7_USART0) && defined(CONFIG_USART0_SERIALDRIVER) -static int sam_usart0_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_usart0port); -} -#endif -#if defined(CONFIG_SAMV7_USART1) && defined(CONFIG_USART1_SERIALDRIVER) -static int sam_usart1_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_usart1port); -} -#endif -#if defined(CONFIG_SAMV7_USART2) && defined(CONFIG_USART2_SERIALDRIVER) -static int sam_usart2_interrupt(int irq, void *context, FAR void *arg) -{ - return sam_interrupt(&g_usart2port); -} -#endif - /**************************************************************************** * Name: sam_ioctl * diff --git a/arch/arm/src/samv7/sam_spi_slave.c b/arch/arm/src/samv7/sam_spi_slave.c index 55b226634e4..6b68769ab87 100644 --- a/arch/arm/src/samv7/sam_spi_slave.c +++ b/arch/arm/src/samv7/sam_spi_slave.c @@ -146,13 +146,7 @@ static void spi_semtake(struct sam_spidev_s *priv); /* Interrupt Handling */ -static int spi_interrupt(struct sam_spidev_s *priv); -#ifdef CONFIG_SAMV7_SPI0_SLAVE -static int spi0_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMV7_SPI1_SLAVE -static int spi1_interrupt(int irq, void *context, FAR void *arg); -#endif +static int spi_interrupt(int irq, void *context, FAR void *arg); /* SPI Helpers */ @@ -395,13 +389,16 @@ static void spi_semtake(struct sam_spidev_s *priv) * ****************************************************************************/ -static int spi_interrupt(struct sam_spidev_s *priv) +static int spi_interrupt(int irq, void *context, FAR void *arg) { + struct sam_spidev_s *priv = (struct sam_spidev_s *)arg; uint32_t sr; uint32_t imr; uint32_t pending; uint32_t regval; + DEBUGASSERT(priv != NULL); + /* We loop because the TDRE interrupt will probably immediately follow the * RDRF interrupt and we might be able to catch it in this handler * execution. @@ -553,48 +550,6 @@ static int spi_interrupt(struct sam_spidev_s *priv) return OK; } -/**************************************************************************** - * Name: spi0_interrupt - * - * Description: - * SPI0 interrupt handler - * - * Input Parameters: - * Standard interrupt input parameters - * - * Returned Value: - * Standard interrupt return value. - * - ****************************************************************************/ - -#ifdef CONFIG_SAMV7_SPI0_SLAVE -static int spi0_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spi0_sctrlr); -} -#endif - -/**************************************************************************** - * Name: spi1_interrupt - * - * Description: - * SPI1 interrupt handler - * - * Input Parameters: - * Standard interrupt input parameters - * - * Returned Value: - * Standard interrupt return value. - * - ****************************************************************************/ - -#ifdef CONFIG_SAMV7_SPI1_SLAVE -static int spi1_interrupt(int irq, void *context, FAR void *arg) -{ - return spi_interrupt(&g_spi1_sctrlr); -} -#endif - /**************************************************************************** * Name: spi_dequeue * @@ -1177,9 +1132,8 @@ struct spi_sctrlr_s *sam_spi_slave_initialize(int port) { /* Set the SPI0 register base address and interrupt information */ - priv->base = SAM_SPI0_BASE, - priv->irq = SAM_IRQ_SPI0; - priv->handler = spi0_interrupt; + priv->base = SAM_SPI0_BASE, + priv->irq = SAM_IRQ_SPI0; /* Enable peripheral clocking to SPI0 */ @@ -1200,9 +1154,8 @@ struct spi_sctrlr_s *sam_spi_slave_initialize(int port) { /* Set the SPI1 register base address and interrupt information */ - priv->base = SAM_SPI1_BASE, - priv->irq = SAM_IRQ_SPI1; - priv->handler = spi1_interrupt; + priv->base = SAM_SPI1_BASE, + priv->irq = SAM_IRQ_SPI1; /* Enable peripheral clocking to SPI1 */ @@ -1255,7 +1208,7 @@ struct spi_sctrlr_s *sam_spi_slave_initialize(int port) /* Attach and enable interrupts at the NVIC */ - DEBUGVERIFY(irq_attach(priv->irq, priv->handler, NULL)); + DEBUGVERIFY(irq_attach(priv->irq, spi_interrupt, priv)); up_enable_irq(priv->irq); spi_dumpregs(priv, "After initialization"); From c62180732eeee36e21b9dfb973ece1bddcc3a0f3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 28 Feb 2017 07:19:55 -0600 Subject: [PATCH 31/38] Adapt more drivers to utilize the IRQ argument feature. --- arch/arm/src/samv7/sam_twihs.c | 45 +++------------ arch/arm/src/stm32/stm32_sdadc.c | 98 +++----------------------------- 2 files changed, 16 insertions(+), 127 deletions(-) diff --git a/arch/arm/src/samv7/sam_twihs.c b/arch/arm/src/samv7/sam_twihs.c index a26e43de3f2..4cbd19d3965 100644 --- a/arch/arm/src/samv7/sam_twihs.c +++ b/arch/arm/src/samv7/sam_twihs.c @@ -140,7 +140,6 @@ struct twi_attr_s gpio_pinset_t sclcfg; /* TWIHS CK pin configuration (SCL in I2C-ese) */ gpio_pinset_t sdacfg; /* TWIHS D pin configuration (SDA in I2C-ese) */ uintptr_t base; /* Base address of TWIHS registers */ - xcpt_t handler; /* TWIHS interrupt handler */ }; /* State of a TWIHS bus */ @@ -199,18 +198,9 @@ static inline void twi_putrel(struct twi_dev_s *priv, unsigned int offset, /* I2C transfer helper functions */ -static int twi_wait(struct twi_dev_s *priv, unsigned int size); +static int twi_wait(struct twi_dev_s *priv, unsigned int size); static void twi_wakeup(struct twi_dev_s *priv, int result); -static int twi_interrupt(struct twi_dev_s *priv); -#ifdef CONFIG_SAMV7_TWIHS0 -static int twi0_interrupt(int irq, FAR void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMV7_TWIHS1 -static int twi1_interrupt(int irq, FAR void *context, FAR void *arg); -#endif -#ifdef CONFIG_SAMV7_TWIHS2 -static int twi2_interrupt(int irq, FAR void *context, FAR void *arg); -#endif +static int twi_interrupt(int irq, FAR void *context, FAR void *arg); static void twi_timeout(int argc, uint32_t arg, ...); static void twi_startread(struct twi_dev_s *priv, struct i2c_msg_s *msg); @@ -250,7 +240,6 @@ static const struct twi_attr_s g_twi0attr = .sclcfg = GPIO_TWIHS0_CK, .sdacfg = GPIO_TWIHS0_D, .base = SAM_TWIHS0_BASE, - .handler = twi0_interrupt, }; static struct twi_dev_s g_twi0; @@ -271,7 +260,6 @@ static const struct twi_attr_s g_twi1attr = .sclcfg = GPIO_TWIHS1_CK, .sdacfg = GPIO_TWIHS1_D, .base = SAM_TWIHS1_BASE, - .handler = twi1_interrupt, }; static struct twi_dev_s g_twi1; @@ -292,7 +280,6 @@ static const struct twi_attr_s g_twi2attr = .sclcfg = GPIO_TWIHS2_CK, .sdacfg = GPIO_TWIHS2_D, .base = SAM_TWIHS2_BASE, - .handler = twi2_interrupt, }; static struct twi_dev_s g_twi2; @@ -571,14 +558,17 @@ static void twi_wakeup(struct twi_dev_s *priv, int result) * ****************************************************************************/ -static int twi_interrupt(struct twi_dev_s *priv) +static int twi_interrupt(int irq, FAR void *context, FAR void *arg) { + struct twi_dev_s *priv = (struct twi_dev_s *)arg; struct i2c_msg_s *msg; uint32_t sr; uint32_t imr; uint32_t pending; uint32_t regval; + DEBUGASSERT(priv != NULL); + /* Retrieve masked interrupt status */ sr = twi_getrel(priv, SAM_TWIHS_SR_OFFSET); @@ -761,27 +751,6 @@ static int twi_interrupt(struct twi_dev_s *priv) return OK; } -#ifdef CONFIG_SAMV7_TWIHS0 -static int twi0_interrupt(int irq, FAR void *context, FAR void *arg) -{ - return twi_interrupt(&g_twi0); -} -#endif - -#ifdef CONFIG_SAMV7_TWIHS1 -static int twi1_interrupt(int irq, FAR void *context, FAR void *arg) -{ - return twi_interrupt(&g_twi1); -} -#endif - -#ifdef CONFIG_SAMV7_TWIHS2 -static int twi2_interrupt(int irq, FAR void *context, FAR void *arg) -{ - return twi_interrupt(&g_twi2); -} -#endif - /**************************************************************************** * Name: twi_timeout * @@ -1444,7 +1413,7 @@ struct i2c_master_s *sam_i2cbus_initialize(int bus) /* Attach Interrupt Handler */ - ret = irq_attach(priv->attr->irq, priv->attr->handler, NULL); + ret = irq_attach(priv->attr->irq, twi_interrupt, priv); if (ret < 0) { ierr("ERROR: Failed to attach irq %d\n", priv->attr->irq); diff --git a/arch/arm/src/stm32/stm32_sdadc.c b/arch/arm/src/stm32/stm32_sdadc.c index cbd0d19ce77..67a769801bb 100644 --- a/arch/arm/src/stm32/stm32_sdadc.c +++ b/arch/arm/src/stm32/stm32_sdadc.c @@ -135,7 +135,6 @@ struct stm32_dev_s #ifdef SDADC_HAVE_TIMER uint8_t trigger; /* Timer trigger selection: see SDADCx_JEXTSEL_TIMxx */ #endif - xcpt_t isr; /* Interrupt handler for this SDADC block */ uint32_t base; /* Base address of registers unique to this SDADC * block */ #ifdef SDADC_HAVE_TIMER @@ -182,16 +181,7 @@ static void sdadc_rccreset(FAR struct stm32_dev_s *priv, bool reset); /* ADC Interrupt Handler */ -static int sdadc_interrupt(FAR struct adc_dev_s *dev); -#if defined(CONFIG_STM32_SDADC1) -static int sdadc1_interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32_SDADC2) -static int sdadc2_interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32_SDADC3) -static int sdadc3_interrupt(int irq, FAR void *context, FAR void * arg); -#endif +static int sdadc_interrupt(int irq, FAR void *context, FAR void *arg); /* ADC Driver Methods */ @@ -241,7 +231,6 @@ static const struct adc_ops_s g_sdadcops = static struct stm32_dev_s g_sdadcpriv1 = { .irq = STM32_IRQ_SDADC1, - .isr = sdadc1_interrupt, .intf = 1, .base = STM32_SDADC1_BASE, .refv = SDADC1_REFV, @@ -271,8 +260,6 @@ static struct adc_dev_s g_sdadcdev1 = static struct stm32_dev_s g_sdadcpriv2 = { .irq = STM32_IRQ_SDADC2, - .isr = sdadc2_interrupt, - .intf = 2, .base = STM32_SDADC2_BASE, .refv = SDADC2_REFV, #ifdef SDADC2_HAVE_TIMER @@ -301,8 +288,6 @@ static struct adc_dev_s g_sdadcdev2 = static struct stm32_dev_s g_sdadcpriv3 = { .irq = STM32_IRQ_SDADC3, - .isr = sdadc3_interrupt, - .intf = 3, .base = STM32_SDADC3_BASE, .refv = SDADC3_REFV, #ifdef SDADC3_HAVE_TIMER @@ -998,7 +983,7 @@ static int sdadc_setup(FAR struct adc_dev_s *dev) { /* Attach the SDADC interrupt */ - ret = irq_attach(priv->irq, priv->isr, NULL); + ret = irq_attach(priv->irq, sdadc_interrupt, dev); if (ret < 0) { ainfo("irq_attach failed: %d\n", ret); @@ -1008,7 +993,7 @@ static int sdadc_setup(FAR struct adc_dev_s *dev) #else /* Attach the SDADC interrupt */ - ret = irq_attach(priv->irq, priv->isr, NULL); + ret = irq_attach(priv->irq, sdadc_interrupt, dev); if (ret < 0) { ainfo("irq_attach failed: %d\n", ret); @@ -1220,14 +1205,18 @@ static int sdadc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg) * ****************************************************************************/ -static int sdadc_interrupt(FAR struct adc_dev_s *dev) +static int sdadc_interrupt(int irq, FAR void *context, FAR void *arg) { - FAR struct stm32_dev_s *priv = (FAR struct stm32_dev_s *)dev->ad_priv; + FAR struct adc_dev_s *dev = (FAR struct adc_dev_s *)arg; + FAR struct stm32_dev_s *priv; uint32_t regval; uint32_t pending; int32_t data; uint8_t chan; + DEBUGASSERT(dev != NULL && dev->ad_priv != NULL); + priv = (FAR struct stm32_dev_s *)dev->ad_priv; + regval = sdadc_getreg(priv, STM32_SDADC_ISR_OFFSET); pending = regval & SDADC_ISR_ALLINTS; if (pending == 0) @@ -1298,75 +1287,6 @@ static int sdadc_interrupt(FAR struct adc_dev_s *dev) return OK; } -/**************************************************************************** - * Name: adc1_interrupt - * - * Description: - * ADC interrupt handler SDADC1 - * - * Input Parameters: - * irq - The IRQ number that generated the interrupt. - * context - Architecture specific register save information. - * - * Returned Value: - * - ****************************************************************************/ - -#if defined(CONFIG_STM32_SDADC1) -static int sdadc1_interrupt(int irq, FAR void *context, FAR void * arg) -{ - sdadc_interrupt(&g_sdadcdev1); - - return OK; -} -#endif - -/**************************************************************************** - * Name: adc2_interrupt - * - * Description: - * ADC interrupt handler SDADC2 - * - * Input Parameters: - * irq - The IRQ number that generated the interrupt. - * context - Architecture specific register save information. - * - * Returned Value: - * - ****************************************************************************/ - -#if defined(CONFIG_STM32_SDADC2) -static int sdadc2_interrupt(int irq, FAR void *context, FAR void * arg) -{ - sdadc_interrupt(&g_sdadcdev2); - - return OK; -} -#endif - -/**************************************************************************** - * Name: adc3_interrupt - * - * Description: - * ADC interrupt handler SDADC3 - * - * Input Parameters: - * irq - The IRQ number that generated the interrupt. - * context - Architecture specific register save information. - * - * Returned Value: - * - ****************************************************************************/ - -#if defined(CONFIG_STM32_SDADC3) -static int sdadc3_interrupt(int irq, FAR void *context, FAR void * arg) -{ - sdadc_interrupt(&g_sdadcdev3); - - return OK; -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ From 92d65294fbb2d9af76fbd4ca933d8bcef57884f0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 28 Feb 2017 08:31:57 -0600 Subject: [PATCH 32/38] Olimex STM32 P407: Add button support --- configs/olimex-stm32-p407/include/board.h | 2 -- configs/olimex-stm32-p407/src/stm32_bringup.c | 11 +++++++++++ configs/olimex-stm32-p407/src/stm32_buttons.c | 10 ++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/configs/olimex-stm32-p407/include/board.h b/configs/olimex-stm32-p407/include/board.h index d8458931402..888ddad8735 100644 --- a/configs/olimex-stm32-p407/include/board.h +++ b/configs/olimex-stm32-p407/include/board.h @@ -45,8 +45,6 @@ #ifndef __ASSEMBLY__ # include #endif -#include "stm32_rcc.h" -#include "stm32.h" /************************************************************************************ * Pre-processor Definitions diff --git a/configs/olimex-stm32-p407/src/stm32_bringup.c b/configs/olimex-stm32-p407/src/stm32_bringup.c index 0894f48b92b..2529cbd87a4 100644 --- a/configs/olimex-stm32-p407/src/stm32_bringup.c +++ b/configs/olimex-stm32-p407/src/stm32_bringup.c @@ -47,6 +47,7 @@ #include #include +#include #ifdef CONFIG_USBMONITOR # include @@ -169,6 +170,16 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_BUTTONS + /* Register the BUTTON driver */ + + ret = btn_lower_initialize("/dev/buttons"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret); + } +#endif + UNUSED(ret); return OK; } diff --git a/configs/olimex-stm32-p407/src/stm32_buttons.c b/configs/olimex-stm32-p407/src/stm32_buttons.c index 463048055ef..ab07a2ed1e9 100644 --- a/configs/olimex-stm32-p407/src/stm32_buttons.c +++ b/configs/olimex-stm32-p407/src/stm32_buttons.c @@ -45,18 +45,12 @@ #include #include +#include "stm32_gpio.h" + #include "olimex-stm32-p407.h" #ifdef CONFIG_ARCH_BUTTONS -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ From efd11ebe35a08432a2f94aaf1f6d104a17e9fe57 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 28 Feb 2017 08:33:52 -0600 Subject: [PATCH 33/38] Fixes from build testing --- arch/arm/src/sama5/sam_emacb.c | 2 +- arch/arm/src/sama5/sam_flexcom_serial.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/sama5/sam_emacb.c b/arch/arm/src/sama5/sam_emacb.c index 31fae778d2f..c1fd14a5c0a 100644 --- a/arch/arm/src/sama5/sam_emacb.c +++ b/arch/arm/src/sama5/sam_emacb.c @@ -2012,7 +2012,7 @@ static void sam_interrupt_work(FAR void *arg) * ****************************************************************************/ -static int sam_emac_interrupt(int irq, void *context, FAR void *arg); +static int sam_emac_interrupt(int irq, void *context, FAR void *arg) { struct sam_emac_s *priv = (struct sam_emac_s *)arg; uint32_t tsr; diff --git a/arch/arm/src/sama5/sam_flexcom_serial.c b/arch/arm/src/sama5/sam_flexcom_serial.c index 9f4ee3b528d..b476b931143 100644 --- a/arch/arm/src/sama5/sam_flexcom_serial.c +++ b/arch/arm/src/sama5/sam_flexcom_serial.c @@ -527,7 +527,7 @@ static void flexus_disableallints(struct flexus_dev_s *priv, uint32_t *imr) * ****************************************************************************/ -static int flexus_interrupt(int irq, void *context, FAR void *arg); +static int flexus_interrupt(int irq, void *context, FAR void *arg) { struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct flexus_dev_s *priv; From 7d24f45c7ed7ecd7c20c68c16f45aaaa4c556dff Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 28 Feb 2017 08:39:02 -0600 Subject: [PATCH 34/38] STM32 1wire: Convert to use new interrupt argument infrastructure. --- arch/arm/src/stm32/stm32_1wire.c | 96 +++----------------------------- 1 file changed, 8 insertions(+), 88 deletions(-) diff --git a/arch/arm/src/stm32/stm32_1wire.c b/arch/arm/src/stm32/stm32_1wire.c index a6bf2388398..b43769577a8 100644 --- a/arch/arm/src/stm32/stm32_1wire.c +++ b/arch/arm/src/stm32/stm32_1wire.c @@ -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 * From ea1e6abfd733c23ab91301dc27285453e53c308f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 28 Feb 2017 08:41:44 -0600 Subject: [PATCH 35/38] Fix error found in build testing. --- arch/arm/src/samdl/sam_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/src/samdl/sam_serial.c b/arch/arm/src/samdl/sam_serial.c index 71571ea9a9f..8c88850acc6 100644 --- a/arch/arm/src/samdl/sam_serial.c +++ b/arch/arm/src/samdl/sam_serial.c @@ -530,7 +530,7 @@ static void sam_disableallints(struct sam_dev_s *priv) static int sam_interrupt(int irq, void *context, FAR void *arg) { - struct uart_dev_s *dev = (struct uart_dev_s )arg; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct sam_dev_s *priv; uint8_t pending; uint8_t intflag; From 370e188fa32ac8e85dfb87a5b6c6846bdae309bc Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 28 Feb 2017 09:05:01 -0600 Subject: [PATCH 36/38] Convert more drivers to use new interrupt argument structure. --- arch/arm/src/stm32/stm32_qencoder.c | 98 ++----------------------- arch/arm/src/stm32l4/stm32l4_qencoder.c | 96 ++---------------------- arch/arm/src/tms570/tms570_serial.c | 39 ++-------- arch/xtensa/src/esp32/esp32_serial.c | 49 ++----------- 4 files changed, 23 insertions(+), 259 deletions(-) diff --git a/arch/arm/src/stm32/stm32_qencoder.c b/arch/arm/src/stm32/stm32_qencoder.c index 07e8faf0a95..e2245075b91 100644 --- a/arch/arm/src/stm32/stm32_qencoder.c +++ b/arch/arm/src/stm32/stm32_qencoder.c @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/stm32/stm32_qencoder.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt * Diego Sanchez * @@ -259,7 +259,6 @@ struct stm32_qeconfig_s uint32_t enable; /* RCC clock enable bit */ uint32_t base; /* Register base address */ uint32_t psc; /* Timer input clock prescaler */ - xcpt_t handler; /* Interrupt handler for this IRQ */ }; /* Overall, RAM-based state structure */ @@ -304,25 +303,7 @@ static FAR struct stm32_lowerhalf_s *stm32_tim2lower(int tim); /* Interrupt handling */ #ifdef HAVE_16BIT_TIMERS -static int stm32_interrupt(FAR struct stm32_lowerhalf_s *priv); -#if defined(CONFIG_STM32_TIM1_QE) && TIM1_BITWIDTH == 16 -static int stm32_tim1interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32_TIM2_QE) && TIM2_BITWIDTH == 16 -static int stm32_tim2interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32_TIM3_QE) && TIM3_BITWIDTH == 16 -static int stm32_tim3interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32_TIM4_QE) && TIM4_BITWIDTH == 16 -static int stm32_tim4interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32_TIM5_QE) && TIM5_BITWIDTH == 16 -static int stm32_tim5interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32_TIM8_QE) && TIM8_BITWIDTH == 16 -static int stm32_tim8interrupt(int irq, FAR void *context, FAR void * arg); -#endif +static int stm32_interrupt(int irq, FAR void *context, FAR void *arg); #endif /* Lower-half Quadrature Encoder Driver Methods */ @@ -363,9 +344,6 @@ static const struct stm32_qeconfig_s g_tim1config = .psc = CONFIG_STM32_TIM1_QEPSC, .ti1cfg = GPIO_TIM1_CH1IN, .ti2cfg = GPIO_TIM1_CH2IN, -#if TIM1_BITWIDTH == 16 - .handler = stm32_tim1interrupt, -#endif }; static struct stm32_lowerhalf_s g_tim1lower = @@ -391,9 +369,6 @@ static const struct stm32_qeconfig_s g_tim2config = .psc = CONFIG_STM32_TIM2_QEPSC, .ti1cfg = GPIO_TIM2_CH1IN, .ti2cfg = GPIO_TIM2_CH2IN, -#if TIM2_BITWIDTH == 16 - .handler = stm32_tim2interrupt, -#endif }; static struct stm32_lowerhalf_s g_tim2lower = @@ -419,9 +394,6 @@ static const struct stm32_qeconfig_s g_tim3config = .psc = CONFIG_STM32_TIM3_QEPSC, .ti1cfg = GPIO_TIM3_CH1IN, .ti2cfg = GPIO_TIM3_CH2IN, -#if TIM3_BITWIDTH == 16 - .handler = stm32_tim3interrupt, -#endif }; static struct stm32_lowerhalf_s g_tim3lower = @@ -447,9 +419,6 @@ static const struct stm32_qeconfig_s g_tim4config = .psc = CONFIG_STM32_TIM4_QEPSC, .ti1cfg = GPIO_TIM4_CH1IN, .ti2cfg = GPIO_TIM4_CH2IN, -#if TIM4_BITWIDTH == 16 - .handler = stm32_tim4interrupt, -#endif }; static struct stm32_lowerhalf_s g_tim4lower = @@ -475,9 +444,6 @@ static const struct stm32_qeconfig_s g_tim5config = .psc = CONFIG_STM32_TIM5_QEPSC, .ti1cfg = GPIO_TIM5_CH1IN, .ti2cfg = GPIO_TIM5_CH2IN, -#if TIM5_BITWIDTH == 16 - .handler = stm32_tim5interrupt, -#endif }; static struct stm32_lowerhalf_s g_tim5lower = @@ -503,9 +469,6 @@ static const struct stm32_qeconfig_s g_tim8config = .psc = CONFIG_STM32_TIM8_QEPSC, .ti1cfg = GPIO_TIM8_CH1IN, .ti2cfg = GPIO_TIM8_CH2IN, -#if TIM8_BITWIDTH == 16 - .handler = stm32_tim8interrupt, -#endif }; static struct stm32_lowerhalf_s g_tim8lower = @@ -713,10 +676,13 @@ static FAR struct stm32_lowerhalf_s *stm32_tim2lower(int tim) ************************************************************************************/ #ifdef HAVE_16BIT_TIMERS -static int stm32_interrupt(FAR struct stm32_lowerhalf_s *priv) +static int stm32_interrupt(int irq, FAR void *context, FAR void *arg) { + FAR struct stm32_lowerhalf_s *priv = (FAR struct stm32_lowerhalf_s *)arg; uint16_t regval; + DEBUGASSERT(priv != NULL); + /* Verify that this is an update interrupt. Nothing else is expected. */ regval = stm32_getreg16(priv, STM32_GTIM_SR_OFFSET); @@ -744,56 +710,6 @@ static int stm32_interrupt(FAR struct stm32_lowerhalf_s *priv) } #endif -/************************************************************************************ - * Name: stm32_timNinterrupt - * - * Description: - * TIMN interrupt handler - * - ************************************************************************************/ - -#if defined(CONFIG_STM32_TIM1_QE) && TIM1_BITWIDTH == 16 -static int stm32_tim1interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32_interrupt(&g_tim1lower); -} -#endif - -#if defined(CONFIG_STM32_TIM2_QE) && TIM2_BITWIDTH == 16 -static int stm32_tim2interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32_interrupt(&g_tim2lower); -} -#endif - -#if defined(CONFIG_STM32_TIM3_QE) && TIM3_BITWIDTH == 16 -static int stm32_tim3interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32_interrupt(&g_tim3lower); -} -#endif - -#if defined(CONFIG_STM32_TIM4_QE) && TIM4_BITWIDTH == 16 -static int stm32_tim4interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32_interrupt(&g_tim4lower); -} -#endif - -#if defined(CONFIG_STM32_TIM5_QE) && TIM5_BITWIDTH == 16 -static int stm32_tim5interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32_interrupt(&g_tim5lower); -} -#endif - -#if defined(CONFIG_STM32_TIM8_QE) && TIM8_BITWIDTH == 16 -static int stm32_tim8interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32_interrupt(&g_tim8lower); -} -#endif - /************************************************************************************ * Name: stm32_setup * @@ -973,7 +889,7 @@ static int stm32_setup(FAR struct qe_lowerhalf_s *lower) { /* Attach the interrupt handler */ - ret = irq_attach(priv->config->irq, priv->config->handler, NULL); + ret = irq_attach(priv->config->irq, stm32_interrupt, priv); if (ret < 0) { stm32_shutdown(lower); diff --git a/arch/arm/src/stm32l4/stm32l4_qencoder.c b/arch/arm/src/stm32l4/stm32l4_qencoder.c index 5e2dc4e0018..7c65b95d5a9 100644 --- a/arch/arm/src/stm32l4/stm32l4_qencoder.c +++ b/arch/arm/src/stm32l4/stm32l4_qencoder.c @@ -199,7 +199,6 @@ struct stm32l4_qeconfig_s uint32_t ti2cfg; /* TI2 input pin configuration (20-bit encoding) */ uint32_t base; /* Register base address */ uint32_t psc; /* Encoder pulses prescaler */ - xcpt_t handler; /* Interrupt handler for this IRQ */ }; /* Overall, RAM-based state structure */ @@ -244,25 +243,7 @@ static FAR struct stm32l4_lowerhalf_s *stm32l4_tim2lower(int tim); /* Interrupt handling */ #ifdef HAVE_16BIT_TIMERS -static int stm32l4_interrupt(FAR struct stm32l4_lowerhalf_s *priv); -#if defined(CONFIG_STM32L4_TIM1_QE) && TIM1_BITWIDTH == 16 -static int stm32l4_tim1interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32L4_TIM2_QE) && TIM2_BITWIDTH == 16 -static int stm32l4_tim2interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32L4_TIM3_QE) && TIM3_BITWIDTH == 16 -static int stm32l4_tim3interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32L4_TIM4_QE) && TIM4_BITWIDTH == 16 -static int stm32l4_tim4interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32L4_TIM5_QE) && TIM5_BITWIDTH == 16 -static int stm32l4_tim5interrupt(int irq, FAR void *context, FAR void * arg); -#endif -#if defined(CONFIG_STM32L4_TIM8_QE) && TIM8_BITWIDTH == 16 -static int stm32l4_tim8interrupt(int irq, FAR void *context, FAR void * arg); -#endif +static int stm32l4_interrupt(int irq, FAR void *context, FAR void *arg); #endif /* Lower-half Quadrature Encoder Driver Methods */ @@ -301,9 +282,6 @@ static const struct stm32l4_qeconfig_s g_tim1config = .psc = CONFIG_STM32L4_TIM1_QEPSC, .ti1cfg = GPIO_TIM1_CH1IN, .ti2cfg = GPIO_TIM1_CH2IN, -#if TIM1_BITWIDTH == 16 - .handler = stm32l4_tim1interrupt, -#endif }; static struct stm32l4_lowerhalf_s g_tim1lower = @@ -327,9 +305,6 @@ static const struct stm32l4_qeconfig_s g_tim2config = .psc = CONFIG_STM32L4_TIM2_QEPSC, .ti1cfg = GPIO_TIM2_CH1IN, .ti2cfg = GPIO_TIM2_CH2IN, -#if TIM2_BITWIDTH == 16 - .handler = stm32l4_tim2interrupt, -#endif }; static struct stm32l4_lowerhalf_s g_tim2lower = @@ -353,9 +328,6 @@ static const struct stm32l4_qeconfig_s g_tim3config = .psc = CONFIG_STM32L4_TIM3_QEPSC, .ti1cfg = GPIO_TIM3_CH1IN, .ti2cfg = GPIO_TIM3_CH2IN, -#if TIM3_BITWIDTH == 16 - .handler = stm32l4_tim3interrupt, -#endif }; static struct stm32l4_lowerhalf_s g_tim3lower = @@ -379,9 +351,6 @@ static const struct stm32l4_qeconfig_s g_tim4config = .psc = CONFIG_STM32L4_TIM4_QEPSC, .ti1cfg = GPIO_TIM4_CH1IN, .ti2cfg = GPIO_TIM4_CH2IN, -#if TIM4_BITWIDTH == 16 - .handler = stm32l4_tim4interrupt, -#endif }; static struct stm32l4_lowerhalf_s g_tim4lower = @@ -405,9 +374,6 @@ static const struct stm32l4_qeconfig_s g_tim5config = .psc = CONFIG_STM32L4_TIM5_QEPSC, .ti1cfg = GPIO_TIM5_CH1IN, .ti2cfg = GPIO_TIM5_CH2IN, -#if TIM5_BITWIDTH == 16 - .handler = stm32l4_tim5interrupt, -#endif }; static struct stm32l4_lowerhalf_s g_tim5lower = @@ -431,9 +397,6 @@ static const struct stm32l4_qeconfig_s g_tim8config = .psc = CONFIG_STM32L4_TIM8_QEPSC, .ti1cfg = GPIO_TIM8_CH1IN, .ti2cfg = GPIO_TIM8_CH2IN, -#if TIM8_BITWIDTH == 16 - .handler = stm32l4_tim8interrupt, -#endif }; static struct stm32l4_lowerhalf_s g_tim8lower = @@ -645,10 +608,13 @@ static FAR struct stm32l4_lowerhalf_s *stm32l4_tim2lower(int tim) ************************************************************************************/ #ifdef HAVE_16BIT_TIMERS -static int stm32l4_interrupt(FAR struct stm32l4_lowerhalf_s *priv) +static int stm32l4_interrupt(int irq, FAR void *context, FAR void *arg) { + FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)arg; uint16_t regval; + DEBUGASSERT(priv != NULL); + /* Verify that this is an update interrupt. Nothing else is expected. */ regval = stm32l4_getreg16(priv, STM32L4_GTIM_SR_OFFSET); @@ -676,56 +642,6 @@ static int stm32l4_interrupt(FAR struct stm32l4_lowerhalf_s *priv) } #endif -/************************************************************************************ - * Name: stm32l4_timNinterrupt - * - * Description: - * TIMN interrupt handler - * - ************************************************************************************/ - -#if defined(CONFIG_STM32L4_TIM1_QE) && TIM1_BITWIDTH == 16 -static int stm32l4_tim1interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32l4_interrupt(&g_tim1lower); -} -#endif - -#if defined(CONFIG_STM32L4_TIM2_QE) && TIM2_BITWIDTH == 16 -static int stm32l4_tim2interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32l4_interrupt(&g_tim2lower); -} -#endif - -#if defined(CONFIG_STM32L4_TIM3_QE) && TIM3_BITWIDTH == 16 -static int stm32l4_tim3interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32l4_interrupt(&g_tim3lower); -} -#endif - -#if defined(CONFIG_STM32L4_TIM4_QE) && TIM4_BITWIDTH == 16 -static int stm32l4_tim4interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32l4_interrupt(&g_tim4lower); -} -#endif - -#if defined(CONFIG_STM32L4_TIM5_QE) && TIM5_BITWIDTH == 16 -static int stm32l4_tim5interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32l4_interrupt(&g_tim5lower); -} -#endif - -#if defined(CONFIG_STM32L4_TIM8_QE) && TIM8_BITWIDTH == 16 -static int stm32l4_tim8interrupt(int irq, FAR void *context, FAR void * arg) -{ - return stm32l4_interrupt(&g_tim8lower); -} -#endif - /************************************************************************************ * Name: stm32l4_setup * @@ -912,7 +828,7 @@ static int stm32l4_setup(FAR struct qe_lowerhalf_s *lower) { /* Attach the interrupt handler */ - ret = irq_attach(priv->config->irq, priv->config->handler, NULL); + ret = irq_attach(priv->config->irq, stm32l4_interrupt, priv); if (ret < 0) { stm32l4_shutdown(lower); diff --git a/arch/arm/src/tms570/tms570_serial.c b/arch/arm/src/tms570/tms570_serial.c index 2878a03fd13..8bb84ed91fd 100644 --- a/arch/arm/src/tms570/tms570_serial.c +++ b/arch/arm/src/tms570/tms570_serial.c @@ -132,7 +132,6 @@ struct tms570_dev_s { const uint32_t scibase; /* Base address of SCI registers */ struct sci_config_s config; /* SCI configuration */ - xcpt_t handler; /* Interrupt handler */ uint8_t irq; /* IRQ associated with this SCI */ }; @@ -144,13 +143,7 @@ static int tms570_setup(struct uart_dev_s *dev); static void tms570_shutdown(struct uart_dev_s *dev); static int tms570_attach(struct uart_dev_s *dev); static void tms570_detach(struct uart_dev_s *dev); -static int tms570_interrupt(struct uart_dev_s *dev); -#ifdef CONFIG_TMS570_SCI1 -static int tms570_sci1_interrupt(int irq, void *context, FAR void *arg); -#endif -#ifdef CONFIG_TMS570_SCI2 -static int tms570_sci2_interrupt(int irq, void *context, FAR void *arg); -#endif +static int tms570_interrupt(int irq, void *context, FAR void *arg); static int tms570_ioctl(struct file *filep, int cmd, unsigned long arg); static int tms570_receive(struct uart_dev_s *dev, uint32_t *status); static void tms570_rxint(struct uart_dev_s *dev, bool enable); @@ -207,7 +200,6 @@ static struct tms570_dev_s g_sci1priv = .bits = CONFIG_SCI1_BITS, .stopbits2 = CONFIG_SCI1_2STOP, }, - .handler = tms570_sci1_interrupt, .irq = TMS570_REQ_SCI1_0, }; @@ -241,7 +233,6 @@ static struct tms570_dev_s g_sci2priv = .bits = CONFIG_SCI2_BITS, .stopbits2 = CONFIG_SCI2_2STOP, }, - .handler = tms570_sci2_interrupt, .irq = TMS570_REQ_SCI2_0, }; @@ -387,7 +378,7 @@ static int tms570_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->irq, priv->handler, NULL); + ret = irq_attach(priv->irq, tms570_interrupt, dev); if (ret == OK) { /* Enable the interrupt (RX and TX interrupts are still disabled @@ -428,10 +419,11 @@ static void tms570_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int tms570_interrupt(struct uart_dev_s *dev) +static int tms570_interrupt(int irq, void *context, FAR void *arg) { + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct tms570_dev_s *priv; - uint32_t intvec; + uint32_t intvec; DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct tms570_dev_s *)dev->priv; @@ -514,27 +506,6 @@ static int tms570_interrupt(struct uart_dev_s *dev) return OK; } -/**************************************************************************** - * Name: tms570_sci[n]_interrupt - * - * Description: - * SCI interrupt handlers - * - ****************************************************************************/ - -#ifdef CONFIG_TMS570_SCI1 -static int tms570_sci1_interrupt(int irq, void *context, FAR void *arg) -{ - return tms570_interrupt(&g_sci1port); -} -#endif -#ifdef CONFIG_TMS570_SCI2 -static int tms570_sci2_interrupt(int irq, void *context, FAR void *arg) -{ - return tms570_interrupt(&g_sci2port); -} -#endif - /**************************************************************************** * Name: tms570_ioctl * diff --git a/arch/xtensa/src/esp32/esp32_serial.c b/arch/xtensa/src/esp32/esp32_serial.c index 37027c8b9b9..a5b132487dd 100644 --- a/arch/xtensa/src/esp32/esp32_serial.c +++ b/arch/xtensa/src/esp32/esp32_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/xtensa/src/esp32/esp32_serial.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -147,7 +147,6 @@ struct esp32_config_s { const uint32_t uartbase; /* Base address of UART registers */ - xcpt_t handler; /* Interrupt handler */ uint8_t periph; /* UART peripheral ID */ uint8_t irq; /* IRQ number assigned to the peripheral */ uint8_t txpin; /* Tx pin number (0-39) */ @@ -186,16 +185,7 @@ static int esp32_setup(struct uart_dev_s *dev); static void esp32_shutdown(struct uart_dev_s *dev); 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, FAR void *arg); -#endif -#ifdef CONFIG_ESP32_UART1 -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, FAR void *arg); -#endif +static int esp32_interrupt(int cpuint, void *context, FAR void *arg); static int esp32_ioctl(struct file *filep, int cmd, unsigned long arg); static int esp32_receive(struct uart_dev_s *dev, unsigned int *status); static void esp32_rxint(struct uart_dev_s *dev, bool enable); @@ -249,7 +239,6 @@ static char g_uart2txbuffer[CONFIG_UART2_TXBUFSIZE]; static const struct esp32_config_s g_uart0config = { .uartbase = DR_REG_UART_BASE, - .handler = esp32_uart0_interrupt, .periph = ESP32_PERIPH_UART, .irq = ESP32_IRQ_UART, .txpin = CONFIG_ESP32_UART0_TXPIN, @@ -296,7 +285,6 @@ static uart_dev_t g_uart0port = static const struct esp32_config_s g_uart1config = { .uartbase = DR_REG_UART1_BASE, - .handler = esp32_uart1_interrupt, .periph = ESP32_PERIPH_UART1, .irq = ESP32_IRQ_UART1, .txpin = CONFIG_ESP32_UART1_TXPIN, @@ -343,7 +331,6 @@ static uart_dev_t g_uart1port = static const struct esp32_config_s g_uart2config = { .uartbase = DR_REG_UART2_BASE, - .handler = esp32_uart2_interrupt, .periph = ESP32_PERIPH_UART2, .irq = ESP32_IRQ_UART2, .txpin = CONFIG_ESP32_UART2_TXPIN, @@ -675,7 +662,7 @@ static int esp32_attach(struct uart_dev_s *dev) /* Attach and enable the IRQ */ - ret = irq_attach(priv->config->irq, priv->config->handler, NULL); + ret = irq_attach(priv->config->irq, esp32_interrupt, dev); if (ret == OK) { /* Enable the CPU interrupt (RX and TX interrupts are still disabled @@ -735,8 +722,9 @@ static void esp32_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static int esp32_interrupt(struct uart_dev_s *dev) +static int esp32_interrupt(int cpuint, void *context, FAR void *arg) { + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct esp32_dev_s *priv; uint32_t regval; uint32_t status; @@ -806,33 +794,6 @@ static int esp32_interrupt(struct uart_dev_s *dev) return OK; } -/**************************************************************************** - * Name: esp32_uart[n]_interrupt - * - * Description: - * UART interrupt handlers - * - ****************************************************************************/ - -#ifdef CONFIG_ESP32_UART0 -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, FAR void *arg) -{ - return esp32_interrupt(&g_uart1port); -} -#endif -#ifdef CONFIG_ESP32_UART2 -static int esp32_uart2_interrupt(int cpuint, void *context, FAR void *arg) -{ - return esp32_interrupt(&g_uart2port); -} -#endif - /**************************************************************************** * Name: esp32_ioctl * From dc93340a01c1d44a7d422db63fd2ff81fbe0d15f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 28 Feb 2017 09:29:09 -0600 Subject: [PATCH 37/38] Convert more drivers to use new interrupt argument structure. --- arch/arm/src/kinetis/kinetis_serial.c | 103 ++------------------------ arch/arm/src/stm32/stm32_can.c | 57 +++----------- arch/risc-v/src/nr5m100/nr5_serial.c | 25 +------ 3 files changed, 22 insertions(+), 163 deletions(-) diff --git a/arch/arm/src/kinetis/kinetis_serial.c b/arch/arm/src/kinetis/kinetis_serial.c index 77dca986946..63873ecab5f 100644 --- a/arch/arm/src/kinetis/kinetis_serial.c +++ b/arch/arm/src/kinetis/kinetis_serial.c @@ -688,11 +688,11 @@ static int up_attach(struct uart_dev_s *dev) * disabled in the C2 register. */ - ret = irq_attach(priv->irqs, up_interrupts, NULL); + ret = irq_attach(priv->irqs, up_interrupts, dev); #ifdef CONFIG_DEBUG_FEATURES if (ret == OK) { - ret = irq_attach(priv->irqe, up_interrupt, NULL); + ret = irq_attach(priv->irqe, up_interrupt, dev); } #endif @@ -749,58 +749,12 @@ static void up_detach(struct uart_dev_s *dev) #ifdef CONFIG_DEBUG_FEATURES static int up_interrupt(int irq, void *context, FAR void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; uint8_t regval; -#ifdef CONFIG_KINETIS_UART0 - if (g_uart0priv.irqe == irq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_KINETIS_UART1 - if (g_uart1priv.irqe == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_KINETIS_UART2 - if (g_uart2priv.irqe == irq) - { - dev = &g_uart2port; - } - else -#endif -#ifdef CONFIG_KINETIS_UART3 - if (g_uart3priv.irqe == irq) - { - dev = &g_uart3port; - } - else -#endif -#ifdef CONFIG_KINETIS_UART4 - if (g_uart4priv.irqe == irq) - { - dev = &g_uart4port; - } - else -#endif -#ifdef CONFIG_KINETIS_UART5 - if (g_uart5priv.irqe == irq) - { - dev = &g_uart5port; - } - else -#endif - { - PANIC(); - } - + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; - DEBUGASSERT(priv); /* Handle error interrupts. This interrupt may be caused by: * @@ -837,7 +791,7 @@ static int up_interrupt(int irq, void *context, FAR void *arg) static int up_interrupts(int irq, void *context, FAR void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; int passes; #ifdef CONFIG_KINETIS_UARTFIFOS @@ -847,53 +801,8 @@ static int up_interrupts(int irq, void *context, FAR void *arg) #endif bool handled; -#ifdef CONFIG_KINETIS_UART0 - if (g_uart0priv.irqs == irq) - { - dev = &g_uart0port; - } - else -#endif -#ifdef CONFIG_KINETIS_UART1 - if (g_uart1priv.irqs == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_KINETIS_UART2 - if (g_uart2priv.irqs == irq) - { - dev = &g_uart2port; - } - else -#endif -#ifdef CONFIG_KINETIS_UART3 - if (g_uart3priv.irqs == irq) - { - dev = &g_uart3port; - } - else -#endif -#ifdef CONFIG_KINETIS_UART4 - if (g_uart4priv.irqs == irq) - { - dev = &g_uart4port; - } - else -#endif -#ifdef CONFIG_KINETIS_UART5 - if (g_uart5priv.irqs == irq) - { - dev = &g_uart5port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; - DEBUGASSERT(priv); /* Loop until there are no characters to be transferred or, * until we have been looping for a long time. diff --git a/arch/arm/src/stm32/stm32_can.c b/arch/arm/src/stm32/stm32_can.c index 52783e62171..d90e5cd06da 100644 --- a/arch/arm/src/stm32/stm32_can.c +++ b/arch/arm/src/stm32/stm32_can.c @@ -159,7 +159,7 @@ static bool stm32can_txempty(FAR struct can_dev_s *dev); /* CAN interrupt handling */ -static int stm32can_rxinterrupt(int irq, FAR void *context, int rxmb); +static int stm32can_rxinterrupt(FAR struct can_dev_s *dev, int rxmb); static int stm32can_rx0interrupt(int irq, FAR void *context, FAR void *arg); static int stm32can_rx1interrupt(int irq, FAR void *context, FAR void *arg); static int stm32can_txinterrupt(int irq, FAR void *context, FAR void *arg); @@ -654,7 +654,7 @@ static int stm32can_setup(FAR struct can_dev_s *dev) * The others are not used. */ - ret = irq_attach(priv->canrx[0], stm32can_rx0interrupt, NULL); + ret = irq_attach(priv->canrx[0], stm32can_rx0interrupt, dev); if (ret < 0) { canerr("ERROR: Failed to attach CAN%d RX0 IRQ (%d)", @@ -662,7 +662,7 @@ static int stm32can_setup(FAR struct can_dev_s *dev) return ret; } - ret = irq_attach(priv->canrx[1], stm32can_rx1interrupt, NULL); + ret = irq_attach(priv->canrx[1], stm32can_rx1interrupt, dev); if (ret < 0) { canerr("ERROR: Failed to attach CAN%d RX1 IRQ (%d)", @@ -670,7 +670,7 @@ static int stm32can_setup(FAR struct can_dev_s *dev) return ret; } - ret = irq_attach(priv->cantx, stm32can_txinterrupt, NULL); + ret = irq_attach(priv->cantx, stm32can_txinterrupt, dev); if (ret < 0) { canerr("ERROR: Failed to attach CAN%d TX IRQ (%d)", @@ -1371,9 +1371,8 @@ static bool stm32can_txempty(FAR struct can_dev_s *dev) * ****************************************************************************/ -static int stm32can_rxinterrupt(int irq, FAR void *context, int rxmb) +static int stm32can_rxinterrupt(FAR struct can_dev_s *dev, int rxmb) { - FAR struct can_dev_s *dev = NULL; FAR struct stm32_can_s *priv; struct can_hdr_s hdr; uint8_t data[CAN_MAXDATALEN]; @@ -1381,24 +1380,7 @@ static int stm32can_rxinterrupt(int irq, FAR void *context, int rxmb) int npending; int ret; -#if defined(CONFIG_STM32_CAN1) && defined(CONFIG_STM32_CAN2) - if (g_can1priv.canrx[rxmb] == irq) - { - dev = &g_can1dev; - } - else if (g_can2priv.canrx[rxmb] == irq) - { - dev = &g_can2dev; - } - else - { - PANIC(); - } -#elif defined(CONFIG_STM32_CAN1) - dev = &g_can1dev; -#else /* defined(CONFIG_STM32_CAN2) */ - dev = &g_can2dev; -#endif + DEBUGASSERT(dev != NULL && dev->cd_priv != NULL); priv = dev->cd_priv; /* Verify that a message is pending in the FIFO */ @@ -1508,7 +1490,8 @@ errout: static int stm32can_rx0interrupt(int irq, FAR void *context, FAR void *arg) { - return stm32can_rxinterrupt(irq, context, 0); + FAR struct can_dev_s *dev = (FAR struct can_dev_s *)arg; + return stm32can_rxinterrupt(dev, 0); } /**************************************************************************** @@ -1528,7 +1511,8 @@ static int stm32can_rx0interrupt(int irq, FAR void *context, FAR void *arg) static int stm32can_rx1interrupt(int irq, FAR void *context, FAR void *arg) { - return stm32can_rxinterrupt(irq, context, 1); + FAR struct can_dev_s *dev = (FAR struct can_dev_s *)arg; + return stm32can_rxinterrupt(dev, 1); } /**************************************************************************** @@ -1548,28 +1532,11 @@ static int stm32can_rx1interrupt(int irq, FAR void *context, FAR void *arg) static int stm32can_txinterrupt(int irq, FAR void *context, FAR void *arg) { - FAR struct can_dev_s *dev = NULL; + FAR struct can_dev_s *dev = (FAR struct can_dev_s *)arg; FAR struct stm32_can_s *priv; uint32_t regval; -#if defined(CONFIG_STM32_CAN1) && defined(CONFIG_STM32_CAN2) - if (g_can1priv.cantx == irq) - { - dev = &g_can1dev; - } - else if (g_can2priv.cantx == irq) - { - dev = &g_can2dev; - } - else - { - PANIC(); - } -#elif defined(CONFIG_STM32_CAN1) - dev = &g_can1dev; -#else /* defined(CONFIG_STM32_CAN2) */ - dev = &g_can2dev; -#endif + DEBUGASSERT(dev != NULL && dev->cd_priv != NULL); priv = dev->cd_priv; /* Get the transmit status */ diff --git a/arch/risc-v/src/nr5m100/nr5_serial.c b/arch/risc-v/src/nr5m100/nr5_serial.c index 3d2e7381876..32572a5ebc4 100644 --- a/arch/risc-v/src/nr5m100/nr5_serial.c +++ b/arch/risc-v/src/nr5m100/nr5_serial.c @@ -363,8 +363,8 @@ static int up_attach(struct uart_dev_s *dev) /* Initialize interrupt generation on the peripheral */ up_serialout(priv, NR5_UART_CTRL_REG_OFFSET, IE_RX | IE_TX); - irq_attach(priv->irqrx, up_interrupt, NULL); - irq_attach(priv->irqtx, up_interrupt, NULL); + irq_attach(priv->irqrx, up_interrupt, dev); + irq_attach(priv->irqtx, up_interrupt, dev); /* Indicate no interrupts active in EPIC */ @@ -415,31 +415,14 @@ static void up_detach(struct uart_dev_s *dev) static int up_interrupt(int irq, void *context, FAR void *arg) { - struct uart_dev_s *dev = NULL; + struct uart_dev_s *dev = (struct uart_dev_s *)arg; struct up_dev_s *priv; int passes; uint32_t status; bool handled; -#ifdef CONFIG_NR5_UART1 - if (g_uart1priv.irqrx == irq || g_uart1priv.irqtx == irq) - { - dev = &g_uart1port; - } - else -#endif -#ifdef CONFIG_NR5_UART2 - if (g_uart2priv.irqrx == irq || g_uart2priv.irqtx == irq) - { - dev = &g_uart2port; - } - else -#endif - { - PANIC(); - } + DEBUGASSERT(dev != NULL && dev->priv != NULL); priv = (struct up_dev_s *)dev->priv; - DEBUGASSERT(priv); /* Loop until there are no characters to be transferred or, * until we have been looping for a long time. From aa0c05af859f72e5666b11193f3e72e0461bf5b5 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 28 Feb 2017 09:32:24 -0600 Subject: [PATCH 38/38] Fix errors found in build testing. --- configs/stm32f4discovery/src/stm32_pmbuttons.c | 2 +- configs/stm32l476vg-disco/src/stm32_buttons.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/stm32f4discovery/src/stm32_pmbuttons.c b/configs/stm32f4discovery/src/stm32_pmbuttons.c index 12d3e21e514..6b974ea38b6 100644 --- a/configs/stm32f4discovery/src/stm32_pmbuttons.c +++ b/configs/stm32f4discovery/src/stm32_pmbuttons.c @@ -80,7 +80,7 @@ ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS -static int button_handler(int irq, FAR void *context); +static int button_handler(int irq, FAR void *context, FAR void *arg); #endif /* CONFIG_ARCH_IRQBUTTONS */ /**************************************************************************** diff --git a/configs/stm32l476vg-disco/src/stm32_buttons.c b/configs/stm32l476vg-disco/src/stm32_buttons.c index 1151003c7d2..7fc0c09d8a9 100644 --- a/configs/stm32l476vg-disco/src/stm32_buttons.c +++ b/configs/stm32l476vg-disco/src/stm32_buttons.c @@ -176,7 +176,7 @@ static void button_pm_notify(struct pm_callback_s *cb, int domain, #if 0 #ifdef CONFIG_ARCH_IRQBUTTONS -static int button_handler(int irq, FAR void *context) +static int button_handler(int irq, FAR void *context, FAR void *arg) { #ifdef CONFIG_PM /* At this point the MCU should have already awakened. The state