iLLD_TC27xD  1.0
lld_codingRules.c
Go to the documentation of this file.
1 /**
2 \page lld_codingRules Coding rules
3 
4 -# \subpage lld_codingRules_codeFormating
5 -# \subpage lld_codingRules_general
6 -# \subpage lld_codingRules_codeChecking
7 -# \subpage lld_dosanddont_commonApis
8 -# \subpage lld_dosanddont_if
9 
10 [\ref lld_conventions "Previous page"] [\ref lld_codingRules_codeFormating "Next page"]
11 
12 \page lld_codingRules_general General rules
13 
14  \section curlyBraces Always use curly braces for if, for, while, do, ...
15 
16  Correct:
17  \code
18  static void IfxDma_Dma_configureTransactionSet(Ifx_DMA_CH* channel, IfxDma_Dma_ChannelConfig* config)
19  {
20  ...
21  if( config->shadowControl != 0)
22  {
23  channel->SHADR.U = config->shadowAddress;
24  }
25  }
26  \endcode
27 
28  Wrong:
29  \code
30  static void IfxDma_Dma_configureTransactionSet(Ifx_DMA_CH* channel, IfxDma_Dma_ChannelConfig* config)
31  {
32  ...
33  if( config->shadowControl != 0)
34  channel->SHADR.U = config->shadowAddress;
35  }
36  \endcode
37 
38 
39 
40 
41 [\ref lld_codingRules_codeFormating "Previous page"] [\ref lld_codingRules_codeChecking "Next page"]
42 
43 
44 
45 
46 \page lld_codingRules_codeChecking Code checking
47  \section parameterCheck Parameter check
48  In case the parameter can not be checked by the compiler for valid values, it shall be checked using the assertion function.
49 
50  Example:
51  \code
52  IFX_INLINE void IfxDma_setChannelTransaction(Ifx_DMA* dma,IfxDma_ChannelId channelId, uint32 transferCount)
53  {
54  IFX_ASSERT(VERBOSE_LEVEL_ERROR,transferCount < 32);
55  }
56  \endcode
57 
58 
59 
60 
61 
62 [\ref lld_codingRules_general "Previous page"] [\ref lld_dosanddont_commonApis "Next page"]
63 
64 
65 
66 
67  */