pccardShow.c
资源名称:ixp425BSP.rar [点击查看]
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:7k
源码类别:
VxWorks
开发平台:
C/C++
- /* pccardShow.c - PC CARD show library */
- /* Copyright 1984-1996 Wind River Systems, Inc. */
- #include "copyright_wrs.h"
- /*
- modification history
- --------------------
- 01d,11dec97,hdn added TFFS support for flash PC card.
- 01c,08nov96,dgp doc: final formatting
- 01b,22feb96,hdn cleaned up
- 01a,10oct95,hdn written.
- */
- /*
- DESCRIPTION
- This library provides generic facilities for showing PC CARD status.
- */
- /* LINTLIBRARY */
- #include "drv/pcmcia/pcmciaLib.h"
- #include "drv/pcmcia/pccardLib.h"
- #include "drv/pcmcia/sramDrv.h"
- #include "drv/hdisk/ataDrv.h"
- #include "net/if.h"
- #include "netinet/if_ether.h"
- #include "drv/netif/if_elt.h"
- #include "tffs/tffsDrv.h"
- /* externs */
- IMPORT PCMCIA_CTRL pcmciaCtrl;
- IMPORT char pcDriveNo [];
- /* globals */
- /* locals */
- /* forward declarations */
- #ifdef INCLUDE_SHOW_ROUTINES
- LOCAL STATUS pccardShow (int sock);
- LOCAL STATUS pccardSramShow (int sock);
- LOCAL STATUS pccardAtaShow (int sock);
- LOCAL STATUS pccardEltShow (int sock);
- LOCAL STATUS pccardTffsShow (int sock);
- #endif /* INCLUDE_SHOW_ROUTINES */
- /*******************************************************************************
- *
- * pccardShowInit - initialize all show routines related to PC CARD drivers
- *
- * This routine initializes all show routines related to PC CARD drivers.
- *
- * RETURNS: N/A
- */
- void pccardShowInit (void)
- {
- #ifdef INCLUDE_SHOW_ROUTINES
- int ix;
- PCCARD_ENABLER *pEnabler;
- for (ix = 0; ix < pccardEnablerNumEnt; ix++)
- {
- pEnabler = &pccardEnabler [ix];
- #ifdef INCLUDE_ATA
- if (pEnabler->type == PCCARD_ATA)
- pEnabler->showRtn = (FUNCPTR)pccardAtaShow;
- #endif /* INCLUDE_ATA */
- #ifdef INCLUDE_SRAM
- if (pEnabler->type == PCCARD_SRAM)
- pEnabler->showRtn = (FUNCPTR)pccardSramShow;
- #endif /* INCLUDE_SRAM */
- #ifdef INCLUDE_ELT
- if (pEnabler->type == PCCARD_LAN_ELT)
- pEnabler->showRtn = (FUNCPTR)pccardEltShow;
- #endif /* INCLUDE_ELT */
- #ifdef INCLUDE_TFFS
- if (pEnabler->type == PCCARD_FLASH)
- pEnabler->showRtn = (FUNCPTR)pccardTffsShow;
- #endif /* INCLUDE_TFFS */
- }
- #endif /* INCLUDE_SHOW_ROUTINES */
- }
- #ifdef INCLUDE_SHOW_ROUTINES
- /*******************************************************************************
- *
- * pccardShow - show PC card generic status
- *
- * Show PC card generic status
- *
- * RETURNS: OK (always).
- */
- LOCAL STATUS pccardShow
- (
- int sock /* socket no. */
- )
- {
- PCMCIA_CTRL *pCtrl = &pcmciaCtrl;
- PCMCIA_CARD *pCard = &pCtrl->card[sock];
- PCCARD_RESOURCE *pResource = pCard->pResource;
- /* info from PCMCIA_CARD */
- printf (" ctrl = 0x%-8xn", pCard->ctrl);
- printf (" installed = %-10s changed = %-10sn",
- pCard->installed ? "TRUE" : "FALSE",
- pCard->changed ? "TRUE" : "FALSE");
- printf (" cardStatus = 0x%-8x initStatus = 0x%-8xn",
- pCard->cardStatus, pCard->initStatus);
- printf (" pBlockDev = 0x%-8x pNetIf = 0x%-8xn",
- (u_int)pCard->pBlkDev, (u_int)pCard->pNetIf);
- /* info from PCCARD_RESOURCE */
- printf (" Vcc = 0x%-8x Vpp = 0x%-8xn",
- pResource->vcc, pResource->vpp);
- printf (" ioStart[0] = 0x%-8x ioStop[0] = 0x%-8xn",
- pResource->ioStart[0], pResource->ioStop[0]);
- printf (" ioStart[1] = 0x%-8x ioStop[1] = 0x%-8xn",
- pResource->ioStart[1], pResource->ioStop[1]);
- printf (" ioExtraws = %-8dn",
- pResource->ioExtraws);
- printf (" memStart = 0x%-8x memStop = 0x%-8xn",
- pResource->memStart, pResource->memStop);
- printf (" memLength = 0x%-8x memOffset = 0x%-8xn",
- pResource->memLength, pResource->memOffset);
- printf (" memExtraws = 0x%-8xn",
- pResource->memExtraws);
- return (OK);
- }
- #ifdef INCLUDE_SRAM
- /*******************************************************************************
- *
- * pccardSramShow - show SRAM status
- *
- * Show SRAM status
- *
- * RETURNS: OK, or ERROR if the driver is not installed.
- */
- LOCAL STATUS pccardSramShow
- (
- int sock /* socket no. */
- )
- {
- PCMCIA_CTRL *pCtrl = &pcmciaCtrl;
- PCMCIA_CARD *pCard = &pCtrl->card[sock];
- PCCARD_RESOURCE *pResource = pCard->pResource;
- if (!pCard->detected)
- {
- printf ("Socket %d is Emptyn", sock);
- return (ERROR);
- }
- if (pResource == NULL)
- {
- printf ("Socket %d is Unknown PC cardn", sock);
- return (ERROR);
- }
- printf ("Socket %d is SRAMn", sock);
- pccardShow (sock);
- return (OK);
- }
- #endif /* INCLUDE_SRAM */
- #ifdef INCLUDE_ATA
- /*******************************************************************************
- *
- * pccardAtaShow - show ATA (PCMCIA) status
- *
- * Show ATA (PCMCIA) status
- *
- * RETURNS: OK, or ERROR if the driver is not installed.
- *
- * NOMANUAL
- */
- LOCAL STATUS pccardAtaShow
- (
- int sock /* socket no. */
- )
- {
- PCMCIA_CTRL *pCtrl = &pcmciaCtrl;
- PCMCIA_CARD *pCard = &pCtrl->card[sock];
- PCCARD_RESOURCE *pResource = pCard->pResource;
- ATA_RESOURCE *pAta = (ATA_RESOURCE *)pResource;
- if (!pCard->detected)
- {
- printf ("Socket %d is Emptyn", sock);
- return (ERROR);
- }
- if (pResource == NULL)
- {
- printf ("Socket %d is Unknown PC cardn", sock);
- return (ERROR);
- }
- printf ("Socket %d is ATAn", sock);
- pccardShow (sock);
- printf (" intVector = 0x%-8x intLevel = 0x%-8xn",
- pAta->intVector, pAta->intLevel);
- printf (" drives = 0x%-8x configType = 0x%-8xn",
- pAta->drives, pAta->configType);
- printf (" twins = 0x%-8x pwrdown = 0x%-8xn",
- pAta->sockTwin, pAta->pwrdown);
- return (OK);
- }
- #endif /* INCLUDE_ATA */
- #ifdef INCLUDE_ELT
- /*******************************************************************************
- *
- * pccardEltShow - show ELT (PCMCIA) status
- *
- * Show ELT (PCMCIA) status
- *
- * RETURNS: OK, or ERROR if the card is not installed.
- *
- * NOMANUAL
- */
- LOCAL STATUS pccardEltShow
- (
- int sock /* socket no. */
- )
- {
- PCMCIA_CTRL *pCtrl = &pcmciaCtrl;
- PCMCIA_CARD *pCard = &pCtrl->card[sock];
- PCCARD_RESOURCE *pResource = pCard->pResource;
- ELT_RESOURCE *pElt = (ELT_RESOURCE *)pResource;
- if (!pCard->detected)
- {
- printf ("Socket %d is Emptyn", sock);
- return (ERROR);
- }
- if (pResource == NULL)
- {
- printf ("Socket %d is Unknown PC cardn", sock);
- return (ERROR);
- }
- printf ("Socket %d is ELTn", sock);
- pccardShow (sock);
- printf (" intVector = 0x%-8x intLevel = 0x%-8xn",
- pElt->intVector, pElt->intLevel);
- printf (" rxFrames = 0x%-8x connector = 0x%-8xn",
- pElt->rxFrames, pElt->connector);
- return (OK);
- }
- #endif /* INCLUDE_ELT */
- #ifdef INCLUDE_TFFS
- /*******************************************************************************
- *
- * pccardTffsShow - show TFFS (PCMCIA) status
- *
- * Show TFFS (PCMCIA) status
- *
- * RETURNS: OK, or ERROR if the card is not installed.
- *
- * NOMANUAL
- */
- LOCAL STATUS pccardTffsShow
- (
- int sock /* socket no. */
- )
- {
- PCMCIA_CTRL *pCtrl = &pcmciaCtrl;
- PCMCIA_CARD *pCard = &pCtrl->card[sock];
- PCCARD_RESOURCE *pResource = pCard->pResource;
- if (!pCard->detected)
- {
- printf ("Socket %d is Emptyn", sock);
- return (ERROR);
- }
- if (pResource == NULL)
- {
- printf ("Socket %d is Unknown PC cardn", sock);
- return (ERROR);
- }
- printf ("Socket %d is Flashn", sock);
- pccardShow (sock);
- if (pcDriveNo[sock] != NONE)
- tffsShow (pcDriveNo [sock]);
- return (OK);
- }
- #endif /* INCLUDE_ELT */
- #endif /* INCLUDE_SHOW_ROUTINES */