# User space interface for GPIO interrupts



## Maverick Kuo (Jun 3, 2019)

Hi,

i am running  12.0-STABLE r348448  arm64  zfs root on raspberry pi3 b+.

Look at the kernel source and it seems that all the functions related to gpio
interrupt are available.

System startup about the gpio interrupt part process  follow by

*Bcm_gpio_intr_attach =>> Bus_setup_intr
?? bcm_gpio_intr_bank[0,1]
?? bcm_gpio_intr_internal*

It seems that BCM_GPIO_GPEDS (Event Status) will be read in the
bcm_gpio_intr_internal function but it is not executed there.

am I missed something ??

but it still lack user space interface  (kqueue/kevent) part, hope it will finish  to reduce cpu loading.

Regards,
Chris


----------



## Maverick Kuo (Jun 3, 2019)

Hi,

Good News !!

after cvs to 12.0-STABLE #0 r348527M GPIO Interrupt with kqueue Works !!!

Thanks to the developers 

Regards,
Chris


----------



## Maverick Kuo (Jun 3, 2019)

Sorry, I got it wrong, gpio interrupt is really available, BUT I forgot to have a patch that mixes https://github.com/ckraemer/freebsd/tree/gsoc2018

Just after the comparison was revised, I found out that I apologize again.

If you need a patch, please use the attachment.
This original source is gsoc2018 as above.


----------



## Nicola Mingotti (Jun 6, 2019)

Hello Maverick Kuo , this is very interesting. I remember we were talking here about this missing capability in the BeagleBone a few months ago. 

I am running 12-RELEASE. As far as you know is GPIO interrupt available in STABLE ? Is there some code snippet to show how to use it ?

bye
Nicola


----------



## Maverick Kuo (Jun 9, 2019)

Hello *Nicola Mingotti, *

i use the #3 patch to 12-stable in my rpi3 b+ and test by this code https://github.com/ckraemer/gsoc2018-utils/blob/master/src/gpioc_intr_test.c 
i works.

wish you can make it work in BeagleBone 

Best Regards.


----------



## aragats (Jun 12, 2019)

Maverick Kuo said:


> test by this code https://github.com/ckraemer/gsoc2018-utils/blob/master/src/gpioc_intr_test.c


Hi Maverick Kuo , have you tried the "signal-driven I/O" option? Does it work?


----------



## aragats (Jun 12, 2019)

I just tried recompiling kernel with that patch, however, something is missing, I get many errors like:
	
	



```
/usr/src/sys/dev/gpio/gpioc.c:126:18: error: function 'gpioc_poll' has internal linkage but is not defined
```


----------



## Maverick Kuo (Jun 19, 2019)

aragats said:


> Hi Maverick Kuo , have you tried the "signal-driven I/O" option? Does it work?



i only test kqueue


----------



## Maverick Kuo (Jun 19, 2019)

aragats said:


> I just tried recompiling kernel with that patch, however, something is missing, I get many errors like:
> 
> 
> 
> ...



maybe you should try cd /usr/src make clean ;  and buildworld and buildkernel


----------

