iLLD_TC27xC  1.0
lld_dosanddont_optimisation.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 \page lld_dosanddont_optimisation Optimisation
8  \section moduleRegisterAccessByArray Module register access (array)
9  <SPAN style="font-family:courier;font-size:small;">[link: \ref moduleRegisterAccessByArray]</SPAN>
10 
11  Code should be optimised by using array index instead of if..else.
12 
13  Correct:
14  \code
15  dma->BLK[index]. ...
16  \endcode
17 
18  Wrong:
19  \code
20  if( moveEngine == IfxDma_MoveEngine_1 )
21  {
22  dma->BLK1. ...
23  }
24  else
25  {
26  dma->BLK0. ...
27  }
28  \endcode
29 
30  In case the array is not available in the module structure definition, please request for implementation. The reasons could be:
31  - it has been forgotten to build the array during the register header file generation
32  - the module address map does not currently supports the array access
33 
34  \section moduleRegisterAccess Module register access (read modify write)
35  <SPAN style="font-family:courier;font-size:small;">[link: \ref moduleRegisterAccess]</SPAN>
36 
37  Runtime optimisation should be done by utilizing a local variable when more than one bitfield of a register is to be modified.
38 
39  Correct:
40  \code
41  IFX_INLINE void IfxDma_setChannelSourceIncrementStep(Ifx_DMA* dma,IfxDma_ChannelId channelId, IfxDma_ChannelIncrementStep incStep, IfxDma_ChannelIncrementDirection direction, IfxDma_ChannelIncrementCircular size)
42  {
43  Ifx_DMA_BLK_ME_ADICR adicr;
44  adicr.U = dma->CH[channelId].ADICR.U;
45  adicr.B.SMF = incStep;
46  adicr.B.INCS = direction;
47  adicr.B.CBLS = size;
48  dma->CH[channelId].ADICR.U = adicr.U;
49  }
50  \endcode
51 
52  Wrong:
53  \code
54  IFX_INLINE void IfxDma_setChannelSourceIncrementStep(Ifx_DMA* dma,IfxDma_ChannelId channelId, IfxDma_ChannelIncrementStep incStep, IfxDma_ChannelIncrementDirection direction, IfxDma_ChannelIncrementCircular size)
55  {
56  dma->CH[channelId].ADICR.B.SMF = incStep;
57  dma->CH[channelId].ADICR.B.INCS = direction;
58  dma->CH[channelId].ADICR.B.CBLS = size;
59  }
60  \endcode
61 
62 [\ref lld_dosanddont_documentation "Previous page"] [\ref lld_dosanddont_enumUsage "Next page"]
63 
64 
65 
66  */