CAT2 Peripheral Driver Library

Functions

void Cy_RAM_ECC_Init (CPUSS_Type *base, uint32_t config)
 Initializes SRAM ECC with the configuration value. More...
 
void Cy_RAM_SetupEccInjection (CPUSS_Type *base, const uint32_t address, const uint8_t parity)
 Sets the CPUSS_ECC_TEST register to set up ECC injection. More...
 
void Cy_RAM_EnableEccInjection (CPUSS_Type *base)
 Sets the CPUSS_RAM_CTL register to enable ECC injection. More...
 
void Cy_RAM_DisableEccInjection (CPUSS_Type *base)
 Set CPUSS_RAM_CTL register to disable ECC injection. More...
 
bool Cy_RAM_IsEccInjectionEnabled (CPUSS_Type *base)
 Check whether the ECC error injection of SRAM is enabled. More...
 
uint32_t Cy_RAM_GetEccWordAddr (CPUSS_Type *base)
 Gets the ECC injection word address. More...
 
uint8_t Cy_RAM_GetEccSyndrome (CPUSS_Type *base)
 Gets the ECC error Syndrome. More...
 
void Cy_RAM_ClearEccSyndrome (CPUSS_Type *base)
 Clears the valid status of ECC capture address and syndrome. More...
 
bool Cy_RAM_IsWritebufferEmpty (CPUSS_Type *base)
 Checks whether the Write Buffer is empty or not. More...
 

Detailed Description

Function Documentation

◆ Cy_RAM_ECC_Init()

void Cy_RAM_ECC_Init ( CPUSS_Type *  base,
uint32_t  config 
)

Initializes SRAM ECC with the configuration value.

Parameters
baseThe pointer to the structure, which describes the RAM (CPU Subsystem) instance registers
configComposite config bitmask, see RAM initialization parameters
Returns
None
Function Usage
uint32_t eccConfig = 0U;
eccConfig |= CY_RAM_ECC_ENABLE;
Cy_RAM_ECC_Init(CPUSS, eccConfig);

◆ Cy_RAM_SetupEccInjection()

void Cy_RAM_SetupEccInjection ( CPUSS_Type *  base,
const uint32_t  address,
const uint8_t  parity 
)

Sets the CPUSS_ECC_TEST register to set up ECC injection.

Parameters
baseThe pointer to the structure, which describes RAM (CPU Subsystem) instance registers
addressSpecifies the address where an ECC error will be injected.
paritySpecifies the parity (ECC syndrome), which will be injected to the word address.
Returns
None
Note
Set the lowest two bits of the address to zero. For SRAM ECC, the word address WORD_ADDR[24:0] is device address A[26:2].
Function Usage
/* Calculate the parity and inject error */
volatile uint32_t test_variable;
uint8_t parity = 0;
uint32_t refData = CY_TEST_RAM_0_DATA; /* original data expected by user*/
/* user should implement parity calculator */
parity = Ecc_GetParity7Bit((uint32_t)&test_variable, refData);
Cy_RAM_SetupEccInjection(CPUSS, (uint32_t)&test_variable, parity);

◆ Cy_RAM_EnableEccInjection()

void Cy_RAM_EnableEccInjection ( CPUSS_Type *  base)

Sets the CPUSS_RAM_CTL register to enable ECC injection.

Parameters
baseThe pointer to the structure, which describes RAM (CPU Subsystem) instance registers
Returns
None
Function Usage
/* Calculate the parity and inject error */
volatile uint32_t test_variable;
uint8_t parity = 0;
uint32_t refData = CY_TEST_RAM_0_DATA; /* original data expected by user*/
/* user should implement parity calculator */
parity = Ecc_GetParity7Bit((uint32_t)&test_variable, refData);
Cy_RAM_SetupEccInjection(CPUSS, (uint32_t)&test_variable, parity);

◆ Cy_RAM_DisableEccInjection()

void Cy_RAM_DisableEccInjection ( CPUSS_Type *  base)

Set CPUSS_RAM_CTL register to disable ECC injection.

