User manual

81
4.9 The recommended way to process interrupts
This methods described in this section are the recommended way to process interrupts in
a CHAPI implementation. They interact more efficiently with the CHARON kernel. See
section (5.1) for description of the appropriate C++ wrapper for that part of CHAPI.
4.9.1 Connect bus request to the bus
Connecting a bus request to the bus belongs to the “Request for bus interrupt” group of
operations. Such an operation is initiated by the device instance and CHARON core is
defined as the target of the operation. All bus requests required for loadable module
should be connected to the bus in order to have possibility for their processing. The right
place to call for this operation is a routine identified by the setup_bus_requests field of
chapi_out communication context descriptor.
To perform the operation, the initiator invokes a routine identified by the
connect_bus_request field of the chapi_in descriptor. The initiator shall indicate in the vector
parameter the vector of the bus requests to connect in the ipl parameter the level at which
bus request should be processed by the bus server, in the brq_ack the bus request
acknowledge procedure which is called in context of CPU thread when bus request is
acknowledged, in the arg1 and arg2 parameters to pass to the bus request acknowledge
routine. The target shall connect bus request with supplied parameters to the bus. The
procedure is invoked as follows:
brq_handle_t brq;
some_data_type *data;
const chapi_in * ci = …;
if (ci->connect_bus_request) {
// Pointer to some kind of data and 0 will be passed to
// the brq_ack routine when it is called.
brq = ci->connect_bus_request(ci, 0154, 04, brq_ack, data, 0);
if(!brq) {
// It was unable to connect bus request to the bus…
// Further operation with this request is impossible
}
else {
// Ok, bus request successfully connected
}
}
int brq_ack(void *data, int something)
{
// Usually bus request is cleared here because this is
// responsibility of device and device interrupt vector is returned…
}
In case of success routine returns bus request handle which should be saved for the
further operations with bus request – each of them requires this identifier.