# BGCRC Module

The BackGround CRC (BGCRC) API provides a set of functions for configuring the BGCRC module. It provides various functions to configure the memory blocks to be checked, the mode of operation, interrupt/NMI configuration and to start, resume and halt the BGCRC omputation

group `bgcrc_api`

  This module is used for configuring BGCRC.

  Defines

  `BGCRC_NMI_ENABLE` 0x5U

    Generate NMI on memory check failure.

    Values that can be passed to BGCRC_setConfig() as the nmiConfig parameter

  `BGCRC_NMI_DISABLE` 0xAU

    failure

    Do not generate NMI on memory check

  `BGCRC_EMUCTRL_SOFT` 0x00U

    Values that can be passed to BGCRC_setConfig() as the emuCtrl parameter.

    CRC module and CRC watchdog stops immediately on DEBUG SUSPEND

  `BGCRC_EMUCTRL_FREE` 0x10U

    not affected by DEBUG HALT

    CRC calculation and CRC watchdog is

  `BGCRC_SCRUB_MODE` 0xAU

    Values that can be passed to BGCRC_setRegion() as the mode parameter.

    CRC of data is not compared with the golden CRC. Error check is done using the ECC/Parity logic.

  `BGCRC_CRC_MODE` 0x5U

    CRC value is compared with golden CRC at the end in addition to the data correctness check by ECC/Parity logic

  `BGCRC_GLOBAL_INT` 0x01U

    Global Interrupt.

    Values that can be passed to all interrupt/NMI functions as intflags or nmiflags parameter

  `BGCRC_TEST_DONE` 0x02U

    Test done interrupt.

  `BGCRC_CRC_FAIL` 0x04U

    CRC Fail Interrupt/NMI.

  `BGCRC_UNCORR_ERR` 0x08U

    Uncorrectable Error Interrupt/NMI.

  `BGCRC_CORR_ERR` 0x10U

    Correctable Error Interrupt/NMI.

  `BGCRC_WD_UNDERFLOW` 0x20U

    Watchdog Underflow Error Interrupt/NMI.

  `BGCRC_WD_OVERFLOW` 0x40U

    Watchdog Overflow Error Interrupt/NMI.

  `BGCRC_ALL_ERROR_FLAGS` (BGCRC_CRC_FAIL | BGCRC_UNCORR_ERR

  | \

  BGCRC_CORR_ERR | BGCRC_WD_UNDERFLOW

  | \

  BGCRC_WD_OVERFLOW)
  `BGCRC_SIZE_BYTES_0` 0U

    Values that can be passed to BGCRC_setRegion as the blockSize parameter For example, to configure a region of size 2.5KB, set blockSize as BGCRC_SIZE_KBYTES(2) + BGCRC_SIZE_BYTES_512

  `BGCRC_SIZE_BYTES_256` 1U
  `BGCRC_SIZE_BYTES_512` 2U
  `BGCRC_SIZE_BYTES_768` 3U
  `BGCRC_SIZE_KBYTES`(x) (4U * (x))
  `BGCRC_ACTIVE` 0x80000000U

    Values returned by the function BGCRC_getRunStatus.

  `BGCRC_IDLE` 0x00000000U
  `BGCRC_REG_EN` 0x00000001U

    Values that can be passed to BGCRC_lockRegister(), BGCRC_unlockRegister() and BGCRC_commitLockRegister() as the regs parameter

  `BGCRC_REG_CTRL1` 0x00000002U
  `BGCRC_REG_CTRL2` 0x00000004U
  `BGCRC_REG_START_ADDR` 0x00000008U
  `BGCRC_REG_SEED` 0x00000010U
  `BGCRC_REG_GOLDEN` 0x00000080U
  `BGCRC_REG_WD_CFG` 0x00004000U
  `BGCRC_REG_WD_MIN` 0x00008000U
  `BGCRC_REG_WD_MAX` 0x00010000U
  `BGCRC_REG_NMIFRC` 0x00800000U
  `BGCRC_REG_INTEN` 0x04000000U
  `BGCRC_REG_INTFRC` 0x20000000U
  `BGCRC_REG_ALL` 0xFFFFFFFFU
  `BGCRC_WD_ENABLE` 0x5UL

    Values that are used by the BGCRC APIs.

  `BGCRC_WD_DISABLE` 0xAUL
  `BGCRC_START_KEY` 0xAUL
  `BGCRC_HALT_KEY` 0xAUL

  Functions

  void `BGCRC_setConfig`(uint32_t base, uint32_t nmiConfig, uint32_t emuCtrl)

    Sets the NMI and emulation control configurations

    This function configures the NMI and emulation control configurations for the BGCRC module.

    Parameters

      - `base`: is the BGCRC module base address.

      - `nmiConfig`: specifies whether NMI needs to be enabled or not for memory check failure

      - `emuCtrl`: specifies the behaviour of CRC during emulation

    nmiConfig can take values BGCRC_NMI_ENABLE or BGCRC_NMI_DISABLE. NMI is enabled by default for the memory check failures.

    emuCtrl can take values BGCRC_EMUCTRL_FREE or BGCRC_EMUCTRL_SOFT.

    Return

      None.

  void `BGCRC_enableWatchdog`(uint32_t base)

    Enables the watchdog

    This function enables the BGCRC watchdog timer. The counter is started when the BGCRC test starts

    Parameters

      - `base`: is the BGCRC module base address.

    Note

      The watchDog window can be configured using the function BGCRC_setWatchdogWindow()

    Return

      None.

  void `BGCRC_disableWatchdog`(uint32_t base)

    Disables the watchdog

    This function disables the BGCRC watchdog.

    Parameters

      - `base`: is the BGCRC module base address.

    Return

      None.

  void `BGCRC_setWatchdogWindow`(uint32_t base, uint32_t min, uint32_t max)

    Configures the BGCRC watchdog window

    This function configures the BGCRC windowed watchdog

    Parameters

      - `base`: is the BGCRC module base address.

      - `min`: is minimum value configuration for the windowed watchdog

      - `max`: is maximum value configuration for the windowed watchdog

    Return

      None.

  void `BGCRC_setRegion`(uint32_t base, uint32_t startAddr, uint32_t blockSize, uint32_t mode)

    Configures the memory region for check

    This function configures the memory region to be checked

    Parameters

      - `base`: is the BGCRC module base address.

      - `startAddr`: is the start address of the block

      - `blockSize`: is the size of the block

      - `mode`: is the BGCRC test mode

    blockSize can take values BGCRC_SIZE_KBYTES(x) and/or BGCRC_SIZE_BYTES_x. For example, to configure a region of size 2.5KB, set blockSize as BGCRC_SIZE_KBYTES(2) + BGCRC_SIZE_BYTES_512

    mode can take values BGCRC_SCRUB_MODE or BGCRC_CRC_MODE. In Scrub mode, CRC of data is not compared with the golden CRC. Error check is done using the ECC/Parity logic. In CRC mode, value is compared with golden CRC at the end in addition to the data correctness check by ECC/Parity logic.

    Return

      None.

  uint32_t `BGCRC_getWatchdogCounterValue`(uint32_t base)

    Gets the BGCRC watchdog counter value

    This function returns the BGCRC watchdog counter value

    Parameters

      - `base`: is the BGCRC module base address.

    Return

      Watchdog counter value.

  void `BGCRC_enableInterrupt`(uint32_t base, uint32_t intFlags)

    Enables individual BGCRC interrupt sources

    This function enables the indicated BGCRC interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt, disabled sources have no effect on the processor.

    Parameters

      - `base`: is the BGCRC module base address.

      - `intFlags`: is the bit mask of the interrupt sources to be disabled.

    The intFlags parameter is the logical OR of any of the following:

    - BGCRC_TEST_DONE - Test done interrupt

    - BGCRC_CRC_FAIL - CRC Fail Interrupt

    - BGCRC_UNCORR_ERR - Uncorrectable Error Interrupt

    - BGCRC_CORR_ERR - Correctable Error Interrupt

    - BGCRC_WD_UNDERFLOW - Watchdog Underflow Error Interrupt

    - BGCRC_WD_OVERFLOW - Watchdog Overflow Error Interrupt

    Return

      None

  void `BGCRC_disableInterrupt`(uint32_t base, uint32_t intFlags)

    Disables individual BGCRC interrupt sources.

    This function disables the indicated BGCRC interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt disabled sources have no effect on the processor.

    Parameters

      - `base`: is the BGCRC module base address.

      - `intFlags`: is the bit mask of the interrupt sources to be disabled.

    The intFlags parameter has the same definition as the intFlags parameter to BGCRC_enableInterrupt().

    Return

      None.

  uint32_t `BGCRC_getInterruptStatus`(uint32_t base)

    Gets the current BGCRC interrupt status

    This function returns the status of the BGCRC interrupts

    Parameters

      - `base`: is the BGCRC module base address

    - BGCRC_GLOBAL_INT - Global Interrupt

    - BGCRC_TEST_DONE - Test done interrupt

    - BGCRC_CRC_FAIL - CRC Fail Interrupt

    - BGCRC_UNCORR_ERR - Uncorrectable Error Interrupt

    - BGCRC_CORR_ERR - Correctable Error Interrupt

    - BGCRC_WD_UNDERFLOW - Watchdog Underflow Error Interrupt

    - BGCRC_WD_OVERFLOW - Watchdog Overflow Error Interrupt

    Return

      The current interrupt status, which is a logical OR of any of the following:

  void `BGCRC_clearInterruptStatus`(uint32_t base, uint32_t intFlags)

    Clears the BGCRC interrupt sources

    The specified BGCRC interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep the interrupt from being triggered again immediately upon exit.

    Parameters

      - `base`: is the BGCRC module base address

      - `intFlags`: is a bit mask of the interrupt sources to be cleared.

    The intFlags parameter has the same definition as the intFlags parameter to BGCRC_getInterruptStatus().

    Return

      None.

  void `BGCRC_forceInterrupt`(uint32_t base, uint32_t intFlags)

    Force the BGCRC interrupt flag

    This function forces the specified interrupt flags

    Parameters

      - `base`: is the BGCRC module base address

      - `intFlags`: is a bit mask of the interrupt flags to be forced.

    The intFlags parameter has the same definition as the intFlags parameter to BGCRC_enableInterrupt().

    Return

      None.

  uint32_t `BGCRC_getNMIStatus`(uint32_t base)

    Gets the current BGCRC NMI status

    This function returns the status of the BGCRC NMI flags

    Parameters

      - `base`: is the BGCRC module base address

    - BGCRC_CRC_FAIL - CRC Fail NMI

    - BGCRC_UNCORR_ERR - Uncorrectable Error NMI

    - BGCRC_CORR_ERR - Correctable Error NMI

    - BGCRC_WD_UNDERFLOW - Watchdog Underflow Error NMI

    - BGCRC_WD_OVERFLOW - Watchdog Overflow Error NMI

    Return

      The current NMI status, which is a logical OR of any of the following:

  void `BGCRC_clearNMIStatus`(uint32_t base, uint32_t nmiFlags)

    Clears the BGCRC NMI sources

    The specified BGCRC NMI sources are cleared, so that they no longer assert. This function must be called in the NMI handler to keep the NMI from being triggered again immediately upon exit.

    Parameters

      - `base`: is the BGCRC module base address

      - `nmiFlags`: is a bit mask of the NMI sources to be cleared.

    The nmiFlags parameter has the same definition as the nmiFlags parameter to BGCRC_getNMIStatus().

    Return

      None.

  void `BGCRC_forceNMI`(uint32_t base, uint32_t nmiFlags)

    Force the BGCRC NMI flag

    This function forces the specified interrupt flags

    Parameters

      - `base`: is the BGCRC module base address

      - `nmiFlags`: is a bit mask of the NMI flags to be forced.

    The nmiFlags parameter has the same definition as the nmiFlags parameter to BGCRC_getNMIStatus().

    Return

      None.

  void `BGCRC_setGoldenCRCValue`(uint32_t base, uint32_t crcVal)

    Sets the golden CRC value

    This function sets the golden CRC value of the memory block being tested. If run in CRC mode, the calculated CRC value is compared with golden CRC and status is updated.

    Parameters

      - `base`: is the BGCRC module base address

      - `crcVal`: is a golden CRC value to be programmed

    Return

      None.

  void `BGCRC_start`(uint32_t base)

    Starts the module operation

    This function starts the module operation. Calling this function during the CRC calculation will reset and re-start the CRC calculation. This also resets the watchdog timer.

    Parameters

      - `base`: is the BGCRC module base address

    Return

      None.

  void `BGCRC_halt`(uint32_t base)

    Halts the module operation

    This function halts the module operation. This function does not stall the watchdog timer.

    Parameters

      - `base`: is the BGCRC module base address

    Return

      None.

  void `BGCRC_resume`(uint32_t base)

    Resumes the module operation

    This function resumes the module operation. The CRC calculation will continue/resume from where it was halted

    Parameters

      - `base`: is the BGCRC module base address

    Return

      None.

  uint32_t `BGCRC_getRunStatus`(uint32_t base)

    Gets the running status of the module

    This function returns whether the module is in ACTIVE or IDLE state

    Parameters

      - `base`: is the BGCRC module base address

    Return

      BGCRC_ACTIVE if CRC module is active, BGCRC_IDLE if CRC module is idle

  void `BGCRC_setSeedValue`(uint32_t base, uint32_t seed)

    Sets the seed value for CRC calculations

    This function sets the seed value for the CRC calculations

    Parameters

      - `base`: is the BGCRC module base address

      - `seed`: is the seed value to be set

    Return

      None

  uint32_t `BGCRC_getResult`(uint32_t base)

    Gets the calculated CRC value

    This function returns the calculated CRC value

    Parameters

      - `base`: is the BGCRC module base address

    Return

      32-bit CRC result

  uint32_t `BGCRC_getCurrentAddress`(uint32_t base)

    Gets the current address

    This function returns the current address from where the data is fetched

    Parameters

      - `base`: is the BGCRC module base address

    Return

      32-bit address

  void `BGCRC_lockRegister`(uint32_t base, uint32_t regs)

    Locks the register configuration

    This function locks the register configuration. The register once locked, cannot be updated until the lock is removed

    Parameters

      - `base`: is the BGCRC module base address

      - `regs`: is the configuration registers to be locked

    The regs parameter is the logical OR of any of the following:

    - BGCRC_REG_EN

    - BGCRC_REG_CTRL1

    - BGCRC_REG_CTRL2

    - BGCRC_REG_START_ADDR

    - BGCRC_REG_SEED

    - BGCRC_REG_GOLDEN

    - BGCRC_REG_WD_CFG

    - BGCRC_REG_WD_MIN

    - BGCRC_REG_WD_MAX

    - BGCRC_REG_NMIFRC

    - BGCRC_REG_INTEN

    - BGCRC_REG_INTFRC

    - BGCRC_REG_ALL

    Return

      None

  void `BGCRC_unlockRegister`(uint32_t base, uint32_t regs)

    Unlocks the register configuration

    This function unlocks the register configuration.

    Parameters

      - `base`: is the BGCRC module base address

      - `regs`: is the configuration registers to be unlocked

    The regs parameter has the same definition as the regs parameter to BGCRC_lockRegister().

    Return

      None

  void `BGCRC_commitRegisterLock`(uint32_t base, uint32_t regs)

    Commits the register configuration

    This function commits the register configuration. Once configuration is committed, only reset can change the configuration.

    Parameters

      - `base`: is the BGCRC module base address

      - `regs`: is the configuration registers to be unlocked

    The regs parameter has the same definition as the regs parameter to BGCRC_lockRegister().

    Return

      None

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