iLLD_TC27xD  1.0
Naming Conventions

This section provides the naming convention to be followed during development.

As general rule all the "exported" types/definitions/class/objects (i.e. Function, enum, typedef, constant, variable, ...) should start with the filename + underscore "_".

Example: in file IfxScuWdt.c/h the function shall be:

  • IfxScuWdt_enableEndinit()
  • IfxScuWdt_disableEndinit()

iLLD Files

Ifx<HW Module name>[<HW Sub module name>][_SW Driver if special][sub SW module name].c/h

Example:

  • 1) With HW module only without sub-module: IfxPort.c/.h
  • 2) With HW module and sub-module: IfxScuWdt.c/.h
  • 3) With HW module sub-module and SW driver: IfxGtmTom_Pwm.c/.h
  • 4) With HW module sub-module and SW driver + SW sub module: IfxGtmTom_PwmHl.c/.h (only if it makes sense to split the 10:files to make it modular)

Important things to check during review/ or with static code check tools:

  • 1) Prefix: Ifx (in title case)
  • 2) <module name>[<HW Sub module name>] (in camel case)
  • 3) [_SW Driver if special] (an underscore to separate and title case SW driver name)
  • 4) .c and .h in the small case

Data Types

typedef <standard type> Ifx<HW Module name>[<HW Sub module name>][SW Driver if special]<user type name>;

<Standard type> structure/union/enum definitions with its elements, and other C data types

Example:

typedef struct
{
uint32 pllFreqInHz;
uint32 stepFreqInHz;
uint8 stepPerIn_uSec;
uint8 pDivider;
uint8 nDivider;
uint8 k2Divider;
} IfxScu_Pll_Config;

Important things to check:

  • 1) Points 1 to 3 for filenames
  • 2) _<user type name >: an underscore to separate with the rest and Camel case letters (first letter also capital).

Structures

To define structure types the convention shall be followed as in type defines above.

For structure elements simple name with camel case letters with first letter small shall be used.

Refer to the example for naming convention for type defines

Enumerated Types

To define enum types the convention shall be followed as in type defines above.

For enum elements following naming convention to be followed:
Ifx<HW Module name>[<HW Sub module name>][SW Driver if special]<Enum Name>_<Enum element>

<Enum element> camel case letter <Enum Name> Camel case letter

Example:

Important things to check:

  • 1) Points 1 to 3 for filenames
  • 2) _<Enum Element>: an underscore to separate with the rest and Camel case letters (first letter lower case).

#define Constants or Macros

#define IFX<MODULE>[<HW SUB MODULE NAME>][SW DRIVER]<FUNCTIONALITY NAME>

<FUNCTIONALITY NAME>: Meaningful name to represent the functionality. With "_" to separate words

Example:

#define IFXSCUCCU_PLL_FREE_RUNNING_FREQ (100000000U)

Important things to check:

  • 1) all capital letters

Functions

All exported functions: Ifx<HW Module name>[<HW Sub module name>][SW Driver if special]<Functionality>

Example:

IfxGtmTom_Pwm_setDutyCycle(..)

Important things to check:

  • 1) Points 1 to 3 for filenames
  • 2)_<Functionality>: an underscore to separate and Camel case letters with first letter small. (Convention used with object oriented programming). Functionality shall start with the main action (verb) to be fulfilled with the interface.

For example:

  • An interface to set pin level high, the function name is setPinHigh.
  • An interface to read the result of ADC conversion is readResult
  • An interface to send the data byte over communication peripheral sendByte

Function's parameter & struct members

Function parameter are not doing an action done but does set values for confiuguration, then there is no verb in the name.

Examples:

typedef struct
{
boolean hardwareRequestEnabled; // \brief Enabling the hardware channel request

Inline Functions

All inline functions as:
IFX_INLINE <function definition>

Shall follow the naming conventions as in Functions

Infineon definitions for Standard Data Types

Located in Cpu/Std/Platform_Types.h

[Previous page] [Next page]