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

📄 init_platform.c

📁 yamon2.27.tar.gz bootloader 在au1200上完全通过
💻 C
字号:

/************************************************************************
*
*  init_platform.c
*
*  Platform specific startup code (c-code)
*
*
* ######################################################################
*
* Copyright (c) 1999-2000 MIPS Technologies, Inc. All rights reserved.
*
* Unpublished rights reserved under the Copyright Laws of the United States of
* America.
*
* This document contains information that is proprietary to MIPS Technologies,
* Inc. ("MIPS Technologies"). Any copying, modifying or use of this information
* (in whole or in part) which is not expressly permitted in writing by MIPS
* Technologies or a contractually-authorized third party is strictly
* prohibited. At a minimum, this information is protected under unfair
* competition laws and the expression of the information contained herein is
* protected under federal copyright laws. Violations thereof may result in
* criminal penalties and fines.
* MIPS Technologies or any contractually-authorized third party reserves the
* right to change the information contained in this document to improve
* function, design or otherwise. MIPS Technologies does not assume any
* liability arising out of the application or use of this information. Any
* license under patent rights or any other intellectual property rights owned
* by MIPS Technologies or third parties shall be conveyed by MIPS Technologies
* or any contractually-authorized third party in a separate license agreement
* between the parties.
* The information contained in this document constitutes one or more of the
* following: commercial computer software, commercial computer software
* documentation or other commercial items. If the user of this information, or
* any related documentation of any kind, including related technical data or
* manuals, is an agency, department, or other entity of the United States
* government ("Government"), the use, duplication, reproduction, release,
* modification, disclosure, or transfer of this information, or any related
* documentation of any kind, is restricted in accordance with Federal
* Acquisition Regulation 12.212 for civilian agencies and Defense Federal
* Acquisition Regulation Supplement 227.7202 for military agencies. The use of
* this information by the Government is further restricted in accordance with
* the terms of the license agreement(s) and/or applicable contract terms and
* conditions covering this information from MIPS Technologies or any
* contractually-authorized third party.
*
************************************************************************/


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

#include <sysdefs.h>
#include <init.h>
#include <sys_api.h>
#include <syscon_api.h>
#include <pci_api.h>
#include <excep_api.h>
#include <stdio.h>
#include <product.h>
#include <malta.h>
#include <atlas.h>
#include <pb1000.h>

/************************************************************************
*  Definitions
************************************************************************/

/************************************************************************
*  Static function prototypes
************************************************************************/

/************************************************************************
*  Implementation : Public functions
************************************************************************/

/************************************************************************
*
*                          arch_platform_init
*  Description :
*  -------------
*
*  Platform specific initialisation code
*
*  Return values :
*  ---------------
*
*  None
*
************************************************************************/
void
arch_platform_init(
				   bool early )	/* TRUE -> Before initmodules(), FALSE -> after */
{
    UINT32 data, cpufreq;
    UINT8  data8, revmaj, revmin;

    /* TBD : Some of this may be moved to drivers (or a new "SuperIO" module) */

    if( early )
    {

        switch( sys_platform )
		{

		case PRODUCT_PB1000_ID:

			/* PBUpdate - insert pre module init stuff here */
			au1000_memtest();
			break;


		  default :

			  break;
        }
    }
    else
    {
        /* !early */

        revmaj = (atoi(_REVMAJ_) & 0xff);
        revmin = (atoi(_REVMIN_) & 0xff);
		cpufreq = ((*(volatile unsigned long *)0xb1900060) & 0x3f) * 12;
        // convert to BCD
        cpufreq = ((cpufreq / 100) << 8) | (((cpufreq / 10) % 10)) << 4 | (cpufreq % 10);

        switch( sys_platform )
		{
		case PRODUCT_PB1000_ID:
			/* PBUpdate - insert post module init stuff here */

#ifdef PB1500_CONFIG
#define brd_ledreg  (*(volatile unsigned long *)0xae000018)
#define brd_hexdisp (*(volatile unsigned long *)0xaf000000)
#define brd_hexblnk (*(volatile unsigned long *)0xaf000008)
            // construct hex display
			data = (revmaj << 24) | (revmin << 16) | cpufreq;
            brd_hexdisp = data;
            brd_hexblnk = 0x08;
            brd_ledreg &= ~0x40;
#endif 

#ifdef PB1100_CONFIG
#define brd_ledreg  (*(volatile unsigned short*)0xae000018)
#define brd_hexdisp (*(volatile unsigned long *)0xaf000000)
#define brd_hexblnk (*(volatile unsigned long *)0xaf000008)
            // construct hex display
			data = (revmaj << 24) | (revmin << 16) | cpufreq;
            brd_hexdisp = data;
            brd_hexblnk = 0x08;
            brd_ledreg &= ~0x40;
#endif 

#if defined(DB1500_CONFIG) || defined(DB1000_CONFIG) || defined(DB1100_CONFIG)
			// Change HEX display
			*(volatile int *)0xAF000000 = 0;
#endif

#ifdef PB1550_CONFIG
#define brd_hexdisp (*(volatile unsigned long *)0xaf800000)
#define brd_hexblnk (*(volatile unsigned long *)0xaf800008)
            // construct hex display
			data = (revmaj << 24) | (revmin << 16) | cpufreq;
            brd_hexdisp = data;
            brd_hexblnk = 0x08;
#endif 

#ifdef PB1200_CONFIG
            // construct hex display
			data = (revmaj << 24) | (revmin << 16) | cpufreq;
			*(volatile unsigned short *)(BCSR_ADDR|0x01C00008) = 0x8;
			*(volatile unsigned int *)  (BCSR_ADDR|0x01C00000) = data;
#endif 

#ifdef DB1200_CONFIG
			// Change HEX display
			*(volatile int *)0xB9C00000 = 0;
#endif
			break;

		default :
			break;
        }

        arch_core_init();
    }
}


/************************************************************************
*  Implementation : Static functions
************************************************************************/

⌨️ 快捷键说明

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