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

📄 syslib.c

📁 Tornado 2.0 BSP for HaeDong HD860-R3 韩国HaeDong公司开发的基于Motorola的MPC860处理器的开发板的BSP
💻 C
📖 第 1 页 / 共 3 页
字号:
/****************************************************************************/
/*                                                                          */
/* Filename : sysLib.c                                                      */
/*                                                                          */
/* Purpose. : This module provides the board specific routines required by  */
/*            the vxWorks OS for support.                                   */
/* History:	                                                                */
/* 01b,27jun97,gsb  added Nvram initialization to sysHwInit()               */
/*                        													*/
/****************************************************************************/

/*********************************/
/*                               */
/* Include files                 */
/*                               */
/*********************************/

#include "vxWorks.h"
#include "vme.h"
#include "memLib.h"
#include "cacheLib.h"
#include "sysLib.h"
#include "config.h"
#include "string.h"
#include "intLib.h"
#include "logLib.h"
#include "stdio.h"
#include "taskLib.h" 
#include "vxLib.h"
#include "tyLib.h"
#include "arch/ppc/vxPpcLib.h"
#include "private/vmLibP.h"
#include "drv/multi/ppc860Siu.h"
#include "hd860r3.h"
#include "seeprom.h"
#include "sysSerial.c"
#include "intrCtl/ppc860Intr.c"
#include "byteNvRam.c" 
#include "timer/ppcDecTimer.c"


/*********************************/
/*                               */
/* Global data defined here      */
/*                               */
/*********************************/

PHYS_MEM_DESC sysPhysMemDesc [] =          /* not used */
{
    {
        (void *) LOCAL_MEM_LOCAL_ADRS,
        (void *) LOCAL_MEM_LOCAL_ADRS,
        LOCAL_MEM_SIZE ,
        VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
        VM_STATE_VALID      | VM_STATE_WRITABLE      | VM_STATE_CACHEABLE
    },

    {
        (void *) INTERNAL_MEM_MAP_ADDR,
        (void *) INTERNAL_MEM_MAP_ADDR,
        INTERNAL_MEM_MAP_SIZE,      /* 64 k - Internal Memory Map */    
        VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
        VM_STATE_VALID      | VM_STATE_WRITABLE      | VM_STATE_CACHEABLE_NOT
    },

    {
        (void *) ROM_BASE_ADRS,
        (void *) ROM_BASE_ADRS,
        ROM_SIZE,               /* Flash memory */  
        VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
        VM_STATE_VALID      | VM_STATE_WRITABLE      | VM_STATE_CACHEABLE_NOT
    }
};

int sysPhysMemDescNumEnt = NELEMENTS( sysPhysMemDesc ) ;

int   sysBus       = BUS            ; /* system bus type (VME_BUS, etc)    */
int   sysCpu       = CPU            ; /* system CPU type (PPC860)          */
char *sysBootLine  = BOOT_LINE_ADRS ; /* address of boot line              */
char *sysExcMsg    = EXC_MSG_ADRS   ; /* catastrophic message area         */
BOOL  sysVmeEnable = FALSE          ; /* by default no VME                 */
                                      /*                                   */
int   sysProcNum                    ; /* processor number of this CPU      */
int   sysFlags                      ; /* boot flags                        */
char  sysBootHost[ BOOT_FIELD_LEN ] ; /* name of host from which we booted */
char  sysBootFile[ BOOT_FIELD_LEN ] ; /* name of file from which we booted */

/*                                                             */
/* last 5 nibbles are board specific, initialized in sysHwInit */
/*                                                             */

#ifdef  INCLUDE_CPM
unsigned char sysCpmEnetAddr [6] = {0x00, 0x0a, 0x1e, 0x00, 0x00, 0x10};
#endif  /* INCLUDE_CPM */

/*********************************/
/*                               */
/* Forward function references   */
/*                               */
/*********************************/

void sysCpmEnetDisable   ( int unit );
void sysCpmEnetIntDisable( int unit );

/****************************************************************************/
/*                                                                          */
/* Function : sysModel( void )                                              */
/*                                                                          */
/* Purpose. : Returns the model name of the CPU board.                      */
/*                                                                          */
/* Returns. : Pointer to string contain model information.                  */
/*                                                                          */
/* Notes... : None                                                          */
/*                                                                          */
/****************************************************************************/

