Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

How can i wakeup program thread with button PIO

I found Microtronix's driver for button PIO (on Altera dev. board) altera_pio_button.c

It seem to catch the IRQ from button and update value in device file.

Is it possible to use this IRQ to wakeup a thread in user program?

I think that IRQ is accessible only through the kernel, but maybe the driver can send a signal or the thread (in the user program) can wait in wait_queue of the driver?

If it possible, please write some code because i still not friendly with Linux functions.

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can use select().

    Look at "man select". There is a example with timeout.

    Or, if you don't need timeout, just a blocked read() will do.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by hippo@Jan 12 2007, 04:02 AM

    or, if you don't need timeout, just a blocked read() will do.

    --- Quote End ---

    Can anyone give me an example for using blocked read with this driver (altera_pio_button.c) ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by motal+jan 14 2007, 11:19 pm--><div class='quotetop'>quote (motal @ jan 14 2007, 11:19 pm)</div>

    --- quote start ---

    <!--quotebegin-hippo@Jan 12 2007, 04:02 AM

    or, if you don&#39;t need timeout, just a blocked read() will do.

    --- Quote End ---

    Can anyone give me an example for using blocked read with this driver (altera_pio_button.c) ?

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=20572)</div>

    [/b]

    --- Quote End ---

    example apps to use button pio.

    http://forum.niosforum.com/forum/index.php...topic=2285&hl=# (http://forum.niosforum.com/forum/index.php?showtopic=2285&hl=#)