📄 pcicshow.c
字号:
/* pcicShow.c - Intel 82365SL PCMCIA host bus adaptor chip show library *//* Copyright 1984-1996 Wind River Systems, Inc. *//* Copyright (c) 1994 David A. Hinds -- All Rights Reserved */#include "copyright_wrs.h"/*modification history--------------------01d,01nov96,hdn fixed PCIC_PORT().01c,28mar96,jdi doc: cleaned up language and format.01b,22feb96,hdn cleaned up01a,15feb95,hdn written based on David Hinds's version 2.2.3.*//*DESCRIPTIONThis is a driver show routine for the Intel 82365 series PCMCIA chip.pcicShow() is the only global function and is installed in the PCMCIA chip table `pcmciaAdapter' in pcmciaShowInit().*/#include "vxWorks.h"#include "stdio.h"#include "dllLib.h"#include "drv/pcmcia/pcmciaLib.h"#include "drv/pcmcia/pcic.h"#include "drv/pcmcia/pd67.h"/* defines */#define PCIC_PORT(slot) (pcicBase + (2*((slot) >> 2)))#define PCIC_REG(slot, reg) ((((slot) & 3) * 0x40) + reg)/* imports */IMPORT PCMCIA_CTRL pcmciaCtrl;IMPORT int pcicBase;/* globals *//* locals */LOCAL BOOL cirrus = FALSE;/* forward declarations */LOCAL STATUS pcicProbe (void);LOCAL void pcicShowStatus (int sock);LOCAL void pcicShowPower (int sock);LOCAL void pcicShowIntctl (int sock);LOCAL void pcicShowCsc (int sock);LOCAL void pcicShowCscint (int sock);LOCAL void pcicShowGenctl (int sock);LOCAL void pcicShowGblctl (int sock);LOCAL void pcicShowMisc (int sock);LOCAL void pcicShowTime (char *pName, int value);LOCAL void pcicShowTiming (int sock, int reg);LOCAL void pcicShowMemwin (int sock, int win);LOCAL void pcicShowIowin (int sock, int win);LOCAL int pcicGet (int sock, int reg);LOCAL int pcicGet2 (int sock, int reg);LOCAL void pcicSet (int sock, int reg, char value);/********************************************************************************* pcicShow - show all configurations of the PCIC chip** This routine shows all configurations of the PCIC chip.** RETURNS: N/A*/void pcicShow ( int sock /* socket no. */ ) { int ix; if (pcicProbe () != OK) return; printf("Identification and revision = 0x%2.2x\n", pcicGet (sock, PCIC_IDENT)); if (cirrus) printf("Chip information = 0x%2.2x\n", pcicGet (sock, PD67_CHIP_INFO)); pcicShowStatus (sock); pcicShowPower (sock); pcicShowIntctl (sock); pcicShowCsc (sock); pcicShowCscint (sock); if (cirrus) pcicShowMisc (sock); else { pcicShowGenctl (sock); pcicShowGblctl (sock); } for (ix = 0; ix < PCIC_MEM_WINDOWS; ix++) pcicShowMemwin (sock, ix); for (ix = 0; ix < PCIC_IO_WINDOWS; ix++) pcicShowIowin (sock, ix); if (cirrus) for (ix = 0; ix < 2; ix++) pcicShowTiming (sock, ix); printf ("\n"); }/********************************************************************************* pcicProbe - Probe the PCIC chip.** This routine probes the PCIC chip.** RETURNS: OK, or ERROR if it could not find the PCIC chip.*/LOCAL STATUS pcicProbe (void) { char *name = "i82365sl"; int id = 0; BOOL done = FALSE; int sock; int value; printf ("Intel PCIC probe: "); for (sock = 0; sock < PCIC_MAX_SOCKS; sock++) { value = pcicGet (sock, PCIC_IDENT); switch (value) { case 0x82: case 0x83: name = "INTEL 82365SL"; break; case 0x84: name = "VLSI 82C146"; break; case 0x88: case 0x89: name = "IBM Clone"; break; case 0x8b: name = "VADEM Clone"; break; default: done = TRUE; } id = value & 7; if (done) break; } if (sock == 0) { printf ("not found: value=0x%x.\n", value); return (ERROR); } /* Check for Cirrus CL-PD67xx chips */ pcicSet (0, PD67_CHIP_INFO, 0); value = pcicGet (0, PD67_CHIP_INFO); if ((value & PD67_INFO_CHIP_ID) == PD67_INFO_CHIP_ID) { value = pcicGet (0, PD67_CHIP_INFO); if ((value & PD67_INFO_CHIP_ID) == 0) { cirrus = TRUE; if (value & PD67_INFO_SLOTS) name = "Cirrus CL-PD672x"; else { name = "Cirrus CL-PD6710"; sock = 1; } id = 8 - ((value & PD67_INFO_REV) >> 2); } } printf ("%s rev %d found, %d sockets\n", name, id, sock); return (OK); }/********************************************************************************* pcicShowStatus - Show status of the PCIC chip.** This routine shows status of the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowStatus ( int sock /* socket no. */ ) { u_char value = pcicGet (sock, PCIC_STATUS); printf ("Interface status = 0x%2.2x\n", value); printf (" "); if (value & PCIC_CS_BVD1) printf ("[BVD1/STSCHG] "); if (value & PCIC_CS_BVD2) printf ("[BVD2/SPKR] "); if (value & PCIC_CS_DETECT) printf ("[DETECT] "); if (value & PCIC_CS_WRPROT) printf ("[WRPROT] "); if (value & PCIC_CS_READY) printf ("[READY] "); if (value & PCIC_CS_POWERON) printf ("[POWERON] "); if (value & PCIC_CS_GPI) printf ("[GPI] "); printf ("\n"); }/********************************************************************************* pcicShowPower - Show power configuration of the PCIC chip.** This routine shows power configuration of the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowPower ( int sock /* socket no. */ ) { u_char value = pcicGet(sock, PCIC_POWER); printf ("Power control = 0x%2.2x\n", value); printf (" "); if (value & PCIC_PWR_OUT) printf ("[OUTPUT] "); if (!(value & PCIC_PWR_NORESET)) printf ("[RESETDRV] "); if (value & PCIC_PWR_AUTO) printf ("[AUTO] "); switch (value & PCIC_VCC_MASK) { case PCIC_VCC_5V: printf ("[Vcc=5v] "); break; case PCIC_VCC_3V: printf ("[Vcc=3v] "); break; case 0: printf ("[Vcc off] "); break; } switch (value & PCIC_VPP_MASK) { case PCIC_VPP_5V: printf ("[Vpp=5v] "); break; case PCIC_VPP_12V: printf ("[Vpp=12v] "); break; case 0: printf ("[Vpp off] "); break; } printf ("\n"); }/********************************************************************************* pcicShowIntctl - Show interrupt control configuration of the PCIC chip.** This routine shows interrupt control configuration of the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowIntctl ( int sock /* socket no. */ ) { u_char value = pcicGet (sock, PCIC_INTCTL); printf ("Interrupt and general control = 0x%2.2x\n", value); printf (" "); if (value & PCIC_RING_ENA) printf ("[RING_ENA] "); if (!(value & PCIC_PC_RESET)) printf ("[RESET] "); if (value & PCIC_PC_IOCARD) printf ("[IOCARD] "); if (value & PCIC_INTR_ENA) printf ("[INTR_ENA] "); printf ("[irq=%d]\n", value & PCIC_IRQ_MASK);}/********************************************************************************* pcicShowCsc - Show card status change of the PCIC chip.** This routine shows card status change of the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowCsc ( int sock /* socket no. */ ) { u_char value = pcicGet (sock, PCIC_CSC); printf ("Card status change = 0x%2.2x\n", value); printf (" "); if (value & PCIC_CSC_BVD1) printf ("[BVD1/STSCHG] "); if (value & PCIC_CSC_BVD2) printf ("[BVD2] "); if (value & PCIC_CSC_DETECT) printf ("[DETECT] "); if (value & PCIC_CSC_READY) printf ("[READY] "); if (value & PCIC_CSC_GPI) printf ("[GPI] "); printf ("\n"); }/********************************************************************************* pcicShowCscint - Show card status change interrupt configuration.** This routine shows card status change interrupt configuration of * the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowCscint ( int sock /* socket no. */ ) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -