The following sequence can be used to initialize a CRC unit to calculate the check value for the corresponding CPU interface.
- Initialize the CRC unit by writing a 1 to the
corresponding CRC_INIT field in the CRC_GLOBAL_CTRL register.
- Configure the seed value (if required) using
CRC_SEED register (CRC_EN can be 0 for when modifying the CRC_SEED
register).
- Configure the CRC_QUALIFIER register if
additional qualification from EBC units is required; If not additional
qualification is not required, set the CRC_QUALIFIER register to 0.
- Enable the CRC unit by setting the CRC_EN to 1 at
the beginning of the software for which the CRC calculation is done.
- Disable the CRC unit by setting the CRC_EN to 0
at the end of the software for which the CRC calculation is done.
- Read the CRC_CURRENT register to record the
computed CRC. This check value can be compared with previous check values to
make sure no changes have occurred.
- Repeat steps 1-7 periodically as needed.
Note: Sufficient NOP's must be added immediately
after the CRC submodule is enabled to make sure the pipeline contains predictable
code as soon as the CRC is enabled. Similarly, sufficient NOP's must be added before
the CRC submodule is disabled. Disabling the CRC write access takes a few cycles,
therefore there must be predictable code in the pipeline stages until the write
takes place.