Interrupt handling [Archive] - C Board

PDA

View Full Version : Interrupt handling


Crash T
07-23-2002, 03:21 AM
Hi,

I'm writing a simple kernel module. This module has the abillity to handle interrupts. I want to be able to let the user program install an interrupt handler, which will be called from the driver. Linux is very picky when it comes to user space and kernel space interraction, so I can't call a user function directly. Is there a simple way of doing this?

I found out that signals can be used to create software interrupts. But how can I send a signal from my driver? (I know I can catch signals with the sigaction function) Maybe with function kill? But I'm not sure if I am allowed to call this function from a kernel module.

I also need to send data with signal (simple int would do it), to know what happened.

thanx,

Dennis

Salem
07-23-2002, 12:33 PM
perhaps? (http://www.google.com/search?hl=en&ie=ISO-8859-1&q=writing+linux+device+drivers)

Crash T
07-24-2002, 12:50 AM
Thanx for your reply. I can send signals now: send_sig, but I can't send any arguments with it. I need to send at least a few bits of information with it, so I now where it came from...

shaik786
07-24-2002, 12:05 PM
You can not send any additional data along with Signals. Why don't you use some kind of IPC instead?

Unregistered
07-25-2002, 12:38 PM
Thanx for your reply!

I now send a signal using send_sig_info(int, struct siginfo *, void*)

I can fill the struct siginfo with some data. I found out that I can use some of the members to send data with. Documentation about this is a bit fuzzy though...

What's IPC by the way?

You can not send any additional data along with SignalsI'm quite sure it should be possible. The aio_read call uses a signal to signal it's done read data. It installs a one time signal handler, this signal handler takes 3 arguments, one of them is a struct siginfo. The si_ptr is used to submit a pointer which can be used. The only difference is, this is done in user space. But the idea would be the same...

shaik786
07-26-2002, 06:02 AM
IPC stands for Inter Process Communication. There are many ways by which two or more processes can communicate with each other in a *NIX environment, of which some are:
* Signals
* Shared Memory
* Semaphores
* Pipes
...
For the tutorials, search the net.