⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcicshow.c

📁 VXWORKS源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
    u_char value = pcicGet (sock, PCIC_CSCINT);    printf ("Card status change interrupt control = 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] ");    printf ("[irq = %d]\n", value >> 4);    }/********************************************************************************* pcicShowGenctl - Show general control of the PCIC chip.** This routine shows general control of the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowGenctl    (    int sock			/* socket no. */    )    {    u_char value = pcicGet (sock, PCIC_GENCTL);    printf ("Card detect and general control = 0x%2.2x\n", value);    printf ("  ");    if (value & PCIC_CTL_16DELAY)	printf ("[16DELAY] ");    if (value & PCIC_CTL_RESET_ENA)	printf ("[RESET] ");    if (value & PCIC_CTL_GPI_ENA)	printf ("[GPI_ENA] ");    if (value & PCIC_CTL_GPI_CTL)	printf ("[GPI_CTL] ");    if (value & PCIC_CTL_RESUME)	printf ("[RESUME] ");    printf ("\n");    }/********************************************************************************* pcicShowGblctl - Show global control of the PCIC chip.** This routine shows global control of the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowGblctl    (    int sock			/* socket no. */    )    {    u_char value = pcicGet (sock, PCIC_GBLCTL);    printf ("Global control = 0x%2.2x\n", value);    printf ("  ");    if (value & PCIC_GBL_PWRDOWN)	printf ("[PWRDOWN] ");    if (value & PCIC_GBL_CSC_LEV)	printf ("[CSC_LEV] ");    if (value & PCIC_GBL_WRBACK)	printf ("[WRBACK] ");    if (value & PCIC_GBL_IRQ_0_LEV)	printf ("[IRQ_0_LEV] ");    if (value & PCIC_GBL_IRQ_1_LEV)	printf ("[IRQ_1_LEV] ");    printf ("\n");    }/********************************************************************************* pcicShowMisc - Show misc control of the PCIC chip.** This routine shows misc control of the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowMisc    (    int sock			/* socket no. */    )    {    u_char value = pcicGet(sock, PD67_MISC_CTL_1);    printf ("Misc control 1 = 0x%2.2x\n", value);    printf ("  ");    if (value & PD67_MC1_5V_DET)	printf ("[5V_DET] ");    if (value & PD67_MC1_VCC_3V)	printf ("[VCC_3V] ");    if (value & PD67_MC1_PULSE_MGMT)	printf ("[PULSE_MGMT] ");    if (value & PD67_MC1_PULSE_IRQ)	printf ("[PULSE_IRQ] ");    if (value & PD67_MC1_SPKR_ENA)	printf ("[SPKR] ");    if (value & PD67_MC1_INPACK_ENA)	printf ("[INPACK] ");    printf ("\n");    value = pcicGet(sock, PD67_MISC_CTL_2);    printf ("Misc control 2 = 0x%2.2x\n", value);    printf ("  ");    if (value & PD67_MC2_FREQ_BYPASS)	printf ("[FREQ_BYPASS] ");    if (value & PD67_MC2_DYNAMIC_MODE)	printf ("[DYNAMIC_MODE] ");    if (value & PD67_MC2_SUSPEND)	printf ("[SUSPEND] ");    if (value & PD67_MC2_5V_CORE)	printf ("[5V_CORE] ");    if (value & PD67_MC2_LED_ENA)	printf ("[LED_ENA] ");    if (value & PD67_MC2_3STATE_BIT7)	printf ("[3STATE_BIT7] ");    if (value & PD67_MC2_DMA_MODE)	printf ("[DMA_MODE] ");    if (value & PD67_MC2_IRQ15_RI)	printf ("[IRQ15_RI] ");    printf ("\n");    }/********************************************************************************* pcicShowTime - Show time scale of the PCIC chip.** This routine shows time scale of the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowTime    (    char *pName,		/* name of time scale */    int  value			/* value of a time scale */    )    {    printf ("%s = %d", pName, value & PD67_TIME_MULT);    switch (value & PD67_TIME_SCALE)	{        case PD67_TIME_SCALE_16:	    printf ("[*16] ");	    break;        case PD67_TIME_SCALE_256:	    printf ("[*256] ");	    break;        case PD67_TIME_SCALE_4096:	    printf ("[*4096] ");	    break;        }    }/********************************************************************************* pcicShowTiming - Show timing of the PCIC chip.** This routine shows timing of the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowTiming    (    int sock,			/* socket no. */    int reg			/* timing register no. */    )    {    printf ("Timing set %d: ", reg);    pcicShowTime ("setup", pcicGet (sock, PD67_TIME_SETUP(reg)));    pcicShowTime (", command", pcicGet (sock, PD67_TIME_CMD(reg)));    pcicShowTime (", recovery", pcicGet (sock, PD67_TIME_RECOV(reg)));    printf ("\n");    }/********************************************************************************* pcicShowMemwin - Show memory window of the PCIC chip.** This routine shows memory window of the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowMemwin    (    int sock,			/* socket no. */    int win			/* memory window no. */    )    {    u_short start = pcicGet2 (sock, PCIC_MEM(win)+PCIC_W_START);    u_short stop  = pcicGet2 (sock, PCIC_MEM(win)+PCIC_W_STOP);    u_short off	  = pcicGet2 (sock, PCIC_MEM(win)+PCIC_W_OFF);    printf ("Memory window %d: ", win);    if (pcicGet (sock, PCIC_ADDRWIN) & PCIC_ENA_MEM(win))	printf ("[ON] ");    else	printf ("[OFF] ");    if (start & PCIC_MEM_16BIT)	printf ("[16BIT] ");    if (cirrus)	{	if (stop & PCIC_MEM_WS1)	    printf ("[TIME1] ");	else	    printf ("[TIME0] ");        }    else	{	if (start & PCIC_MEM_0WS)	    printf ("[0WS] ");	if (stop & PCIC_MEM_WS1)	    printf ("[WS1] ");	if (stop & PCIC_MEM_WS0)	    printf ("[WS0] ");        }    if (off & PCIC_MEM_WRPROT)	printf ("[WRPROT] ");    if (off & PCIC_MEM_REG)	printf ("[REG] ");    printf ("\n  start = 0x%4.4x", start & 0x3fff);    printf (", stop = 0x%4.4x", stop & 0x3fff);    printf (", offset = 0x%4.4x\n", off & 0x3fff);    }/********************************************************************************* pcicShowIowin - Show IO window of the PCIC chip.** This routine shows IO window of the PCIC chip.** RETURNS: N/A*/LOCAL void pcicShowIowin    (    int sock,			/* socket no. */    int win			/* IO window no. */    )    {    u_char  ctl   = pcicGet  (sock, PCIC_IOCTL);    u_short start = pcicGet2 (sock, PCIC_IO(win)+PCIC_W_START);    u_short stop  = pcicGet2 (sock, PCIC_IO(win)+PCIC_W_STOP);    printf ("I/O window %d: ", win);    if (pcicGet (sock, PCIC_ADDRWIN) & PCIC_ENA_IO(win))	printf ("[ON] ");    else	printf ("[OFF] ");        if (cirrus)	{	if (ctl & PCIC_IOCTL_WAIT(win))	    printf (" [TIME1]");	else	    printf (" [TIME0]");        }    else	{	if (ctl & PCIC_IOCTL_WAIT(win))	    printf ("[WAIT] ");	if (ctl & PCIC_IOCTL_0WS(win))	    printf ("[0WS] ");        }    if (ctl & PCIC_IOCTL_CS16(win))	printf ("[CS16] ");    if (ctl & PCIC_IOCTL_16BIT(win))	printf ("[16BIT] ");        printf ("\n  start = 0x%4.4x, stop = 0x%4.4x", start, stop);    if (cirrus)	{        u_short off = pcicGet2 (sock, PD67_IO_OFF(win));	printf (", offset = 0x%4.4x", off);        }    printf ("\n");    }/********************************************************************************* pcicGet - Get a value from the register.** This routine gets a value from the register.** RETURNS: a value of the register.*/LOCAL int pcicGet    (    int sock,			/* socket no. */    int reg			/* register no. */    )    {    short port	= PCIC_PORT (sock);    char offset	= PCIC_REG (sock, reg);    sysOutByte (port, offset);    return (sysInByte (port+1));    }/********************************************************************************* pcicGet2 - Get a value from the consecutive registers.** This routine gets a value from the consecutive registers.** RETURNS: a value of the register.*/LOCAL int pcicGet2    (    int sock,			/* socket no. */    int reg			/* register no. */    )    {    short a	= pcicGet (sock, reg);    short b	= pcicGet (sock, reg+1);    return (a + (b<<8));    }/********************************************************************************* pcicSet - Set value into the register.** This routine sets value into the register.** RETURNS: N/A*/LOCAL void pcicSet    (    int  sock,			/* socket no. */    int  reg,			/* register no. */    char value			/* value to set */    )    {    short port	= PCIC_PORT (sock);    char offset	= PCIC_REG (sock, reg);    sysOutByte (port, offset);    sysOutByte (port+1, value);    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -