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