Thread: Interrupt handling

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    2

    Interrupt handling

    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

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    2
    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...

  4. #4
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    You can not send any additional data along with Signals. Why don't you use some kind of IPC instead?

  5. #5
    Unregistered
    Guest
    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 Signals
    I'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...

  6. #6
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. event handling is serialized in MS Visual Studio C++ 2005 ??
    By mynickmynick in forum Windows Programming
    Replies: 3
    Last Post: 08-07-2008, 04:47 AM
  2. Interrupt Handling
    By manmohan in forum C Programming
    Replies: 3
    Last Post: 07-11-2004, 09:54 PM
  3. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM
  4. Interrupt handling in VC++(Windows)
    By ashu12 in forum Windows Programming
    Replies: 6
    Last Post: 12-17-2002, 05:57 AM