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