MEMCFG Module

The MemCfg module provides an API to configure the device’s Memory Control Module. The functions that are provided fall into three main categories: RAM section configuration, access violation status and interrupts, and memory error status an interrupts. The RAM section configuration functions can initialize RAM, configure access protection settings, and configure section ownership. The access violation and memory error categories contain functions that can return violation and error status and address information as well as configure interrupts that can be generated as a result of these issues.

group memcfg_api

This module is used for CM SRAM configurations.

Defines

MEMCFG_KEY 0xA5A50000U

Key for error registers.

MEMCFG_SECT_TYPE_MASK 0xFF000000U

Mask for section type.

MEMCFG_SECT_TYPE_CX 0x00000000U

Mask for Cx memory.

MEMCFG_SECT_TYPE_CMMSGX 0x01000000U

Mask for CMMSGRAM.

MEMCFG_SECT_TYPE_SX 0x02000000U

Mask for S/Ex memory.

MEMCFG_SECT_TYPE_ROM 0x03000000U

Mask for ROM memory.

MEMCFG_SECT_TYPE_PERIMEM 0x04000000U

memory(EMAC & EtherCAT)

Mask for peripheral

MEMCFG_SECT_NUM_MASK 0x00FFFFFFU

section number

Mask for selecting the

MEMCFG_TESTMODE_M MEMCFG_CXTEST_TEST_C0_M

test mode

Mask for

MEMCFG_SECT_C0 0x00000001U

C0 RAM.

MEMCFG_SECT_C1 0x00000002U

C1 RAM.

MEMCFG_SECT_CX_ALL 0x00000003U

All Cx RAM.

MEMCFG_SECT_CMTOCPU1MSGRAM0 0x01000001U

CM TO CPU1 MSG RAM0.

MEMCFG_SECT_CMTOCPU1MSGRAM1 0x01000002U

CM TO CPU1 MSG RAM1.

MEMCFG_SECT_CMTOCPU2MSGRAM0 0x01000004U

CM TO CPU2 MSG RAM0.

MEMCFG_SECT_CMTOCPU2MSGRAM1 0x01000008U

CM TO CPU2 MSG RAM1.

MEMCFG_SECT_CMMSGX_ALL 0x0100000FU

All CM MSG RAMs.

MEMCFG_SECT_S0 0x02000001U

S0 RAM.

MEMCFG_SECT_S1 0x02000002U

S1 RAM.

MEMCFG_SECT_S2 0x02000004U

S2 RAM.

MEMCFG_SECT_S3 0x02000008U

S3 RAM.

MEMCFG_SECT_E0 0x02000010U

E0 RAM.

MEMCFG_SECT_SX_ALL 0x0200001FU

All Sx and Ex RAM.

MEMCFG_SECT_ROM 0x03000001U

ROM Section.

MEMCFG_SECT_PERIMEM_EMAC 0x04000002U

EMAC memory.

MEMCFG_SECT_PERIMEM_ETHERCAT 0x04000020U

EtherCAT memory.

MEMCFG_SECT_PERIMEM_ALL 0x04000001U

All peripheral memories.

MEMCFG_SECT_ALL 0xFFFFFFFFU

All memory Sections.

MEMCFG_UCERR_M4READ 0x00000001U

Uncorr M4 Read Error.

MEMCFG_UCERR_M4WRITE 0x00000002U

Uncorr M4 Write Error.

MEMCFG_UCERR_EMACREAD 0x00000004U

Uncorr EMAC Read Error.

MEMCFG_UCERR_UDMAREAD 0x00000010U

Uncorr uDMA Read Error.

MEMCFG_UCERR_UDMAWRITE 0x00000020U

Uncorr uDMA Write Error.

MEMCFG_UCERR_ETHERCATMEMREAD 0x00000040U

Error.

Uncorr ECAT Mem Read

MEMCFG_UCERR_EMACMEMREAD 0x00000080U

Error.

Uncorr EMAC Mem Read

MEMCFG_CERR_M4READ 0x00000001U

Corr M4 Read Error.

