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

VxWorks

开发平台:

C/C++

  1. /* smVxLib.h - VxWorks specific backplane driver header file */
  2. /* Copyright 1984-2002 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01h,21mar02,vvv  added doc for copyFromMbufs (SPR #20787)
  7. 01g,11jun00,ham  removed reference to etherLib.
  8. 01f,23jul93,jmm  changed #include "socket.h" to "sys/socket.h" (spr 2033)
  9. 01e,22sep92,rrr  added support for c++
  10. 01d,26may92,rrr  the tree shuffle
  11. 01c,02may92,elh  added mask to smVxInit
  12. 01b,10apr92,elh  added startAddr for sequential addressing.
  13. 01a,17nov90,elh  written.
  14. */
  15. #ifndef __INCsmVxLibh
  16. #define __INCsmVxLibh
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /* includes */
  21. #include "vxWorks.h"
  22. #include "smLib.h"
  23. #include "net/mbuf.h"
  24. #include "net/if.h"
  25. #include "netinet/if_ether.h"
  26. #include "drv/netif/if_sm.h"
  27. #include "errno.h"
  28. #include "sys/ioctl.h"
  29. #include "net/unixLib.h"
  30. #include "net/if_subr.h"
  31. #include "inetLib.h"
  32. /* defines */
  33. #define SM_LOAN FALSE
  34. #define SM_NUM_LOAN 10
  35. #define SM_MEM_SIZE 0x10000
  36. #define SM_INPUT_PKTS  200
  37. #define NSM   1
  38. /*
  39.  * vxWorks convention is to malloc the driver softc structure, whereas
  40.  * UNIX wants this to be a static structure.  We provide macros to map
  41.  * these differences.
  42.  */
  43. IMPORT SM_SOFTC * sm_softc[];
  44. #define UNIT_TO_SOFTC(unit) (sm_softc [unit])
  45. /* is a struct in sunOS */
  46. #define etherAddrPtr(eaddr) (eaddr)
  47. /* different parameters from sunOs */
  48. /* copyFromMbufs may cause unaligned memory accesses. It should not be used. */
  49. #define copyFromMbufs(pData, pMbuf, len)
  50. copy_from_mbufs ((pData), (pMbuf), (len))
  51. #define copyToMbufs(pData, len, off, pIf) 
  52. copy_to_mbufs ((pData), (len), (off), (pIf))
  53. #if 0
  54. #define do_protocol(eh, pMbuf, acp, len) 
  55. do_protocol_with_type ((eh)->ether_type, (pMbuf), (acp), (len))
  56. #endif
  57. #define deviceValid(unit) ((sm_softc [unit] != NULL) ? TRUE : FALSE)
  58. /* Function declarations */
  59. #if defined(__STDC__) || defined(__cplusplus)
  60. extern STATUS smVxInit (SM_ANCHOR * pAnchor, char * pMem, int memSize,
  61. BOOL tasOK,
  62. #ifndef USE_OFFSET
  63.   int busToLocalOffset,
  64. #endif
  65.   int cpuMax, int maxPktBytes, u_long startAddr, u_long mask);
  66. extern STATUS smVxAttach (int unit, SM_ANCHOR * pAnchor,
  67. #ifndef USE_OFFSET
  68.           int busToLocalOffset,
  69. #endif
  70.   int maxInputPkts, int intType, int intArg1, int intArg2,
  71.   int intArg3);
  72. extern STATUS smVxInetGet (char * smName, struct in_addr * pSmInet, int cpuNum);
  73. struct mbuf * smLoanBuild (SM_SOFTC * xs, SM_PKT * pPkt, u_char * pData,
  74.     int len);
  75. #else
  76. extern STATUS smVxInit ();
  77. extern STATUS smVxAttach ();
  78. extern STATUS smVxInetGet ();
  79. struct mbuf * smLoanBuild ();
  80. #endif /* __STDC__ */
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif /* __INCsmVxLibh */