| /*-------------------------------------------------------------------------------------------------------------------- |
| (C) Copyright 2012, 2013 Marvell DSPC Ltd. All Rights Reserved. |
| -------------------------------------------------------------------------------------------------------------------*/ |
| |
| #ifndef _ERROR_HANDLER_H_ |
| #define _ERROR_HANDLER_H_ |
| |
| /*----------- Local include files --------------------------------------------*/ |
| |
| #include <time.h> |
| #include "global_types.h" |
| |
| /******************************************************************************************/ |
| /* GENERAL */ |
| /******************************************************************************************/ |
| //ICAT EXPORTED ENUM |
| typedef enum |
| { |
| //enumerated |
| EE_SYS_RESET_EN, |
| EE_ASSERT_EN, |
| EE_EXCEPTION_EN, |
| EE_WARNING_EN, |
| EE_NUM_ENTRY_TYPES, |
| // Codes |
| EE_SYS_RESET = 300, |
| EE_ASSERT = 350, |
| EE_EXCEPTION = 450, |
| EE_WARNING = 550 |
| #if !defined(COMPILER_DOES_NOT_SUPPORT_SHORT_ENUMS) || defined(_PPC_) |
| } EE_entry_t; |
| #else |
| } EE_entry_t_; |
| typedef UINT16 EE_entry_t; |
| #endif |
| |
| //ICAT EXPORTED ENUM |
| typedef enum |
| { |
| EEE_DataAbort, |
| EEE_PrefetchAbort, |
| EEE_FatalError, |
| EEE_SWInterrupt, |
| EEE_UndefInst, |
| EEE_ReservedInt |
| #if !defined(COMPILER_DOES_NOT_SUPPORT_SHORT_ENUMS) || defined(_PPC_) |
| } EE_ExceptionType_t; |
| #else |
| } EE_ExceptionType_t_; |
| typedef UINT8 EE_ExceptionType_t; |
| #endif |
| |
| //ICAT EXPORTED ENUM |
| typedef enum |
| { |
| EE_NO_RESET_SOURCE, |
| EE_POWER_ON_RESET, |
| EE_EXT_MASTER_RESET, |
| EE_WDT_RESET |
| #if !defined(COMPILER_DOES_NOT_SUPPORT_SHORT_ENUMS) || defined(_PPC_) |
| } EE_PMU_t; |
| #else |
| } EE_PMU_t_; |
| typedef UINT8 EE_PMU_t; |
| #endif |
| |
| /* secondary exception types */ |
| typedef enum |
| { |
| VERTICAL = 0, |
| ALIGNMENT_1 = 1, |
| TERMINAL = 2, |
| ALIGNMENT_2 = 3, |
| EXTERNAL_ABORT_ON_TRANSLATION = 12, |
| EXTERNAL_ABORT_ON_TRANSLATION_2 = 14, |
| TRANSLATION = 5, |
| TRANSLATION_2 = 7, |
| EE_DOMAIN = 9, |
| EE_DOMAIN_2 = 11, |
| PERMISSION = 13, |
| PERMISSION_2 = 15, |
| IMPRECISE_EXTERNAL_DATA_ABORT = 6, |
| LOCK_ABORT = 4, |
| DATA_CACHE_PARITY_ERROR = 8, |
| INSTRUCTION_MMU = 0, |
| EXTERNAL_INSTRUCTION_ERROR = 6, |
| INSTRUCTION_CACHE_PARITY_ERROR = 8 |
| } EXCEPTION_TYPE; |
| |
| /******************************************************************************************/ |
| /* CPU register context format */ |
| /******************************************************************************************/ |
| |
| //ICAT EXPORTED STRUCT |
| typedef struct |
| { |
| UINT32 r0; /* register r0 contents */ |
| UINT32 r1; /* register r1 contents */ |
| UINT32 r2; /* register r2 contents */ |
| UINT32 r3; /* register r3 contents */ |
| UINT32 r4; /* register r4 contents */ |
| UINT32 r5; /* register r5 contents */ |
| UINT32 r6; /* register r6 contents */ |
| UINT32 r7; /* register r7 contents */ |
| UINT32 r8; /* register r8 contents */ |
| UINT32 r9; /* register r9 contents */ |
| UINT32 r10; /* register r10 contents */ |
| UINT32 r11; /* register r11 contents */ |
| UINT32 r12; /* register r12 contents */ |
| UINT32 SP; /* register r13 contents */ |
| UINT32 LR; /* register r14 contents (excepted mode)*/ |
| UINT32 PC; /* PC - excepted instruction */ |
| UINT32 cpsr; /* saved program status register contents */ |
| UINT32 FSR; /* Fault status register */ |
| UINT32 FAR_R; /* Fault address register */ |
| EE_PMU_t PMU_reg; /* saved reset cause - should be last */ |
| |
| // UINT32 PESR; /* Extension */ |
| // UINT32 XESR; |
| // UINT32 PEAR; |
| // UINT32 FEAR; |
| // UINT32 SEAR; |
| // UINT32 GEAR; |
| } EE_RegInfo_Data_t; |
| |
| // |
| // Context types: the two enumerations below must be synchronized |
| // |
| |
| //ICAT EXPORTED ENUM |
| typedef enum |
| { |
| EE_CT_None, |
| EE_CT_ExecTrace, |
| EE_CT_StackDump |
| #if !defined(COMPILER_DOES_NOT_SUPPORT_SHORT_ENUMS) || defined(_PPC_) |
| }EE_ContextType_t; // This enumerates configureable types of contents to be saved in the context buffer |
| #else |
| } EE_ContextType_t_; // This enumerates configureable types of contents to be saved in the context buffer |
| typedef UINT8 EE_ContextType_t; |
| #endif |
| |
| //ICAT EXPORTED ENUM |
| typedef enum |
| { |
| EE_CDT_None, |
| EE_CDT_ExecTrace, |
| EE_CDT_StackDump, |
| EE_CDT_UserDefined = 0x10 |
| #if !defined(COMPILER_DOES_NOT_SUPPORT_SHORT_ENUMS) || defined(_PPC_) |
| }EE_ContextDataType_t; // This enumerates possible types of contents of the context buffer in the log |
| #else |
| } EE_ContextDataType_t_; // This enumerates configureable types of contents to be saved in the context buffer |
| typedef UINT8 EE_ContextDataType_t; |
| #endif |
| |
| |
| //ICAT EXPORTED STRUCT |
| typedef struct |
| { |
| UINT32 _PESR; |
| UINT32 _XESR; |
| UINT32 _PEAR; |
| UINT32 _FEAR; |
| UINT32 _SEAR; |
| UINT32 _GEAR; |
| } EE_XscGasketRegs; |
| |
| //ICAT EXPORTED STRUCT |
| typedef struct |
| { |
| UINT8 second; // Seconds after minute: 0 - 59 |
| UINT8 minute; // Minutes after hour: 0 - 59 |
| UINT8 hour; // Hours after midnight: 0 - 23 |
| UINT8 day; // Day of month: 1 - 31 |
| UINT8 month; // Month of year: 1 - 12 |
| UINT16 year; // Calendar year: e.g 2001 |
| }RTC_CalendarTime; |
| |
| /******************************************************************************************/ |
| /* LOG ENTRY FORMAT */ |
| /******************************************************************************************/ |
| #ifndef ERROR_HANDLER_MAX_DESC_SIZE |
| #define ERROR_HANDLER_MAX_DESC_SIZE 100 |
| #endif |
| |
| //ICAT EXPORTED STRUCT |
| typedef struct |
| { |
| UINT16 fileWriteOffset; //DO NOT REMOVE OR CHANGE TYPE!!!(for cyclic file) |
| EE_entry_t type; |
| RTC_CalendarTime dateAndTime; |
| char desc[ERROR_HANDLER_MAX_DESC_SIZE]; |
| EE_RegInfo_Data_t RegInfo; |
| EE_ContextDataType_t contextBufferType; |
| UINT8 contextBuffer[256 * 2]; |
| UINT32 CHKPT0; |
| UINT32 CHKPT1; |
| char taskName[10]; |
| UINT32 taskStackStart; |
| UINT32 taskStackEnd; |
| //UP TO HERE 0x1e4 bytes (out of 0x200 allocated by linker control file INT_RAM_EE segment) |
| EE_XscGasketRegs xscaleGasketRegs; |
| UINT32 warningCntr; //reserved[1]; |
| } EE_Entry_t; |
| |
| #endif //end of _ERROR_HANDLER_H_ |