📄 dm_errors.h
字号:
*******************************************************************************
Secondary sub-location codes - 4 bits max - 16 possible secondary sub-location
codes. These are normally used to indicate a particular location within the
function we are in. It is recommended that they be hardcoded numbers.
*******************************************************************************
*/
#define ERR_S2_SHIFT 12 // the sub-location bit shift
// Mask to isolate sub-location code
#define ERR_S2_MASK (0xF << ERR_S2_SHIFT)
#define ERR_S2_NONE 0x0 // Unspecified sub-location
/*
*******************************************************************************
Error type codes - 12 bits max - 4095 possible codes
Error codes are prefixed with ERR_T_.
Fatal and Non-Fatal errors can be assigned here. Setting the high bit signifies that
the error will be treated as a fatal error and the system will trap out to a
function that displays an LED error code. The defined name will contain FATAL_
in the name to identify that this is a fatal error.
*******************************************************************************
*/
#define ERR_T_MASK (0xFFF) // Mask to isolate error type code
#define ERR_T_MSK ERR_T_MASK // Still used in XsDma.c
#define ERR_T_NONE 0x000 // None
#define ERR_T_UNSPECIFIED 0x001 // Unspecified error
#define ERR_T_ILLPARAM 0x002 // Illegal parameter
#define ERR_T_TIMEOUT 0x003 // Timeout
#define ERR_T_NODEVICE 0x004 // A device is not present or cannot be initialized
#define ERR_T_NOBITSET 0x005 // some bit in a register cannot be set or reset
#define ERR_T_INVALIDACC 0x006 // invalid access. Attempt to read/write invalid memory.
#define ERR_T_UNKNOWN 0x007 // unknown error - a generic catch-all
#define ERR_T_BADRANGE 0x008 // bad range - some number or computation is out of range
#define ERR_T_NORECEIVE 0x009 // Some receiver cannot receive data
#define ERR_T_NOTRANSMIT 0x00A // some transmitter cannot transmit data
#define ERR_T_ILLALIGN 0x00B // Illegal alignment
#define ERR_T_BUSERRINT 0x00C // internal bus error interrupt
#define ERR_T_NODESC 0x00D // DMA could not get a valid descriptor
#define ERR_T_UNEXPECTED 0x00E // Unexpected result returned from device
#define ERR_T_NO_HANDLER 0x00F // An expected interrupt handler was not detected
#define ERR_T_ALREADY_IN_USE 0x010 // A requested or expected resource was already in use.
#define ERR_T_NOT_AVAIL 0x011 // A requested or expected resource was not available.
#define ERR_T_REG_HANDLER 0x012 // There is a registered interrupt handler.
#define ERR_T_WRONG_STATE 0x013 // The target (SW or HW) was in the wrong state.
#define ERR_T_NO_INT_REASON 0x014 // Int hndlr detected no reason for its invocation.
// Internal software error in reporting module
#define ERR_T_SW_INTERNAL 0x015 // or a subroutine. Details in error history.
#define ERR_T_CLIPPED 0x016 // A value or signal was clipped (forcibly truncated)
#define ERR_T_NOT_IMPLEMENTED 0x017 // A requested service is currently not implemented.
#define ERR_T_HW_NOT_SUPPORTED 0x018 // An unsupported hardware device was detected
#define ERR_T_FIFO 0x019 // FIFO error. Either underflow or overflow.
#define ERR_T_UNEXPECT_STATUS 0x01A // Unexpected status from the DMA controller.
#define ERR_T_WRONG_VALUE 0x01B // The wrong value was returned
#define ERR_T_CRC 0x01C // CRC error.
#define ERR_T_DATA_UNDERRUN 0x01D // Data Underrun error.
#define ERR_T_DATA_OVERRUN 0x01E // Data Overrun error.
#define ERR_T_NO_MEM_AVAIL 0x01F // No memory available from memory allocator (mallocx)
#define ERR_T_ILLPARM_PTOV 0x020 // Bad physical address detected by PhysicalToVirtual()
#define ERR_T_ILLPARM_VTOP 0x021 // Bad physical address detected by VirtualToPhysical()
#define ERR_T_RECEIVE_MISMATCH 0x022 // Mismatch on Transmit and receive data
#define ERR_T_DMA_NOCHAN 0x023 // No DMA channel can be allocated
#define ERR_T_DEV_PRESENT 0x024 // Device still present
#define ERR_T_DEV_NO_WRITE_PRO 0x025 // Device not write protected
// Device specific error types
#define ERR_T_RECEIVE_SHORT 0x100 // Ethernet controller Received packet too short
#define ERR_T_RECEIVE_NOINT 0x101 // Ethernet controller No Receive interrupt
#define ERR_T_BMP 0x102 // BMP file verify error.
#define ERR_T_NOTRANSFER 0x103 // USB Host has No free memory for transfer descriptors
#define ERR_T_EPHALTED 0x104 // Endpoint halted
#define ERR_T_NOBUFFER 0x105 // No free buffers
#define ERR_T_MAXPACKETSIZE 0x106 // Bad max packet size returned
#define ERR_T_BADLCDDETECT 0x107 // Could not detect the LCD type
#define ERR_T_PROGRESS 0xFFF // Just a progress code, not an error - for the hex display.
//
// Fatal errors are below this line. They form a subrange of error types.
// ERR_T_FATAL_BASE should not "OR"ed with another error type; that would just
// confuse things.
//
// Fatal errors must all be in the range 0x800 - 0xFFE
#define ERR_T_FATAL_BASE 0x800 // Do not change this value.
/*
*******************************************************************************
The error record structure
*******************************************************************************
*/
#define MAX_STORED_ERRORS 30
typedef struct ErrorRecord_S
{
XLLP_UINT32_T errorCode; // A constructed error code
XLLP_UINT32_T param_1; // Some additional data
XLLP_UINT32_T param_2;
XLLP_UINT32_T param_3;
} ErrorRecord_T;
/*
*******************************************************************************
The error code structure
*******************************************************************************
*/
typedef struct ErrorList_S
{
XLLP_UINT32_T errorCode; // An error code
P_XLLP_INT8_T string; // Description of the error
} ErrorList_T;
/*
*******************************************************************************
*
* MACRO: LOGERROR
*
* DESCRIPTION: Constructs an error integer and stores it in the provided
* location. A call to DMErrorRecord is made with the
* constructed error code and the
*
* INPUT PARAMETERS: _logerr -the name of the location to store the
* constructed error code. UINT32 required.
* _where -the location code
* _sub_where -the sub location code
* _type -the error type code
* _param[1,2,3] -the extra optional data. Param3 is often
* used for the hardware device code,
* especially if P1 and P2 are 0.
*
* RETURNS: None
*
* GLOBAL EFFECTS: None
*
* ASSUMPTIONS: Should be called from within the driver function
*
*******************************************************************************
*/
#define LOGERROR(_logerr,_where,_sub_where,_type,_param1,_param2,_param3) \
_logerr = ERRORCODE(_where, _sub_where, _type); \
XllpUtilityErrorRecord (_logerr, _param1, _param2, _param3);
#define LOGERRORX(_logerr,_where,_sub_where,s2,_type,_param1,_param2,_param3) \
_logerr = ERRORCODEX(_where, _sub_where, s2, _type); \
XllpUtilityErrorRecord (_logerr, _param1, _param2, _param3);
/*
*******************************************************************************
Function prototypes
*******************************************************************************
*/
void XllpUtilityErrorRecord (XLLP_UINT32_T code, XLLP_UINT32_T param1, XLLP_UINT32_T param2, XLLP_UINT32_T param3);
void XllpUtilityDumpErrors (void*, P_XLLP_INT8_T);
void XllpUtilityClearErrors (void*, P_XLLP_INT8_T);
void XllpUtilityOutputError (XLLP_UINT32_T logerr);
#endif // _DM_ERRORS_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -