Multi-Instance Synchronization
Provide a possibility to synchronize Cores and SyncGroups of multiple µRT instances.
If there are multiple devices in a system (as it is the case for AMiRo), each device runs an individual µRT instance.
While all nodes within each instance can be synchronized via the urtCoreSynchronizeNodes()
function, the µRT instances on the various modules cannot be synchronized yet.
Since the interfaces via which the nodes of those instances communicate are not defined by µRT, the according synchronization code must be provided externally to µRT.
Such a callback could be provided as argument to urtCoreInit()
like
typedef urt_status_t (*urt_synchronize_f)(urt_status_t syncstatus, void* params);
...
void urtCoreInit(urt_synchronize_f cb, void* params);
which is called at the end of urtCoreSynchronizeNodes()
:
// instance variables
urt_synchronize_f _urt_core_synccb;
void* _urt_core_synccb_params;
...
urt_status_t urtCoreSynchronizeNodes(urt_node_t* node) {
urt_status_t synchstatus;
...
// local sync
if (corenode == NULL) {
...
synchstatus = URT_STATUS_OK;
} else if (corenode->stage == (node->stage - 1)) {
...
synchstatus = URT_STATUS_SYNC_PENDING;
} else {
...
syncstatus = URT_STATUS_SYNC_ERROR
}
// external sync
if (_urt_core_synccb != NULL) {
syncstatus = _urt_core_synccb(syncstatus, _urt_core_synccb_params);
}
return syncstatus;
}
However, it should be evaluated, what information is actually required to realize such an external synchronization function (e.g. counters) and whether further common logic should be implemented within µRT.
Furthermore, a similar mechanism could be provided for the Sync module (i.e. urtSyncNodeSynchronize()
), where the callback and parameters are specified via a modified urtSyncGroupInit()
API.