User manual

80
defined as the target of the operation. It is the task of the CPU instruction interpretation
thread to respond to the operation of removing the bus interrupt request.
To perform the operation, the initiator invokes a routine identified by the clear_irq field of
the chapi_in descriptor. The initiator shall indicate through the vec parameter the vector of
the interrupt requests to clear. The target shall clear all the interrupt requests previously
originated by the initiator through the vector supplied. The procedure is invoked as follows:
const chapi_in * ci = …;
if (ci->clear_irq) {
ci->clear_irq(ci, vec);
}
The example above shows that the CHARON core is not obliged to support the indicated
operation. It also indicates why the device instance should retain the chapi_in descriptor.
4.8.3 Bus interrupt acknowledge
Acknowledging the bus interrupt request is currently the only operation defined within the
group of operations called “Request for bus interrupt acknowledge”. The CHARON core
(one of the CPU instruction interpretation threads) initiates such an operation. The device
instance is defined as a target of the operation.
In order to perform the operation, the initiator invokes a routine identified by the fun
parameter, supplied during the corresponding request for a bus interrupt. See the
“Requesting a bus interrupt” above. The procedure is invoked as follows:
irq_handler fun = …;
if (fun) {
vec = fun(arg1, arg2);
}
The example above shows that the device is not obliged to support the indicated
operation. Which means that it is allowed to supply 0 for the fun parameter when
requesting a bus interrupt through the put_irq entry point of the chapi_in descriptor. Note
that the CHAPI defines an additional argument, supplied through the arg1 and the arg2
parameters, to help the target dispatching requests.
The bus interrupt acknowledge procedure indicated by the fun parameter must return the
interrupt vector in case of acknowledgement. In this case the CHARON core uses the
returned value as the interrupt vector instead of the vector supplied through the previous
call to the put_irq procedure. If the bus interrupt is not acknowledged, the bus interrupt
acknowledge procedure shall return zero (0) indicating that the interrupt vector is not valid.
The CHAPI guarantees that the bus interrupt acknowledge procedure identified by the fun
argument is invoked in the execution context synchronized to the CPU instruction
interpretation thread.