Real-Time API Revision2025.2-0
Loading...
Searching...
No Matches
Asynchronous RTDB access API
Collaboration diagram for Asynchronous RTDB access API:

Functions

int ccurAsynQ_asyncInputQueueMap (int init)
int ccurAsynQ_asyncInputQPut (AsyncQElement *e, int nElements, void *str, int length)
void ccurAsynQ_freeBuf (AsyncQElement *e)
int ccurAsynQ_asyncInputQGet (AsyncQElement *e, int *nElements, void *str, int *len)
int ccurAsynQ_getQNumberOfEntries (void)
int ccurAsynQ_setRTDBItemValue (RTDBItem *pItem, double value, unsigned char rtFlags, unsigned long long stamp)

Detailed Description

This API is used by asynchronous processes to update the value of RTDB items. Asynchronous processes should not update the RTDB directly via calls to ccurRTDB_setCVTValue or ccurRTDB_setAlternateValue because it will violate the principle of RTDB coherence. I.e. a model that uses the value of an RTDB item might see 2 different values if the value is updated directly outside of the synchronous frame run while the model is running.
The queue is processed by the scheduling process in parallel with the execution of the first synchronous sub-cycle (input processes).
The queue is processed for a finite amount of time defined in micro seconds when starting the session. The default processing time is 20 micro seconds which can be changed at test startup time.

Function Documentation

◆ ccurAsynQ_asyncInputQueueMap()

int ccurAsynQ_asyncInputQueueMap ( int init)

Map the asynchronous update queue within the calling process.
This routine must be called by processes that want to use ccurAsynQ_asyncInputQPut.

Parameters
initInteger set to != 0 when the queue is to be initialized.
Only the scheduler calls this routine with init != 0.
Returns
0 If the call is successful.
Return values
-1Any of the system calls (shm_open, mmap) failed.

◆ ccurAsynQ_asyncInputQPut()

int ccurAsynQ_asyncInputQPut ( AsyncQElement * e,
int nElements,
void * str,
int length )

Put an AsyncQElement element in the queue. The element must be initialized correctly with the item hash index which is used by the asynchronous update routine to update the correct item.

Parameters
ePointer to an array of AsyncQElement containing the values to put in the queue.
nElementsThe number of elements in the array.
strPointer to the string value when the item to be updated is a string item. Pass NULL for non string item.
lengthInteger with the length in bytes of the string variable
Return values
0If the call is successful.
<0 RTDB_ASYNCQFULL if the queue is full.

◆ ccurAsynQ_freeBuf()

void ccurAsynQ_freeBuf ( AsyncQElement * e)

Free a buffer entry allocated by the QPut call This routine is only used by the SimWB scheduler and must not be used in user programs.

◆ ccurAsynQ_asyncInputQGet()

int ccurAsynQ_asyncInputQGet ( AsyncQElement * e,
int * nElements,
void * str,
int * len )

Get the oldest AsyncQElement element cwfrom the asynchronous queue.
Only the asynchronous queue processing routine uses this routine.

Return values
0The queue is empty.
1The element is a normal scalar element.
2If the element is a string variable.

◆ ccurAsynQ_getQNumberOfEntries()

int ccurAsynQ_getQNumberOfEntries ( void )

Returns the number of elements still to be processed in the asynchronous IO queue.

Return values
Thenumber of elements pending in the queue.

◆ ccurAsynQ_setRTDBItemValue()

int ccurAsynQ_setRTDBItemValue ( RTDBItem * pItem,
double value,
unsigned char rtFlags,
unsigned long long stamp )

Set the value of the RTDB item via the asynchronous queue.
Asynchronous processes should use this call to update the RTDB. This call will map the queue into the user process via ccurAsynQ_asyncInputQueueMap if it has not been mapped yet.

Parameters
pItemPointer to the RTDBItem which is to be updated.
valuedouble with the value for the item.
rtFlagsunsigned char with the run time flags corresponding to the item. Only RTDBFL_OUTOFEURANGE and RTDBFL_OUTOFHARDWARERANGE can be updated via this call.
stampunsigned long long with TSC time stamp corresponding to when the data value was acquired. Pass 0 into this value for the call to use its stamp at the time of this call
Return values
0The call is successful.
<0 RTDB_POINTNOTFOUND if pItem is NULL.
<0 RTDB_ASYNCQFULL if the queue is full.