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

📄 syslib.c

📁 vworks 下wlan的实现代码
💻 C
📖 第 1 页 / 共 4 页
字号:
char * sysPhysMemTop (void)    {    static char * physTop = NULL;    if (physTop == NULL)	{#ifdef LOCAL_MEM_AUTOSIZE	/* use the calculated size of Ram */	physTop = (char *)(LOCAL_MEM_LOCAL_ADRS + sysRamSize);#else	/* use the default size for Ram */	physTop = (char *)(LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE);#endif	}    return (physTop) ;    }/********************************************************************************* sysMemTop - get the address of the top of VxWorks memory** This routine returns a pointer to the first byte of memory not* controlled or used by VxWorks.** The user can reserve memory space by defining the macro USER_RESERVED_MEM* in config.h.  This routine returns the address of the reserved memory* area.  The value of USER_RESERVED_MEM is in bytes.** RETURNS: The address of the top of VxWorks memory.*/char * sysMemTop (void)    {    static char * memTop = NULL;    if (memTop == NULL)	{	memTop = sysPhysMemTop () - USER_RESERVED_MEM;	}    return memTop;    }/******************************************************************************** sysToMonitor - transfer control to the ROM monitor** This routine transfers control to the ROM monitor.  Normally, it is called* only by reboot()--which services ^X--and bus errors at interrupt level.* However, in some circumstances, the user may wish to introduce a* <startType> to enable special boot ROM facilities.** RETURNS: Does not return.*/STATUS sysToMonitor    (     int startType	/* parameter passed to ROM to tell it how to boot */    )    {    FUNCPTR pRom = (FUNCPTR) (ROM_TEXT_ADRS + 4);	/* Warm reboot */#if defined(INCLUDE_CACHE_SUPPORT)    cacheDisable (0);        /* Disable the Instruction Cache */    cacheDisable (1);        /* Disable the Data Cache */#endif#ifdef	INCLUDE_CPM_END    sysCpmEnetDisable (0);	/* disable the ethernet device */    sysCpmEnetIntDisable (0);	/* disable the ethernet device interrupt */#endif	/* INCLUDE_CPM_END */         sysSerialReset();		/* reset the serial device */    /* Clear the MSR */    vxMsrSet (0);    WRS_ASM("sync");    (*pRom) (startType);	/* jump to bootrom entry point */    return (OK);	/* in case we ever continue from ROM monitor */    }/******************************************************************************** sysHwInit2 - additional system configuration and initialization** This routine connects system interrupts and does any additional* configuration necessary.** RETURNS: N/A** NOMANUAL*/void sysHwInit2 (void)    {    static BOOL configured = FALSE;    int		immrVal;    if (!configured)	{	immrVal = vxImmrIsbGet();        /*	 * NOTE:  We must unfreeze the Time Base clock prior to calling	 * sysSerialHwInit2().  This is because sysSerialHwInit2() calls	 * kbdHrdInit() to initialize the keyboard which, in turn, calls	 * sysMsDelay() which depends upon the decrementer ticking.  If	 * sysSerialHwInit2() is called first, we will hang in sysMsDelay()	 * forever because the decrementer won't be counting down.	 *	 * Unfreeze the Time Base clock.	 */	/* SPR 65678 wrap TBSCR write with unlock/lock code */#ifdef USE_KEYED_REGS        * TBSCRK(immrVal) = KEYED_REG_UNLOCK_VALUE;        ISYNC;#endif	* TBSCR(immrVal) = TBSCR_TBE | TBSCR_TBF;#ifdef USE_KEYED_REGS        * TBSCRK(immrVal) = ~KEYED_REG_UNLOCK_VALUE;#endif	/* initialize serial interrupts */	sysSerialHwInit2();	configured = TRUE;	}    /* check battery and nvram status */    *BCSR2 = (*BCSR2 & BCSR2_LED_MASK) |		/* Turn off LED's */             (BCSR2_D_PASS_FAIL_LED    |              BCSR2_D_STATUS_LED1      |              BCSR2_D_STATUS_LED2);    /* The LED's have a negative setting, 1: off, 0: on. */    switch (*BCSR2 & (BCSR2_BOARD_BATTERY | BCSR2_NVRAM_BATTERY))	{	case BCSR2_NVRAM_BATTERY:			/* Turn on LED1 */	    *BCSR2 = (*BCSR2 & BCSR2_LED_MASK) |	             (BCSR2_D_PASS_FAIL_LED   | BCSR2_D_STATUS_LED2);	    break;	case BCSR2_BOARD_BATTERY:			/* Turn on LED2 */	    *BCSR2 = (*BCSR2 & BCSR2_LED_MASK) |	             (BCSR2_D_PASS_FAIL_LED   | BCSR2_D_STATUS_LED1);	    break;	case (BCSR2_BOARD_BATTERY | BCSR2_NVRAM_BATTERY):	    *BCSR2 = (*BCSR2 & BCSR2_LED_MASK) | (BCSR2_D_PASS_FAIL_LED);	    break;	default:	    break;	}    /* Configure plugged in PCMCIA card(s) */    #ifdef INCLUDE_MBX_PCMCIA    mbxPcmciaConfig();#endif /* INCLUDE_MBX_PCMCIA */    }/******************************************************************************** sysProcNumGet - get the processor number** This routine returns the processor number for the CPU board, which is* set with sysProcNumSet().* * RETURNS: The processor number for the CPU board.** SEE ALSO: sysProcNumSet()*/int sysProcNumGet (void)    {    return (sysProcNum);    }/******************************************************************************** sysProcNumSet - set the processor number** This routine sets the processor number for the CPU board.  Processor numbers* should be unique on a single backplane.** Not applicable for the busless 860Ads.** RETURNS: N/A** SEE ALSO: sysProcNumGet()**/void sysProcNumSet    (    int 	procNum			/* processor number */    )    {    sysProcNum = procNum;    }/******************************************************************************** sysLocalToBusAdrs - convert a local address to a bus address** This routine gets the VMEbus address that accesses a specified local* memory address.** Not applicable for the 860Ads** RETURNS: ERROR, always.** SEE ALSO: sysBusToLocalAdrs()*/ STATUS sysLocalToBusAdrs    (    int 	adrsSpace,	/* bus address space where busAdrs resides */    char *	localAdrs,	/* local address to convert */     char **	pBusAdrs	/* where to return bus address */     )    {    return (ERROR);    }/******************************************************************************** sysBusToLocalAdrs - convert a bus address to a local address** This routine gets the local address that accesses a specified VMEbus* physical memory address.** Not applicable for the 860Ads** RETURNS: ERROR, always.** SEE ALSO: sysLocalToBusAdrs()*/STATUS sysBusToLocalAdrs    (    int  	adrsSpace, 	/* bus address space where busAdrs resides */    char *	busAdrs,   	/* bus address to convert */    char **	pLocalAdrs 	/* where to return local address */    )    {    return (ERROR);    }/******************************************************************************** sysBusTas - test and set a location across the bus** This routine does an atomic test-and-set operation across the backplane.** Not applicable for the 860Ads.** RETURNS: FALSE, always.** SEE ALSO: vxTas()*/BOOL sysBusTas    (    char *	adrs		/* address to be tested-and-set */    )    {    return (FALSE);    }/******************************************************************************** sysBusClearTas - test and clear ** This routine is a null function.** RETURNS: N/A*/void sysBusClearTas    (    volatile char * address	/* address to be tested-and-cleared */    )    {    } #ifdef	INCLUDE_CPM_END/********************************************************************************* sysCpmEnetDisable - disable the Ethernet controller** This routine is expected to perform any target specific functions required* to disable the Ethernet controller.  This usually involves disabling the* Transmit Enable (TENA) signal.** RETURNS: N/A*/void sysCpmEnetDisable    (    int         unit    /* not used */    )    {    *BCSR1 &= ~(BCSR1_E_ET);		/* disable Ethernet device */    *PCPAR(vxImmrIsbGet()) &= ~(1<<0); SYNC;    }/********************************************************************************* sysCpmEnetIntDisable - disable the Ethernet interface interrupt** This routine disable the interrupt for the Ethernet interface specified* by <unit>.** RETURNS: N/A.*/void sysCpmEnetIntDisable    (    int		unit	/* not used */    )    {    *CIMR(vxImmrIsbGet()) &= ~CIMR_SCC1;    }/********************************************************************************* sysCpmEnetEnable - enable the Ethernet controller** This routine is expected to perform any target specific functions required* to enable the Ethernet controller.  These functions typically include* enabling the Transmit Enable signal (TENA) and connecting the transmit* and receive clocks to the SCC.** RETURNS: OK, or ERROR if the Ethernet controller cannot be enabled.*/STATUS sysCpmEnetEnable    (    int		unit    /* not used */    )    {    int immrVal = vxImmrIsbGet();    *PAPAR(immrVal) |= ((1<<1)|(1<<0)); SYNC;    *PADIR(immrVal) &= ~((1<<1)|(1<<0)); SYNC;    *PAODR(immrVal) &= ~((1<<1)|(1<<0)); SYNC;    *PCPAR(immrVal) &= ~((1<<5)|(1<<4)); SYNC;    *PCDIR(immrVal) &= ~((1<<5)|(1<<4)); SYNC;    *PCSO(immrVal)  |= ((1<<5)|(1<<4)); SYNC;    *PAPAR(immrVal) |= ((1<<11)|(1<<9)); SYNC;    *PADIR(immrVal) &= ~((1<<11)|(1<<9)); SYNC;    /* Clear SCC1 Clock Sources and set NMSI */    *SICR(immrVal)  &= ~(SICR_SC1_MUX | SICR_R1CS_MSK | SICR_T1CS_MSK);    SYNC;    /* Set SCC1 Clock Sources to Rx: CLK4, and TX: CLK2 */    *SICR(immrVal)  |= (SICR_R1CS_CLK4 | SICR_T1CS_CLK2);    SYNC;    *PCPAR(immrVal) |= (1<<0); SYNC;    *PCDIR(immrVal) &= ~(1<<0); SYNC;    /* U-BUS arbitration priority 5 (BR5) */    *MPC860_SDCR(immrVal) = SDCR_RAID_BR5;    /* Enable Ethernet, 10BaseT (TP), and Disable Full Duplex Mode. */    *BCSR1 |= (BCSR1_E_ET | BCSR1_E_TP | BCSR1_E_DFD);    SYNC;    return (OK);    }/********************************************************************************* sysCpmEnetAddrGet - get the hardware Ethernet address** This routine provides the six byte Ethernet hardware address that will be* used by each individual Ethernet device unit.  This routine must copy* the six byte address to the space provided by <addr>.** RETURNS: OK, or ERROR if the Ethernet address cannot be returned.*/STATUS sysCpmEnetAddrGet    (    int		unit,   /* not used */    UINT8 *	addr    )    {    bcopy ((char *) sysCpmEnetAddr, (char *) addr, sizeof (sysCpmEnetAddr));    return (OK);    }/********************************************************************************* sysCpmEnetCommand - issue a command to the Ethernet interface controller** RETURNS: OK, or ERROR if the Ethernet controller could not be restarted.*/STATUS sysCpmEnetCommand    (    int		unit,    UINT16	command    )    {    int	immrVal = vxImmrIsbGet();    while (*CPCR(immrVal) & CPM_CR_FLG);        *CPCR(immrVal) = CPM_CR_CHANNEL_SCC1 | command | CPM_CR_FLG;    while (*CPCR(immrVal) & CPM_CR_FLG)	/* do nothing */;    return (OK);    }/********************************************************************************* sysCpmEnetIntEnable - enable the Ethernet interface interrupt** This routine enable the interrupt for the Ethernet interface specified* by <unit>.** RETURNS: N/A.*/void sysCpmEnetIntEnable    (    int		unit    )    {    *CIMR(vxImmrIsbGet()) |= CIMR_SCC1;    }/********************************************************************************* sysCpmEnetIntClear - clear the Ethernet interface interrupt** This routine clears the interrupt for the Ethernet interface specified* by <unit>.** RETURNS: N/A.*/void sysCpmEnetIntClear    (    int		unit    )    {    *CISR(vxImmrIsbGet()) = CISR_SCC1;    }#endif	/* INCLUDE_CPM_END *//******************************************************************************** sysPciTrap - trap handler for PCI exception** This routine is called from the excConnectCode stub if the PCI configuration* access generates an exception. By default, sysIn... returns the value read.* This code changes the PC to sysPciErr which sets the return value to -1.*  NOTE:  The QSpan PCI Bridge causes machine check exceptions to*  occur when a non-present device address is put into the

⌨️ 快捷键说明

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