MEMCFG_CERR_M4WRITE 0x00000002U

Corr M4 Write Error.

MEMCFG_CERR_EMACREAD 0x00000004U

Corr EMAC Read Error.

MEMCFG_CERR_UDMAREAD 0x00000010U

Corr uDMA Read Error.

MEMCFG_CERR_UDMAWRITE 0x00000020U

Corr uDMA Write Error.

MEMCFG_DIAGERR_UNCORR_READ 0x00000001U

Diag Uncorr Read Error.

MEMCFG_DIAGERR_UNCORR_WRITE 0x00000002U

Diag Uncorr Write Error.

MEMCFG_DIAGERR_CORR_READ 0x00000004U

Diag Corr Read Error.

MEMCFG_DIAGERR_CORR_WRITE 0x00000008U

Diag Corr Write Error.

MEMCFG_BUSMASTER_M4 MEMCFG_BUSFAULTFLG_M4BUSFAULT
MEMCFG_BUSMASTER_UDMA MEMCFG_BUSFAULTFLG_UDMABUSFAULT
MEMCFG_BUSMASTER_EMAC MEMCFG_BUSFAULTFLG_EMACBUSFAULT
MEMCFG_BUSMATER_ALL (MEMCFG_BUSMASTER_M4

| \

MEMCFG_BUSMASTER_UDMA

| \

MEMCFG_BUSMASTER_EMAC)
MEMCFG_BUSFAULT_M4 MEMCFG_BUSFAULTFLG_M4BUSFAULT
MEMCFG_BUSFAULT_UDMA MEMCFG_BUSFAULTFLG_UDMABUSFAULT
MEMCFG_BUSFAULT_EMAC MEMCFG_BUSFAULTFLG_EMACBUSFAULT

Enums

enum MemCfg_TestMode

Values that can be passed to MemCfg_setTestMode() as the testMode parameter.

Values:

enumerator MEMCFG_TEST_FUNCTIONAL = 0x0U

Functional mode.

enumerator MEMCFG_TEST_WRITE_DATA = 0x1U

Writes allowed to data only.

enumerator MEMCFG_TEST_WRITE_ECC = 0x2U

Writes allowed to ECC only.

enumerator MEMCFG_TEST_FUNC_DIAG = 0x3U

Diagnostic mode, similar to functional mode but NMI is not generated

Functions

uint32_t MemCfg_getUncorrErrorStatus(void)

Gets the current uncorrectable memory read/write error status.

Return

Returns the current error status, enumerated as a bit field of MEMCFG_UCERR_M4READ, MEMCFG_UCERR_M4WRITE, MEMCFG_UCERR_EMACREAD, MEMCFG_UCERR_UDMAREAD, MEMCFG_UCERR_UDMAWRITE, MEMCFG_UCERR_ETHERCATMEMREAD or/and MEMCFG_UCERR_EMACMEMREAD.

void MemCfg_forceUncorrErrorStatus(uint32_t stsFlags)

Sets the specified uncorrectable memory read/write error status flag.

This function sets the specified uncorrectable memory read/write error status flag. The

stsFlags parameter can take any of the following values: MEMCFG_UCERR_M4READ, MEMCFG_UCERR_M4WRITE, MEMCFG_UCERR_EMACREAD, MEMCFG_UCERR_UDMAREAD, MEMCFG_UCERR_UDMAWRITE, MEMCFG_UCERR_ETHERCATMEMREAD or/and MEMCFG_UCERR_EMACMEMREAD.
Parameters
  • stsFlags: is a bit mask of the error sources.

Return

None.

void MemCfg_clearUncorrErrorStatus(uint32_t stsFlags)

Clears uncorrectable memory read/write error flags.

This function clears the specified uncorrectable memory read/write error flags. The

stsFlags parameter can take any of the following values or their logical OR: MEMCFG_UCERR_M4READ, MEMCFG_UCERR_M4WRITE, MEMCFG_UCERR_EMACREAD, MEMCFG_UCERR_UDMAREAD, MEMCFG_UCERR_UDMAWRITE, MEMCFG_UCERR_ETHERCATMEMREAD or/and MEMCFG_UCERR_EMACMEMREAD.
Parameters
  • stsFlags: is a bit mask of the status flags to be cleared.

