Advanced: Creating Customized OSIs : Customizing API Definitions : Customizing Code Style : Variables Naming Style

Variables Naming Style
 
Example Definition
Code Generated
Controls the naming of the global flags buffers. If more than one buffer is required, the name of the next buffer is postfixed with an incrementing number, starting with 1. (cgGlobalFlags1, cgGlobalFlags2, etc.)
The generated application uses some bit sized data to handle various parts of the implementation (like Bit activation for tasks). All those bits are combined into buffers and are generated in the files glob_dat.c (declaration) and glob_dat.h (extern declaration).
For an Application using 14 global bits.
API definition: cgGlobalFlags
uint16 cgGlobalFlags;
Controls the naming of the timeout mask buffers. If more than one buffer is required, the name of the next buffer is postfixed with an incrementing number, starting with 1. (cgTimeoutMask1, cgTimeoutMask2, etc.)
The generated application uses bits sized data to indicate that a Timeout is pending.
All those bits are combined into buffers and are generated in the files glob_dat.c (declaration) and glob_dat.h (extern declaration)
For an Application using 14 Timeouts.
API definition: cgTimeoutsMask
uint8 cgTimeoutsMask;
uint8 cgTimeoutsMask1;
Timeout Event Name(nameid)
Controls the naming of the timeout event. The profile name can be added here.
Example: $<nameid>_$<profileName>
Defines the name that identifies the event that relates to a Timeout.
The code generator creates a predefined name for the event, which the user can customize.
For a Timeout with predefined name: tm_999999998
API Definition: $<nameid>_$<profileName>
Generated event name:
tm_999999998_MY_PROF
Timeout Time Variable Name(nameid)
Controls the naming of the timeout time variable. The profile name can be added here.
Example: $<nameid>_TIME_$<profileName>
A Timeout uses a Timeout-Time-Variable to hold the time in which it expires.
The name of the Timeout-Time-Variable is used when installing the Timeout, and when testing for Timeout's expiration.
For a Timeout with predefined name: tm_999999998
API Definition: $<nameid>_TIME
Generated event name:
Timeout Mask Name(nameid)
Controls the naming of the timeout mask. The profile name can be added here.
Example: $<nameid>_TM_MASK_$<profileName>
A timeout uses a bit sized data to indicate that the Timeout was installed and is now pending. All the bits for all the timeouts are combined into buffers.
In order to access the relevant bit for a Timeout, the application uses a Mask.
The name of the Mask is defined by this API, and is generated in the file macro_def.h
For a Timeout with predefined name: tm_999999998
API Definition: $<nameid>_TM_MASK
Generated code for the mask:
#define tm_999999998_TM_MASK 0x01
Timeout Counter Index Name(nameid)
Controls the naming of the timeout's related counter index. The profile name can be added here.
Example: $<nameid>_counter_$<profileName>
When using the optimization "Reuse Timeout Variable Where Possible", more than one Timeout may share the same Timeout-Time-Variable. If those Timeouts are using a different Counter. then it is required to store the actual counter on which the timeout was installed. For this purpose, a variable is allocated that stores the index of the counter.
The name of this variable is defined by this API, and is generated in the file glob_dat.c (declaration) and glob_dat.h (extern declaration).
For a Timeout with predefined name: tm_999999998
API Definition: $<nameid>_counter
Generated code for the counter's index variable:
uint8 tm_999999998_counter;
Controls the naming of the variable that holds the “current time” retrieved from a counter; variable is later passed to functions that require this information.
When retrieving the value of a counter, this API is used to define the name of the variable used to hold this value.
The retrieval of the counter's value is done before calling a method that requires the current time of a counter, like when testing for Timeout's expiration.
API definition: currentTick
Generated Code: currentTick
Single Buffer Variable Prefix(activityNameid)
Defines the prefix of the Single Buffer type, for Task/ISR.
Single buffered elements that are related to a Task/ISR are generated in a structure.
This API is used when generating the name of the 'Single Buffer' variable of this Single Buffer type, in the file glob_dat.c (declaration) and glob_dat.h (extern declaration)
For an Activity defined to be a Task:
API Definition: myCgSingleBuffer_
cgSingleBufferType_T1 myCgSingleBuffer_T1;
Double Buffer Typedef Prefix(activityNameid)
Defines the prefix of the Double Buffer typedef’ed type, for Task/ISR.
Double buffered elements that are related to a Task/ISR are generated in a structure.
This API is used when generating the name of the 'Double Buffer' type, in the file type_def.c
For an Activity defined to be a Task:
API Definition: myCgDoubleBuffer_
struct myCgDoubleBuffer_T1_type {
… (Double buffered data)
typedef struct myCgDoubleBuffer_T1_type cgDoubleBufferType_T1;
Double Buffer Next Variable Prefix(activityNameid)
Defines the prefix of the Double Buffer variable which holds the current value, for Task/ISR.
Double buffered elements that are related to a Task/ISR are generated in a structure.
This API is used when generating the name of the 'Double Buffer' variable of this Double Buffer type, in the file glob_dat.c (declaration) and glob_dat.h (extern declaration).
The double buffering of an Element is achieved by using two instances of the Double Buffer type; one is "new" and one is "old". This API is used for prefixing the name of the buffer of the "new" values.
For an Activity defined to be a Task:
API Definition: myCgDoubleBuffer_
extern cgDoubleBufferType_T1 /* New*/cgDoubleBufferNew_T1;
Double Buffer Current Variable Prefix(activityNameid)
Defines the prefix of the Double Buffer variable which holds the new value, for Task/ISR.
Double buffered elements that are related to a Task/ISR are generated in a structure.
This API is used when generating the name of the 'Double Buffer' variable of this Double Buffer type, in the file glob_dat.c (declaration) and ""glob_dat.h"" (extern declaration).
The double buffering of an Element is achieved by using two instances of the Double Buffer; type one is "new" and one is "old". This API is used for prefixing the name of the buffer of the "old" values.
For an Activity defined to be a Task:
API Definition: myCgDoubleBuffer_
extern cgDoubleBufferType_T1 /*Old*/cgDoubleBufferOld_T1;
Events Buffer Prefix(udt_or_activity_nameid)
Controls the naming of the Events buffers. If more than one buffer is required, the name of the next buffer is postfixed with an incrementing number, starting with 1 (cg_Events1, cg_Events2, etc.).
The formal parameter udt_or_activity_nameid is that name of the context element in which the buffer is defined. The context element can be either an Activity of a User-defined type.
Events use Bit sized data, which are combined into buffers.
The name of these buffers is defined using this API, and is generated in the file type_def.h, inside the Double-Buffer type structure.
For an Activity defined to be a Task:
With 10 Events assigned to this Task, and Word Size defined to be 8-Bits
struct cgDoubleBuffer_T1_type {
uint8 cg_Events;
Bits Buffer Prefix(udt_or_activity_nameid)
Controls the naming of the Bits and Conditions buffer in a Task/ISR or user-defined-type structure, and for globals.
The formal parameter udt_or_activity_nameid is the name of the context element in which the buffer is defined.
The context element can be either an Activity or a User-defined-type.
Conditions and Data-Item of type "Bit" use Bit sized data, which are combined into buffers.
The name of these buffers is defined using this API, and is generated in the file type_def.h" inside the Task's/ISR's data type structure (if related to it), or in the files glob_dat.c (declaration) and glob_dat.h (extern declaration).
For 10 Conditions that are defined in the "global" scope, and Word Size defined to be 8-Bit.
API definition: cg_BitsConditions
The generated code in the file glob_dat.c:
AMCBitsStruct8 cg_BitsConditions;
AMCBitsStruct8 cg_BitsConditions1;
Current State Info Variable Prefix(activityNameid)
Defines the prefix of the Current State variable, for statecharts.
A Statechart Hierarchy (under a Control-Activity) uses a single variable to hold the state of the state machine.
This API defines the prefix of the State variable that holds the current state of the state machine.
Name: FAN_CTRL
API Definition: currentState_
Generated code (in glob_dat.c):
StateInfo_FAN_CTRL currentState_FAN_CTRL;
Stay Same State Info Variable Prefix(activityNameid)
Defines the prefix of the Stay Same variable, for statecharts.
A Statechart Hierarchy (under a Control-Activity) uses a single variable to hold the state of the state machine.
This API defines the prefix of the State variable that holds the state of the state machine in favor of the Entering and Exiting reaction implementation.
This variable is generated in the Statechart's function.
Name: FAN_CTRL
Generated code (in <module>.c):
cgDo_FAN_CTRL(void)
StateInfo_FAN_CTRL staySame_FAN_CTRL = 0;
Next State Info Variable Prefix(activityNameid)
Defines the prefix of the Next State variable, for statecharts.
A Statechart Hierarchy (under a Control-Activity) uses a single variable to hold the state of the state machine.
This API defines the prefix of the State variable that holds the state of the state machine in favor of the Entering and Exiting reaction and Statechart's implementation.
This variable is generated in the Statechart's function.
Name: FAN_CTRL
Generated code (in <module>.c):
cgDo_FAN_CTRL(void)
StateInfo_FAN_CTRL nextState_FAN_CTRL = 0;