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

📄 zl5011xprinterror.c

📁 Zalink50114----TDMoIP芯片驱动源码
💻 C
字号:
/*******************************************************************************
*
*  File name:              zl5011xPrintError.c
*
*  Version:                7
*
*  Author:                 MRC
*
*  Date created:           03/05/2002
*
*  Copyright 2002, 2003, 2004, 2005, Zarlink Semiconductor Limited.
*  All rights reserved.
*
*  Module Description:
*
*  This is the header file for the error code handling functions.
*  It contains the function prototypes and any definitions.
*
*  Revision History:
*
*  Rev:  Date:       Author:  Comments:
*  1     03/05/2002  MRC      Creation
*  2     07/05/2002  MRC      Updated
*  3     13/06/2002  MRC      Added prefix to error code in print fn
*  4     19/12/2002  MRC      Tidied up.
*  5     13/01/2003  MRC      PrintError fn now uses TRACE
*  6     21/01/2003  MRC      Added include for PrintError header
*  7     20/01/2005  APL      Added alternative version of GetErrString
*
*******************************************************************************/

#include "zl5011x.h"
#include "zl5011xErrorString.h"
#include "zl5011xPrintError.h"

const char zl5011xStrErrorUnknown[] = "*** Unknown error code ***";

/*******************************************************************************

 Function:
    zl5011xGetErrString2

 Description:
   Takes an error code enum in and returns a string for that code.

 Inputs:
   status   Error code to use

 Outputs:

 Returns:
  pointer to an error string

 Remarks:
   None

*******************************************************************************/

const char * zl5011xGetErrString2(zlStatusE status)
{
   Uint32T  loop;

   for (loop = 0; loop < (sizeof(zlError) / sizeof(zlErrorStringsS)); loop++)
   {
      if (zlError[loop].code == status)
      {
         return zlError[loop].text;
      }
   }
   return zl5011xStrErrorUnknown;
}

/*******************************************************************************

 Function:
    zl5011xGetErrString

 Description:
   Takes an error code enum in and returns a string for that code.

 Inputs:
   status   Error code to use

 Outputs:
   buf      pointer to a buffer to copy the error string into

 Returns:
   Nothing

 Remarks:
   None

*******************************************************************************/

void zl5011xGetErrString(zlStatusE status, char *buf)
{
   strcpy(buf, zl5011xGetErrString2(status));
}

/*******************************************************************************

 Function:
    zl5011xPrintErr

 Description:
   Takes an error code and prints the string representation to the standard
   output

 Inputs:
   status   Error code to use

 Outputs:
   None

 Returns:
  zlStatusE

 Remarks:
   None

*******************************************************************************/

void zl5011xPrintErr(zlStatusE status)
{
   if (status != ZL5011X_OK)
   {
      ZL5011X_TRACE(ZL5011X_ERR_FN_ID, "ERROR-API = %s (%d)",
            (Uint32T)zl5011xGetErrString2(status), status, 0, 0, 0, 0);
   }
}

⌨️ 快捷键说明

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