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

📄 erc.c

📁 nuclues 内核源代码已经在arm7-9 上作了移植
💻 C
字号:
/*************************************************************************/
/*                                                                       */
/*        Copyright (c) 1993-2001 Accelerated Technology, Inc.           */
/*                                                                       */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the      */
/* subject matter of this material.  All manufacturing, reproduction,    */
/* use, and sales rights pertaining to this subject matter are governed  */
/* by the license agreement.  The recipient of this software implicitly  */
/* accepts the terms of the license.                                     */
/*                                                                       */
/*************************************************************************/

/*************************************************************************/
/*                                                                       */
/* FILE NAME                                            VERSION          */
/*                                                                       */
/*      erc.c                                           PLUS  1.13       */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      ER - Error Management                                            */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains the core routines for the Error management    */
/*      component.                                                       */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      Accelerated Technology, Inc.                                     */
/*                                                                       */
/* DATA STRUCTURES                                                       */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* FUNCTIONS                                                             */
/*                                                                       */
/*      ERC_System_Error                    System error function        */
/*                                                                       */
/* DEPENDENCIES                                                          */
/*                                                                       */
/*      tc_defs.h                           Thread control definitions   */
/*      er_extr.h                           Error handling functions     */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         DATE                    REMARKS                               */
/*                                                                       */
/*      03-01-1993      Created initial version 1.0                      */
/*      04-19-1993      Verified version 1.0                             */
/*      03-01-1994      Modified copyright notice,                       */
/*                      resulting in version 1.1                         */
/*                                                                       */
/*      03-18-1994      Verified version 1.1                             */
/*      04-17-1996      updated to version 1.2                           */
/*      03-24-1998      Released version 1.3.                            */
/*                                                                       */
/*************************************************************************/
#define         NU_SOURCE_FILE

#ifdef          NU_ERROR_STRING
#include        <stdio.h>                   /* Standard I/O functions    */
#endif
#include        "tc_defs.h"                 /* Thread control constants  */
#include        "er_extr.h"                 /* Error handling functions  */


/* Define external inner-component global data references.  */

extern  INT     ERD_Error_Code;

#ifdef          NU_ERROR_STRING
extern  CHAR    ERD_Error_String[];
#endif

/* Define direct access to a thread component variable.  */

extern  VOID   *TCD_Current_Thread;


/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      ERC_System_Error                                                 */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This function processes system errors detected by various        */
/*      system components.  Typically an error of this type is           */
/*      considered fatal.                                                */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      Accelerated Technology, Inc.                                     */
/*                                                                       */
/* CALLED BY                                                             */
/*                                                                       */
/*      Various Components                                               */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      error_code                          Code of detected system error*/
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         DATE                    REMARKS                               */
/*                                                                       */
/*      03-01-1993      Created initial version 1.0                      */
/*      04-19-1993      Verified version 1.0                             */
/*                                                                       */
/*************************************************************************/
VOID  ERC_System_Error(INT error_code)
{
#ifdef          NU_ERROR_STRING
INT     i;
CHAR   *pointer;
CHAR    name[NU_MAX_NAME+1];
#endif

    /* First place the error code into the global variable.  */
    ERD_Error_Code =  error_code;
    
#ifdef          NU_ERROR_STRING
    /* Build string that corresponds to the error.  */
    switch(error_code)
    {

    case        NU_ERROR_CREATING_TIMER_HISR:
    
        /* Build string that indicates an error occurred creating the timer
           HISR.  */
        sprintf(ERD_Error_String,"%s\n", "Error Creating Timer HISR");
        break;

    case        NU_ERROR_CREATING_TIMER_TASK:
    
        /* Build string that indicates an error occurred creating the timer
           Task.  */
        sprintf(ERD_Error_String,"%s\n", "Error Creating Timer Task");
        break;

    case        NU_STACK_OVERFLOW:
    
        /* Build string that indicates a stack overflow occurred.  */
        name[NU_MAX_NAME] =  (CHAR) 0;
        pointer =  (((TC_TCB *) TCD_Current_Thread) -> tc_name);
        for (i = 0; i < NU_MAX_NAME; i++)
            name[i] =  *pointer++;
        sprintf(ERD_Error_String,"%s %s\n", "Stack Overflow in task/HISR: ",
                                                                        name);
        break;

    
    case        NU_UNHANDLED_INTERRUPT:    

        /* Build string that indicates an error occurred because of an 
           unhandled interrupt.  */
        sprintf(ERD_Error_String,"%s\n", "Unhandled interrupt error");
        break;
    }
#endif

    /* This function cannot return, since the error is fatal.  */
    while(1)
    {
    }
}

⌨️ 快捷键说明

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