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

VxWorks

开发平台:

C/C++

  1. /* smNetLib.h - VxWorks specific backplane driver header file */
  2. /* Copyright 1984-2002 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01m,03may02,mas  made pPkt volatile pointer in loanBuild() (SPR 68334)
  7. 01l,21mar02,vvv  added doc for copyFromMbufs (SPR #20787)
  8. 01k,02oct01,mas  added support for all 8 NETIF arguments in smNetAttach2 (4547)
  9. 01j,20aug96,vin  commented out do_protocol
  10. 01i,11aug93,jmm  Changed ioctl.h and socket.h to sys/ioctl.h and sys/socket.h
  11. 01h,22sep92,rrr  added support for c++
  12. 01g,27jul92,elh  Added smNetShowInit.
  13. 01f,15jun92,elh  changed parameter to smNetInetGet.
  14. 01e,02jun92,elh  the tree shuffle
  15. 01d,27may92,elh  Incorperated the changes caused from restructuring the
  16.  shared memory libraries.  Renamed from smVxLib.h
  17. 01c,02may92,elh  added mask to smNetInit
  18. 01b,10apr92,elh  added startAddr for sequential addressing.
  19. 01a,17nov90,elh  written.
  20. */
  21. #ifndef __INCsmNetLibh
  22. #define __INCsmNetLibh
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* includes */
  27. #include "vxWorks.h"
  28. #include "net/mbuf.h"
  29. #include "net/if.h"
  30. #include "netinet/in.h"
  31. #include "netinet/in_var.h"
  32. #include "netinet/if_ether.h"
  33. #include "if_sm.h"
  34. #include "errno.h"
  35. #include "sys/ioctl.h"
  36. #include "etherLib.h"
  37. #include "net/unixLib.h"
  38. #include "net/if_subr.h"
  39. #include "inetLib.h"
  40. #include "stdio.h"
  41. /* defines */
  42. #define NSM 1
  43. /* macros needed by backplane driver */
  44. IMPORT SM_SOFTC * sm_softc[];
  45. #define UNIT_TO_SOFTC(unit) (sm_softc [unit])
  46. #define etherAddrPtr(eaddr) (eaddr)
  47. /* 
  48.  * copyFromMbufs should not be used since it may cause unaligned memory
  49.  * accesses.
  50.  */
  51. #define copyFromMbufs(pData, pMbuf, len)
  52. copy_from_mbufs ((pData), (pMbuf), (len))
  53. #define copyToMbufs(pData, len, off, pIf) 
  54. copy_to_mbufs ((pData), (len), (off), (pIf))
  55. /* hooks */
  56. #define outputHook(pIf, pData, bytes)
  57. ((etherOutputHookRtn != NULL) && 
  58. ((*etherOutputHookRtn) ((pIf), (pData), (bytes)))) ?
  59. (TRUE) : (FALSE)
  60. #define inputHook(pIf, pData, bytes)
  61. ((etherInputHookRtn != NULL) &&
  62. ((*etherInputHookRtn)((pIf), (pData), (bytes)))) ?
  63. (TRUE) : (FALSE)
  64. #define deviceValid(unit) ((sm_softc [unit] != NULL) ? TRUE : FALSE)
  65. /* function prototypes */
  66. #if defined(__STDC__) || defined(__cplusplus)
  67. extern STATUS smNetInit (SM_ANCHOR * pAnchor, char * pMem, int memSize,
  68.                          int tasType, int cpuMax, int maxPktBytes,
  69.                          u_long startAddr);
  70. extern STATUS smNetAttach (int unit, SM_ANCHOR *pAnchor, int maxInputPkts,
  71.                            int intType, int intArg1, int intArg2, int intArg3);
  72. extern STATUS smNetAttach2 (int unit, SM_ANCHOR *pAnchor, int maxInputPkts,
  73.                             int intType, int intArg1, int intArg2, int intArg3,
  74.                             int masterCpu, int maxTicsWait);
  75. extern STATUS smNetInetGet (char * smName, char * smInet, int cpuNum);
  76. extern void   smNetShowInit (void);
  77. extern STATUS smNetShow (char * ifName, BOOL zero);
  78. struct mbuf * loanBuild (SM_SOFTC * xs, SM_PKT volatile * pPkt, u_char * pData,
  79.                          int len);
  80. #else
  81. extern STATUS smNetInit ();
  82. extern STATUS smNetAttach ();
  83. extern STATUS smNetInetGet ();
  84. extern void   smNetShowInit ();
  85. extern STATUS smNetShow ();
  86. struct mbuf * loanBuild ();
  87. #endif /* __STDC__ */
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif /* __INCsmNetLibh */