|
|
|
|
|
Timeout Install Define (nameid, tmMaskName, tmMaskVal, tmVariableName, tmMaskVarName, tmVariableType, tmCurrentTickName, tmCounterVarName, tmCounterName)
|
?<begin> $<tmMaskVal> ?<==> ?<?>?<:>#define $<tmMaskName> $<tmMaskVal>
?<end>#define INSTALL_TM_$<nameid>(D, C) \
$<tmMaskVarName> |= $<tmMaskName>; \
$<tmVariableName> = ($<tmVariableType>)$<tmCurrentTickName> + (D); ?<begin> $<tmCounterVarName> ?<==> ?<?>?<:>\
$<tmCounterVarName> = (C);?<end>
|
Definition of the Timeout installation, in the file macro_def.h
|
This API is used for each of the Timeouts in the model, when generating the macro for installing the Timeout.
The macro is generated in the file macro_def.h
|
For a Timeout with predefined name: tm_999999998
tmMaskName = tm_999999998_TM_MASK
tmMaskVarName = cgTimeoutsMask
tmVariableName = tm_999999998_TIME
?<begin> $<tmMaskVal> ?<==> ?<?>?<:>#define $<tmMaskName> $<tmMaskVal>
?<end>#define INSTALL_TM_$<nameid>(D, C) \
|
Timeout Install Define (nameid, tmMaskName, tmMaskVal, tmVariableName, tmMaskVarName, tmVariableType, tmCurrentTickName, tmCounterVarName, tmCounterName)
|
|
|
|
$<tmVariableName> = ($<tmVariableType>)$<tmCurrentTickName> + (D); ?<begin> $<tmCounterVarName> ?<==> ?<?>?<:>\
#define tm_999999998_TM_MASK (UNSIGNED_MASK_TYPE)( 0x01)
#define INSTALL_TM_tm_9999999 98(D, C) \
cgTimeoutsMask |= tm_999999998_TM_MASK; \
tm_999999998_TIME = (uint32)currentTick + (D)
|
Timeout Install Call(nameid, time, counterIndex, tmCounterName, tmCurrentTickName)
|
$<tmCurrentTickName> = $<tmCounterName>;
INSTALL_TIMEOUT($<nameid>, $<time>, $<counterIndex>)
|
Definition of the call to the install of a Timeout, in file <module>.c
|
This API is used for each of the Timeouts in the model, when generating the code for installing the Timeout.
The code for the installation is generated in the file <module>.c
|
For a Timeout with predefined name: tm_999999998
counterIndex = ms_counter_INDEX
INSTALL_TIMEOUT($<nameid>, $<time>, $<counterIndex>)
INSTALL_TIMEOUT(tm_99 9999998,1,ms_counter_ INDEX);
|
Timeout Test on Expiration Call(nameid, tmCurrentTickName, tmCounterName, tmEventBuffer, tmCounterIndex, genContextVar)
|
$<tmCurrentTickName> = $<tmCounterName>;
$<nameid>($<tmCounterName>, &$<tmEventBuffer>, $<tmCounterIndex>?<begin>$<genContextVar> ?<!=> ?<?>, $<genContextVar>?<:>?<end>)
|
Definition of the call to the Timeouts Dispatch function, in the file <module>.c
|
This API is used in the Task's code frame.
The API defines the code that calls to the Timeouts Dispatch Function, in <module>.c
|
For a Timeout with predefined name: tm_999999998
counterIndex = ms_counter_INDEX
tmEventBuffer = cgDoubleBufferOld_T1
$<nameid>($<tmCounterName>, &$<tmEventBuffer>, $<tmCounterIndex>?<begin>$<genContextVar> ?<!=> ?<?>, $<genContextVar>?<:>?<end>);
genTmEvent_T1(current Tick, &cgDoubleBufferOld_T1 , ms_counter_INDEX);
|
Timeout Test on Expiration Define(nameid, tmCurrentTickType, tmCurrentTickName, tmEventBuffType, tmEventBuffName, tmCounterIndexType, tmCounterIndex, genContextVar, timeoutList)
|
@<for> @<timeoutList> @<begin> if(?<begin> $<$<timeoutList>_counterIndex>?<==> ?<?>?<:>$<tmCounterIndex> == $<$<timeoutList>_counterIndex> &&
?<end>$<$<timeoutList>_buffMask> & $<timeoutList>_TM_MASK && $<tmCurrentTickName> >= $<$<timeoutList>_timeVar>) {
GEN_IN_BUFF($<timeoutList>, $<tmEventBuffName>);
$<$<timeoutList>_buffMask> &= ~$<timeoutList>_TM_MASK;
|
Definition of the Timeouts Dispatch function, in the file <module>.c
|
This API is used when generating the Timeout Dispatch Function.
A separate Timeout Dispatch Function is generated for each of the Tasks, ISR's and Generic Activity generated as function.
This API uses a syntax capability that handles lists of Design-Attributes.
Lists of Design-Attributes are simply a set of Design-Attributes with identical name, in the same element.
The syntax uses the character "@" and the "begin" and "end" tokens to define the boundaries of the definition related to the list of Design-Attributes.
|
With Timeouts: tm_999999998, tm_999999997
API Definition: Same as the example definition
tmEventBuffType = cgDoubleBufferType_T1*
genTmEvent_T1(uint16 currentTickVar, cgDoubleBufferType_T1 * buff, uint8 counterIndex)
if(counterIndex == ms_counter_INDEX &&
cgTimeoutsMask & tm_999999998_TM_MASK && currentTickVar >= tm_999999998_TIME) {
|
Timeout Test on Expiration Define(nameid, tmCurrentTickType, tmCurrentTickName, tmEventBuffType, tmEventBuffName, tmCounterIndexType, tmCounterIndex, genContextVar, timeoutList)
|
|
|
|
GEN_IN_BUFF(tm_999999 998, buff);
cgTimeoutsMask &= ~tm_999999998_TM_MASK ;
if(counterIndex == sec_counter_INDEX &&
cgTimeoutsMask & tm_999999997_TM_MASK && currentTickVar >= tm_999999997_TIME) {
GEN_IN_BUFF(tm_999999 997, buff);
cgTimeoutsMask &= ~tm_999999997_TM_MASK ;
|
Timeout Test on Expiration Declare(nameid, tmCurrentTickType, tmCurrentTickName, tmEventBuffType, tmEventBuffName, tmCounterIndexType, tmCounterIndex, genContextVar)
|
void $<nameid>($<tmCurrentTickType> $<tmCurrentTickName>, $<tmEventBuffType>* $<tmEventBuffName>, $<tmCounterIndexType> $<tmCounterIndex>?<begin>$<genContextVar> ?<!=> ?<?>, $<genContextVar>?<:>?<end>);
|
The forward declaration of the Timeouts Dispatch function, in the file type_def.h
|
This API is used when generating the Timeout Dispatch Function's forward declaration.
The forward declaration is generated in the file type_def.h
|
tmEventBuffType = cgDoubleBufferType_T1*
void $<nameid>($<tmCurrentTickType> $<tmCurrentTickName>, $<tmEventBuffType>* $<tmEventBuffName>, $<tmCounterIndexType> $<tmCounterIndex>?<begin>$<genContextVar> ?<!=> ?<?>, $<genContextVar>?<:>?<end>);
void genTmEvent_T1(uint16 currentTickVar, cgDoubleBufferType_T1 * buff, uint8 counterIndex);
|
Timeout Overflow Code Per Task(tmMasks, tmDispatchFunc, counterMaxAllowdVal, tmEventBuffName, counterIndex, genContextVar, timeoutList, timeoutVarType, counterValueType)
|
$<tmDispatchFunc>($<counterMaxAllowdVal>, &($<tmEventBuffName>), $<counterIndex>?<begin>$<genContextVar> ?<!=> ?<?>, $<genContextVar>?<:>?<end>);
@<for>@<timeoutList> @<begin>?<begin> $<$<timeoutList>_counterIndex>?<!=> ?<?> if($<$<timeoutList>_counterIndex> == $<counterIndex>)
?<:>?<end> $<$<timeoutList>_timeoutVar> -= ($<timeoutVarType>) 1 + (($<counterValueType>)$<counterMaxAllowdVal>);
|
The overflow code related to a specific task with timeouts, put in the Overflow-Task, in the file glob_func.c
|
This API is used in the Counter's overflow task, in the section where the overflow task calls the Timeout Dispatch Functions for each of the related Timeouts.
This API defines the code for calling the Timeout Dispatch Function for Timeouts that related to the same Task, ISR or generic activity instance.
This code is generated in the file glob_func.c
|
tmEventBuffName = cgDoubleBufferNew_T1
counterIndex = ms_counter_INDEX
timeoutList = tm_999999998 (list with only 1 Timeout)
genTmEvent_T1((uint16 ) -1, &(cgDoubleBufferNew_T 1), ms_counter_INDEX);
tm_999999998_TIME -= (uint32) 1 + ((uint16)(uint16) - 1);
|