![]() |
Energy Micro IEC60355 Library Example Project 1.0 (internal use only!) GCC-Version
Example project demonstrating POST and BIST library functions
|
00001 /***************************************************************************/ 00029 #include <stdint.h> 00030 #include "iec60335_class_b_cpureg_test.h" 00031 00036 IEC60335_CPUreg_struct IEC60335_CPUregTestPOST; 00037 IEC60335_CPUreg_struct IEC60335_CPUregTestBIST; 00038 00039 testResult_t IEC60335_ClassB_CPUregTest_POST(void) 00040 { 00041 testResult_t Result = IEC60335_testFailed; 00042 ASMCPUregTestPOST(); 00043 00044 Result = IEC60335_CPUregTestPOST.testResult; 00045 00046 return(Result); 00047 } 00048 00049 testResult_t IEC60335_ClassB_CPUregTest_BIST(void) 00050 { 00051 /* Clear the current test states */ 00052 IEC60335_CPUregTestBIST.testState = IEC60335_statePending; 00053 IEC60335_CPUregTestBIST.testResult = IEC60335_testFailed; 00054 00055 /* Test the low registers r0-r7 */ 00056 ASMCPUregTestLOW(); 00057 if (IEC60335_CPUregTestBIST.testResult != IEC60335_testPassed) 00058 { 00059 return(IEC60335_testFailed); 00060 } 00061 00062 /* Clear the PASS bit */ 00063 IEC60335_CPUregTestBIST.testResult = IEC60335_testFailed; 00064 /* Test the high registers r8-r12 */ 00065 ASMCPUregTestHIGH(); 00066 if (IEC60335_CPUregTestBIST.testResult != IEC60335_testPassed) 00067 { 00068 return(IEC60335_testFailed); 00069 } 00070 00071 /* Clear the PASS bit */ 00072 IEC60335_CPUregTestBIST.testResult = IEC60335_testFailed; 00073 /* Test the stack pointer registers 00074 * NOTE: DISABLES ALL INTERRUPTS! 00075 */ 00076 ASMCPUregTestSP(); 00077 if (IEC60335_CPUregTestBIST.testResult != IEC60335_testPassed) 00078 { 00079 return(IEC60335_testFailed); 00080 } 00081 00082 /* Clear the PASS bit */ 00083 IEC60335_CPUregTestBIST.testResult = IEC60335_testFailed; 00084 /* Test the Special registers */ 00085 ASMCPUregTestSPEC(); 00086 if (IEC60335_CPUregTestBIST.testResult != IEC60335_testPassed) 00087 { 00088 return(IEC60335_testFailed); 00089 } 00090 00091 /* Indicate all tests passed */ 00092 IEC60335_CPUregTestBIST.testResult = IEC60335_testPassed; 00093 IEC60335_CPUregTestBIST.testState = IEC60335_stateDone; 00094 00095 return(IEC60335_testPassed); 00096 } 00097 00102 /************************************** EOF *********************************/