Parameters
baseThe pointer to the structure, which describes RAM (CPU Subsystem) instance registers
Returns
None
Function Usage
/* Calculate the parity and inject error */
volatile uint32_t test_variable;
uint8_t parity = 0;
uint32_t refData = CY_TEST_RAM_0_DATA; /* original data expected by user*/
/* user should implement parity calculator */
parity = Ecc_GetParity7Bit((uint32_t)&test_variable, refData);
Cy_RAM_SetupEccInjection(CPUSS, (uint32_t)&test_variable, parity);

◆ Cy_RAM_IsEccInjectionEnabled()

bool Cy_RAM_IsEccInjectionEnabled ( CPUSS_Type *  base)

Check whether the ECC error injection of SRAM is enabled.

Parameters
baseThe pointer to the structure, which describes RAM (CPU Subsystem) instance registers
Returns
TRUE if injection enabled, FALSE - otherwise.
Function Usage
/* Calculate the parity and inject error */
volatile uint32_t test_variable;
uint8_t parity = 0;
uint32_t refData = CY_TEST_RAM_0_DATA; /* original data expected by user*/
/* user should implement parity calculator */
parity = Ecc_GetParity7Bit((uint32_t)&test_variable, refData);
Cy_RAM_SetupEccInjection(CPUSS, (uint32_t)&test_variable, parity);

◆ Cy_RAM_GetEccWordAddr()

uint32_t Cy_RAM_GetEccWordAddr ( CPUSS_Type *  base)

Gets the ECC injection word address.

Parameters
baseThe pointer to the structure, which describes RAM (CPU Subsystem) instance registers
Returns
ECC injection word address.
Note
Returns zero if no valid address is present
Function Usage
uint32_t syndrome_address;
uint8_t syndrome;
/* In handler we can check where error occurs and what exactly error happened */
syndrome_address = Cy_RAM_GetEccWordAddr(CPUSS);
syndrome = Cy_RAM_GetEccSyndrome(CPUSS);
if (1U == Cy_RAM_IsWritebufferEmpty(CPUSS))
{
/* if buffer is empty then we can go to the sleep mode */
}

◆ Cy_RAM_GetEccSyndrome()

uint8_t Cy_RAM_GetEccSyndrome ( CPUSS_Type *  base)

Gets the ECC error Syndrome.

Parameters
baseThe pointer to the structure, which describes RAM (CPU Subsystem) instance registers
Returns
ECC error Syndrome.
Note
Returns zero if no valid ECC syndrome is present
Function Usage
uint32_t syndrome_address;
uint8_t syndrome;
/* In handler we can check where error occurs and what exactly error happened */
syndrome_address = Cy_RAM_GetEccWordAddr(CPUSS);
syndrome = Cy_RAM_GetEccSyndrome(CPUSS);
if (1U == Cy_RAM_IsWritebufferEmpty(CPUSS))
{
/* if buffer is empty then we can go to the sleep mode */
}

◆ Cy_RAM_ClearEccSyndrome()

void Cy_RAM_ClearEccSyndrome ( CPUSS_Type *  base)

Clears the valid status of ECC capture address and syndrome.

Parameters
baseThe pointer to the structure, which describes RAM (CPU Subsystem) instance registers
Returns
None
Function Usage
uint32_t syndrome_address;
uint8_t syndrome;
/* In handler we can check where error occurs and what exactly error happened */
syndrome_address = Cy_RAM_GetEccWordAddr(CPUSS);
syndrome = Cy_RAM_GetEccSyndrome(CPUSS);
if (1U == Cy_RAM_IsWritebufferEmpty(CPUSS))
{
/* if buffer is empty then we can go to the sleep mode */
}

◆ Cy_RAM_IsWritebufferEmpty()

bool Cy_RAM_IsWritebufferEmpty ( CPUSS_Type *  base)

Checks whether the Write Buffer is empty or not.

Parameters
baseThe pointer to the structure, which describes RAM (CPU Subsystem) instance registers
Returns
TRUE if buffer is empty, FALSE otherwise.
Note
This information is used when entering DeepSleep power mode: WB_EMPTY must be '1' before a transition to system DeepSleep power mode. '0': Write buffer NOT empty. '1': Write buffer empty. The SRAM controller write buffer is only used when ECC checking is enabled. if ECC not enabled result should be always true (buffer empty).