Return

None.

uint32_t MemCfg_getBusFaultStatus(uint32_t busMasters)

Gets the bus fault status of the selected bus master.

This function returns the bus fault status for selected bus masters.The parameter

busMasters can be logical OR of any of the following values: MEMCFG_BUSMASTER_M4, MEMCFG_BUSMASTER_UDMA, MEMCFG_BUSMASTER_EMAC, or MEMCFG_BUSMATER_ALL to get the status for all the bus masters.
Parameters
  • busMasters: specifies the bus master for which status is to be returned.

Return

Returns bus fault status of the bus masters. It can return below values or their logical OR’s:

  • MEMCFG_BUSFAULT_M4 - M4 access encountered busfault

  • MEMCFG_BUSFAULT_UDMA - uDMA access encountered busfault

  • MEMCFG_BUSFAULT_EMAC - EMAC access encountered busfault

void MemCfg_clearBusFaultStatus(uint32_t busMasters)

Clears the bus fault status of the selected bus master.

This function clears the bus fault status for selected bus masters. The

busMasters parameter can be logical OR of any of the following values: MEMCFG_BUSMASTER_M4, MEMCFG_BUSMASTER_UDMA, MEMCFG_BUSMASTER_EMAC, or MEMCFG_BUSMATER_ALL to clear the status for all the bus masters.
Parameters
  • busMasters: specifies the bus masters for which fault status is to be cleared.

Return

None

uint32_t MemCfg_getCorrErrorStatus(void)

Gets the current correctable memory read/write error status.

Return

Returns the current error status, enumerated as a bit field of MEMCFG_CERR_M4READ, MEMCFG_CERR_M4WRITE, MEMCFG_CERR_EMACREAD, MEMCFG_CERR_UDMAREAD, and/or MEMCFG_CERR_UDMAWRITE.

void MemCfg_forceCorrErrorStatus(uint32_t stsFlags)

Sets the specified correctable memory read/write error status flag.

This function sets the specified correctable memory read/write error status flag. The

stsFlags parameter can take any of the following values: MEMCFG_CERR_M4READ, MEMCFG_CERR_M4WRITE, MEMCFG_CERR_EMACREAD, MEMCFG_CERR_UDMAREAD, and/or MEMCFG_CERR_UDMAWRITE.
Parameters
  • stsFlags: is a bit mask of the error sources.

Return

None.

void MemCfg_clearCorrErrorStatus(uint32_t stsFlags)

Clears correctable memory read/write error flags.

This function clears the specified correctable memory read/write error flags. The

stsFlags parameter can take any of the following values: MEMCFG_CERR_M4READ, MEMCFG_CERR_M4WRITE, MEMCFG_CERR_EMACREAD, MEMCFG_CERR_UDMAREAD and/or MEMCFG_CERR_UDMAWRITE.
Parameters
  • stsFlags: is a bit mask of the status flags to be cleared.

Return

None.

uint32_t MemCfg_getCorrErrorCount(void)

Gets the correctable error count.

Return

Returns the number of correctable error which have occurred.

void MemCfg_setCorrErrorThreshold(uint32_t threshold)

Sets the correctable error threshold value.

This value sets the error-count threshold at which a correctable error interrupt is generated. That is when the error count register reaches the value specified by the

threshold parameter, an interrupt is generated if it is enabled.
Parameters
  • threshold: is the correctable error threshold.

Return

None.

void MemCfg_enableCorrErrorInterrupt(uint32_t intFlags)

Enables correctable error interrupt source.

This function enables the indicated correctable error interrupt source. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. The param

intFlags can take the value MEMCFG_CERR_M4READ only. Other values are reserved.
Parameters
  • intFlags: is a bit mask of the interrupt sources to be enabled.

Note

Note that only correctable errors may generate interrupts.

Return

None.

void MemCfg_disableCorrErrorInterrupt(uint32_t intFlags)

Disables individual correctable error interrupt sources.

