LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-17-2004, 02:30 PM   #1
cardias
LQ Newbie
 
Registered: Aug 2004
Posts: 5

Rep: Reputation: 0
how to set an interrupt (irq) via software


hi there...

i'm writing a linux driver that should read data from a device and send it to the user space. the device will generate an interrupt (irq) indicating that the data is ready. the problem is that the device doesn't exist yet and, in the meantime, i have to simulate it with a program that writes data in the driver, making it (the driver) generate the irq.
does anyone know how to make a driver generate an interrupt when i write data in it? i want to avoid using queues to wake up the reader tasks.

thanks,
cardias.
 
Old 09-20-2004, 08:44 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
You can't (as far as I know). IRQs are a voltage level on a wire, and they tend to be rather like inputs in nature.

However, you can wire together two pins of the parallel port (say, connecting the data pin bit 0 to the interrupt pin). You can then trigger an interrupt just by writing to that data pin. Probably a good idea to use a series resistor to prevent you from blowing up the port as well, and you're limited to whichever IRQ line the parallel port is connected to (see /proc/irq), but it should work (after you enable parallel port IRQs in the status register).

See http://www.tldp.org/HOWTO/IO-Port-Pr...g-6.html#ss6.1 for more.
 
Old 09-20-2004, 07:37 PM   #3
saajii
Member
 
Registered: Sep 2003
Location: sydney
Distribution: Redhat 8.0
Posts: 36

Rep: Reputation: 15
hi cardias;

have a look at chapter 9 from Linux Device Drivers which explains the interrupt handling.The electronic version is at http://www.xml.com/ldd/chapter/book/ch09.html .

good luck
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
HELP!!! how to set the IRQ in Linux????? ro_nicu Linux - Hardware 2 10-13-2005 10:09 AM
IRQ probe failed (0xfffffff8)+hda lost interrupt titoutitou Linux - Software 0 01-25-2005 10:05 AM
MDK Command to set an IRQ? Alacrity Linux - Software 0 03-23-2004 03:17 AM
Set IRQ thep Linux - Hardware 1 02-11-2003 02:42 AM
linux software interrupt oyoyoOnLinux Programming 3 12-05-2001 06:23 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:25 PM.

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