# CLAPROMCRC Module

The CLAPROMCRC is a non-intrusive CRC engine for the CLA Program ROM. It calculates the CRC-32 value of a configurable block of memory of the CLA Program ROM and can be used to validate the contents of the CLA Program ROM. The CLAPROMCRC driver provides functions to use the CLAPROMCRC and can be used from either the CLA or the C28x. The driver can be used to configure the start address of the CRC and the block size of the CRC in 1kB increments. It also provides functions to start, halt and check the status and result of the CLAPROMCRC calculation.

group `clapromcrc_api`

  Enums

  enum `CLAPROMCRC_EmulationMode`

    Values that can be passed to CLAPROMCRC_setEmulationMode().

    Values:

    enumerator `CLAPROMCRC_MODE_SOFT` = 0x00

      Soft Mode.

    enumerator `CLAPROMCRC_MODE_FREE` = 0x10

      Free Mode.

  enum `CLAPROMCRC_IntFlag`

    Values that can be passed to CLAPROMCRC_getInterruptStatus() and CLAPROMCRC_clearInterruptFlag().

    Values:

    enumerator `CLAPROMCRC_INT_FLG` = 0x01

      Global Interrupt Flag.

    enumerator `CLAPROMCRC_CRCDONE_FLG` = 0x02

      CRCDONE Interrupt Flag.

  Functions

  void `CLAPROMCRC_setEmulationMode`(uint32_t base, CLAPROMCRC_EmulationMode emulationMode)

    Sets the Emulation Mode.

    This function sets the emulation mode which controls the behaviour of the CRC32 calculation during emulation. CLAPROMCRC_MODE_SOFT mode will stop the CLAPROMCRC module on CLA debug suspend. CLAPROMCRC_MODE_FREE mode sets the CLAPROMCRC module so that the CRC32 calculation is not affected by debug halt of the CLA.

    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

      - `emulationMode`: is soft mode or free mode. It can take values CLAPROMCRC_MODE_SOFT or CLAPROMCRC_MODE_FREE.

    Return

      None.

  void `CLAPROMCRC_start`(uint32_t base)

    Starts the CRC32 calculation.

    This function starts CRC32 calculation.

    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

    Return

      None.

  void `CLAPROMCRC_halt`(uint32_t base)

    Halts the CRC32 calculations.

    This function halts the CRC32 calculation.

    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

    Return

      None.

  void `CLAPROMCRC_resume`(uint32_t base)

    Resumes the CRC32 calculations.

    This function resumes the CRC32 calculation.

    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

    Return

      None.

  void `CLAPROMCRC_setBlockSize`(uint32_t base, uint16_t blockSize)

    Sets the Block Size of the CRC32 calculation.

    This function sets the block size for the CRC32 calculation.

    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

      - `blockSize`: is the number of KB. The maximum value is 128 KB

    Return

      None.

  void `CLAPROMCRC_setStartAddress`(uint32_t base, uint32_t startAddress)

    Sets the Start Address of the CRC32 calculation.

    This function sets the start address with

    startAddress for the CRC32 calculation.
    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

      - `startAddress`: defines the starting point for the CRC32 calculation. A startAddress corresponding to the CLA memory map is to be used. startAddress has to be a 1KB aligned address. If it is not aligned, then the LSB bits are ignored to get a 1KB aligned address.

    Return

      None.

  void `CLAPROMCRC_setSeed`(uint32_t base, uint32_t seed)

    Sets the Seed of the CRC32 calculation.

    This function sets the seed with

    Seed for CRC32 calculation.
    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

      - `seed`: is the initial value of the CRC32 calculation.

    Return

      None.

  uint16_t `CLAPROMCRC_getCurrentAddress`(uint32_t base)

    Gets the Current Address of the CRC32 calculation.

    This function returns the current CLA memory map address of the data fetch unit of the CLAPROMCRC.

    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

    Return

      Returns the current address.

  bool `CLAPROMCRC_checkStatus`(uint32_t base)

    Check the status of the CRC32 calculation.

    This function returns the status for the CLAPROMCRC. Return value of true means PASS. Return value of false means FAIL. The comparison is enabled after CRC calculation is completed.

    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

    Return

      Returns true (PASS) or false (FAIL) as the status of the CRC32 calculation.

  bool `CLAPROMCRC_getRunStatus`(uint32_t base)

    Gets the Run Status of the CRC32 calculation.

    This function returns the run status for the CLAPROMCRC with the base address passed in the

    base parameter. Return value of false means IDLE. Return value of true means ACTIVE.
    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

    Return

      Returns true (Active) or false (Idle) as the run status of the CRC32 calculation.

  uint32_t `CLAPROMCRC_getResult`(uint32_t base)

    Gets the Result of the CRC32 calculation.

    This function returns the result of the CRC32 calculation.

    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

    Return

      Returns the result of the CRC32 calculation.

  void `CLAPROMCRC_setGoldenCRC`(uint32_t base, uint32_t goldenCRC)

    Sets the Golden CRC of the CRC32 calculation.

    This function sets the GOLDENCRC register with

    goldenCRC for the CLAPROMCRC module. The value of GOLDENCRC is compared with CRCRESULT to determine a PASS or FAIL.
    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

      - `goldenCRC`: is value which will be compared with CRCRESULT.

    Return

      None.

  void `CLAPROMCRC_disableDoneInterrupt`(uint32_t base)

    Disables Interrupts the CRC32 calculations.

    This function disables interrupts for the CRC32 calculation.

    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

    Return

      None.

  void `CLAPROMCRC_enableDoneInterrupt`(uint32_t base)

    Enables Interrupts the CRC32 calculations.

    This function enables interrupts for the CRC32 calculation.

    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

    Return

      None.

  bool `CLAPROMCRC_getInterruptStatus`(uint32_t base, CLAPROMCRC_IntFlag intFlag)

    Gets the Interrupt Status of of flag.

    This function returns the interrupt status for

    intFlag. Return value of false means no interrupt generated. Return value of true means interrupt was generated.
    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

      - `intFlag`: is a CLAPROMCRC_IntFlag type and is either CLAPROMCRC_INT_FLG or CLAPROMCRC_CRCDONE_FLG.

    Return

      Returns the interrupt status. True means interrupt was generated and false means no interrupt was generated.

  void `CLAPROMCRC_clearInterruptFlag`(uint32_t base, CLAPROMCRC_IntFlag intFlag)

    Clears the Global Interrupt Flag of the CLAPROMCRC.

    This function clears the interrupt flag for the CLAPROMCRC with the base address passed in the

    base parameter.
    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

      - `intFlag`: is either CLAPROMCRC_INT_FLG or CLAPROMCRC_CRCDONE_FLG.

    Return

      None.

  void `CLAPROMCRC_forceDoneFlag`(uint32_t base)

    Force the CRCDONE Interrupt Flag of the CLAPROMCRC.

    This function forces the CRCDONE interrupt flag for the CLAPROMCRC with the base address passed in the

    base parameter.
    Parameters

      - `base`: is the base address of the CLAPROMCRC module.

    Return

      None.

The code for this module is contained in driverlib/clapromcrc.c, with driverlib/clapromcrc.h containing the API declarations for use by applications.