This function disables the indicated correctable error interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. The param

intFlags can take the value MEMCFG_CERR_M4READ only. Other values are reserved.
Parameters
  • intFlags: is a bit mask of the interrupt sources to be disabled.

Note

Note that only correctable errors may generate interrupts.

Return

None.

uint32_t MemCfg_getCorrErrorInterruptStatus(void)

Gets the current RAM correctable error interrupt status.

Return

Returns the current error interrupt status. Will return a value of MEMCFG_CERR_M4READ if an interrupt has been generated. If not, the function will return 0.

void MemCfg_forceCorrErrorInterrupt(uint32_t intFlags)

Sets the correctable error interrupt status.

This function sets the correctable error interrupt flag. The parameter

intFlags can take the value MEMCFG_CERR_M4READ only. Other values are reserved.
Parameters
  • intFlags: is a bit mask of the interrupt sources to be set.

Note

Note that only correctable errors may generate interrupts.

Return

None.

void MemCfg_clearCorrErrorInterruptStatus(uint32_t intFlags)

Clears the correctable error interrupt status.

This function clears the correctable error interrupt flag.

Parameters
  • intFlags: is a bit mask of the interrupt sources to be cleared. Can take the value MEMCFG_CERR_M4READ only. Other values are reserved.

Note

Note that only correctable errors may generate interrupts.

Return

None.

uint32_t MemCfg_getDiagErrorStatus(void)

Gets the diagnostics corr/uncorr memory error status.

Return

Returns the diagnostics error status. It can return following values: MEMCFG_DIAGERR_UNCORR_READ, MEMCFG_DIAGERR_UNCORR_WRITE, MEMCFG_DIAGERR_CORR_READ and/or MEMCFG_DIAGERR_CORR_WRITE.

void MemCfg_clearDiagErrorStatus(uint32_t stsFlags)

Clears the diagnostics corr/uncorr memory error status.

This function clears the specified diagnostics corr/uncorr memory read/write error flags. The param

stsFlags can be any of the following values: MEMCFG_DIAGERR_UNCORR_READ, MEMCFG_DIAGERR_UNCORR_WRITE, MEMCFG_DIAGERR_CORR_READ and/or MEMCFG_DIAGERR_CORR_WRITE.
Parameters
  • stsFlags: is a bit mask of the status flags to be cleared.

Return

None.

uint32_t MemCfg_getDiagErrorAddress(void)

Gets address location of diagnostics corr/uncorr memory read/write error.

Return

Return address location of diagnostics corr/uncorr memory read/write error.

void MemCfg_lockConfig(uint32_t memSections)

Locks the write to the configuration of specified memory sections.

This function locks writes to the init and test configuration of RAM sections, test configuration of boot ROM & peripheral(EMAC & EtherCAT) memory sections. That means calling

MemCfg_setTestMode(), MemCfg_initSections() for a locked RAM section; MemCfg_setTestMode() for locked BootROM & peripheral memory will have no effect until MemCfg_unlockConfig() is called.
Parameters
  • memSections: is the logical OR of the sections to be configured.

The ramSections parameter is an OR of one of the following sets of indicators:

  • MEMCFG_SECT_C0 through MEMCFG_SECT_C1 or MEMCFG_SECT_CX_ALL,

  • MEMCFG_SECT_CMTOCPU1MSGRAM0 through MEMCFG_SECT_CMTOCPU2MSGRAM1 or MEMCFG_SECT_CMMSGX_ALL,

  • MEMCFG_SECT_S0 through MEMCFG_SECT_S3, MEMCFG_SECT_E0 or MEMCFG_SECT_SX_ALL,

  • MEMCFG_SECT_ROM,

  • MEMCFG_SECT_PERIMEM_ALL,

  • OR use MEMCFG_SECT_ALL to configure all possible sections.

Return

None.

void MemCfg_unlockConfig(uint32_t memSections)

Unlocks the writes to the configuration of specified memory sections.

This function unlocks writes to the init and test configuration of RAM sections, test configuration of boot ROM & peripheral(EMAC & EtherCAT) memory sections that has been locked using

