param.h

来自「eCos操作系统源码」· C头文件 代码 · 共 1,048 行 · 第 1/3 页

H
1,048
字号
#define udb cyg_udb#define udbinfo cyg_udbinfo#define udp_ip6 cyg_udp_ip6#define udpstat cyg_udpstat#endif// Symbols from the BSD_CRYPTO package// TEXT symbols#define SHA256_Data cyg_SHA256_Data#define SHA256_End cyg_SHA256_End#define SHA256_Final cyg_SHA256_Final#define SHA256_Init cyg_SHA256_Init#define SHA256_Transform cyg_SHA256_Transform#define SHA256_Update cyg_SHA256_Update#define SHA384_Data cyg_SHA384_Data#define SHA384_End cyg_SHA384_End#define SHA384_Final cyg_SHA384_Final#define SHA384_Init cyg_SHA384_Init#define SHA384_Update cyg_SHA384_Update#define SHA512_Data cyg_SHA512_Data#define SHA512_End cyg_SHA512_End#define SHA512_Final cyg_SHA512_Final#define SHA512_Init cyg_SHA512_Init#define SHA512_Last cyg_SHA512_Last#define SHA512_Transform cyg_SHA512_Transform#define SHA512_Update cyg_SHA512_Update#define md5_init cyg_md5_init#define md5_loop cyg_md5_loop#define md5_pad cyg_md5_pad#define md5_result cyg_md5_result#define sha1_init cyg_sha1_init#define sha1_loop cyg_sha1_loop#define sha1_pad cyg_sha1_pad#define sha1_result cyg_sha1_result#define cast128_decrypt_round12 cyg_cast128_decrypt_round12#define cast128_decrypt_round16 cyg_cast128_decrypt_round16#define cast128_encrypt_round12 cyg_cast128_encrypt_round12#define cast128_encrypt_round16 cyg_cast128_encrypt_round16#define set_cast128_subkey cyg_set_cast128_subkey#define twofish_TableOp cyg_twofish_TableOp#define twofish_blockDecrypt cyg_twofish_blockDecrypt#define twofish_blockEncrypt cyg_twofish_blockEncrypt#define twofish_cipherInit cyg_twofish_cipherInit#define twofish_makeKey cyg_twofish_makeKey#define twofish_reKey cyg_twofish_reKey#define rijndaelDecrypt cyg_rijndaelDecrypt#define rijndaelEncrypt cyg_rijndaelEncrypt#define rijndaelKeyEncToDec cyg_rijndaelKeyEncToDec#define rijndaelKeySched cyg_rijndaelKeySched#define rijndael_blockDecrypt cyg_rijndael_blockDecrypt#define rijndael_blockEncrypt cyg_rijndael_blockEncrypt#define rijndael_cipherInit cyg_rijndael_cipherInit#define rijndael_makeKey cyg_rijndael_makeKey#define rijndael_padDecrypt cyg_rijndael_padDecrypt#define rijndael_padEncrypt cyg_rijndael_padEncrypt// Data symbols#define numRounds cyg_numRounds// BSS symbols#include <pkgconf/net.h>#include <cyg/infra/cyg_type.h>  // Standard eCos types#define __P(protos) protos#if defined(__cplusplus)#define __BEGIN_DECLS   extern "C" {#define __END_DECLS     };#else#define __BEGIN_DECLS#define __END_DECLS#endif#include <sys/types.h>#include <sys/endian.h>#include <errno.h>#ifdef _KERNEL// External [common] variablesextern int hz;extern volatile struct timeval ktime;#define time_second ktime.tv_secextern int tick;extern int proc0;#define curproc 0extern void microtime(struct timeval *tp);extern void getmicrotime(struct timeval *tp);extern void getmicrouptime(struct timeval *tp);extern int  tvtohz(struct timeval *tv);extern int  arc4random(void);// Function mappingsextern int  cyg_ticks(void);#define ticks cyg_ticks()extern int  cyg_tsleep(void *, int, char *, int);extern void cyg_wakeup(void *);#define tsleep(e,p,w,t) cyg_tsleep(e,0,w,t)#define wakeup(e)       cyg_wakeup(e)#define wakeup_one(e)   cyg_wakeup(e)#ifdef CYGIMPL_TRACE_SPLX   extern cyg_uint32  cyg_splimp(const char *file, const int line);extern cyg_uint32  cyg_splnet(const char *file, const int line);extern cyg_uint32  cyg_splclock(const char *file, const int line);extern cyg_uint32  cyg_splsoftnet(const char *file, const int line);extern void        cyg_splx(cyg_uint32, const char *file, const int line);#define splimp()   cyg_splimp(__FUNCTION__, __LINE__)#define splnet()   cyg_splnet(__FUNCTION__, __LINE__)#define splclock() cyg_splclock(__FUNCTION__, __LINE__)#define splsoftnet() cyg_splsoftnet(__FUNCTION__, __LINE__)#define splx(x)    cyg_splx(x, __FUNCTION__, __LINE__)#define cyg_scheduler_lock() _cyg_scheduler_lock(__FUNCTION__, __LINE__)#define cyg_scheduler_safe_lock() _cyg_scheduler_safe_lock(__FUNCTION__, __LINE__)#define cyg_scheduler_unlock() _cyg_scheduler_unlock(__FUNCTION__, __LINE__)#elseextern cyg_uint32  cyg_splimp(void);extern cyg_uint32  cyg_splnet(void);extern cyg_uint32  cyg_splclock(void);extern cyg_uint32  cyg_splsoftnet(void);extern cyg_uint32  cyg_splhigh(void);extern void        cyg_splx(cyg_uint32);#define splimp     cyg_splimp#define splnet     cyg_splnet#define splclock   cyg_splclock#define splsoftnet cyg_splsoftnet#define splhigh    cyg_splhigh#define splx       cyg_splx#endifextern void cyg_panic(const char *msg, ...);#define panic cyg_panic/* * Constants related to network buffer management. * MCLBYTES must be no larger than CLBYTES (the software page size), and, * on machines that exchange pages of input or output buffers with mbuf * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple * of the hardware page size. */#define MSIZE           128             /* size of an mbuf */#define MCLSHIFT        11              /* convert bytes to m_buf clusters */#define MCLBYTES        (1 << MCLSHIFT) /* size of a m_buf cluster */#define MCLOFSET        (MCLBYTES - 1)  /* offset within a m_buf cluster */#define CLBYTES         4096            /* size of actual cluster */#define PAGE_SIZE       CLBYTES/* * Round p (pointer or byte index) up to a correctly-aligned value * for all data types (int, long, ...).   The result is u_int and * must be cast to any desired pointer type. */#define ALIGNBYTES      (sizeof(int) - 1)#define ALIGN(p)        (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)// These symbols are used in the IPV6 stuff// (be more defensive about external setup)#undef __linux__   #undef __bsdi__    #undef __FreeBSD__ #undef __OpenBSD__ #undef __NetBSD__  #define __FreeBSD__       4#define __FreeBSD_version 440000// TEMP#include <cyg/infra/diag.h>#include <cyg/hal/hal_intr.h>#include <cyg/kernel/kapi.h>#include <cyg/io/file.h>struct net_stats {    int              count;    cyg_uint32       min_time, max_time, total_time;};#ifdef CYGDBG_NET_TIMING_STATS#define START_STATS()                                   \    cyg_uint32 start_time, end_time, elapsed_time;      \    HAL_CLOCK_READ(&start_time);#define FINISH_STATS(stats)                                                             \    HAL_CLOCK_READ(&end_time);                                                          \    if (end_time < start_time) {                                                        \        elapsed_time = (end_time+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - start_time;       \    } else {                                                                            \        elapsed_time = end_time - start_time;                                           \    }                                                                                   \    if (stats.min_time == 0) {                                                          \        stats.min_time = 0x7FFFFFFF;                                                    \    }                                                                                   \    if (elapsed_time < stats.min_time)                                                  \        stats.min_time = elapsed_time;                                                  \    if (elapsed_time > stats.max_time)                                                  \        stats.max_time = elapsed_time;                                                  \    stats.total_time += elapsed_time;                                                   \    stats.count++;#else#define START_STATS() #define FINISH_STATS(X)#endif// TEMP// timeout supporttypedef void (timeout_fun)(void *);typedef struct callout {    struct callout *next, *prev;    cyg_int32     delta;  // Number of "ticks" in the future for this timeout    timeout_fun  *fun;    // Function to execute when it expires    void         *arg;    // Argument to pass when it does    int           flags;  // Info about this item} timeout_entry;#define CALLOUT_LOCAL    0x0001#define CALLOUT_ACTIVE   0x0002#define CALLOUT_PENDING  0x0004extern cyg_uint32 timeout(timeout_fun *fun, void *arg, cyg_int32 delta);extern void untimeout(timeout_fun *fun, void *arg);extern void callout_init(struct callout *);extern void callout_reset(struct callout *, int, timeout_fun *, void *);extern void callout_stop(struct callout *);extern int  callout_active(struct callout *);extern void callout_deactivate(struct callout *);extern int  callout_pending(struct callout *);extern int uiomove(caddr_t cp, int n, struct uio *uio);extern int copyout(const void *s, void *d, size_t len);extern int copyin(const void *s, void *d, size_t len);extern void ovbcopy(const void *s, void *d, size_t len);extern void get_mono_time(void);extern int arc4random(void);extern void get_random_bytes(void *buf, size_t len);extern void read_random(void *buf, size_t len);extern int read_random_unlimited(void *buf, size_t len);extern void *hashinit(int elements, void *type, u_long *hashmask);// Initialization support - cross between RedBoot & FreeBSDtypedef void _init_fun(void *);typedef _init_fun *_init_fun_ptr;struct init_tab_entry {    _init_fun_ptr fun;    void *data;    char *name;} CYG_HAL_TABLE_TYPE;#define _cat(a,b) a##b#define __Net_init(_p1_,_p2_,_f_,_d_)                                    \struct init_tab_entry _cat(_net_init_tab,_p1_##_p2_##_f_) \  CYG_HAL_TABLE_QUALIFIED_ENTRY(_Net_inits,_p1_##_p2_##_f_) = { (_init_fun_ptr) _f_, _d_, #_f_ }; #define _Net_init(_p1_,_p2_,_f_,_d_)                                    \        __Net_init(_p1_,_p2_,_f_,_d_)                                    #define SI_ORDER_FIRST  000000#define SI_ORDER_SECOND 000001#define SI_ORDER_THIRD  000002#define SI_ORDER_MIDDLE 080000#define SI_ORDER_ANY    FFFFFF#define SI_SUB_MBUF         0x50#define SI_SUB_DEVICES      0x60#define SI_SUB_PSEUDO       0x70#define SI_SUB_PROTO_IF     0x84#define SI_SUB_PROTO_DOMAIN 0x88#define SYSINIT(label, group, order, fun, ident) \  _Net_init(_cat(group,order), label, fun, ident)#define PSEUDO_SET(fun, sys) \  SYSINIT(sys, SI_SUB_PSEUDO, SI_ORDER_FIRST, fun, NULL)// VM zone stuff#define ZONE_INTERRUPT  1typedef struct _elem {    struct _elem *next;} elem;typedef struct vm_zone {    char *name;    int   elem_size, free, total;    int   alloc_tries, alloc_fails, alloc_frees;    elem *pool;    struct vm_zone *next;} *vm_zone_t;vm_zone_t zinit(char *name, int size, int nentries, int flags, int zalloc);void *    zalloci(vm_zone_t z);void      zfreei(vm_zone_t z, void *item);// Function mapping#define printf     diag_printf#define sprintf    diag_sprintf#define snprintf   diag_snprintf// Missing standard functionsstatic __inline int imax(int a, int b) { return (a > b ? a : b); }static __inline int imin(int a, int b) { return (a < b ? a : b); }static __inline long lmax(long a, long b) { return (a > b ? a : b); }static __inline long lmin(long a, long b) { return (a < b ? a : b); }static __inline u_int max(u_int a, u_int b) { return (a > b ? a : b); }static __inline u_int min(u_int a, u_int b) { return (a < b ? a : b); }static __inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); }static __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); }static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); }static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); }// Align a value to a natural multiple (4)#define _ALIGN(n) (((n)+3)&~3)  // Is this right?// Round a number 'n' up to a multiple of 'm'#define roundup(n,m) ((((n)+((m)-1))/(m))*(m))#define NEW_STRUCT_ROUTEextern char *hostname;// Logging facilities#ifdef CYGPKG_NET_FREEBSD_LOGGINGextern int cyg_net_log_mask;#define LOG_ERR      0x0001#define LOG_WARNING  0x0002#define LOG_NOTICE   0x0004#define LOG_INFO     0x0008#define LOG_DEBUG    0x0010#define LOG_MDEBUG   0x0020#define LOG_IOCTL    0x0040#define LOG_ADDR     0x0100#define LOG_FAIL     0x0200#define LOG_INIT     0x0080#define LOG_EMERG    0x4000#define LOG_CRIT     0x8000#define log(lvl, args...) \do { if (cyg_net_log_mask & lvl) diag_printf(args); } while (0)#define log_dump(lvl, buf, len) \do { if (cyg_net_log_mask & lvl) diag_dump_buf(buf, len); } while (0)#define log_(lvl) \if (cyg_net_log_mask & lvl)#else#define log(lvl, args...) #define log_dump(lvl, buf, len)#define log_(lvl)#endif#endif // _KERNELint extern cyg_arc4random(void);#endif //_SYS_PARAM_H_

⌨️ 快捷键说明

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