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

📄 syslib.c.bak

📁 该源码为mpc8248处理器的BSP
💻 BAK
📖 第 1 页 / 共 3 页
字号:
/* use pci auto config */#include "pci/pciAutoConfigLib.c"    /* automatic PCI configuration */#include "sysBusPci.c"               /* pciAutoConfig BSP support file */#include "mot82xxPci.c"#endif /* INCLUDE_PCI */UINT32 vxImmrGet();#include "sysSerial.c"#include "m827xIntrCtl.c"#include "timer/m8260Timer.c"#define M82XX_SIO_FIXES#include "sio/m8260Sio.c"#ifdef INCLUDE_FLASH#include "mem/flashMem.c"#include "mem/nvRamToFlash.c"#else#include "mem/nullNvRam.c"#endif#ifdef  CTDB_MPC8280/*加入FLASH 驱动程序*/#include "flash.c"#ifdef CTDB_MPC8280_BIOS#include "at49bv040b.c"#endif#endif#include "mem/m82xxDpramLib.c"#ifdef  INCLUDE_MOTFCCEND/* set the following array to a unique Ethernet hardware address *//* last 5 nibbles are board specific, initialized in sysHwInit */unsigned char sysFccEnetAddr [2][6] = {{0x08, 0x00, 0x3e, 0x33, 0x02, 0x01},				       {0x08, 0x00, 0x3e, 0x33, 0x02, 0x02}};STATUS sysFccEnetAddrGet (int unit, UCHAR * address);#endif  /* INCLUDE_MOTFCCEND *//* locals */STATUS sysFccEnetDisable (UINT32 immrVal, UINT8 fccNum);void sysControlLED ( int LED, int on);/* defines */#define ZERO    0#define SYS_MODEL       "Motorola MPC8260 ADS"#define SYS_MODEL_HIP4  "Motorola MPC82xx ADS - HIP4"#define SYS_MODEL_HIP7  "Motorola MPC82xx ADS - HIP7"/* needed to enable timer base */#ifdef INCLUDE_PCI#define      M8260_DPPC_MASK	0x0C000000 /* bits 4 and 5 */#define      M8260_DPPC_VALUE	0x0C000000 /* bits (4,5) should be (1,0) */#else#define      M8260_DPPC_MASK	0x0C000000 /* bits 4 and 5 */#define      M8260_DPPC_VALUE	0x08000000 /* bits (4,5) should be (1,0) */#endif /*INCLUDE_PCI */#include "drv/sio/m8260Sio.h"#ifdef  INCLUDE_MOTFCCEND#   include "sysMotFcc2End.c"#endif /* INCLUDE_MOTFCCEND */#ifdef INCLUDE_FEI_END#   include "sysFei82557End.c"#endif /* INCLUDE_FEI_END */#ifdef PCI_BRIDGE_READ_ERRATA_WORKAROUNDUCHAR	sysInByte(ULONG port){return(pciBridgeRegisterReadByte(port));}USHORT	sysInWord(ULONG port){return(pciBridgeRegisterReadWord(port));}ULONG	sysInLong(ULONG port){return(pciBridgeRegisterReadLong(port));}#endif /*PCI_BRIDGE_READ_ERRATA_WORKAROUND *//******************************************************************************** sysModel - return the model name of the CPU board** This routine returns the model name of the CPU board.** RETURNS: A pointer to the string.*/char * sysModel (void)    {    UINT device;    if (((device = vxPvrGet()) & HIP4_MASK) == HIP4_ID)        return(SYS_MODEL_HIP4);    if (((device = vxPvrGet()) & HIP4_MASK) == HIP7_ID)        return(SYS_MODEL_HIP7);    return (SYS_MODEL);    }/******************************************************************************** sysBspRev - return the bsp version with the revision eg 1.0/<x>** This function returns a pointer to a bsp version with the revision.* for eg. 1.0/<x>. BSP_REV defined in config.h is concatanated to* BSP_VERSION and returned.** RETURNS: A pointer to the BSP version/revision string.*/char * sysBspRev (void)    {    return (BSP_VERSION BSP_REV);    }/****************************************************************************** * * sysHwMemInit - initialize and configure system memory. * * This routine is called before sysHwInit(). It performs memory auto-sizing * and updates the system's physical regions table, `sysPhysRgnTbl'. It may * include the code to do runtime configuration of extra memory controllers. * * NOTE: This routine should not be called directly by the user application.  It * cannot be used to initialize interrupt vectors. * * RETURNS: N/A */void sysHwMemInit (void)    {    /* Call sysPhysMemTop() to do memory autosizing if available */    sysPhysMemDesc[1].len = (UINT)(sysPhysMemTop () -  RAM_LOW_ADRS);#ifdef INCLUDE_PCI    sysPhysMemDesc[4].len = (UINT)(sysPhysMemTop ());#endif}/******************************************************************************** sysHwInit - initialize the system hardware** This routine initializes various feature of the MPC8260 ADS board. It sets up* the control registers, initializes various devices if they are present.** NOTE: This routine should not be called directly by the user.** RETURNS: NA*/void sysHwInit (void)    {    int	immrVal = vxImmrGet();    /* put correct memory size in sysPhysMemDesc[1].len for     * size of local memory     */    sysHwMemInit();    /* Zero IO Port registers */    /* reset the parallel ports */    * M8260_IOP_PADIR(immrVal) = 0x00000000;    * M8260_IOP_PAPAR(immrVal) = 0x00000000;    * M8260_IOP_PASO(immrVal) = 0x00000000;    * M8260_IOP_PAODR(immrVal) = 0x00000000;    * M8260_IOP_PADAT(immrVal) = 0x00000000;    * M8260_IOP_PBDIR(immrVal) = 0x00000000;    * M8260_IOP_PBPAR(immrVal) = 0x00000000;    * M8260_IOP_PBSO(immrVal) = 0x00000000;    * M8260_IOP_PBODR(immrVal) = 0x00000000;    * M8260_IOP_PBDAT(immrVal) = 0x00000000;    * M8260_IOP_PCDIR(immrVal) = 0x00000000;    * M8260_IOP_PCPAR(immrVal) = 0x00000000;    * M8260_IOP_PCSO(immrVal) = 0x00000000;    * M8260_IOP_PCODR(immrVal) = 0x00000000;    * M8260_IOP_PCDAT(immrVal) = 0x00000000;    * M8260_IOP_PDDIR(immrVal) = 0x00000000;    * M8260_IOP_PDPAR(immrVal) = 0x00000000;    * M8260_IOP_PDSO(immrVal) = 0x00000000;    * M8260_IOP_PDODR(immrVal) = 0x00000000;    * M8260_IOP_PDDAT(immrVal) = 0x00000000;    m82xxDpramLibInit();    /* set the BRGCLK division factor */    * M8260_SCCR(immrVal) = BRGCLK_DIV_FACTOR;    /* set DPPC in SIUMCR to 10 so that timer is enabled (TBEN) */	    * M8260_SIUMCR(immrVal) &= ~M8260_DPPC_MASK;  /* clear the dppc */    * M8260_SIUMCR(immrVal) |= M8260_DPPC_VALUE;  /* or in the desired value */    /* reset the Communications Processor */    *M8260_CPCR(immrVal) = M8260_CPCR_RESET | M8260_CPCR_FLG;    CACHE_PIPE_FLUSH();    /* Get the Baud Rate Generator Clock  frequency */    baudRateGenClk = sysBaudClkFreq();#ifdef INCLUDE_PCI#ifdef PCI_BRIDGE_READ_ERRATA_WORKAROUND    /* Setup to do IDMA for PCI Bridge reads */    pciBridgeIdmaInit();#endif / *PCI_BRIDGE_READ_ERRATA_WORKAROUND */    /* config pci */    if (pciConfigLibInit (PCI_MECHANISM_0,(ULONG) sysPciConfigRead,                              (ULONG) sysPciConfigWrite,(ULONG) sysPciSpecialCycle) != OK)        {        sysToMonitor (BOOT_NO_AUTOBOOT);  /* BAIL */        }    /*  Initialize PCI interrupt library. */    if ((pciIntLibInit ()) != OK)        {        sysToMonitor (BOOT_NO_AUTOBOOT);        }    if (*((char*)PCI_AUTO_CONFIG_ADRS)==FALSE)        {	mot82xxBridgeInit();        if (PCI_CFG_TYPE == PCI_CFG_AUTO)            sysPciAutoConfig();        *((char*)PCI_AUTO_CONFIG_ADRS)=TRUE;	}#endif /* INCLUDE_PCI */    /* Reset serial channels */        LightUp();    sysSerialHwInit();    /* Initialize interrupts */    m8260IntrInit();    /* Initialize the Security Block */    *M82XX_SECMR (immrVal) = 0xfffe0000;        *M82XX_SECBR (immrVal) = SEC_ENG_BASE_ADRS | 0x1;    /*     * The power management mode is initialized here. Reduced power mode     * is activated only when the kernel is iddle (cf vxPowerDown).     * Power management mode is selected via vxPowerModeSet().     * DEFAULT_POWER_MGT_MODE is defined in config.h.     */    vxPowerModeSet (DEFAULT_POWER_MGT_MODE);    }/********************************************************************************* sysPhysMemTop - get the address of the top of physical memory** This routine returns the address of the first missing byte of memory,* which indicates the top of memory.** Determine installed memory by reading memory control registers* and calculating if one or 2 chip selects are used for SDRAM.* Use the address mask and valid bit to determine each bank size.** RETURNS: The address of the top of physical memory.** SEE ALSO: sysMemTop()*/char * sysPhysMemTop (void)    {    LOCAL char * physTop = NULL;    physTop = (char *)(LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE);    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)    {    LOCAL char * 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 + 8);	/* Warm reboot */    intLock();    cacheDisable(INSTRUCTION_CACHE);    cacheDisable(DATA_CACHE);    sysAuxClkDisable();    /* disable both RS232 ports on the board */    sysSerialReset();		/* reset the serial device */    vxMsrSet (0);    (*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

⌨️ 快捷键说明

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