iLLD_TC27xC
1.0
lld_dosanddont_namingConvention.c
Go to the documentation of this file.
1
/*
2
* $Author: $tklose
3
* $Date: 2014-02-26 09:24:12 GMT$
4
* $Revision: $0.1
5
*/
6
/**
7
8
\page lld_dosanddont_namingConvention Naming convention
9
\section enum Enum
10
<SPAN style="font-family:courier;font-size:small;">[link: \ref enum]</SPAN>
11
12
Enumeration items must be prefixed with the enumeration type.
13
14
Correct:
15
\code
16
typedef enum
17
{
18
IfxDma_ChannelPriority_low = 0,
19
IfxDma_ChannelPriority_medium,
20
IfxDma_ChannelPriority_high
21
} IfxDma_ChannelPriority;
22
\endcode
23
Wrong (<SPAN style="font-family:courier">IfxDma_ChannelPriority<SPAN style="color:red">Select</SPAN></SPAN>):
24
\code
25
typedef enum
26
{
27
IfxDma_ChannelPriority_low = 0,
28
IfxDma_ChannelPriority_medium,
29
IfxDma_ChannelPriority_high
30
} IfxDma_ChannelPrioritySelect;
31
\endcode
32
33
34
35
\section directoryName Directory name
36
<SPAN style="font-family:courier;font-size:small;">[link: \ref directoryName]</SPAN>
37
38
Dirtectory shall have the same name as the driver name without the Ifx prefix.
39
40
Correct:
41
- Dma
42
- Dma
43
- IfxDma.c
44
- IfxDma.h
45
46
Wrong:
47
- Dma
48
- <SPAN style="color:red">Interface</SPAN>
49
- IfxDma.c
50
- IfxDma.h
51
52
53
\section parameter Function's parameter & struct members
54
<SPAN style="font-family:courier;font-size:small;">[link: \ref parameter]</SPAN>
55
56
Function parameter are not doing an action done but does set values for confiuguration, then there is no verb in the name.
57
58
Correct:
59
\code
60
typedef struct
61
{
62
boolean hardwareRequestEnabled; // \brief Enabling the hardware channel request
63
} IfxDma_Dma_ChannelConfig;
64
\endcode
65
66
Wrong(<SPAN style="font-family:courier"><SPAN style="color:red">enable</SPAN>HardwareRequest</SPAN>):
67
\code
68
typedef struct
69
{
70
boolean enableHardwareRequest; // \brief Enabling the hardware channel request
71
} IfxDma_Dma_ChannelConfig;
72
\endcode
73
74
\section staticFunctionNames Static function names shall also be prefixed
75
<SPAN style="font-family:courier;font-size:small;">[link: \ref staticFunctionNames]</SPAN>
76
77
78
Correct:
79
\code
80
static void IfxDma_Dma_configureTransactionSet(Ifx_DMA_CH* channel, IfxDma_Dma_ChannelConfig* config)
81
\endcode
82
83
Wrong:
84
\code
85
static void configureTransactionSet(Ifx_DMA_CH* channel, IfxDma_Dma_ChannelConfig* config)
86
\endcode
87
88
\section parameterhandle Do not explicitely use 'handle' in the parameter name
89
<SPAN style="font-family:courier;font-size:small;">[link: \ref parameterhandle]</SPAN>
90
91
Remove the name ‘handle’ from the parameter’s name, even we hnow that it is an handle. It does not add information but increase the source code length.
92
93
Correct:
94
\code
95
IFX_EXTERN void IfxDma_Dma_initChannelConfig(IfxDma_Dma_ChannelConfig* config, IfxDma_Dma* dma);
96
\endcode
97
98
Wrong(<SPAN style="font-family:courier">dma<SPAN style="color:red">Handle</SPAN></SPAN>):
99
\code
100
IFX_EXTERN void IfxDma_Dma_initChannelConfig(IfxDma_Dma_ChannelConfig* config, IfxDma_Dma* dmaHandle);
101
\endcode
102
103
104
[\ref lld_dosanddont "Previous page"] [\ref lld_dosanddont_codingRules "Next page"]
105
106
*/
doc
doxygen
common
dosAndDont
lld_dosanddont_namingConvention.c
Generated by
1.8.4