Interrupt handling

This is a discussion on Interrupt handling within the Linux Programming forums, part of the Platform Specific Boards category; Hi, I'm writing a simple kernel module. This module has the abillity to handle interrupts. I want to be able ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761

  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, 05:47 AM
  2. Interrupt Handling
    By manmohan in forum C Programming
    Replies: 3
    Last Post: 07-11-2004, 10: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21