⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 errors.h

📁 嵌入式系统关于串口传输、触摸屏、定时器、控制器、中断处理、音频控制等实验代码
💻 H
字号:
/******************************************************************************
**
**  COPYRIGHT (C) 2000, 2001 Intel Corporation.
**
**  This software as well as the software described in it is furnished under
**  license and may only be used or copied in accordance with the terms of the
**  license. The information in this file is furnished for informational use
**  only, is subject to change without notice, and should not be construed as
**  a commitment by Intel Corporation. Intel Corporation assumes no
**  responsibility or liability for any errors or inaccuracies that may appear
**  in this document or any software that may be provided in association with
**  this document.
**  Except as permitted by such license, no part of this document may be
**  reproduced, stored in a retrieval system, or transmitted in any form or by
**  any means without the express written consent of Intel Corporation.
**
**  FILENAME:      dm_errors.h
**
**  PURPOSE:       This file contains the global #defines for all of the error
**                 codes in the diagnostic manager. Errors are stored as
**                 encoded 32-bit integers. In little-endian fashion, the
**                 most significant 12 bits are reserved for the location of
**                 the error. The next 8 bits are to be used as a sub-location
**                 of the error, and the last 12 bits are used for the error
**                 type encoding.
**
**                 These errors are intended to provide a means to track errors
**                 from device driver modules. The reasoning is that when an
**                 error occurs from a device driver module it may imply that
**                 there is a hardware failure. However, there is ample
**                 tracking and reporting for other software related errors too.
**
**  LAST MODIFIED: $Modtime: 7/13/01 11:37a $
******************************************************************************/
#ifndef _DM_ERRORS_H
#define _DM_ERRORS_H

/*
*******************************************************************************
Forward references
*******************************************************************************
*/
//void DM_ErrorRecord (UINT32 code, UINT32 param1, UINT32 param2, UINT32 param3);

typedef UINT32 ErrorT;
#define ERRORCODE(l,s,t) ((l << ERR_L_SHIFT) | (s << ERR_S_SHIFT) | t)

/*
*******************************************************************************
Special 32-bit codes
*******************************************************************************
*/
// Use this value to initialize the context structure error return value
#define ERR_PASS_CODE   0x50415353u  // PASS in ASCII

// Use the following value for non-zero failing return value if there is no
// other value more suitable such as the error code itself.
#define ERR_FAIL_CODE   0x4641494Cu  // FAIL in ASCII

// "No Error" return code
#define ERR_NONE ERRORCODE(ERR_L_NONE, ERR_S_NONE, ERR_T_NONE)

// "Unspecified Error" return code
#define ERR_UNSPECIFIED ERRORCODE(ERR_L_NONE, ERR_S_NONE, ERR_T_UNSPECIFIED)

/*
*******************************************************************************
(Software) Location codes - 12 bits max - 4095 possible codes
  - Used to identify the module that detects an error which affects its own
    processing.
Location codes are prefixed with ERR_L_.
Force these constants to unsigned because they shift to the high end of the
    unsigned storage variable.
*******************************************************************************
*/

#define ERR_L_SHIFT 20  // the bit shift for the location code

    // Mask to isolate location code
#define ERR_L_MASK          (0xFFFu << ERR_L_SHIFT)

#define ERR_L_NONE          0x000u  // Unspecified location/device/module
#define ERR_L_XSIC          0x001u  // Main processor Interrupt Controller SW
#define ERR_L_XSDMA         0x002u  // Main processor DMA Controller module
#define ERR_L_FLASH         0x003u  // Flash memory device
#define ERR_L_XSGPIO        0x004u  // Main processor GPIO module
#define ERR_L_LAN91C96      0x005u  // LAN91C96 Ethernet Controller
#define ERR_L_XSFFUART      0x006u  // FFUart device
#define ERR_L_XSBTUART      0x007u  // BTUart device
#define ERR_L_XSSTUART      0x008u  // STUart device
#define ERR_L_XSRTC         0x009u  // Main Processor Real Time Clock
#define ERR_L_XSOST         0x00Au  // Main processor Operating System Timer
#define ERR_L_XSAC97CTRL    0x00Bu  // Main processor AC '97 Controller Unit
#define ERR_L_XSCLKMGR      0x00Cu  // Main processor clock manager
#define ERR_L_AC97          0x00Du  // AC'97 Audio and Modem Codec driver
#define ERR_L_PERIPH_BDCTRL 0x00Eu  // Peripheral board's Control module
#define ERR_L_SK            0x00Fu  // Companion chip's overall SW module
#define ERR_L_SKIC          0x010u  // Companion chip's Interrupt Controller SW
#define ERR_L_CPU           0x011u  // General CPU failures
#define ERR_L_MEMORY        0x012u  // General Memory failures
#define ERR_L_SRAM          0x013u  // SRAM device
#define ERR_L_SDRAM         0x014u  // SDRAM device
#define ERR_L_XSUDC         0x015u  // USB device controller
#define ERR_L_USB           0x016u  // USB Host
#define ERR_L_XSSSP         0x017u  // SSP device
#define ERR_L_XSICP         0x018u  // ICP device
#define ERR_L_LCD           0x019u  // LCD device
#define ERR_L_TS            0x01Au  // Touchscreen device
#define ERR_L_PS2           0x01Bu  // PS2 ports device
#define ERR_L_MMC           0x01Cu  // MMC device

#define ERR_L_RSVD_FAIL     0x464u   // reserved for FAIL code
#define ERR_L_RSVD_PASS     0x504u   // reserved for PASS code

/*
*******************************************************************************
Sub-location codes - 8 bits max - 253 possible sub-location codes.
These codes are arbitrary and left to the discretion of the programmer and may
not be unique. Therefore, there are no global #defines done here except for the
bit shift for the field and two reserved values. The programmer must define
his own static sub-location codes within the device driver code.
It is recommended that sublocation code symbols be  prefixed with ERR_S_.
*******************************************************************************
*/

#define ERR_S_SHIFT 12  // the sub-location bit shift

    // Mask to isolate sub-location code
#define ERR_S_MASK  (0xFF << ERR_S_SHIFT)

#define ERR_S_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_XSAC97CTRL_FIFO   0x019   // AC97 controller FIFO error.  Either underflow or overflow.
#define ERR_T_XSDMA_UNEXPECTED  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.

//
// 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 - 0xFFF
#define ERR_T_FATAL_BASE        0x800   // Do not change this value.



/*
*******************************************************************************
The error record structure
*******************************************************************************
*/

#define MAX_STORED_ERRORS 30

typedef struct ErrorRecord_S
{
    UINT32  errorCode;  // A constructed error code
    UINT32  param_1;    // Some additional data
    UINT32  param_2;
    UINT32  param_3;
} ErrorRecord_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);                                     \
            DM_ErrorRecord (_logerr, _param1, _param2, _param3);
#endif // _DM_ERRORS_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -