#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