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

📄 dm_errors.c

📁 pxa270触摸屏驱动程序
💻 C
📖 第 1 页 / 共 2 页
字号:

} // XllpUtilityErrorRecord()

/*
*******************************************************************************
*
* FUNCTION:         XllpUtilityClearErrors
*
* DESCRIPTION:      Clears the stored errors and resets the counter under 
*                   interrupt protection.
*
* INPUT PARAMETERS: Unused, but meet syntax requirements of command list
*
* RETURNS:          void
*
* GLOBAL EFFECTS:   All errors are cleared from memory
*
* ASSUMPTIONS:      None
*
* PROTOTYPE:        VOID DM_ClearErrors (PVOID, PCHAR);
*
*******************************************************************************
*/
VOID XllpUtilityClearErrors (void* argP, P_XLLP_INT8_T paramP)
{
    // Use interrupt protection because the ErrorList might be manipualated 
    //  in ISRs.
    XLLP_UINT32_T irqIntState;
    irqIntState = XsIcDisableInterruptsIrq();       // Begin atomic zone.

    // Use fastest implementation because interrupts are disabled.
    memset (&ErrorList[0], 0, sizeof (ErrorList));

    // reset the global count
    RecordCount = 0;

    XsIcRestoreInterruptsIrq (irqIntState);         // End atomic zone.
} // XllpUtilityClearErrors ()

/*
*******************************************************************************
*
* FUNCTION:         XllpUtilityDumpErrors
*
* DESCRIPTION:      Dumps all of the stored errors to the output device.
*                   in the order in which they were stored.
*
* INPUT PARAMETERS: Unused, but meet syntax requirements of command list
*
* RETURNS:          void
*
* GLOBAL EFFECTS:   void
*
* ASSUMPTIONS:      None
*
* CALLS:            DM_PrintError
*
* CALLED BY:        Anyone
*
* PROTOTYPE:        void XllpUtilityDumpErrors (void*, P_XLLP_INT8_T);
*
*******************************************************************************
*/

void XllpUtilityDumpErrors (void* argP, P_XLLP_INT8_T paramP)
{
    XLLP_UINT32_T i;
    XLLP_INT32_T recordCountTmp = RecordCount;

    if (recordCountTmp)
    {
        printf ("   %d errors logged. Format (hex):\r\n", (int)recordCountTmp);
        printf ("Err Num (dec): Loc-Subloc-S2-Type;   Param1;   Param2;  Param3\r\n");

        for (i = 0; i < recordCountTmp ; i++)
        {
            XllpUtilityErrorPrint ( i,
                            ErrorList[i].errorCode,
                            ErrorList[i].param_1, 
                            ErrorList[i].param_2,
                            ErrorList[i].param_3);
        } 
    }
    else
    {
        printf (" No errors logged\r\n");
    }

} // XllpUtilityDumpErrors ()


/*
*******************************************************************************
*
* FUNCTION:         XllpUtilityErrorPrint
*
* DESCRIPTION:      Sends a formatted error record to the output
*
* INPUT PARAMETERS: The elements of the error structure
*
* RETURNS:          void
*
* GLOBAL EFFECTS:   May clear the display
*
* ASSUMPTIONS:      None
*
*******************************************************************************
*/

static void XllpUtilityErrorPrint (XLLP_INT32_T errIndex,
                                    XLLP_UINT32_T error, 
                                    XLLP_UINT32_T param1, 
                                    XLLP_UINT32_T param2, 
                                    XLLP_UINT32_T param3)
{

    // Format: Err Num (dec): Location-Sublocation-Type; Param1; Param2; Param3
    printf ("     %2d:       %02X - %02X -  %01X - %03X;  %08X; %08X; %08X\r\n",
               (int)errIndex,
               ((int)error & ERR_L_MASK ) >> ERR_L_SHIFT, 
               ((int)error & ERR_S_MASK ) >> ERR_S_SHIFT,
               ((int)error & ERR_S2_MASK) >> ERR_S2_SHIFT,
               (int)error & ERR_T_MASK,
               (int)param1,
               (int)param2,
               (int)param3);

} // XllpUtilityErrorPrint ()

/*
*******************************************************************************
*
* FUNCTION:         XllpUtilityTrapFatalError
*
* DESCRIPTION:      calls different blink codes for different errors depending 
*                   on the system type. Currently this routine only detects if
*                   a neponset board is attached and assumes Sandgate for the 
*                   primary board. 
*
* INPUT PARAMETERS: UINT32 - the error type code
*
* RETURNS:          void
*
* GLOBAL EFFECTS:   traps the system in a loop where there is no escape
*
* ASSUMPTIONS:      This routine is only called in extreme cases.
*
* CALLS:            LED control functions and system identifiers
*
* CALLED BY:        XllpUtilityErrorRecord
*
* PROTOTYPE:        static void XllpUtilityTrapFatalError(XLLP_UINT32_T code);
*
*******************************************************************************
*/
static
void XllpUtilityTrapFatalError (XLLP_UINT32_T code)
{
    XLLP_INT32_T major, minor;
    
    // strip off the location code for the major count
    major = code & ERR_L_MASK;
     
    // shift it down to bit 0 because the LedsDisplay is shifting it up.
    major = major >> ERR_L_SHIFT;
     
    // strip off the type for the minor count
    minor = code & ERR_T_MASK;
     
    // clip off the high order bit to keep the count manageable
    minor = minor & ~ERR_T_FATAL_BASE; 
    
    WriteHexLedsHalfs(major, minor);    
    
} // XllpUtilityTrapFatalError()

/*
*******************************************************************************
*
* MACRO:            XllpUtilityOutputError
*
* DESCRIPTION:      Constructs an error integer and stores it in the provided
*                   location. A call to DMErrorRecord is made with the
*                   constructed error code
*
* INPUT PARAMETERS: 
*   XLLP_UINT32_T error - error code, UINT32 required.
*
* RETURNS:          None
*
* GLOBAL EFFECTS:   None
*
* ASSUMPTIONS:      Should be called from within the driver function
*
*******************************************************************************
*/
void XllpUtilityOutputError (XLLP_UINT32_T error)
{
    P_XLLP_INT8_T deviceLocStrn = NULL;
    P_XLLP_INT8_T typeStrn = NULL;
    XLLP_UINT32_T i, deviceLoc, type;
        
    // Get a device location and an error type from the error code
    deviceLoc = ERR_L(error);
    type = ERR_T(error);

    // Find the device from the list of the devices and get the string
    for (i = 0; ErrorDeviceLocList[i].errorCode != ERR_L_UNKNOWN; i++)
    {
        if (ErrorDeviceLocList[i].errorCode == deviceLoc) break;
    }
    deviceLocStrn = ErrorDeviceLocList[i].string;

    // Find the type of the error from the error types list and get the string
    for (i = 0; ErrorTypeList[i].errorCode != ERR_T_PROGRESS; i++)
    {
        if (ErrorTypeList[i].errorCode == type) break;
    }
    typeStrn = ErrorTypeList[i].string;

    // Print error code message
    printf(" Error! %08x\r\n", (int)error); 

    // Print the device name part of the error message
    printf(" %s\r\n", deviceLocStrn);

    // Print the error type part of the error message
    printf(" %s!\r\n", typeStrn);

    // Display error code on the HEX leds
    PlatformLeds(error);
}

⌨️ 快捷键说明

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