MemCfg_lockConfig().
Parameters
  • memSections: is the logical OR of the sections to be configured.

The ramSections parameter is an OR of one of the following sets of indicators:

  • MEMCFG_SECT_C0 through MEMCFG_SECT_C1 or MEMCFG_SECT_CX_ALL,

  • MEMCFG_SECT_CMTOCPU1MSGRAM0 through MEMCFG_SECT_CMTOCPU2MSGRAM1 or MEMCFG_SECT_CMMSGX_ALL,

  • MEMCFG_SECT_S0 through MEMCFG_SECT_S3, MEMCFG_SECT_E0 or MEMCFG_SECT_SX_ALL,

  • MEMCFG_SECT_ROM,

  • MEMCFG_SECT_PERIMEM_ALL,

  • OR use MEMCFG_SECT_ALL to configure all possible sections.

See

MemCfg_lockConfig()

Return

None.

void MemCfg_setTestMode(uint32_t memSection, MemCfg_TestMode testMode)

Sets the test mode of the specified memory section.

This function sets the test mode configuration of the RAM section. The

testMode parameter can take one of the following values:
  • MEMCFG_TEST_FUNCTIONAL,

  • MEMCFG_TEST_WRITE_DATA,

  • MEMCFG_TEST_WRITE_ECC, or

  • MEMCFG_TEST_FUNC_DIAG

Parameters
  • memSection: is the memory section to be configured.

  • testMode: is the test mode selected.

The ramSection parameter is one of the following indicators:

  • MEMCFG_SECT_C0 through MEMCFG_SECT_C1 or MEMCFG_SECT_CX_ALL,

  • MEMCFG_SECT_CMTOCPU1MSGRAM0 through MEMCFG_SECT_CMTOCPU2MSGRAM1 or MEMCFG_SECT_CMMSGX_ALL,

  • MEMCFG_SECT_S0 through MEMCFG_SECT_S3, MEMCFG_SECT_E0 or MEMCFG_SECT_SX_ALL,

  • OR use MEMCFG_SECT_ROM.

Return

None.

void MemCfg_initSections(uint32_t ramSections)

Starts the initialization the specified RAM sections.

This function starts the initialization of the specified RAM sections. Use

MemCfg_getInitStatus() to check if the initialization is done.
Parameters
  • ramSections: is the logical OR of the sections to be initialized.

The ramSections parameter is an OR of one of the following sets of indicators:

  • MEMCFG_SECT_C0 through MEMCFG_SECT_C1 or MEMCFG_SECT_CX_ALL,

  • MEMCFG_SECT_CMTOCPU1MSGRAM0 through MEMCFG_SECT_CMTOCPU2MSGRAM1 or MEMCFG_SECT_CMMSGX_ALL,

  • MEMCFG_SECT_S0 through MEMCFG_SECT_S3, MEMCFG_SECT_E0 or MEMCFG_SECT_SX_ALL,

  • OR use MEMCFG_SECT_ALL to configure all possible sections.

Return

None.

bool MemCfg_getInitStatus(uint32_t ramSections)

Get the status of initialized RAM sections.

This function gets the initialization status of the RAM sections specified by the

ramSections parameter.
Parameters
  • ramSections: is the logical OR of the sections to be checked.

The ramSections parameter is an OR of one of the following sets of indicators:

  • MEMCFG_SECT_C0 through MEMCFG_SECT_C1 or MEMCFG_SECT_CX_ALL,

  • MEMCFG_SECT_CMTOCPU1MSGRAM0 through MEMCFG_SECT_CMTOCPU2MSGRAM1 or MEMCFG_SECT_CMMSGX_ALL,

  • MEMCFG_SECT_S0 through MEMCFG_SECT_S3, MEMCFG_SECT_E0 or MEMCFG_SECT_SX_ALL,

  • OR use MEMCFG_SECT_ALL to configure all possible sections.

Note

Use MemCfg_initSections() to start the initialization.

Return

Returns true if all the sections specified by ramSections have been initialized and false if not.

void MemCfg_forceMemError(uint32_t memTypes)

Forces parity error in the selected memory.

This function forces the parity error in the memories specified by the

memTypes parameter.
Parameters
  • memTypes: is the logical OR of the sections to be tested.

The memTypes parameter is an OR of one of the following sets of indicators:

  • MEMCFG_SECT_ROM,

  • MEMCFG_SECT_PERIMEM_EMAC,

  • MEMCFG_SECT_PERIMEM_ETHERCAT, or

  • OR use MEMCFG_SECT_ALL to get status of all possible sections.

Return

None.

void MemCfg_enablePeriMemTestMode(uint32_t memTypes)

Enables test mode for selected peripheral memories.

This function enables test mode for selected peripheral memories specified by the

memTypes parameter.
Parameters
  • memTypes: is the logical OR of the memories to be tested.

The memTypes parameter is an OR of one of the following sets of indicators:

  • MEMCFG_SECT_PERIMEM_EMAC,

  • MEMCFG_SECT_PERIMEM_ETHERCAT, or

  • MEMCFG_SECT_PERIMEM_ALL

Return

None.

void MemCfg_disablePeriMemTestMode(uint32_t memTypes)

Disables the test mode for selected peripheral memories.

This function disables test mode for selected peripheral memories specified by the

memTypes parameter.
Parameters
  • memTypes: is the logical OR of the memories to be tested.

The memTypes parameter is an OR of one of the following sets of indicators:

  • MEMCFG_SECT_PERIMEM_EMAC,

  • MEMCFG_SECT_PERIMEM_ETHERCAT, or

  • MEMCFG_SECT_PERIMEM_ALL

Return

None.

uint32_t MemCfg_getUncorrErrorAddress(uint32_t stsFlag)

Gets the address location of uncorrectable memory read/write error.

This function returns the address location of uncorrectable read/write error for the specified error. The parameter

stsFlag can be any of the MEMCFG_UCERR_M4READ, MEMCFG_UCERR_M4WRITE, MEMCFG_UCERR_EMACREAD, MEMCFG_UCERR_EMACWRITE,MEMCFG_UCERR_UDMAREAD, MEMCFG_UCERR_UDMAWRITE, MEMCFG_UCERR_ETHERCATMEMREAD or/and MEMCFG_UCERR_EMACMEMREAD values.
Parameters
  • stsFlag: is the error for which address needs to be returned.

Return

Return address location of uncorrectable read/write error.

uint32_t MemCfg_getCorrErrorAddress(uint32_t stsFlag)

Gets the address location of correctable memory read/write error.

This function returns the address location of correctable read/write error for the specified error. The param

stsFlag can take any of the MEMCFG_CERR_M4READ, MEMCFG_CERR_M4WRITE, MEMCFG_CERR_EMACREAD, MEMCFG_CERR_EMACWRITE, MEMCFG_CERR_UDMAREAD and/or MEMCFG_CERR_UDMAWRITE values.
Parameters
  • stsFlag: is the error for which address needs to be returned.

Return

Return address location of correctable read/write error.

uint32_t MemCfg_getBusFaultAddress(uint32_t busMaster)

Gets the bus fault address for the selected bus master.

This function return the bus fault address for selected bus master. The parameter

busMaster can be any of the following values: MEMCFG_BUSMASTER_M4, MEMCFG_BUSMASTER_UDMA, or MEMCFG_BUSMASTER_EMAC.
Parameters
  • busMaster: specifies the bus masters for which fault address is to be returned.

Return

Returns bus fault address for the selected bus master.

Many of the functions provided by this API to configure RAM sections’ settings will take a RAM section identifier or an OR of several identifiers as a parameter. These are #defines with names in the format MEMCFG_SECT_X. Take care to read the function description to learn which functions can operate on multiple sections of the same type at a time and which ones can only configure one section at a time. A quick way to check this is to see if the parameter says e ramSection or the plural e ramSections. Some functions may also be able to take a MEMCFG_SECT_ALL value to indicate that all RAM sections should be operated on at the same time. Again, read the function’s detailed description to be sure.

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