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

Types Naming Style
 
Sample Definition
Code Generated
Single Buffer Type Prefix(activityNameid)
Defines the prefix of the Single Buffer type, for Task/ISR
All data which is defined as "Single Buffered" and that relates to a Task/ISR is combined into a structure. The structure's name is combined from the prefix defined by this API, and from the name of the Task/ISR.
The type is defined in the file type_def.h
For an Activity defined to be a Task:
API Definition: cgSingleBufferType_
struct cgSingleBufferType_T1_type {
Double Buffer Type Prefix(activityNameid)
Defines the prefix of the Double Buffer type, for Task/ISR
All data which is defined as "Double Buffered" and that relates to a Task/ISR is combined into a structure. The structure's name is combined from the prefix defined by this API, and from the name of the Task/ISR.
The type is defined in the file type_def.h
For an Activity defined to be a Task:
API Definition: cgDoubleBufferType_
struct cgDoubleBufferType_T1_type {
State Variable Prefix(activityNameid)
Defines the prefix of the State Variable type, for statechart hierarchy
A control Activity, which represent a Statechart hierarchy is implemented using a single function. The state in which the state machine is in is stored in a variable.
For each such Statechart hierarchy a separate type is generated.
The name of the type is combined of the prefix defined by this API, and from the name of the Control Activity.
The type id defined in the file type_def.h
Name: FAN_CTRL
Generated code (in type_def.h):
typedef uint8 StateInfo_FAN_CTRL;
Bits Buffer Type Prefix(udt_or_activity_nameid)
Defines the prefix of the Bits and Conditions buffer.
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-Items of type Bit are combined into buffers. The number of Bits/Condition per buffer comes from the selected Word-Size.
In case there are more Bits/Conditions than the size of the Word-Size an additional buffer is allocated with the prefix defined in this API and postfixed with an incrementing number.
The buffers are defined in the file type_def.h for Bits/Conditions that relates to a TASK/ISR or a User-Defined-Type, and in the files glob_dat.c and glob_dat.h for Bits/Conditions that relate to the global scope.
For Conditions CO1 - CO12 and Data-Items of type "bit" BIT1-BIT12, using word size of 8-Bits:
API Definition: bitsConditionsStruct
There are total of 26 elements, that require 4 8-Bits buffers.
Therefore the generated code would be:
uint8 bitsConditionsStruct;
uint8 bitsConditionsStruct1;
uint8 bitsConditionsStruct2;
uint8 bitsConditionsStruct3
Integer Signed Type Macro Prefix()
Defines the prefix of the 'signed type' macro for integer Data-Item , used with bit shifting predefined functions, or other user-defined usages.
Element which is defined to be of type Integer or Bitarray will have a definition of its 'signed type' in the generated code. The definition may be a macro in the file macro_def.h, or a typedef in the file type_def.h (depending on a profile setting).
This type is used with the Arithmetical bitwise operations (ASHL, ASHR), to cast the value of the element to the Element's "signed type".
The definition of the "signed type" is defined in the Element's Design-Attributes.
For a Data-Item of type: Integer
Design-Attribute "Integer Signed Type":
signed long int
Expression: DI = ASHL(DI, 5)
#define STYPE_DI signed long int (in macro_def.h)
DI = ((STYPE_DI)DI) << 5; (in <module>.c)
Defines the prefix of the 'unsigned type' macro for integer Data-Item , used with bit shifting predefined functions, o r other user-defined usages.
Element which is defined to be of type Integer or Bit array will have a definition of its 'unsigned type' in the generated code. The definition may be a macro in the file macro_def.h, or a typedef in the file type_def.h (depending on profile settings).
This type is used with the Logical bitwise operations (LSHL, LSHR), to cast the value of the element to the Element's "unsigned type".
The definition of the "unsigned type" is defined in the Element's Design-Attributes.
For a Data-Item of type: Integer
Design-Attribute "Integer Unsigned Type": unsigned long int
Expression: DI = LSHL(DI, 5)
#define STYPE_DI signed long int (in macro_def.h)
DI = ((TYPE_DI)DI) << 5; (in <module>.c)
User Defined Type Record Name Postfix()
_T
Controls the postfix of the name of the structure of a User-Defined-Type or Data-Items defined as Record/Union.
It also controls the postfix of the structures:
The following typedef will be generated for Data-Item DI_REC defined as record with the fields: G1 and G2.
typedef struct DI_REC_type<Postfix> {
Elements of type Record/Union may have a postfix in the name of their generated type.
The type is defined in the file type_def.h.
The postfix is used only on the name of the type and not on the typedef'ed name.
For Data-Item defined as record:
Fields : G1 and G2, defined as integers.
typedef struct DI_REC_type_T {
} DI_REC_type;