| Xmega IEC60730 Class B Library 1.0 |

All Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Submodules
CPU Register test

## Detailed Description

This is the self-test module for the registers in the CPU.

The CPU registers are tested for stuck bits and some coupling faults. The test is executed by calling classb_register_test(). The test procedure consists of five steps per register:

1. Write 0x55 to register
2. Write 0xAA to register
3. Verify content (0xAA) of register
4. Write 0x55 to register
5. Verify content (0x55) of register

Non-destructive testing is done on the R-registers that are stated to need preservation in the compiler documentation and on all IO registers. Further, this test returns its result using a register. Therefore, the register used to return the value, the stack pointer registers or those used within the test (e.g. to save values) are critical in the sense that the test cannot be executed correctly unless these registers are working.

The error handler for the test is CLASSB_ERROR_HANDLER_REGISTERS(). It is possible to configure independently the behavior of the test with respect to failure in critical and non-critical registers (see CLASSB_ERROR_CRIT and CLASSB_ERROR_NON_CRIT).

Given that GCC and IAR make use of the CPU registers in a different manner, we have included a compiler-specific function. This reduces execution time and simplifies the code.

Note:
  Interrupts must be disabled during this test.

## Submodules
| Settings related to error handling
| In principle, any error in critical registers would mean that the system cannot verify whether the registers are working correctly. Since registers are vital to most applications, the microcontroller should probably hang. However, this behavior can be modified so that failure in critical registers is handled by CLASSB_ERROR_HANDLER_REGISTERS(). The behavior for failure in non-critical registers can also be configured: the microcontroller can call the error handler or hang.
| Functions
| This is the self-test for CPU registers.