Since you are talking about interrupts, you can only implement interrupt 
routines in kernel code, but all kernel code is developed in C, not C++.

Starting with the Linux Kernel source code, do the following:

git grep irqreturn_t

This will give you all interrupt routings in the Kernel source. You will find 
both documentation and code references to irqreturn_t. In the /drivers folder 
you will find device drivers. Start with a driver that is closest to what you 
want to develop. The name just to the right of irqreturn_t is the interrupt 
handler. Do the same as before:

git grep <interrupt_handler>

This will show you how to register the interrupt handler with the kernel. For 
example:

john:~/Download/GIT/ti-linux-kernel-dev/KERNEL$ git grep omap_gpio_irq_handler
drivers/gpio/gpio-omap.c:static irqreturn_t omap_gpio_irq_handler(int irq, void 
*gpiobank)
drivers/gpio/gpio-omap.c:       ret = devm_request_irq(bank->dev, bank->irq, 
omap_gpio_irq_handler,

The second line shows you how to define your interrupt handler and the third 
line shows you how to register your interrupt.

Regards,
John




> On Dec 21, 2015, at 2:10 AM, Ajay Mahicha <[email protected]> wrote:
> 
> do you have interrupt code for beaglebone in c++. help me out here.
> 
> On Friday, 27 December 2013 11:36:47 UTC+5:30, Dave Hylands wrote:
> Hi,
> 
> 
> On Tue, Dec 24, 2013 at 2:58 PM, <[email protected] <javascript:>> 
> wrote:
> >
> > Hey Guys,
> >
> > i am quite new to embedded linux ...
> > My regular province are microcontrollers like AVR/PIC/STM32 and so on.
> >
> > Now i want to get fit with embedded linux systems.
> > As a beginner i always start to to toggle some leds and so on ... all fine 
> > ...
> > now i want start to use with usart interrupt driven communication, but i 
> > dont get it.
> >
> > Is the anywhere a useful C/C++ - project where i can see how to handle with 
> > receive interrupts ...
> > this is for sure as simple as a microcontroller application ... isnt it?
> 
> So when writing code for linux, you can write is user space (where most code 
> runs) or from kernel space.
> 
> Interrupts are purely in the domain of kernel space. The UART drivers are all 
> fully interrupt driven.
> 
> Here is some sample code for reading/writing to the serial ports:
> https://github.com/dhylands/projects/tree/master/host/sertest 
> <https://github.com/dhylands/projects/tree/master/host/sertest>
> 
> Here is some documentation on working with serial ports under linux: 
> http://tldp.org/HOWTO/Serial-Programming-HOWTO/ 
> <http://tldp.org/HOWTO/Serial-Programming-HOWTO/>
> 
> --
> Dave Hylands
> Shuswap, BC, Canada
> http://www.davehylands.com <http://www.davehylands.com/>
> 
> -- 
> For more options, visit http://beagleboard.org/discuss 
> <http://beagleboard.org/discuss>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to