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

📄 syslib.c

📁 MPC850的bootrom。使用后可以直接启动boot程序
💻 C
📖 第 1 页 / 共 2 页
字号:
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 */    )    {    } /********************************************************************************* 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 - only slave SCC1 is wired to port */    )    {   #ifdef MPC850_BSP    /* If running an 850, use SCC2 */	   *PBPAR(vxImmrGet()) &= ~(0x2000);    /* set port B -> RTS2 = *TENA */	                                        /* PB18 = 0 , 即TENA无效 , gtt */#else    *PBPAR(vxImmrGet()) &= ~(0x1000);    /* set port B -> RTS1 = *TENA */                                         /* PB19 = 0 , 即TENA无效 , gtt */#endif}/********************************************************************************* 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    )    {    /* If running an 823, use SCC2 */#ifdef  MPC850_BSP	     *CIMR(vxImmrGet()) &= ~CIMR_SCC2;#else	     *CIMR(vxImmrGet()) &= ~CIMR_SCC1;  /* CIMR_SCC1 = 0x40000000 , SCC1中断被屏蔽  gtt */#endif    }#ifdef	INCLUDE_CPM/********************************************************************************* 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 - only slave SCC1 is wired to port */    )    {    int immrVal = vxImmrGet();    #ifdef MPC850_BSP    /* If running an 823, use SCC2 */     *PAPAR(immrVal) |= 0x0A0c;	   *PADIR(immrVal) &= ~(0x0A0c);  /* PA4:ETHRCK PA6:ETHTCK PA12:ETHTXD PA13:ETHRXD gtt */   	*PCPAR(immrVal) &= ~(0x00c0);	   *PCDIR(immrVal) &= ~(0x00c0);	   *PCSO(immrVal)  |= 0x00c0; 	   /* *SICR(immrVal)  |= 0x2c00; */  /* R1CS=101  CLK2 , T1CS=100  CLK1 , connect SCC1 clocks */	   *SICR(immrVal)  |= 0x2f00;      /* T1CS=111  CLK4 , R1CS=101  CLK2  gtt  */  	   *SICR(immrVal)  &= ~(0x4000);	/* NMSI mode */      	  	*PBPAR(immrVal) |= 0x00002000;  /* set port B -> *RTS2 = TENA */	   *PBDIR(immrVal) |= 0x00002000; 	#else	   /* *PAPAR(immrVal) |= 0x0303;	   *PADIR(immrVal) &= ~(0x0303);  */	   *PAPAR(immrVal) |= 0x0A03;     /* PA4:ETHRCK PA6:ETHTCK PA14:ETHTXD PA15:ETHRXD gtt  */	   *PADIR(immrVal) &= ~(0x0A03);	   *PCPAR(immrVal) &= ~(0x0030);	   *PCDIR(immrVal) &= ~(0x0030);	   *PCSO(immrVal)  |= 0x0030;    /* PC10:ERENA  PC11:ECLSN  gtt  */	   *PCDIR(immrVal) |= 0x0f00;	   *PCDAT(immrVal) |= 0x0600;	   *PCDAT(immrVal) &= ~(0x0900); 	   	   /* *SICR(immrVal)  |= 0x2c;  */ 	                              /* R1CS=101  CLK2 , T1CS=100  CLK1 , connect SCC1 clocks */	   *SICR(immrVal)  |= 0x3D;      /* R1CS=111  CLK4 , T1CS=101  CLK2  gtt  */                         	   *SICR(immrVal)  &= ~(0x40);   /* NMSI mode */		  	*PBPAR(immrVal) |= 0x00001000;      /* set port B -> *RTS1 = TENA */	   *PBDIR(immrVal) |= 0x00001000;#endif    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 - only slave SCC1 is wired to port */    UINT8 *	addr    )    {    /* getMACAddr(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 = vxImmrGet();    /* If running an 823, use SCC2 */#ifdef MPC850_BSP    while (*CPCR(immrVal) & CPM_CR_FLG);     *CPCR(immrVal) = CPM_CR_CHANNEL_SCC2 | command | CPM_CR_FLG;    while (*CPCR(immrVal) & CPM_CR_FLG);#else    while (*CPCR(immrVal) & CPM_CR_FLG);    *CPCR(immrVal) = CPM_CR_CHANNEL_SCC1 | command | CPM_CR_FLG;    while (*CPCR(immrVal) & CPM_CR_FLG);#endif    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    )    {    /* If running an 823, use SCC2 */#ifdef MPC850_BSP    *CIMR(vxImmrGet()) |= CIMR_SCC2;#else    *CIMR(vxImmrGet()) |= CIMR_SCC1;#endif    }/********************************************************************************* 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    )    {    /* If running an 823, use SCC2 */#ifdef MPC850_BSP 	  *CISR(vxImmrGet()) = CISR_SCC2;#else	   *CISR(vxImmrGet()) = CISR_SCC1;#endif    }/********************************************************************************* sysCpmAttach - attach wrapper**/STATUS sysCpmAttach    (    int         unit,           /* unit number */    SCC *       pScc,           /* address of SCC parameter RAM */    SCC_REG *   pSccReg,        /* address of SCC registers */    VOIDFUNCPTR * ivec,         /* interrupt vector offset */    SCC_BUF *   txBdBase,       /* transmit buffer descriptor base address */    SCC_BUF *   rxBdBase,       /* receive buffer descriptor base address */    int         txBdNum,        /* number of transmit buffer descriptors */    int         rxBdNum,        /* number of receive buffer descriptors */    UINT8 *     bufBase         /* address of memory pool; NONE = malloc it */    )    {    /* If running an 823, use SCC2 */#ifdef MPC850_BSP	   return (cpmattach(unit, IF_USR_823ARG1, IF_USR_823ARG2, IF_USR_823ARG3,			         txBdBase, rxBdBase, txBdNum, rxBdNum, bufBase));#else    /* else use SCC1 */ 	  return (cpmattach(unit, pScc, pSccReg, ivec, 			         txBdBase, rxBdBase, txBdNum, rxBdNum, bufBase));#endif    }#endif	/* INCLUDE_CPM */#ifdef INCLUDE_MOT_FEC/********************************************************************************* sysFecEnetEnable - enable the MII interface of the Fast Ethernet controller** This routine is expected to perform any target specific functions required* to enable the Ethernet device and the MII interface of the Fast Ethernet * controller. These functions include setting the MII-compliant signals on * Port D and disabling the IRQ7 signal.** This routine does not enable the 7-wire serial interface.** RETURNS: OK, or ERROR if the Fast Ethernet controller cannot be enabled.*/STATUS sysFecEnetEnable    (    UINT32	motCpmAddr	/* base address of the on-chip RAM */    )    {    int intLevel = intLock();    /* enable the Ethernet device for the FEC */    *BCSR4 |= (BCSR4_FETH_RST | BCSR4_FETH_CFG0 	       | BCSR4_FETH_FDE);     *BCSR4 &= ~BCSR4_UUFDIS;		    /* introduce a little delay */    taskDelay (sysClkRateGet ());    /* mask IRQ7 off, as it is shared with MII_TX_CLK */    *SIMASK (motCpmAddr) &= ~SIMASK_IRM7;    /* also clear any pending interrupt */    *SIPEND (motCpmAddr) |= SIPEND_IRQ7;    /*      * set the arbitration level for the FEC. Do not enable     * FEC aggressive mode.     */    *SDCR (motCpmAddr) |= SDCR_FAID_BR6;    /* set Port D to use MII signals */    *PDPAR (motCpmAddr) = 0x1fff;    *PDDIR (motCpmAddr) = 0x1c58;    intUnlock (intLevel);    return (OK);    }/********************************************************************************* sysFecEnetDisable - disable MII interface to the Fast Ethernet controller** This routine is expected to perform any target specific functions required* to disable the Ethernet device and the MII interface to the Fast Ethernet * controller.  This involves restoring the default values for all the Port * D signals.** RETURNS: OK, always.*/STATUS sysFecEnetDisable    (    UINT32	motCpmAddr	/* base address of the on-chip RAM */    )    {    int intLevel = intLock();    /* disable the Ethernet device for the FEC */    *BCSR4 |= BCSR4_UUFDIS;    /* configure all Port D pins as general purpose input pins */    *PDPAR (motCpmAddr) = 0x0;    *PDDIR (motCpmAddr) = 0x0;    intUnlock (intLevel);    return (OK);    }/********************************************************************************* sysFecEnetAddrGet - get the hardware Ethernet address** This routine provides the six byte Ethernet hardware address that will be* used by each individual Fast 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 sysFecEnetAddrGet    (    UINT32	motCpmAddr,	/* base address of the on-chip RAM */    UCHAR *	addr		/* where to copy the Ethernet address */    )    {    bcopy ((char *) sysFecEnetAddr, (char *) addr, sizeof (sysFecEnetAddr));    return (OK);    }#endif /* INCLUDE_MOT_FEC */

⌨️ 快捷键说明

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