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

📄 std.h

📁 用于嵌入式系统的TCP/IP协议栈及若干服务
💻 H
字号:
/**            Copyright (c) 1998-2001 by NETsilicon Inc.**  This software is copyrighted by and is the sole property of*  NETsilicon.  All rights, title, ownership, or other interests*  in the software remain the property of NETsilicon.  This*  software may only be used in accordance with the corresponding*  license agreement.  Any unauthorized use, duplication, transmission,*  distribution, or disclosure of this software is expressly forbidden.**  This Copyright notice may not be removed or modified without prior*  written consent of NETsilicon.**  NETsilicon, reserves the right to modify this software*  without notice.**  NETsilicon*  411 Waverley Oaks Road                  USA 781.647.1234*  Suite 227                               http://www.netsilicon.com*  Waltham, MA 02452                       AmericaSales@netsilicon.com***************************************************************************  $Name: Fusion 6.52 Fusion 6.51 $*  $Date: 2002/01/15 15:19:30 $*  $Source: M:/psisrc/stack/incl/rcs/std.h $*  $Revision: 1.29 $***************************************************************************                         - Revision Log -                               ** Who   When        Why** FND   09/17/01    Definition of min, max, and abs disabled because of*                   conflicts with TCS C/C++ headers.****************************************************************************  File Description:  FUSION Generic standard include file***************************************************************************/#ifndef _STD_#define _STD_#include "config.h"#include "ccdep.h"/* Some things that used to be in config.h but are always required   and will eventually be deprecated in the code.*/#define ptr2u32(ptr)    ((u32)ptr)/* used on embedded systems only */#ifndef NULL#define NULL (void *)0#endif#define BUILTIN_TIMER /* Deprecated.  Related code to be removed in 5.x *//*************************************************************************/#define ARR_CNT(a)      (sizeof(a)/sizeof(a[0]))#define ARR_END(a)      (&a[ARR_CNT(a)])#define ARR_LAST(a)     (&a[ARR_CNT(a) - 1])#define SYS_ERR         (-1)#define ERR         (-1)/* pseudo keywords */#define boolean         int#define true            1#define false           0#define import          extern#define export#define OK          0#define fallthru#define skip#define forever         for(;;)/* if NO_ROUTER is not defined then IGMP_PROTOCOL should be */#if defined(RIP_PROTOCOL) || defined(OSPF_PROTOCOL)#ifndef IGMP_PROTOCOL#define IGMP_PROTOCOL /* need IGMP protocol for RIP */#endif#endif/* kernel pseudo keywords *//* When used with MOTOROLA define _savpri as 16 bit integer to store SR register.   For INTEL it should be 32 bit integer. */#ifndef use_critical#define use_critical        fast int _savpri#endif#ifndef criticalextern int os_critical(void);extern void os_normal(int savpri);#define critical        (_savpri = os_critical())#define normal          (os_normal(_savpri))#endif#define use_lcritical       use_critical    #define lcritical       critical    #define lnormal         normal  /* standard FUSION types */#ifdef __STDC__#define NO_FAST#endiftypedef int  ((*pf_t)(void * mp));typedef pf_t  ((*pfpf_t)(void * mp));typedef pfpf_t (*st)(void * mp);  /* ptr. to a state function */#ifndef odd#define odd(x)          ((x)&1)#endif#ifndef abs#ifdef __GNU__#define abs(i)  __builtin_abs(i)#else#if !defined(__cplusplus)#if __TCS_VERSION__>=300/*FIXTHIS it should be independent of compiler version. */#else#define abs(i)           ((i) < 0 ? -(i) : (i))#endif#endif#endif#endif#ifndef max#ifdef __GNU__#define max(a,b) \	({typedef _ta = (a), _tb = (b); \	_ta _a = (a); _tb _b = (b); \	_a > _b ? _a : _b; })#else#if !defined(__cplusplus)#define max(x,y)        ((x) >= (y) ? (x) : (y))#endif#endif#endif#ifndef min#ifdef __GNU__#define min(a,b) \	({typedef _ta = (a), _tb = (b); \	_ta _a = (a); _tb _b = (b); \	_a < _b ? _a : _b; })#else#if !defined(__cplusplus)#define min(x,y)        ((x) <= (y) ? (x) : (y))#endif#endif#endif#ifndef bound#ifdef __GNU__#define bound(a,b,c) \	({typedef _ta = (a), _tb = (b), _tc = (c); \	_ta _a = (a); _tb _b = (b); _tc _c = (c); \	_a < _b ? _b : _a < _c ? _a : _c; })#else#define bound(v,min,max)    ((v)<(min) ? (min) : (v)<(max) ? (v) : (max))#endif#endif#ifndef inbound#define inbound(v,min,max)  ((min)<=(v) && (v)<=(max))#endif#define cptostack(val, ptr) (*(ptr) = val)#define kpnewa(type, cnt) ((type *)h_calloc((i32)((cnt) * sizeof(type)), (int *)0, false))#define knewa(type, cnt) ((type *)h_alloc((i32)((cnt) * sizeof(type)), (int *)0, false))/* List of possible FUSION DEMO application tasks */#define UDP_SINK        1       /* UDP client sink */#define UDP_ECHO        2       /* UDP client echo */#define TCP_ECHO        3       /* TCP client echo */ #define TCP_SERV_ECHO   4       /* TCP server echo */#define TCP_SINK        5       /* TCP client sink */#define TCP_SERV_SINK   6       /* TCP server sink */#define UDP_SERV_ECHO   7       /* UDP server echo */#define UDP_SERV_SINK   8       /* UDP server sink */#define DO_TELNETD      9       /* Telnet daemon */#define TFTP_PUT        10      /* Tftp put */#define TFTP_GET        11      /* Tftp get */#define FTP_CLIENT_TEST 12      /* general ftp client test */#define FTP_SERVER_TEST 13      /* general ftp server test */#define RPC_CLIENT_TEST 14	/* some rpc client tests */#define RPC_SERVER_TEST 15	/* rpc server test *//* Some sanity checks */#if defined(OSPF_PROTOCOL) || defined(RIP_PROTOCOL)#if !defined(IP_ROUTER)#error You must define IP_ROUTER to use RIP or OSPF.#endif#endif /* OSPF_PROTOCOL or RIP_PROTOCOL is defined */#if defined(NAT_ROUTER)#if !defined(IP_ROUTER)#error You must have IP_ROUTER defined to use NAT_ROUTER.#endif#endif#ifdef CPU_IS_LITTLE_ENDIAN#ifdef CPU_IS_BIG_ENDIAN#error You must define only one of CPU_IS_BIG_ENDIAN or CPU_IS_LITTLE_ENDIAN#endif#else#ifndef CPU_IS_BIG_ENDIAN#error You must defined one and only one of CPU_IS_BIG_ENDIAN or CPU_IS_LITTLE_ENDIAN#endif /* ndef CPU_IS_BIG_ENDIAN */#endif /* CPU_IS_LITTLE_ENDIAN */#ifdef NO_TRANSMIT_Q#error NO_TRANSMIT_Q compiler symbol not used anymore. Please see Fusion porting guide.#endif/************************************************************************************//* If config.h has the RFC 1323 symbol defined, define all of the sybmols that cause*//* the RFC 1323 features to be compiled.                                            *//************************************************************************************/#ifdef TCP_RFC_1323 #ifndef TCP_WND_SCALE#define TCP_WND_SCALE#endif#ifndef TCP_RTTM#define TCP_RTTM#endif#ifndef TCP_PAWS#define TCP_PAWS#endif#ifndef TCP_TIMESTAMPS#define TCP_TIMESTAMPS#endif#endif /* TCP_RFC_1323 *//************************************************************************************//* Translate between config.h symbol names and internal symbol names */#ifdef TCP_RFC_2001#ifndef TCP_SS_CA_FRETR_FREC#define TCP_SS_CA_FRETR_FREC#endif#endif /* TCP_RFC_2001 */#ifdef TCP_RFC_2018#ifndef TCP_SELACK_ENHANCEMENTS#define TCP_SELACK_ENHANCEMENTS#endif#endif /* TCP_RFC_2018 */#ifdef TCP_RFC_1644#ifndef TCP_TRANSACTION_TCP#define TCP_TRANSACTION_TCP#endif#endif /* TCP_RFC_1644 *//* We need the code for the timestamps option if either the RTTM code or the PAWS code   is included */#ifndef TCP_TIMESTAMPS#if ( defined(TCP_RTTM) || defined(TCP_PAWS) )#define TCP_TIMESTAMPS#endif /* TCP_RTTM || TCP_PAWS */#endif /* TCP_TIMESTAMPS */#ifndef OS_SET_ERRNO#define OS_SET_ERRNO(e)#endif#ifndef OS_RAND/* A not-very-random (if used at system startup time) default */#define OS_RAND t_time#else/* prototype the function named in config.h */u32 OS_RAND;#endif#ifndef MAX_DEV_NAME#define MAX_DEV_NAME    16#endif#endif /*_STD_*/

⌨️ 快捷键说明

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