LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Closed Thread
  Search this Thread
Old 07-30-2015, 10:06 AM   #1
david_8274
Member
 
Registered: Jun 2013
Location: California
Distribution: Ubuntu, Fedora
Posts: 75

Rep: Reputation: Disabled
Getting hardware interrupt in user-space program


Hi,

I am working on an embedded Linux project. In the project, I wish to get a GPIO interrupt in my user-space program. I read about using UIO to get kernel interrupt from user-space. However, it seems that I will have to do a blocking call, such as read(), poll(), to wait for interrupt happens. But I don't want to block and wait. Is there a solution would let my program act like a bare-metal project, where I attach an interrupt handler to the system and free to preform other tasks until an interrupt happens and the program jumps to the ISR?

Thanks,
Wei Xu
 
Old 07-31-2015, 10:09 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,642
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
A hardware interrupt can't be trapped in user space, because any process could be running at the time the interrupt happens. A kernel-level handler must receive the interrupt, quash it, and then signal a user space program so that the program becomes runnable and will get notified.
 
Old 07-31-2015, 10:17 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Duplicate thread.
 
Old 07-31-2015, 10:30 AM   #4
david_8274
Member
 
Registered: Jun 2013
Location: California
Distribution: Ubuntu, Fedora
Posts: 75

Original Poster
Rep: Reputation: Disabled
@sundialsvcs
Thanks for the reply. Could you provide some more details on how to 'signal' the user space program from the kernel?

Thanks,
Wei
 
Old 07-31-2015, 12:03 PM   #5
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,600

Rep: Reputation: 4083Reputation: 4083Reputation: 4083Reputation: 4083Reputation: 4083Reputation: 4083Reputation: 4083Reputation: 4083Reputation: 4083Reputation: 4083Reputation: 4083
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting hardware interrupt in user-space program david_8274 Linux - Kernel 23 08-05-2015 06:46 AM
Getting hardware interrupt in user-space program david_8274 Linux - Newbie 1 07-29-2015 08:56 PM
[SOLVED] Catch LPT interrupt in user space. LEICIF Linux - Newbie 9 06-25-2011 11:15 AM
Mechanism for interrupt report to user space zvivered Linux - Embedded & Single-board computer 0 08-11-2009 03:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration