Interrupt driven uart communication

2,120 views
Skip to first unread message

penne...@googlemail.com

unread,
Dec 24, 2013, 5:58:41 PM12/24/13
to beagl...@googlegroups.com
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?

Dave Hylands

unread,
Dec 27, 2013, 1:06:47 AM12/27/13
to beagl...@googlegroups.com
Hi,
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

Here is some documentation on working with serial ports under linux: http://tldp.org/HOWTO/Serial-Programming-HOWTO/

--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

Ajay Mahicha

unread,
Dec 21, 2015, 5:10:27 AM12/21/15
to BeagleBoard
do you have interrupt code for beaglebone in c++. help me out here.

John Syne

unread,
Dec 21, 2015, 4:26:52 PM12/21/15
to beagl...@googlegroups.com
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




--
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 beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages