User manual
85
In order to perform the operation, the initiator invokes a routine identified by the
set_bus_request_affinity field of the chapi_in descriptor supplying in the parameter brq_handle
the identifier of bus request to set affinity mask for and in the parameter mask the affinity
mask to set. Affinity mask is a bit mask where each particular bit is designated to
particular emulated CPU – lowest bit to the first CPU and so on. The procedure is invoked
as follows:
brq_handle_t brq_handle;
const chapi_in * ci = …;
…
// Connect bus request to the bus getting brq_handle as in previous example
…
// Only first CPU will be allowed to process bus request
// identified by brq_handle
if (ci->set_bus_request_affinity) {
ci->set_bus_request_affinity (ci, brq_handle, 0x01);
}
The example above shows that the CHARON core is not obliged to support the indicated
operation. It also indicates why the device instance should remember the chapi_in
descriptor.
4.9.8 Set bus request affinity callback
The operation of setting bus request affinity callback belongs to the group of operations
previously called “Request for bus interrupt”. Such an operation is initiated by the device
instance and CHARON core is defined as the target of the operation. This routine has
sense only for the case of multi CPU emulated system and defines callback routine which
will notify loadable device that bus request affinity mask is modified for some bus request.
In order to perform the operation, the initiator invokes a routine identified by the set_
affinity_callback field of the chapi_in descriptor supplying in the parameter brq_handle the
identifier of bus request to set affinity callback for, in the parameter sa_callback the pointer
to callback routine to set and in the parameters arg1, arg2 the parameters to be passed to
specified callback routine during its execution. The procedure is invoked as follows:
void sa_procedure(void *arg1, int arg2, int c_no)
{
// Do something here ... c_no is CPU with the lowest number
// among all CPUs specified in affinity mask and used as bus servers
}
…
brq_handle_t brq_handle;
const chapi_in * ci = …;
…
// Connect bus request to the bus getting brq_handle as in previous example
…
// Setup affinity callback routine










