iLLD_TC27xD
1.0
lld_dosanddont.c
Go to the documentation of this file.
1
/**
2
\page lld_dosanddont Do's and don't
3
4
-# \subpage lld_dosanddont_namingConvention
5
-# \subpage lld_dosanddont_codingRules
6
-# \subpage lld_dosanddont_documentation
7
-# \subpage lld_dosanddont_optimisation
8
-# \subpage lld_dosanddont_enumUsage
9
10
11
12
[\ref lld_versioning "Previous page"] [\ref lld_dosanddont_namingConvention "Next page"]
13
14
15
\page lld_dosanddont_codingRules Coding rules
16
17
\section typeAssumption Type assumption
18
<SPAN style="font-family:courier;font-size:small;">[link: \ref typeAssumption]</SPAN>
19
20
Bitfield values should not be assumed as Boolean.
21
22
Correct:
23
\code
24
IFX_INLINE boolean IfxDma_getChannelPatternDetectionOldValue(Ifx_DMA* dma,IfxDma_ChannelId channelId)
25
{
26
return dma->CH[channelId].CHCSR.B.LXO != 0;
27
}
28
\endcode
29
30
Wrong:
31
\code
32
IFX_INLINE boolean IfxDma_getChannelPatternDetectionOldValue(Ifx_DMA* dma,IfxDma_ChannelId channelId)
33
{
34
return dma->CH[channelId].CHCSR.B.LXO;
35
}
36
\endcode
37
38
39
\section variableNmaes Variable names
40
<SPAN style="font-family:courier;font-size:small;">[link: \ref variableNmaes]</SPAN>
41
42
Use explicit names for variable.
43
Example:
44
With
45
\code
46
Ifx_DMA* dma;
47
dma->source = 0x123;
48
\endcode
49
the code can be easier understand than with
50
\code
51
Ifx_DMA* baseAddr;
52
baseAddr->source = 0x123;
53
\endcode
54
55
\section numbers Avoid numbers, use constant instead
56
<SPAN style="font-family:courier;font-size:small;">[link: \ref numbers]</SPAN>
57
58
59
Correct:
60
\code
61
#define IFXDMA_DMA_ENABLE_SHADOW_ADDRESS (2) // Position of the shadow address enable bit
62
63
static void IfxDma_Dma_configureTransactionSet(Ifx_DMA_CH* channel, IfxDma_Dma_ChannelConfig* config)
64
{
65
...
66
if( config->shadowControl & (1 << IFXDMA_DMA_ENABLE_SHADOW_ADDRESS) )
67
{
68
channel->SHADR.U = config->shadowAddress;
69
}
70
}
71
\endcode
72
73
Wrong:
74
\code
75
static void IfxDma_Dma_configureTransactionSet(Ifx_DMA_CH* channel, IfxDma_Dma_ChannelConfig* config)
76
{
77
...
78
if( config->shadowControl & (1 << 2) )
79
{
80
channel->SHADR.U = config->shadowAddress;
81
}
82
}
83
\endcode
84
85
. Example(1 << 2) below
86
87
88
[\ref lld_dosanddont_namingConvention "Previous page"] [\ref lld_dosanddont_documentation "Next page"]
89
90
\page lld_dosanddont_documentation Documentation
91
92
\section theSame Avoid 'the same' in documentation
93
<SPAN style="font-family:courier;font-size:small;">[link: \ref theSame]</SPAN>
94
95
Correct:
96
\code
97
boolean channelInterrupt; // \brief Determines the setting of the channel transfer interrupt flag and interrupt service request
98
\endcode
99
100
Wrong(<SPAN style="font-family:courier"><SPAN style="color:red">for the same</SPAN></SPAN>):
101
\code
102
boolean channelInterrupt; // \brief Determines the setting of the channel transfer interrupt flag and interrupt service request for the same
103
\endcode
104
105
106
107
[\ref lld_dosanddont_codingRules "Previous page"] [\ref lld_dosanddont_optimisation "Next page"]
108
109
110
*/
doc
doxygen
common
dosAndDont
lld_dosanddont.c
Generated by
1.8.4