ERC32 EDAC Driver
Nicolas Horro
nhorro at gmail.com
Mon Jun 2 19:13:16 UTC 2008
Hi,
I'm working on a simple EDAC driver for ERC32. Tests running on SIS do
nothing and tests running on real hardware produce trap 0x9 (not 0x16, as it
would be expected).
Driver (basically) does the following:
1. Ensure EDAC is turned on in MEMCFR:
ERC32_MEC.Memory_Configuration |= 0x00004000;
2. Install ISR handler:
/* EDAC_Correction_Handler */
rtems_isr EDAC_Correction_Handler( rtems_vector_number vector ) {
++_Sram_Edac.errorCount;
*( (uint32_t*)ERC32_MEC.First_Failing_Address) =
*( (uint32_t*)ERC32_MEC.First_Failing_Address);
}
(...)
/* install handler */
rtems_interrupt_catch( EDAC_Correction_Handler,
ERC32_TRAP_TYPE(ERC32_INTERRUPT_CORRECTABLE_MEMORY_ERROR),
&old );
For testing, I'm using a function to write a value with checkbits and
another to read it and produce EDAC trap if checkbits are wrong:
--- file: EDACTest.c --
(...)
uint32_t a;
/* Intentionally write value with wrong CheckBits (Correct CB: 0x2C) */
writeValueWithCheckBits(&a, 0x01, 0x2D):
/* Attempt to read so Trap 0x16 occurs */
readAddress(&a);
(...)
/*****************************************************************************/
void writeValueWithCheckBits(uint32_t* address,
uint32_t value,
uint32_t checkbits )
/*****************************************************************************/
{
// Enable EDAC Test Mode in TESTCTR
printf("EDAC Test$ Enabling EDAC Test Mode in Test Control
Register.\n");
ERC32_MEC.Test_Control = 0x20000;
// Setting check bits
printf("EDAC Test$ Writing check bits.\n");
ERC32_MEC.Test_Control |= checkbits;
// Write value affected by check bits
printf("EDAC Test$ Writing '0x%08x' at address '0x%08x'.\n", value,
address);
*address = value;
// Disable EDAC Test Mode in TESTCTR
printf("EDAC Test$ Disabling EDAC Test Mode in Test Control
Register.\n");
ERC32_MEC.Test_Control &= ~0x20000;
}
/*****************************************************************************/
void readAddress(uint32_t* address)
/*****************************************************************************/
{
uint32_t tmp;
// Read address
printf("EDAC Test$ Reading address '0x%08x'. If wrong checkbits, EDAC
trap should occur.\n", address);
tmp = address;
printf("EDAC Test$ Address content is: '0x%08x'.\n", tmp);
}
(...)
Any suggestion? Obviously I'm doing something wrong, but I can't figure out
what it is.
Greetings and thanks!
Nicolás Eduardo Horro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20080602/ecb16442/attachment.html>
More information about the users
mailing list