char * sysModel( void )
{
 return( SYS_MODEL ) ;
}

/****************************************************************************/
/*                                                                          */
/* Function : sysBspRev( void )                                             */
/*                                                                          */
/* Purpose. : Provides the BSP version information.                         */
/*                                                                          */
/* Returns. : Pointer to BSP version/revision string.                       */
/*                                                                          */
/* Notes... : None                                                          */
/*                                                                          */
/****************************************************************************/

char * sysBspRev( void )
{
 return( BSP_VERSION BSP_REV );
}

/****************************************************************************/
/*                                                                          */
/* Function : sysHwInit( void )                                             */
/*                                                                          */
/* Purpose. : Initialize the system hardware. In this case the SBC8XX board */
/*            setup includes the control registers and various devices.     */
/*                                                                          */
/* Returns. : None                                                          */
/*                                                                          */
/* Notes... : None                                                          */
/*                                                                          */
/****************************************************************************/

void sysHwInit( void )
{
    char  initValue[NV_INIT_SIZE+1];

    /*                                                                      */
    /* Get the physical location of the IMMR register                       */
    /*                                                                      */
    int immrVal = vxImmrGet() ;

    /*                                                                      */
    /* reset port A,B,C,D                                                         */
    /*                                                                      */
    *PAPAR( immrVal ) = 0x0000;
    *PADIR( immrVal ) = 0x0000;
    *PAODR( immrVal ) = 0x0000;
    *PBPAR( immrVal ) = 0x0000;
    *PBDIR( immrVal ) = 0x0000;
    *PBODR( immrVal ) = 0x0000;
    *PCPAR( immrVal ) = 0x0000;
    *PCDIR( immrVal ) = 0x0000;
    *PCSO ( immrVal ) = 0x0000;
    *PDPAR( immrVal ) = 0x0000;
    *PDDIR( immrVal ) = 0x0000;

    /*                                                                      */
    /* Initialize SI/NMSI                                                   */
    /*                                                                      */
    *SICR( immrVal ) = 0x0;

    /*                                                                      */
    /* Initialize interrupts - default interrupt level                      */
    /*                                                                      */
    ppc860IntrInit( IV_LEVEL4 ) ;

    /* 																		*/
	/* Initialize Nvram with DEFAULT_BOOT_LINE if currently uninitialized   */
	/*																		*/
	
	seeprom_initI2C();	/* Init SEEPROM ( used as NVRAM ) */
	
	if ((sysNvRamGet(&initValue[0],NV_INIT_SIZE+1,-NV_BOOT_OFFSET)) != ERROR)
	{
	  
	  if ( strcmp( initValue, NVRAM_INITIALIZED) != 0 ) 
	  {
	  	
	    (void)sysNvRamSet(DEFAULT_BOOT_LINE, strlen(DEFAULT_BOOT_LINE)+1,0);
		(void)sysNvRamSet(NVRAM_INITIALIZED, NV_INIT_SIZE+1, -NV_BOOT_OFFSET);
		
	  }
	}
	

    /*                                                                      */
    /* Reset serial channels                                                */
    /*                                                                      */
    sysSerialHwInit();

    /*                                                                      */
    /* make sure Ethernet is disabled                                       */
    /*                                                                      */
    sysCpmEnetDisable   ( 0 ) ;
    sysCpmEnetIntDisable( 0 ) ;
}

/****************************************************************************/
/*                                                                          */
/* Function : sysPhysMemTop( void )                                         */
/*                                                                          */
/* Purpose. : Return the top of physical memory.                            */
/*                                                                          */
/* Returns. : Address of top of memory.                                     */
/*                                                                          */
/* Notes... : None                                                          */
/*                                                                          */
/****************************************************************************/

char * sysPhysMemTop( void )
{
    static char * physTop = NULL;

    if (physTop == NULL)
    {
      physTop = (char *)(LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE);
    }

    return( physTop ) ;
}

/****************************************************************************/
/*                                                                          */
/* Function : sysMemTop( void )                                             */

⌨️ 快捷键说明

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