iLLD_TC27xD  1.0
lld_conventions.c
Go to the documentation of this file.
1 /** \page lld_conventions Naming Conventions
2 
3 This section provides the naming convention to be followed during development.
4 
5 As general rule all the "exported" types/definitions/class/objects (i.e. Function, enum, typedef, constant, variable, ...) should start with the filename + underscore "_".
6 
7 Example: in file IfxScuWdt.c/h the function shall be:
8  \li IfxScuWdt_enableEndinit()
9  \li IfxScuWdt_disableEndinit()
10 
11 
12 \section files iLLD Files
13 
14 Ifx<HW Module name>[<HW Sub module name>][_SW Driver if special][sub SW module name].c/h
15 
16 Example:
17  \li 1) With HW module only without sub-module: IfxPort.c/.h
18  \li 2) With HW module and sub-module: IfxScuWdt.c/.h
19  \li 3) With HW module sub-module and SW driver: IfxGtmTom_Pwm.c/.h
20  \li 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)
21 
22 Important things to check during review/ or with static code check tools:
23  \li 1) Prefix: Ifx (in title case)
24  \li 2) <module name>[<HW Sub module name>] (in camel case)
25  \li 3) [_SW Driver if special] (an underscore to separate and title case SW driver name)
26  \li 4) .c and .h in the small case
27 
28 
29 \section types Data Types
30 <B>typedef <standard type> Ifx<HW Module name>[<HW Sub module name>][_SW Driver if special]_<user type name>;</B>
31 
32 <Standard type> structure/union/enum definitions with its elements, and other C data types
33 
34 Example:
35 \code
36 typedef struct
37 {
38  uint32 pllFreqInHz;
39  uint32 stepFreqInHz;
40  uint8 stepPerIn_uSec;
41  uint8 pDivider;
42  uint8 nDivider;
43  uint8 k2Divider;
44 } IfxScu_Pll_Config;
45 \endcode
46 
47 Important things to check:
48  \li 1) Points 1 to 3 for filenames
49  \li 2) _<user type name >: an underscore to separate with the rest and Camel case letters (first letter also capital).
50 
51 
52 \section struct Structures
53 
54 To define structure types the convention shall be followed as in type defines above.
55 
56 For structure elements simple name with camel case letters with first letter small shall be used.
57 
58 Refer to the example for naming convention for type defines
59 
60 
61 \section enum Enumerated Types
62 To define enum types the convention shall be followed as in type defines above.
63 
64 For enum elements following naming convention to be followed:\n
65 <B>Ifx<HW Module name>[<HW Sub module name>][_SW Driver if special]_<Enum Name>_<Enum element></B>
66 
67 <Enum element> camel case letter
68 <Enum Name> Camel case letter
69 
70 Example:
71 \code
72 typedef enum {
73  IfxDma_ChannelPriority_low = 0,
74  IfxDma_ChannelPriority_medium,
75  IfxDma_ChannelPriority_high
76 } IfxDma_ChannelPriority;
77 \endcode
78 
79 Important things to check:
80  \li 1) Points 1 to 3 for filenames
81  \li 2) _<Enum Element>: an underscore to separate with the rest and Camel case letters (first letter lower case).
82 
83 
84 
85 \section defines #define Constants or Macros
86 
87  <B>#define IFX<MODULE>[<HW SUB MODULE NAME>][_SW DRIVER]_<FUNCTIONALITY NAME></B>
88 
89 <FUNCTIONALITY NAME>: Meaningful name to represent the functionality. With "_" to separate words
90 
91 Example:
92 \code
93 #define IFXSCUCCU_PLL_FREE_RUNNING_FREQ (100000000U)
94 \endcode
95 
96 Important things to check:
97  \li 1) all capital letters
98 
99 
100 \section function Functions
101 
102 All exported functions:
103  <B>Ifx<HW Module name>[<HW Sub module name>][_SW Driver if special]_<Functionality></B>
104 
105 Example:
106 
107 \code
108  IfxGtmTom_Pwm_setDutyCycle(..)
109 \endcode
110 
111 Important things to check:
112  \li 1) Points 1 to 3 for filenames
113  \li 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.
114 
115 For example:
116  \li An interface to set pin level high, the function name is setPinHigh.
117  \li An interface to read the result of ADC conversion is readResult
118  \li An interface to send the data byte over communication peripheral sendByte
119 
120 \section parameter Function's parameter & struct members
121 Function parameter are not doing an action done but does set values for confiuguration, then there is no verb in the name.
122 
123 Examples:
124 \code
125 typedef struct
126 {
127  boolean hardwareRequestEnabled; // \brief Enabling the hardware channel request
128 } IfxDma_Dma_ChannelConfig;
129 \endcode
130 
131 \section inline Inline Functions
132 
133 All inline functions as:\n
134  <B>IFX_INLINE <function definition></B>
135 
136 Shall follow the naming conventions as in Functions
137 
138 
139 \section standard Infineon definitions for Standard Data Types
140 
141 Located in \ref Cpu/Std/Platform_Types.h
142 
143 
144 [\ref lld_api "Previous page"] [\ref lld_codingRules "Next page"]
145 */