LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 06-30-2011, 03:28 AM   #1
henfos
LQ Newbie
 
Registered: Jun 2011
Posts: 9

Rep: Reputation: Disabled
Interrupts, linux 2.6.33


Hi experts,
im currently coding a simple read/write library for use between host and a power supply. I know how to read and write on the bus so thats solved, but i keep getting "bus time expired" because i cant get it synchronized. The power supply generates a interrupt on IRQ7 when it puts data in its output port. How can i use this? I'm completely noob, i've been reading about interrupt handling in the linux device drivers from 2005. But i'm having a bit of a struggle getting my head wrapped around it. So can anyone give me some pointers? I'm really only interrested in how i can get my function to wait with reading until the ps send the interrupt.

Thanks in advance
 
Old 06-30-2011, 06:04 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
You are probably working at too low of a level, and you are also tackling a task that has already been done. (Linux systems have been shutting themselves down when power dies, for many ye ... )

The port (a serial port?) is simply a device, and you should have (and BTW there already exists...) a daemon that can start an asynchronous read upon the port (uses a mechanism like poll() ...) and be woken up when the read completes.

IRQs and such are the lowest-level glue when talking to a device, and "a port is a device ... a power-supply is not ... and we already know how to talk to a port."

When the daemon decides that power has been lost, it notifies the kernel to switch to a different runlevel, thereby bringing the system to a stop.

Last edited by sundialsvcs; 06-30-2011 at 06:06 AM.
 
Old 06-30-2011, 06:46 AM   #3
henfos
LQ Newbie
 
Registered: Jun 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
You are probably working at too low of a level, and you are also tackling a task that has already been done. (Linux systems have been shutting themselves down when power dies, for many ye ... )

The port (a serial port?) is simply a device, and you should have (and BTW there already exists...) a daemon that can start an asynchronous read upon the port (uses a mechanism like poll() ...) and be woken up when the read completes.

IRQs and such are the lowest-level glue when talking to a device, and "a port is a device ... a power-supply is not ... and we already know how to talk to a port."

When the daemon decides that power has been lost, it notifies the kernel to switch to a different runlevel, thereby bringing the system to a stop.
Okei, ive maybe been a bit unspecific. When main power cuts and the operating system is doing some operation the computer have crashed.... Therefore i've acquired an UPS(my device ), and now i'm trying to write a program which reads from the UPS when it goes from AC power to batteries. But i can't get the I/O operations synced without the ability to know when the UPS sends an interrupt on the parallell which indicates that its put new info on the bus.

But thanks for answer, been glaring into the screen for hours now (N)

Last edited by henfos; 06-30-2011 at 06:49 AM.
 
  


Reply



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
Can anyone please explain about "Function call interrupts" entry in /proc/interrupts? cyclops.xmen Linux - Software 2 12-09-2009 12:13 PM
Vector based interrupts in linux chandraprakash.d Linux - Newbie 1 07-04-2009 01:05 PM
Interrupts and Signals in embedded linux zigma.dsp Linux - Embedded & Single-board computer 0 05-12-2009 12:55 PM
interrupts in linux. rose_hatami Programming 2 11-26-2007 10:53 PM
howto handle interrupts in linux cheema Programming 3 07-08-2004 01:44 AM

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

All times are GMT -5. The time now is 07:20 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