zmatt icon

uio irq handling outline

zmatt | PRO | 05/13/20 11:55:40 AM UTC | 0 ⭐ | 514 👁️ | Never ⏰ | []
C++ |

1.35 KB

|

None

|

0 👍

/

0 👎

#include "uio-irq.h"  // https://pastebin.com/w42Ti0Hz
 
// blocking, for level-triggered interrupts:
int fd = open( path, O_RDWR | O_CLOEXEC );
setup_irq();
loop {
    uio_irqenable( fd );
    uio_wfi( fd );
    handle_irq();
}
 
// blocking, for edge-triggered interrupts:
int fd = open( path, O_RDWR | O_CLOEXEC );
setup_irq();
loop {
    uio_irqenable( fd );
    handle_irq();
    uio_wfi( fd );
}
 
 
// non-blocking, for level-triggered interrupts:
int fd = open( path, O_RDWR | O_CLOEXEC | O_NONBLOCK );
setup_irq();
uio_irqenable( fd );
when fd readable {
    uio_wfi( fd );
    handle_irq();
    uio_irqenable( fd );
}
 
// non-blocking, for edge-triggered interrupts:
int fd = open( path, O_RDWR | O_CLOEXEC | O_NONBLOCK );
setup_irq();
uio_irqenable( fd );
handle_irq();
when fd readable {
    uio_wfi( fd );
    uio_irqenable( fd );
    handle_irq();
}

Comments