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

📄 ccdep.h

📁 用于嵌入式系统的TCP/IP协议栈及若干服务
💻 H
📖 第 1 页 / 共 2 页
字号:
/**            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: 2001/09/20 10:19:16 $*  $Source: M:/psisrc/stack/incl/rcs/ccdep.h $*  $Revision: 1.30 $***************************************************************************                         - Revision Log -                              ** Who   When        Why** FND   01/09/02    Convert i16, u16, i32, etc. to typdefs.****************************************************************************  File Description:  C compiler dependent definitions***************************************************************************/#ifndef _CCDEP_#define _CCDEP_#include "config.h"/* 'register' storage class macro */#ifndef NOT_FUSION_SOURCE /* Hack until we get rid of fast in all Fusion source */#ifdef  NO_FAST#define fast    /**/#else#define fast    register#endif#endif /* NOT_FUSION_SOURCE *//* structure assignment macro */#ifdef  NO_STASS    /*    #define stass(d,s)  memcpy((char *)&(d), (char *)&(s), sizeof(s))    */    #define stass(d,s)  OS_MOVE_N((char *)&(d), (char *)&(s), sizeof(s) )#else    #define stass(d,s)  ((d) = (s))#endif#define local   static  /* global 'static' storage class macro */#define pflocal local  /* Legacy *//* for compilers that can't deal with unsigned char's  ----- */#ifdef  NO_UCHARtypedef char  u8;#elsetypedef unsigned char  u8;#endif/* 'void' type macro */#ifdef  NO_VOID#define void    int#endif#define I32_SHIFT       2/* primitive types for machines w/ 32-bit 'int's */#ifdef  INT_32typedef signed   short  i16;typedef signed   long   i32;typedef unsigned short  u16;typedef unsigned long   u32;#define INT_SHIFT   2#endif/* primitive types for machines w/ 16-bit 'int's */#ifdef  INT_16typedef int         i16;typedef unsigned    u16;typedef long        i32;/* if no 'unsigned long', use 'long' */#ifdef  NO_ULONGtypedef long   u32;#elsetypedef unsigned long   u32;#endif#define INT_SHIFT   1#endif/* For routing code */typedef u32 rripa; /* fast register types */#ifdef  FAST16#define ifast   i16#define ufast   u16#else#define ifast   int#define ufast   unsigned#endif/* bit field macros, bit clear, set, true, false */#define bC1(v,f)    ((v) &= ~(f))#define bS1(v,f)    ((v) |= (f))#define bT1(v,f)    ((v) & (f))#define bF1(v,f)    (((v) & (f)) == 0)#ifdef  BITOPS#define bC2(v,f1,f2)    (bC1(v,f1), bC1(v,f2), v)#define bC3(v,f1,f2,f3) (bC1(v,f1), bC1(v,f2), bC1(v,f3), v)#define bS2(v,f1,f2)    (bS1(v,f1), bS1(v,f2), v)#define bS3(v,f1,f2,f3) (bS1(v,f1), bS1(v,f2), bS1(v,f3), v)#define bT2(v,f1,f2)    (bT1(v,f1) && bT1(v,f2))#define bT3(v,f1,f2,f3) (bT1(v,f1) && bT1(v,f2) && bT1(v,f3))#define bF2(v,f1,f2)    (bF1(v,f1) && bF1(v,f2))#define bF3(v,f1,f2,f3) (bF1(v,f1) && bF1(v,f2) && bF1(v,f3))#else   /*BITOPS*/#define bC2(v,f1,f2)    bC1(v, ((f1)|(f2)))#define bC3(v,f1,f2,f3) bC1(v, ((f1)|(f2)|(f3)))#define bS2(v,f1,f2)    bS1(v, ((f1)|(f2)))#define bS3(v,f1,f2,f3) bS1(v, ((f1)|(f2)|(f3)))#define bT2(v,f1,f2)    (((v) & ((f1)|(f2))) == ((f1)|(f2)))#define bT3(v,f1,f2,f3) (((v) & ((f1)|(f2)|(f3))) == ((f1)|(f2)|(f3)))#define bF2(v,f1,f2)    bF1(v, ((f1)|(f2)))#define bF3(v,f1,f2,f3) bF1(v, ((f1)|(f2)|(f3)))#endif  /*BITOPS*//*************************************************************************                                                                       **                      6 Byte Memory to Memory Move                     **                                                                       *************************************************************************/#ifndef OS_MOVE_6 /* did customer define his own in config.h? */    #ifdef USE_DATA_MOVE_MACROS        #ifdef NONALIGNED_ACCESS             /* Processor allows non-aligned accesses */            #define OS_MOVE_6(d,s) \                   {\                    *((u32 *)(d)) = *((u32 *)(s));\                    *((u16 *)((u8 *)(d)+4)) = *((u16 *)((u8 *)(s)+4)); \                   }        #else            /* Processor does not allow non-aligned accesses */            #define OS_MOVE_6(d,s) \                   {\                    *((u8 *)(d)) = *((u8 *)(s));\                    *((u8 *)(d)+1) = *((u8 *)(s)+1);\                    *((u8 *)(d)+2) = *((u8 *)(s)+2);\                    *((u8 *)(d)+3) = *((u8 *)(s)+3);\                    *((u8 *)(d)+4) = *((u8 *)(s)+4);\                    *((u8 *)(d)+5) = *((u8 *)(s)+5); \                   }        #endif /* NONALIGNED_ACCESS */    #else        /* do not use data access macros, use function from 'generic.c' */        #define OS_MOVE_6(d,s) os_move_6((char *)d, (char *)s)        extern void os_move_6(char *, char *);    #endif /* USE_DATA_MOVE_MACROS */#endif/*************************************************************************                                                                       **                      4 Byte Memory to Memory Move                     **                                                                       *************************************************************************/#ifndef OS_MOVE_4 /* did customer define his own in config.h? */    #ifdef USE_DATA_MOVE_MACROS        #ifdef NONALIGNED_ACCESS            /* Processor allows non-aligned accesses */            #define OS_MOVE_4(d,s) *((u32 *)(d)) = *((u32 *)(s));        #else            /* Processor does not allow non-aligned accesses */            #define OS_MOVE_4(d,s) \                   {\                    *((u8 *)(d)) = *((u8 *)(s));\                    *((u8 *)(d)+1) = *((u8 *)(s)+1);\                    *((u8 *)(d)+2) = *((u8 *)(s)+2);\                    *((u8 *)(d)+3) = *((u8 *)(s)+3); \                   }        #endif /* NONALIGNED_ACCESS */    #else        /* do not use data access macros, use function from 'generic.c' */        #define OS_MOVE_4(d,s) os_move_4((char *)d, (char *)s)        extern void os_move_4(char *, char *);    #endif /* USE_DATA_MOVE_MACROS */#endif/*************************************************************************                                                                       **                      2 Byte Memory to Memory Move                     **                                                                       *************************************************************************/#ifndef OS_MOVE_2 /* did customer define his own in config.h? */    #ifdef USE_DATA_MOVE_MACROS        #ifdef NONALIGNED_ACCESS            /* Processor allows non-aligned accesses */            #define OS_MOVE_2(d,s) *((u16 *)(d)) = *((u16 *)(s));        #else            /* Processor does not allow non-aligned accesses */            #define OS_MOVE_2(d,s) \                   {\                    *((u8 *)(d)) = *((u8 *)(s));\                    *((u8 *)(d)+1) = *((u8 *)(s)+1); \                   }        #endif /* NONALIGNED_ACCESS */    #else        /* do not use data access macros, use function from 'generic.c' */        #define OS_MOVE_2(d, s) os_move_2((char *)d, (char *)s)        extern void os_move_2(char *, char *);    #endif /* USE_DATA_MOVE_MACROS */#endif/*************************************************************************                                                                       **                      N Byte Memory to Memory Move                     **                                                                       *************************************************************************/#ifndef OS_MOVE_N    #ifdef USE_DATA_MOVE_MACROS        #ifdef NONALIGNED_ACCESS            /* Processor allows non-aligned accesses */            #define OS_MOVE_N(d,s,n) \                   {\                       register void *__os_move_d_ = (void *)(d);\                       register void *__os_move_s_ = (void *)(s);\                       register int __os_move_n_ = (int)(n);\                    if ( (__os_move_n_ = n >> 2) != 0 )\                    do {\                      *((u32 *)__os_move_d_) = *((u32 *)__os_move_s_);\                      __os_move_d_ = (void *)((u32)__os_move_d_ + (u32)4);\                      __os_move_s_ = (void *)((u32)__os_move_s_ + (u32)4);\                       }\                    while ( --__os_move_n_ );\                    if ( n & 2 )\                       {\                        *((u16 *)__os_move_d_) = *((u16 *)__os_move_s_);\                        __os_move_d_ = (void *)((u32)__os_move_d_ + (u32)2);\                        __os_move_s_ = (void *)((u32)__os_move_s_ + (u32)2);\                       }\                    if ( n & 1 )\                       *(u8 *)__os_move_d_ = *(u8 *)__os_move_s_;\                   }        #else            /* Processor does not allow non-aligned accesses */            #define OS_MOVE_N(d,s,n) \                   {\                    fast u8 *__os_move_d_ = (u8 *)(d);\                    fast u8 *__os_move_s_ = (u8 *)(s);\                    fast int __os_move_n_ = (int)(n);\                    if( n != 0 )\                    do {\                       *__os_move_d_++ = *__os_move_s_++;\                       }\                    while ( --__os_move_n_ );\                   }        #endif /* NONALIGNED_ACCESS */    #else        /* do not use data access macros, use function from 'generic.c' */        #define OS_MOVE_N(d, s, n ) os_move_n( d, s, n )        extern void os_move_n( char *d, char *s, int n );

⌨️ 快捷键说明

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