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

📄 systffs.c

📁 VMware上运行vxWorks的BSP
💻 C
📖 第 1 页 / 共 3 页
字号:
LOCAL void flOutportb     (    unsigned portId,     unsigned char value    )    {    sysOutByte (portId, value);    }/********************************************************************************* get365 - read an 82365SL register** This routine read an 82365SL register** RETURNS: N/A*/LOCAL unsigned char get365    (    FLSocket vol, 		/* pointer identifying drive */    unsigned char reg		/* register index */    )    {    unsigned char value;#if DRIVES > 1    if (vol.serialNo == 1)        reg += 0x40;#endif    flStartCriticalSection (&flPcicMutex);    flOutportb (INDEX_REG,reg);    value = flInportb (DATA_REG);    flEndCriticalSection (&flPcicMutex);    return (value);    }/********************************************************************************* set365 - write an 82365SL register** This routine write an 82365SL register** RETURNS: N/A*/LOCAL void set365    (    FLSocket vol, 		/* pointer identifying drive */    unsigned char reg,		/* register index */    unsigned char value		/* value to set */    )    {#if DRIVES > 1    if (vol.serialNo == 1)        reg += 0x40;#endif    flStartCriticalSection (&flPcicMutex);    flOutportb (INDEX_REG, reg);    flOutportb (DATA_REG, value);    flEndCriticalSection (&flPcicMutex);    }/********************************************************************************* pcCardDetected - detect if a card is present (inserted)** This routine detects if a card is present (inserted).** RETURNS: TRUE, or FALSE if the card is not present.*/LOCAL FLBoolean pcCardDetected    (    FLSocket vol		/* pointer identifying drive */    )    {    return ((~get365 (&vol, INTERFACE) & 	    (CARD_DETECT_1 | CARD_DETECT_2)) == 0);    }/********************************************************************************* pcVccOn - turn on Vcc (3.3/5 Volts)** This routine turns on Vcc (3.3/5 Volts). Vcc must be known to be good * on exit.** RETURNS: N/A*/LOCAL void pcVccOn    (    FLSocket vol		/* pointer identifying drive */    )    {    unsigned char interface;    unsigned long timeout	= flMsecCounter + 2000;    set365 (&vol, POWER, get365 (&vol, POWER) | CARD_POWER_ENABLE);    do {        interface = get365 (&vol, INTERFACE);        } while (pcCardDetected (&vol) && 		 (~interface & (CARD_POWER_ACTIVE | CARD_READY)) &&	         (flMsecCounter < timeout));    }/********************************************************************************* pcVccOff - turn off Vcc (3.3/5 Volts)** This routine turns off Vcc (3.3/5 Volts).** RETURNS: N/A*/LOCAL void pcVccOff    (    FLSocket vol		/* pointer identifying drive */    )    {#if	FALSE    set365 (&vol, POWER, get365 (&vol, POWER) & ~CARD_POWER_ENABLE);#endif    }#ifdef SOCKET_12_VOLTS/********************************************************************************* pcVppOn - turn on Vpp (12 Volts)** This routine turns on Vpp (12 Volts). Vpp must be known to be good on exit.** RETURNS: flOK always*/LOCAL FLStatus pcVppOn    (    FLSocket vol		/* pointer identifying drive */    )    {    set365 (&vol, POWER, 	(get365 (&vol, POWER) & ~(VPP1_CONTROL | VPP2_CONTROL)) | VPP_ON_12V);    flDelayMsecs (VPP_DELAY_MSEC);	/* wait for Vpp to ramp up */    return (flOK);    }/********************************************************************************* pcVppOff - turn off Vpp (12 Volts)** This routine turns off Vpp (12 Volts).** RETURNS: N/A*/LOCAL void pcVppOff    (    FLSocket vol		/* pointer identifying drive */    )    {    set365 (&vol, POWER, 	    (get365(&vol, POWER) & ~(VPP1_CONTROL | VPP2_CONTROL)) | VPP_ON_5V);    }#endif	/* SOCKET_12_VOLTS *//********************************************************************************* pcInitSocket - perform all necessary initializations of the socket** This routine performs all necessary initializations of the socket.** RETURNS: flOK, or flGeneralFailure if it failed to create a mutex semaphore,*                or FALSE if the PCIC is neither STEP_A nor STEP_B.*/LOCAL FLStatus pcInitSocket    (    FLSocket vol		/* pointer identifying drive */    )    {    unsigned char identification;    /* create mutex protecting PCIC registers access */    if ((flPcicMutex == NULL) && (flCreateMutex (&flPcicMutex) != flOK))	{#ifdef DEBUG_PRINT        DEBUG_PRINT ("Debug: failed creating Mutex for PCIC.\n");#endif        return (flGeneralFailure);        }    identification = get365 (&vol, IDENTIFICATION);    if (identification != PCIC_STEP_A && identification != PCIC_STEP_B)        return (FALSE);    set365 (&vol, POWER, DISABLE_RESUME_RESETDRV | ENABLE_OUTPUTS);    set365 (&vol, INTERRUPT, 0);			/* reset */    set365 (&vol, INTERRUPT, PC_CARD_NOT_RESET);	/* enough reset */    set365 (&vol, CARD_STATUS_INTERRUPT, 0);		/* no CSC interrupt */    set365 (&vol, ADDRESS_WINDOW_ENABLE, MEMCS16_DECODE);    return (flOK);    }/********************************************************************************* pcSetWindow - set current window attributes, Base address, size, etc** This routine sets current window hardware attributes: Base address, size,* speed and bus width.  The requested settings are given in the 'vol.window' * structure.  If it is not possible to set the window size requested in* 'vol.window.size', the window size should be set to a larger value, * if possible. In any case, 'vol.window.size' should contain the * actual window size (in 4 KB units) on exit.** RETURNS: N/A*/LOCAL void pcSetWindow    (    FLSocket vol		/* pointer identifying drive */    )    {    set365 (&vol, ADDRESS_WINDOW_ENABLE,	   MEMCS16_DECODE | (MEMORY_WINDOW_0_ENABLE << WINDOW_ID));    set365 (&vol, WINDOW_0_START_LO + WINDOW_ID * 8,	   vol.window.baseAddress);    set365 (&vol, WINDOW_0_START_HI + WINDOW_ID * 8,	   vol.window.busWidth == 16 ? DATA_16_BITS : 0);    set365 (&vol, WINDOW_0_STOP_LO + WINDOW_ID * 8,	   vol.window.baseAddress + (vol.window.size / 0x1000) - 1);    set365 (&vol, WINDOW_0_STOP_HI + WINDOW_ID * 8,0);	/* no wait states */    }/********************************************************************************* pcSetMappingContext - sets the window mapping register to a card address** This routine sets the window mapping register to a card address.* The window should be set to the value of 'vol.window.currentPage',* which is the card address divided by 4 KB. An address over 128MB,* (page over 32K) specifies an attribute-space address.** The page to map is guaranteed to be on a full window-size boundary.** RETURNS: N/A*/LOCAL void pcSetMappingContext    (    FLSocket vol,		/* pointer identifying drive */    unsigned page		/* page to be mapped */    )    {    unsigned mapRegValue = page - vol.window.baseAddress;    mapRegValue &= 0x3fff;    if (page & ATTRIBUTE_SPACE_MAPPED)        mapRegValue |= (REG_ACTIVE << 8);    set365 (&vol, WINDOW_0_ADDRESS_LO + WINDOW_ID * 8, mapRegValue);    set365 (&vol, WINDOW_0_ADDRESS_HI + WINDOW_ID * 8, mapRegValue >> 8);    }/********************************************************************************* pcGetAndClearCardChangeIndicator - return the hardware card-change indicator** This routine returns the hardware card-change indicator and clears it if set.** RETURNS: FALSE, or TRUE if the card has been changed*/LOCAL FLBoolean pcGetAndClearCardChangeIndicator    (    FLSocket vol		/* pointer identifying drive */    )    {    /* Note: On the 365, the indicator is turned off by the act of reading */    return (get365 (&vol, CARD_STATUS_CHANGE) & CARD_DETECT_CHANGE);    }/********************************************************************************* pcWriteProtected - return the write-protect state of the media** This routine returns the write-protect state of the media** RETURNS: FALSE, or TRUE if the card is write-protected*/LOCAL FLBoolean pcWriteProtected    (    FLSocket vol		/* pointer identifying drive */    )    {    return ((~get365 (&vol, INTERFACE) & 	    (MEMORY_WRITE_PROTECT | CARD_DETECT_1 | CARD_DETECT_2)) == 0);    }#endif	/* INCLUDE_PCMCIA */#ifdef EXIT/********************************************************************************* pcFreeSocket - free resources that were allocated for this socket.** This routine free resources that were allocated for this socket.* This function is called when FLite exits.** RETURNS: N/A*/LOCAL void pcFreeSocket    (    FLSocket vol		/* pointer identifying drive */    )    {    flDeleteMutex (&flPcicMutex);    }#endif /* EXIT */#endif	/* defined (INCLUDE_SOCKET_PCIC0) || defined (INCLUDE_SOCKET_PCIC1) *//********************************************************************************* flFitInSocketWindow - check whether the flash array fits in the socket window** This routine checks whether the flash array fits in the socket window.** RETURNS: A chip size guaranteed to fit in the socket window.*/long int flFitInSocketWindow     (    long int chipSize,		/* size of single physical chip in bytes */    int      interleaving,	/* flash chip interleaving (1,2,4 etc) */    long int windowSize		/* socket window size in bytes */    )    {    /* x86 architectures use sliding windows for flash arrays */    /* so this check is irrelevant for them                   */    return (chipSize);    }#if	FALSE/********************************************************************************* sysTffsCpy - copy memory from one location to another** This routine copies <size> characters from the object pointed* to by <source> into the object pointed to by <destination>. If copying* takes place between objects that overlap, the behavior is undefined.** INCLUDE FILES: string.h** RETURNS: A pointer to <destination>.* * NOMANUAL*/void * sysTffsCpy    (    void *       destination,   /* destination of copy */    const void * source,        /* source of copy */    size_t       size           /* size of memory to copy */    )    {    bcopy ((char *) source, (char *) destination, (size_t) size);    return (destination);    }/********************************************************************************* sysTffsSet - set a block of memory** This routine stores <c> converted to an `unsigned char' in each of the* elements of the array of `unsigned char' beginning at <m>, with size <size>.** INCLUDE FILES: string.h** RETURNS: A pointer to <m>.* * NOMANUAL*/void * sysTffsSet    (    void * m,                   /* block of memory */    int    c,                   /* character to store */    size_t size                 /* size of memory */    )    {    bfill ((char *) m, (int) size, c);    return (m);    }#endif	/* FALSE *//********************************************************************************* flDelayMsecs - wait for specified number of milliseconds** This routine waits for specified number of milliseconds.** RETURNS: N/A* * NOMANUAL*/void flDelayMsecs    (    unsigned milliseconds       /* milliseconds to wait */    )    {    UINT32 ix;    UINT32 iy = 1;    UINT32 iz = 2;    /* it doesn't count time consumed in interrupt level */    for (ix = 0; ix < milliseconds; ix++)        for (ix = 0; ix < sysTffsMsecLoopCount; ix++)	    {	    tickGet ();			/* dummy */	    iy = KILL_TIME_FUNC;	/* consume time */	    }    }/********************************************************************************* flDelayLoop - consume the specified time** This routine consumes the specified time.** RETURNS: N/A*/void flDelayLoop     (    int  cycles    )    {    }

⌨️ 快捷键说明

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