Linux Device Driver: how can an ISR wake up a user-thread?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Linux Device Driver: how can an ISR wake up a user-thread?
# 1  
Old 01-21-2010
Linux Device Driver: how can an ISR wake up a user-thread?

Hi all,

Is it possible to do the following in Linux (kernel 2.6.x):

- A user-space thread goes to "sleep". Using any call/mechanism
- On a hardware generated interrupt, the Interrupt handler (ISR) "wakes" the sleeping user-thread.

I have seen wait_event() and wake_up() but it appears that the two should be both user-mode or kernel-mode. Or can they be in different spaces?

I could use complete, semaphores or queues or anything else but it appears that any kind of such synchronization requires the shared object to be either in kernel-space or user-space.

Gaurav
# 2  
Old 01-21-2010
Interfaces between kernel space and user space are generally accomplished through convenient pre-existing system calls and interfaces. Use something like a blocking read() or open() call to a device node or an interface under /proc. ACPI events are reported this way, when you push the power button things waiting to read from /proc/acpi/event are fed data like "[BUTTON]". This way should work for threads AND processes too, even arbitrarily from shell like how you can 'cat /proc/acpi/event' and see events pop up when the kernel reports them.

Last edited by Corona688; 01-21-2010 at 05:50 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Certification For Linux Device Driver Programming

Hi All, I'm looking for role change to Linux device Driver developer. My current role has no connection to Linux Device driver development and hence to support my stand i want to do a certification for the same. I have googled but couldn't found any standard certification. I have submitted... (1 Reply)
Discussion started by: kg_gaurav
1 Replies

2. Programming

How to sleep and wake a thread???

Hi guys, I am creating two posix threads. I have some queries, hopefully you will help me out with them 1) How can I put a thread to indefinite sleep, for indefinite time period. I am familiar with this sleep(5); for 5 second, how can I make it indefinite?? 2) How can one thread wake another... (11 Replies)
Discussion started by: gabam
11 Replies

3. Linux

Linux Device Driver: avoid mem copy from/to user/kernel space

I recently started working with Linux and wrote my first device driver for a hardware chip controlled by a host CPU running Linux 2.6.x kernel. 1. The user space process makes an IOCTL call with pointer to a user memory buffer. 2. The kernel device driver in the big switch-case of IOCTL,... (1 Reply)
Discussion started by: agaurav
1 Replies

4. UNIX for Advanced & Expert Users

wake up user space thread from kernel space ISR

Hello, I'm searching for a proper way to let the kernel space ISR(implemented in a kernel module) wake up a user space thread on a hardware interrupt. Except for sending a real-time signal, is it possible to use a semaphore? I've searched it on google, but it seems impossible to share a... (0 Replies)
Discussion started by: aaronwong
0 Replies

5. Programming

how to wake up a thread that blocking at epoll_wait?

I have two threads: one maintains a thread-safe message queue (handle this queue at the beginning of every loop) and deals with tcp connections, the other one posts message to the former one. the problem is, while the former one was blocking at epoll_wait, it's not sure that how long until the... (0 Replies)
Discussion started by: cometeor
0 Replies

6. UNIX for Dummies Questions & Answers

Need Book for Linux Basics and Linux device driver.

hai friend, I am new to Linux, i need a book for Linux basic and Linux device driver .. plz send the book name and author(Easy to learn and mostly used by programmers) and also send the link if it is available in Net... Thank you. ... (0 Replies)
Discussion started by: sundar.lsr
0 Replies

7. Solaris

SUNWglmr -- rasctrl environment monitoring driver for i2c or SCSI device driver ?

I've been researching minimizeing Solaris 8 and found that on the web page http://www.sun.com/bigadmin/content/packagelist/s8u7PkgList/p2.html the package SUNWglmr is listed as "rasctrl environment monitoring driver for i2c, (Root) (32-bit)" while in the document "Solaris 8 minimize-updt1.pdf"... (1 Reply)
Discussion started by: roygoodwin
1 Replies
Login or Register to Ask a Question