Attach an “idle” interrupt handler
#include <sys/neutrino.h>
int InterruptHookIdle(
void (*handler)( uint64_t *ptime,
struct qtime_entry *pqtime),
unsigned flags );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The InterruptHookIdle() kernel call attaches the specified interrupt handler to the _NTO_HOOK_IDLE synthetic interrupt, which is generated when a processor becomes idle. This is typically used to implement power management features.
Before calling this function, the thread must obtain I/O privileges by successfully calling:
ThreadCtl( _NTO_TCTL_IO, 0 );
If the thread doesn't do this, the attachment fails with an error code of EPERM.
To detach the interrupt handler, call InterruptDetach().
The arguments to the handler function are:
The simplest idle handler consists of a halt instruction.
This call doesn't block.
An interrupt function ID, or -1 if an error occurs (errno is set).
Use the returned value with the InterruptDetach() function to detach this interrupt handler.
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
InterruptAttach(), InterruptAttachEvent(), InterruptDetach()
Writing an Interrupt Handler chapter of the Neutrino Programmer's Guide