📄 dm_errors.c
字号:
/******************************************************************************
**
** 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.c
**
** PURPOSE: This file contains the procedures for capturing, testing
** for, and reporting error conditions with the device driver
** system.
**
** LAST MODIFIED: $Modtime: 7/24/03 11:47a $
******************************************************************************/
/*
*******************************************************************************
* HEADER FILES
*******************************************************************************
*/
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "systypes.h"
#include "dm_errors.h"
//#include "platform.h"
#include "XsIntCtrlApi.h"
/*
*******************************************************************************
* LOCAL DEFINITIONS
*******************************************************************************
*/
/*
*******************************************************************************
(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.
*******************************************************************************
*/
// --------------------
static ErrorList_T ErrorDeviceLocList[] =
{
{ERR_L_NONE, "Unspecified device"},
{ERR_L_XSIC, "Interrupt Controller"},
{ERR_L_XSDMA, "DMA Controller"},
{ERR_L_FLASH, "Flash Memory"},
{ERR_L_XSGPIO, "GPIO"},
{ERR_L_LAN91C111, "Ethernet Controller"},
{ERR_L_XSFFUART, "FFUART"},
{ERR_L_XSBTUART, "BTUART"},
{ERR_L_XSSTUART, "STUART"},
{ERR_L_XSRTC, "RTC"},
{ERR_L_XSOST, "OST"},
{ERR_L_XSAC97CTRL, "AC97 Controller"},
{ERR_L_XSCLKMGR, "Clock Manager"},
{ERR_L_AC97, "AC97 Audio CODEC"},
{ERR_L_PERIPH_BDCTRL, "FPGA"},
{ERR_L_I2SCODEC, "I2S Audio CODEC"},
{ERR_L_MEMSTICK, "Mem Stick Controller"},
{ERR_L_CPU, "General CPU failure"},
{ERR_L_MEMORY, "General Mem failure"},
{ERR_L_SRAM, "SRAM"},
{ERR_L_SDRAM, "SDRAM"},
{ERR_L_XSUDC, "USB Client"},
{ERR_L_USB, "USB Host"},
{ERR_L_XSSSP1, "SSP1"},
{ERR_L_XSICP, "ICP"},
{ERR_L_LCD, "LCD"},
{ERR_L_TS, "AC97 Touchscreen"},
{ERR_L_SSPTOUCH, "SSP Touchscreen"},
{ERR_L_MMC, "MMC"},
{ERR_L_USIM, "USIM"},
{ERR_L_PCMCIA, "PCMCIA"},
{ERR_L_MSL, "MSL Controller"},
{ERR_L_KEYPAD, "Keypad Controller"},
{ERR_L_HEXLEDS, "HEX LEDs"},
{ERR_L_DISCLEDS, "Discrete LEDs"},
{ERR_L_HEXSW, "HEX Switches"},
{ERR_L_USERSW, "User Switches"},
{ERR_L_I2C, "I2C Bus"},
{ERR_L_HEAP, "Heap Manager"},
{ERR_L_MSL, "MSL Baseband Interface"},
{ERR_L_XSSSP2, "SSP2"},
{ERR_L_XSSSP3, "SSP3"},
{ERR_L_DVM, "DVM"},
{ERR_L_USBOTG, "USB OTG Transceiver"},
{ERR_L_UNKNOWN, "Unknown device"}
};
/*
*******************************************************************************
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.
*******************************************************************************
*/
// --------------------
static ErrorList_T ErrorTypeList[] =
{
{ERR_T_NONE, "No error"},
{ERR_T_UNSPECIFIED, "Unspecified error"},
{ERR_T_ILLPARAM, "Illegal parameter"},
{ERR_T_TIMEOUT, "Timeout"},
{ERR_T_NODEVICE, "Device not found"},
{ERR_T_NOBITSET, "Stuck register bit"},
{ERR_T_INVALIDACC, "Invalid access"},
{ERR_T_UNKNOWN, "Unknown error"},
{ERR_T_BADRANGE, "Bad range"},
{ERR_T_NORECEIVE, "Receive failed"},
{ERR_T_NOTRANSMIT, "Transmit failed"},
{ERR_T_ILLALIGN, "Illegal alignment"},
{ERR_T_BUSERRINT, "Bus error"},
{ERR_T_NODESC, "No valid descriptor"},
{ERR_T_UNEXPECTED, "Unexpected result"},
{ERR_T_NO_HANDLER, "No interrupt handler"},
{ERR_T_ALREADY_IN_USE, "Already in use"},
{ERR_T_NOT_AVAIL, "Not available"},
{ERR_T_REG_HANDLER, "Cannot set handler"},
{ERR_T_WRONG_STATE, "Wrong state"},
{ERR_T_NO_INT_REASON, "No interrupt reason"},
{ERR_T_SW_INTERNAL, "Internal SW error"},
{ERR_T_CLIPPED, "Forced truncation"},
{ERR_T_NOT_IMPLEMENTED, "Not implemented"},
{ERR_T_HW_NOT_SUPPORTED, "Unknown device"},
{ERR_T_FIFO, "FIFO error"},
{ERR_T_UNEXPECT_STATUS, "Unexpected status"},
{ERR_T_WRONG_VALUE, "Wrong value"},
{ERR_T_CRC, "CRC error"},
{ERR_T_DATA_UNDERRUN, "Data underrun"},
{ERR_T_DATA_OVERRUN, "Data overrun"},
{ERR_T_NO_MEM_AVAIL, "Out of memory"},
{ERR_T_ILLPARM_PTOV, "Bad address"},
{ERR_T_ILLPARM_VTOP, "Bad address"},
{ERR_T_RECEIVE_MISMATCH, "Data Mismatch"},
{ERR_T_DMA_NOCHAN, "No DMA channel"},
{ERR_T_DEV_PRESENT, "Device still present"},
{ERR_T_DEV_NO_WRITE_PRO, "Device not write protected"},
{ERR_T_RECEIVE_SHORT, "Received packet too short"},
{ERR_T_RECEIVE_NOINT, "No Rx Interrupt was received"},
{ERR_T_BMP, "BMP file error"},
{ERR_T_NOTRANSFER, "No free transfer descriptors"},
{ERR_T_EPHALTED, "Endpoint halted"},
{ERR_T_NOBUFFER, "No free buffer"},
{ERR_T_MAXPACKETSIZE, "Bad max packet size"},
{ERR_T_BADLCDDETECT, "LCD Type not detected"},
{ERR_T_PROGRESS, "Unknown error"}
};
/*
*******************************************************************************
EXTERNAL REFERENCES
*******************************************************************************
*/
/*
*******************************************************************************
* LOCAL DEFINITIONS
*******************************************************************************
*/
static ErrorRecord_T ErrorList[MAX_STORED_ERRORS]; //array of error structures
static XLLP_UINT32_T RecordCount = 0; // the current error record count
static void XllpUtilityTrapFatalError(XLLP_UINT32_T);
static void XllpUtilityErrorPrint (XLLP_INT32_T, XLLP_UINT32_T,
XLLP_UINT32_T, XLLP_UINT32_T, XLLP_UINT32_T);
/*
*******************************************************************************
*
* FUNCTION: XllpUtilityErrorRecord
*
* DESCRIPTION: Stores a record of an error with additional information
* if present. Current implementation is to just store
* this information in RAM. Uses interrupt protection.
*
* INPUT PARAMETERS: code - The constructed error code
* param1 - additional data
* param2 - additional data
* param3 - additional data
*
* RETURNS: None
*
* GLOBAL EFFECTS: None
*
* ASSUMPTIONS: None
*
*******************************************************************************
*/
void XllpUtilityErrorRecord (XLLP_UINT32_T code, XLLP_UINT32_T param1,
XLLP_UINT32_T param2, XLLP_UINT32_T param3)
{
// Record errors while there is room, then stop without telling anybody.
// Use interrupt protection because the ErrorList might be manipualated
// in ISRs.
XLLP_UINT32_T irqIntState;
irqIntState = XsIcDisableInterruptsIrq(); // Begin atomic zone.
if ( RecordCount < MAX_STORED_ERRORS)
{
ErrorList[RecordCount].errorCode = code;
ErrorList[RecordCount].param_1 = param1;
ErrorList[RecordCount].param_2 = param2;
ErrorList[RecordCount].param_3 = param3;
RecordCount++;
}
XsIcRestoreInterruptsIrq (irqIntState); // End atomic zone.
// trap to an LED code generator if the error has a fatal classification
if (code & ERR_T_FATAL_BASE)
{
XllpUtilityTrapFatalError(code);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -