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

VxWorks

开发平台:

C/C++

  1. /* usrPcmcia.c - PCMCIA initialization */
  2. /* Copyright 1992-1995 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01b,28feb95,hdn  cleaning up.
  7. 01a,29jun95,hdn  written.
  8. */
  9. /*
  10. DESCRIPTION
  11. This file is used to configure and initialize the VxWorks PCMCIA support.
  12. This file is included by bootConfig.c and usrConfig.c.
  13. SEE ALSO: usrExtra.c
  14. NOMANUAL
  15. */
  16. #ifndef  __INCusrPcmcia
  17. #define  __INCusrPcmcia
  18. /* imports */
  19. IMPORT PCMCIA_CTRL pcmciaCtrl;
  20. /*******************************************************************************
  21. *
  22. * usrPcmciaConfig - mount a DOS file system from a PCMCIA block device
  23. *
  24. * This routine mounts a DOS file system from a PCMCIA block device.
  25. *
  26. * The <sock> parameter is the socket number of the PCMCIA.
  27. *
  28. * The <fileName> parameter is the mount point, e.g., `/pc0/'.
  29. *
  30. * RETURNS: OK or ERROR.
  31. *
  32. * SEE ALSO:
  33. * .pG "I/O System, Local File Systems, Intel i386/i486 Appendix"
  34. */
  35. STATUS usrPcmciaConfig
  36.     (
  37.     int     sock, /* 0 - n: socket number */
  38.     char *  fileName /* mount point */
  39.     )
  40.     {
  41.     PCMCIA_CTRL *pCtrl = &pcmciaCtrl;
  42.     PCMCIA_CARD *pCard = &pCtrl->card[sock];
  43.     PCMCIA_CHIP *pChip = &pCtrl->chip;
  44.     char bootDir [BOOT_FILE_LEN];
  45.     if ((UINT)sock >= pChip->socks)
  46. {
  47. printErr ("sock is out of range (0-%d).n", pChip->socks - 1);
  48. return (ERROR);
  49. }
  50.     if (pCard->pBlkDev == NULL)
  51. return (ERROR);
  52.     /* split off boot device from boot file */
  53.     devSplit (fileName, bootDir);
  54.     /* Make DOS file system */
  55.     if (dosFsDevInit(bootDir, pCard->pBlkDev, NULL) == (DOS_VOL_DESC *)NULL)
  56.         {
  57. printErr ("Error during dosFsDevInit: %xn", errno);
  58.         return (ERROR);
  59.         }
  60.     return (OK);
  61.     }
  62. /*******************************************************************************
  63. *
  64. * pcmciaattach - attach a PCMCIA network device
  65. *
  66. * This routine attach a PCMCIA network device.
  67. *
  68. * RETURNS: OK or ERROR.
  69. *
  70. */
  71. STATUS pcmciaattach
  72.     (
  73.     int unit, /* unit number */
  74.     int arg1, /* socket number */
  75.     int arg2, /* reserved */
  76.     int arg3, /* reserved */
  77.     int arg4, /* reserved */
  78.     int arg5, /* reserved */
  79.     int arg6, /* reserved */
  80.     int arg7, /* reserved */
  81.     int arg8 /* reserved */
  82.     )
  83.     {
  84.     PCMCIA_CTRL *pCtrl = &pcmciaCtrl;
  85.     PCMCIA_CARD *pCard = &pCtrl->card[arg1];
  86.     NETIF *pNetIf = pCard->pNetIf;
  87.     if (pNetIf == NULL)
  88. return (ERROR);
  89.     
  90.     return (pNetIf->attachRtn (unit, pNetIf->arg1, pNetIf->arg2,
  91. pNetIf->arg3, pNetIf->arg4, pNetIf->arg5,
  92. pNetIf->arg6, pNetIf->arg7, pNetIf->arg8));
  93.     }
  94. #endif /* __INCusrPcmcia */