Get or set a characteristic associated with an interrupt
Synopsis:
#include <sys/neutrino.h>
int InterruptCharacteristic( int type,
int id,
unsigned *new,
unsigned *old );
int InterruptCharacteristic_r( int type,
int id,
unsigned *new,
unsigned *old );
Library:
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
Arguments:
- type
- The type of characteristic; the only type that's currently defined is:
- _NTO_IC_LATENCY — set or get the interrupt's latency.
- id
- The identifier for the interrupt function, as returned by
InterruptAttach()
or
InterruptAttachEvent().
- new
- NULL, or a pointer to the new value.
- old
- NULL, or a pointer to a location where the function can store the old value.
Description:
The InterruptCharacteristic() and InterruptCharacteristic_r()
kernel calls set or get a characteristic of an interrupt.
These functions are identical except in the way they indicate errors.
See the Returns section for details.
The only
type currently defined is
_NTO_IC_LATENCY.
If the
new argument is non-
NULL, it points to an
unsigned that contains the new latency value for the interrupt, in nanoseconds.
If the
old argument is non-
NULL, it's filled in with the old
latency value for the interrupt.
The default latency value is zero.
In order to set a latency, the calling thread must be the process that attached to the interrupt,
and it must have obtained I/O privileges by calling:
ThreadCtl( _NTO_TCTL_IO, 0 );
The id argument can be -1.
In this case, you're setting the global latency value for the system.
If an interrupt attachment doesn't specify a latency value, the global latency number is
used when calculating how deep a sleep state the kernel may use.
You need to have I/O privileges to set the global latency value.
Returns:
The only difference between these functions is the way they indicate errors:
- InterruptCharacteristic()
- 0 on success.
If an error occurs, -1 is returned and
errno
is set.
- InterruptCharacteristic_r()
- 0 on success.
This function does NOT set errno.
If an error occurs, a value from the Errors section is returned.
Errors:
- EFAULT
- The function couldn't read from the new pointer, or it couldn't write to
the old.
- EINVAL
- The type isn't _NTO_IC_LATENCY.
- EPERM
- You're trying to set a new latency, but the calling thread isn't the attaching process
or doesn't have I/O privileges.
- ESRCH
- The id isn't either a valid interrupt attachment identifier or -1.
Classification:
QNX Neutrino
Safety: |
|
Cancellation point |
No |
Interrupt handler |
Yes |
Signal handler |
Yes |
Thread |
Yes |