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

📄 ossys.c

📁 本软件是TI公司免费提供的网络开发包 现在好象很难找到,有黑心的公司把它改一改,就卖价5000元,对网络开发和网络驱动开发有参考价值
💻 C
字号:
/*
 *  Copyright 2006 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *
 *  @(#) TCP/IP_Network_Developers_Kit 1.91.00.08 08-22-2006 (ndk-a08)
 */
//--------------------------------------------------------------------------
// OS Demonstration Software
//--------------------------------------------------------------------------
// OsSys.c
//
// General System Functions
//
// This module is a bit of a catch-all for things that don't have
// another home.
//
// Author: Michael A. Denio
// Copyright 1999, 2000 by Texas Instruments Inc.
//-------------------------------------------------------------------------
#include <netmain.h>
#include <_oskern.h>
#include <ctype.h>

// Configuration
OSENVCFG _oscfg = { DEF_DBG_PRINT_LEVEL, DEF_DBG_ABORT_LEVEL,
                    OS_TASKPRILOW_DEF, OS_TASKPRINORM_DEF,
                    OS_TASKPRIHIGH_DEF, OS_TASKPRIKERN_DEF,
                    OS_TASKSTKLOW_DEF, OS_TASKSTKNORM_DEF,
                    OS_TASKSTKHIGH_DEF };

// Debug Log
#pragma DATA_SECTION(DebugLog, ".far:NDK_OBJMEM");
char DebugLog[LL_DEBUG_LOG_MAX];
int  DebugLogSize   = 0;
int  DebugCritError = 0;

#pragma DATA_SECTION(TempBuffer, ".far:NDK_OBJMEM");
static char TempBuffer[OS_PRINTFBUFFER];

//--------------------------------------------------------------------
// DbgPrintf()
//
// Print Debug Messages to Log
//--------------------------------------------------------------------
void DbgPrintf(uint Level, char *fmt, ... )
{
    uint Time, TimeMS, length;

    if( Level >= DBG_PRINT_LEVEL )
    {
        va_list arg_ptr;

        // Initial printf to temporary buffer
        va_start( arg_ptr, fmt );
        length = vsprintf( TempBuffer, fmt, arg_ptr );
        va_end( arg_ptr );

        // Get the log time
        Time = llTimerGetTime( &TimeMS ) - llTimerGetStartTime();

        // Log to screen
        printf( "%05d.%03d %s\n", Time, TimeMS, TempBuffer );

        // Log to debug buffer if it will fit - allow 16 chars for
        // the timestamp and \n
        if( (DebugLogSize+length) < (LL_DEBUG_LOG_MAX-16) )
            DebugLogSize += sprintf( DebugLog+DebugLogSize, "%05d.%03d %s\n",
                                     Time, TimeMS, TempBuffer );
    }

    if( Level >= DBG_ABORT_LEVEL )
        NC_NetStop(-1);
}

//--------------------------------------------------------------------
// Case insensitive string compare
//--------------------------------------------------------------------
int stricmp( char *s1, char *s2)
{
    for ( ; (tolower(*s1) == tolower(*s2)); s1++, s2++)
        if (*s1 == '\0') return(0);   // EOS
    //  Not equal
    return( *s1 - *s2 );
}

⌨️ 快捷键说明

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