Xenomai API
2.6.5
|
Interruptions management services. More...
Functions | |
int | pthread_intr_attach_np (pthread_intr_t *intrp, unsigned irq, xnisr_t isr, xniack_t iack) |
Create and attach an interrupt object. More... | |
int | pthread_intr_detach_np (pthread_intr_t intr) |
Destroy an interrupt object. More... | |
int | pthread_intr_control_np (pthread_intr_t intr, int cmd) |
Control the state of an interrupt channel. More... | |
int | pthread_intr_wait_np (pthread_intr_t intr, const struct timespec *to) |
Wait for the next interruption. More... | |
Interruptions management services.
The services described here allow applications written using the POSIX skin to handle interrupts, either in kernel-space or in user-space.
Note however, that it is recommended to use the standardized driver API of the RTDM skin (see Real-Time Driver Model).
int pthread_intr_attach_np | ( | pthread_intr_t * | intrp, |
unsigned | irq, | ||
xnisr_t | isr, | ||
xniack_t | iack | ||
) |
Create and attach an interrupt object.
This service creates and attaches an interrupt object.
This service installs isr as the handler for the interrupt irq. If iack is not null it is a custom interrupt acknowledge routine.
When called upon reception of an interrupt, the isr function is passed the address of an underlying xnintr_t object, and should use the macro PTHREAD_IDESC() to get the pthread_intr_t object. The meaning of the isr and iack function and what they should return is explained in xnintr_init() documentation.
This service is a non-portable extension of the POSIX interface.
intrp | address where the created interrupt object identifier will be stored on success; |
irq | IRQ channel; |
isr | interrupt handling routine; |
iack | if not NULL, optional interrupt acknowledge routine. |
The prototype of this service is :
int pthread_intr_attach_np (pthread_intr_t *intrp, unsigned irq, int mode);
This service causes the installation of a default interrupt handler which unblocks any Xenomai user-space interrupt server thread blocked in a call to pthread_intr_wait_np(), and returns a value depending on the mode parameter.
This service is intended to be used in conjunction with the pthread_intr_wait_np() service.
The return values are identical in kernel-space and user-space.
0 | on success; |
-1 | with errno set if:
|
References pthread_intr_detach_np(), xnintr_attach(), xnintr_init(), and xnsynch_init().
int pthread_intr_control_np | ( | pthread_intr_t | intr, |
int | cmd | ||
) |
Control the state of an interrupt channel.
This service allow to enable or disable an interrupt channel.
This service is a non-portable extension of the POSIX interface.
intr | identifier of the interrupt to be enabled or disabled. |
cmd | one of PTHREAD_IENABLE or PTHREAD_IDISABLE. |
0 | on success; |
-1 | with errno set if:
|
References xnintr_disable(), and xnintr_enable().
int pthread_intr_detach_np | ( | pthread_intr_t | intr | ) |
Destroy an interrupt object.
This service destroys the interrupt object intr. The memory allocated for this object is returned to the system heap, so further references using the same object identifier are not guaranteed to fail.
If a user-space interrupt server is blocked in a call to pthread_intr_wait_np(), it is unblocked and the blocking service returns with an error of EIDRM.
This service is a non-portable extension of the POSIX interface.
intr | identifier of the interrupt object to be destroyed. |
0 | on success; |
-1 | with errno set if:
|
Referenced by pthread_intr_attach_np().
int pthread_intr_wait_np | ( | pthread_intr_t | intr, |
const struct timespec * | to | ||
) |
Wait for the next interruption.
This service is used by user-space interrupt server threads, to wait, if no interrupt is pending, for the next interrupt.
This service is a cancelation point. If a thread is canceled while blocked in a call to this service, no interruption notification is lost.
This service is a non-portable extension of the POSIX interface.
intr | interrupt object identifier; |
to | if not NULL, timeout, expressed as a time interval. |
References pthread_setcanceltype().