tcp_errs.c
来自「mcf5307实验源代码」· C语言 代码 · 共 387 行 · 第 1/2 页
C
387 行
/****************************************************************************/
/* */
/* CopyrIght (c) 1993 - 1996 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 inplicitly */
/* accepts the terms of the license. */
/* */
/****************************************************************************/
/****************************************************************************/
/* FILE NAME VERSION */
/* */
/* TCP_ERRS.C 3.2 */
/* */
/* COMPONENT */
/* All the routines in this file are used for the TCP/IP, Nucleus */
/* interface. They will handle all the processing, storing, and query */
/* for any error codes generated by the TCP/IP modules. */
/* */
/* DESCRIPTION */
/* */
/* This file will hold all the Nukelus routines for handling the of the TCP */
/* errors. These routines are supplied by us for handling internal errors */
/* generated by the TCP/IP code. */
/* */
/* AUTHOR */
/* */
/* Craig L. Meredith */
/* */
/* DATA STRUCTURES */
/* */
/* struct TCP_IP_ERR : Holds the error information. */
/* struct TCP_MSG_STR : Holds the error number and a pointer to the str. */
/* */
/* FUNCTIONS */
/* void NU_Tcp_Log_Error (uint16 err_num, uint8 stat */
/* uint8 *file, uint16 line); */
/* void NU_Tcp_Clear_All_Errors (); */
/* unit8 *NU_Tcp_Error_String (uint16 error_number); */
/* */
/* DEPENDENCIES */
/* */
/* None. */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* Maiqi Qian 12/06/96 Fixed the time wrap around (spr0229) */
/* */
/****************************************************************************/
#ifdef PLUS
#include "nucleus.h"
#else
#include "nu_defs.h" /* added during ATI mods - 10/20/92, bgh */
#include "nu_extr.h"
#endif
#include "tcp.h"
#include "tcp_errs.h"
#include "tcpdefs.h"
#include "externs.h"
/* Setup and init the TCP_Avail_Index value at compile time */
int16 TCP_Avail_Index = -1;
/* Allocate the space for the error array */
struct TCP_IP_ERR NU_Tcp_Err_List [MAX_TCP_ERRORS];
/****************************************************************************/
/* FUNCTION */
/* NU_Tcp_Log_Error () */
/* */
/* DESCRIPTION */
/* This routine will handle storing the current error number into the */
/* error structure. The current port number, task id, socket number, */
/* and current system time into the structure. This routine will handle */
/* searching for the next available location, set the next location to */
/* avail, and then set its own location to TRUE for being used. The data */
/* will then be stored into the structure. */
/* */
/* AUTHOR */
/* */
/* Craig L. Meredith */
/* */
/* CALLED BY */
/* */
/* many functions */
/* */
/* CALLS */
/* NU_Request_Resource () */
/* NU_Release_Resource () */
/* NU_Real_Time () */
/* NU_Current_Task_ID () */
/* */
/* INPUTS */
/* uint16 err_num : Error number to store. */
/* uint8 stat : Status flag to store for error severity. */
/* uint8 *file : Pointer to the current filename in which the error */
/* happened. */
/* uint16 line : Line number in the file where the error happened. */
/* */
/* OUTPUTS */
/* Load passed in and calculated information into the NU_Tcp_Err_List */
/* array, and also will update the value of the TCP_Avail_Index. */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* */
/****************************************************************************/
void NU_Tcp_Log_Error (uint16 err_num, uint8 stat, int8 *file, uint16 line)
{
int16 i;
struct TCP_IP_ERR *err_list_ptr;
#ifdef PRINT_ERROR_MSG
printf("ERROR - number: %d status: %d file: %s line: %d\n\r", err_num,
stat, file, line);
#endif
/* check for this is the first time an error has been called */
if (TCP_Avail_Index == -1)
{
/* start at the first location */
TCP_Avail_Index = 0;
}
/* load the needed information into the current array location */
err_list_ptr = &NU_Tcp_Err_List [TCP_Avail_Index];
/* get the current port id number and store it */
err_list_ptr->tie_port_num = 0;
/* get the currently running task id */
#ifdef PLUS
err_list_ptr->tie_task_id = NU_Current_Task_Pointer ();
#else
err_list_ptr->tie_task_id = NU_Current_Task_ID ();
#endif
/* get the current socket number */
err_list_ptr->tie_sock_num = 0;
/* store the passed in error number */
err_list_ptr->tie_err_num = err_num;
/* store the passed in status for this error */
err_list_ptr->tie_err_stat = stat;
/* store the current system time */
err_list_ptr->tie_err_time = n_clicks();
/* store the passed in filename where the error occurred */
for (i = 0; ((i < MAX_TCP_FILENAME) && (file != (int8 *)NU_NULL)); i++)
{
err_list_ptr->tie_file [i] = (uint8)*file++;
}
/* store the passed in line number where the error occured */
err_list_ptr->tie_line_num = line;
/* increment the global index forward and handle the wrap */
TCP_Avail_Index = (TCP_Avail_Index + 1) % MAX_TCP_ERRORS;
} /* end NU_Tcp_Log_Error */
/****************************************************************************/
/* FUNCTION */
/* NU_Tcp_Clear_All_Errors () */
/* */
/* DESCRIPTION */
/* This routine will reset the NU_Tcp_Err_Index value back to -1, which */
/* will in effect, clear all the current errors from the NU_Tcp_Err_List */
/* array. */
/* */
/* AUTHOR */
/* */
/* Craig L. Meredith */
/* */
/* CALLED BY */
/* */
/* */
/* CALLS */
/* NU_Request_Resource () */
/* NU_Release_Resource () */
/* */
/* INPUTS */
/* None. */
/* */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?