LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 02-07-2005, 06:40 AM   #1
mp4-10
LQ Newbie
 
Registered: Jan 2005
Posts: 16

Rep: Reputation: 0
Smile interrupt handling


HI,
I wrote module which detects interrupts on RS232 port, it works ok, but how can I detect these interrupts in my application and not only in kernel.
Is there any way to send some signal(like betwen tasks in linux) to my application from kernel when interrupt is occured.

I hope someone can help me!!!!
Bye
 
Old 02-07-2005, 10:14 AM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
Consider the idea of polling - look into select(), which I/O drivers can talk to in order to say 'I have data'.
 
Old 02-08-2005, 12:32 AM   #3
AngryLlama
Member
 
Registered: Sep 2004
Location: /dev/urandom
Distribution: Gentoo
Posts: 171

Rep: Reputation: 30
or use a signal. SIGUSR1 and others are provided for user signals.
 
Old 02-08-2005, 05:31 PM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
Re: interrupt handling

Quote:
Originally posted by mp4-10
I wrote module which detects interrupts on RS232 port, it works ok, but how can I detect these interrupts in my application and not only in kernel.
Is there any way to send some signal(like betwen tasks in linux) to my application from kernel when interrupt is occured.
Are you sure you want to kernel programming for this? AFAIK it's not needed. You can have a program block (sleep) until a control line of the serial changes from 1 --> 0 or from 0 --> 1. See here: http://www.linuxquestions.org/questi...71#post1448471

To have your program notified asynchronously you can fork() a child off that'll wait blocking for some serial port event. And send SIGUSR1 to its parent.
 
Old 02-08-2005, 10:42 PM   #5
novice_din
LQ Newbie
 
Registered: Feb 2005
Posts: 12

Rep: Reputation: 0
you can you SIGIO which send a signal if there is I/O activity
 
Old 02-14-2005, 06:13 AM   #6
mp4-10
LQ Newbie
 
Registered: Jan 2005
Posts: 16

Original Poster
Rep: Reputation: 0
Hi,
I tried to use SIGIO , it works but interrupts are detected only if Enter ASCII sequence is sent to RS232.
How can I use it to handle any ASCII character not only ENTER.
 
  


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
Exception Handling vipinsharma Programming 2 09-25-2005 11:05 AM
handling arrays.....in C Veteq Programming 3 05-30-2005 03:59 PM
<0>Kernel panic: Aiee, killing interrupt handler! In interrupt handler - not syncing mrb Linux - Newbie 2 01-09-2005 09:47 AM
Handling all those dependecies Baix Linux - Newbie 4 06-19-2004 02:31 PM
Interrupt handling in gcc? captainstorm Programming 13 07-16-2003 05:57 AM


All times are GMT -5. The time now is 05:59 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration