Module register access (array)
[link: Module register access (array)]
Code should be optimised by using array index instead of if..else.
Correct:
Wrong:
{
dma->BLK1. ...
}
else
{
dma->BLK0. ...
}
In case the array is not available in the module structure definition, please request for implementation. The reasons could be:
- it has been forgotten to build the array during the register header file generation
- the module address map does not currently supports the array access
Module register access (read modify write)
[link: Module register access (read modify write)]
Runtime optimisation should be done by utilizing a local variable when more than one bitfield of a register is to be modified.
Correct:
{
Ifx_DMA_BLK_ME_ADICR adicr;
adicr.U = dma->CH[channelId].ADICR.U;
adicr.B.SMF = incStep;
adicr.B.INCS = direction;
adicr.B.CBLS = size;
dma->CH[channelId].ADICR.U = adicr.U;
}
Wrong:
{
dma->CH[channelId].ADICR.B.SMF = incStep;
dma->CH[channelId].ADICR.B.INCS = direction;
dma->CH[channelId].ADICR.B.CBLS = size;
}
[Previous page] [Next page]