Contents
Interrupts
The interface described here is a low-level interface. In most cases, it is recommended to use the interface provided by the kdf library to manage interrupts.
KnIoAttachIrq()
This function is declared in the coresrv/io/irq.h
file.
Retcode KnIoAttachIrq(Handle rid, rtl_uint32_t flags, Handle *handle);
This function attaches the calling thread to the interrupt.
Input parameters:
rid
is the interrupt handle received by using theKnRegisterIrq()
call.flags
refer to the interrupt flags.
Output parameter handle
contains the IPC handle that will be used by the calling thread to wait for the interrupt after making the Recv()
call.
If successful, the function returns rcOk, otherwise it returns an error code.
Interrupt flags
- IRQ_LEVEL_LOW indicates low level generation.
- IRQ_LEVEL_HIGH indicates high level generation.
- IRQ_EDGE_RAISE indicates rising edge generation.
- IRQ_EDGE_FALL indicates falling edge generation.
- IRQ_SHARED indicates a shared interrupt.
- IRQ_PRIO_LOW indicates a low-priority interrupt.
- IRQ_PRIO_NORMAL indicates normal priority.
- IRQ_PRIO_HIGH indicates high priority.
- IRQ_PRIO_RT indicates real-time priority.
KnIoDetachIrq()
This function is declared in the coresrv/io/irq.h
file.
Retcode KnIoDetachIrq(Handle rid);
This function detaches the calling thread from the interrupt.
rid
is the interrupt handle received by using the KnRegisterIrq()
call.
If successful, the function returns rcOk, otherwise it returns an error code.
Page topKnIoDisableIrq()
This function is declared in the coresrv/io/irq.h
file.
Retcode KnIoDisableIrq(Handle rid);
Masks (prohibits) the interrupt with the handle rid
.
If successful, the function returns rcOk.
Page topKnIoEnableIrq()
This function is declared in the coresrv/io/irq.h
file.
Retcode KnIoEnableIrq(Handle rid);
Unmasks (allows) the interrupt with the handle rid
.
If successful, the function returns rcOk.
Page topKnRegisterIrq()
This function is declared in the coresrv/io/irq.h
file.
Retcode KnRegisterIrq(int irq, Handle *outRid);
Registers the interrupt with the number irq
.
Output parameter outRid
contains the interrupt handle.
If successful, the function returns rcOk.
If an interrupt is no longer being used, it must be freed by using the KnIoClose()
function.