libirq usage example using a self-created thread.
libirq usage example using a self-created thread.
#include <l4/util/util.h>
#include <stdio.h>
#include <pthread.h>
enum { IRQ_NO = 17 };
static void isr_handler(void)
{
printf("Got IRQ %d\n", IRQ_NO);
}
static void *isr_thread(void *data)
{
l4irq_t *irq;
(void)data;
return NULL;
while (1)
{
continue;
isr_handler();
}
return NULL;
}
int main(void)
{
pthread_t thread;
if (pthread_create(&thread, NULL, isr_thread, NULL))
return 1;
return 0;
}
l4irq_t * l4irq_attach(int irqnum)
Attach/connect to IRQ.
long l4irq_wait(l4irq_t *irq)
Wait for specified IRQ.
void l4_sleep_forever(void) L4_NOTHROW L4_NORETURN
Go sleep and never wake up.