2009-05-05 11:46:17     Notify use of an external event.

Document created by Aaronwu Employee on Aug 15, 2013
Version 1Show Document
  • View in full screen mode

2009-05-05 11:46:17     Notify use of an external event.

zigma dsp (GERMANY)

Message: 73673   

 

Hi all,

 

I am new to Linux environment.

 

In non-linux environments I have used interrupts in user space to notify of an event. Coming to linux, I understand that interrupts are completely managed by Kernel. Now, a simple question, which I could not resist to ask - how does a user get notified of an event? I saw the event_test code and it looks like we need to read() the device to see the status.

 

Now, are we kind of 'polling' the device driver running from kernel - from the user space? Are these system calls (read /write) blocking / non-blocking?

 

In general, a guidline would be enough for me - I want to run an algorithm in real time and do some action 'only based on the interrupt'.

 

Thanks & Regards

 

JA.

QuoteReplyEditDelete

 

 

2009-05-05 16:31:27     Re: Notify use of an external event.

Mike Frysinger (UNITED STATES)

Message: 73703   

 

i doubt you were using interrupts in user space as user space is not capable of configuring or receiving interrupts.  that must be done in supervisor mode.

 

the approach is not "i want an interrupt", but rather "Linux has a device driver / framework for XXX device".  reading through random test code or device drivers wont help.  you first have to declare what kind of device you want to use.  is it SPI ?  I2C ?  GPIO interrupt ?  touchscreen ?  etc...

QuoteReplyEditDelete

 

 

2009-05-05 22:50:23     Re: Notify use of an external event.

Sonic Zhang (CHINA)

Message: 73722   

 

You need to write a driver for your device and handler all interrupts there in kernel.

 

Your application can read/write data through system call ioctl to your driver. Your application can block in the system call or get user defined signal notification from your driver.

QuoteReplyEditDelete

 

 

2009-05-06 00:52:44     Re: Notify use of an external event.

zigma dsp (GERMANY)

Message: 73723   

 

Mike,

 

Thanks for the reply. Yes you are right, it is only in supervisor mode. I actually meant the 'user mode', and there wasn't any kernel.

 

I could catch that there are frameworks or drivers. A small ISR is executed, which normally has the code to clear the system interrupt source and return back. However, when it returns back, does the 'user' get notified automatically, or does he need to call a read(fd) to know the state (that an interrupt was just trigerred)?

QuoteReplyEditDelete

 

 

2009-05-06 00:54:41     Re: Notify use of an external event.

zigma dsp (GERMANY)

Message: 73724   

 

Hi Sonic,

 

Thanks for the time.

 

Where do I find info on- :" user defined signal notification from the driver."?

 

Are the system calls blocking or non-blocking by default? How do I alter the same?

QuoteReplyEditDelete

 

 

2009-05-06 02:02:13     Re: Notify use of an external event.

Sonic Zhang (CHINA)

Message: 73727   

 

You'd better find a linux program and driver program book to start up.

QuoteReplyEditDelete

 

 

2009-05-06 05:55:16     Re: Notify use of an external event.

Mike Frysinger (UNITED STATES)

Message: 73744   

 

as Sonic said, it sounds like you need to start fundamental.  you can find such books here:

  docs.blackfin.uclinux.org/doku.php?id=references_and_pointers

 

the LDD3 book is free and online and should explain the frameworks you will want to use

QuoteReplyEditDelete

Attachments

    Outcomes