systm.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:3k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* systm.h - system header file */
  2. /* Copyright 1984 - 2001 Wind River Systems, Inc. */
  3. /*
  4.  * Copyright (c) 1982, 1986 Regents of the University of California.
  5.  * All rights reserved.  The Berkeley software License Agreement
  6.  * and the VxWorks Software License Agreement specify the terms and
  7.  * conditions for redistribution.
  8.  *
  9.  * @(#)systm.h 7.1 (Berkeley) 6/4/86
  10.  */
  11. /*
  12. modification history
  13. --------------------
  14. 01n,10oct01,rae  merge from truestack (VIRTUAL_STACK)
  15. 01m,28feb00,frf  Add SH4 support for T2
  16. 01m,04sep98,cdp  make ARM CPUs with ARM_THUMB==TRUE use portable routines.
  17. 01l,20sep97,tpr  added ARM to !PORTABLE list.
  18. 01k,22sep92,rrr  added support for c++
  19.                   updated copyright
  20. 02k,04oct91,rrr  passed through the ansification filter
  21.   -fixed #else and #endif
  22.   -changed copyright notice
  23. 02j,07mar91,ajm  ifdef'd out _remque, and _insque for mips compiler
  24. 02i,05oct90,shl  added copyright notice.
  25. 02h,20mar90,jcf  changed semTake operations to include timeout of WAIT_FOREVER.
  26. 02g,22jun88,dnw  name tweaks to spl macros.
  27.  added macros for ovbcopy(), copyin(), copyout(), and imin().
  28. 02f,04mar88,jcf  changed splSem to splSemId, and changed sem calls accordingly.
  29. 02e,27jan88,rdc  included taskLib.h instead of vxLib.h
  30. 02d,23jan88,rdc  changed names of processor level macros because of
  31.  size issues.
  32. 02c,08jan88,rdc  added processor level macros.
  33. 02b,28aug87,dnw  removed unnecessary stuff.
  34. 02a,03apr87,ecs  added header and copyright.
  35. */
  36. #ifndef __INCsystmh
  37. #define __INCsystmh
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. #include "vxWorks.h"
  42. #include "taskLib.h"
  43. #include "semLib.h"
  44. #ifdef VIRTUAL_STACK
  45. #include "netinet/vsLib.h"
  46. #endif
  47. #if ( defined(PORTABLE) || 
  48.       ( 
  49.         (CPU!=MC68020) && (CPU!=MC68040) && (CPU!=MC68060) && 
  50.         (CPU_FAMILY!=I80X86) && (CPU_FAMILY!=AM29XXX) && 
  51.         (CPU_FAMILY!=SH) && (CPU_FAMILY!=ARM) 
  52.       ) || 
  53.      ((CPU_FAMILY == ARM) && ARM_THUMB))
  54. #define unixLib_PORTABLE
  55. #define INCHKSUM_PORTABLE
  56. #endif /* defined(PORTABLE) || (CPU_FAMILY != MC680X0) */
  57. #ifndef VIRTUAL_STACK
  58. IMPORT SEM_ID splSemId;
  59. IMPORT int splTid;
  60. #endif
  61. /* casts to keep lint happy */
  62. #define insque(q,p)     _insque((caddr_t)q,(caddr_t)p)
  63. #define remque(q)       _remque((caddr_t)q)
  64. /* macros for Unix routines */
  65. #define ovbcopy bcopy /* overlapped buffer copy */
  66. #define copyout(from, to, len) (bcopy (from, to, len), OK)
  67. #define copyin(from, to, len) (bcopy (from, to, len), OK)
  68. #define imin(a,b) (((a) < (b)) ? (a) : (b)) /* interger min */
  69. #define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
  70. /* processor level macro -
  71.  * these are identical to the routines spl...() and can be used where
  72.  * speed is more important than code size.
  73.  */
  74. #define SPLNET() (((ULONG)taskIdCurrent == splTid) ?
  75.         1 : (semTake(splSemId, WAIT_FOREVER),  
  76.        splTid = (ULONG)taskIdCurrent, 0))
  77. #define SPLIMP() SPLNET()
  78. #define SPLX(x) if ((x) == 0) (splTid = 0, semGive (splSemId))
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif /* __INCsystmh */