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

📄 init.c

📁 老外的一个开源项目
💻 C
字号:
// Copyright (c) David Vescovi.  All rights reserved.
// Part of Project DrumStix
// Windows Embedded Developers Interest Group (WE-DIG) community project.
// http://www.we-dig.org
// Copyright (c) Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------------------------
//
//  File:  init.c
//
//  Board initialization code.
//
//------------------------------------------------------------------------------
#include "bsp.h"

// External function prototypes.
//
extern void TurnOnBTB(void);
extern void InitDebugSerial(UINT32 DbgSerPhysAddr);

/*
    Global:  dwOEMDrWatsonSize

    Global variable which specify DrWatson buffer size. It can be fixed
    in config.bib via FIXUPVAR.
 */
#define DR_WATSON_SIZE_NOT_FIXEDUP (-1)
DWORD dwOEMDrWatsonSize = DR_WATSON_SIZE_NOT_FIXEDUP;

// Cache-related variables.
//
#define ZBANK_BASE_C_VIRTUAL        0x9A500000
DWORD CacheBufferFlag;  // NOTE: this needn't be a const variable and OEMCacheRangeFlush won't be called before KernelRelocate.
const LPVOID gpvCacheFlushBaseMemoryAddress = (LPVOID)ZBANK_BASE_C_VIRTUAL;

// Common timer routine constants.
//
const DWORD OEMTimerFreq     = OEM_CLOCK_FREQ;
const int OEMMinTickDistance = (OEM_CLOCK_FREQ / 20002);    // ~50 us

//------------------------------------------------------------------------------
//
//  Function:  OEMInit
//
//  This is Windows CE OAL initialization function. It is called from kernel
//  after basic initialization is made.
//
//------------------------------------------------------------------------------
void OEMInit()
{

    // Set up the debug zones according to the fix-up variable initialOALLogZones
    OALLogSetZones(initialOALLogZones);

	OALMSG(OAL_FUNC, (L"+OEMInit\r\n"));
	//
    // Expose the processor type.
    CEProcessorType = PROCESSOR_ARM920;

    // Enable the branch-target buffer.
    //
	TurnOnBTB();

    // Set memory size for DrWatson kernel support.
    //
    dwNKDrWatsonSize = 0;
    if (dwOEMDrWatsonSize != DR_WATSON_SIZE_NOT_FIXEDUP) {
        dwNKDrWatsonSize = dwOEMDrWatsonSize;
    }

    // Intialize optional kernel functions.
    //
    pOEMIsProcessorFeaturePresent = OALIsProcessorFeaturePresent;

	// forces the operating system (OS) to boot from a clean object store file system 
	NKForceCleanBoot();

	// Initialize interrupts.
    //
    if (!OALIntrInit())
    {
        OALMSG(OAL_ERROR, (L"ERROR: OEMInit: failed to initialize interrupts.\r\n"));
    }

    // Initialize system clock.
    //
    OALTimerInit(1, OEM_TICKS_1MS, OEM_TICK_COUNT_MARGIN);

    // Initialize the KITL connection if required.
    //
    KITLIoctl (IOCTL_KITL_STARTUP, NULL, 0, NULL, 0, NULL);

    OALMSG(OAL_FUNC, (L"-OEMInit\r\n"));
}


void OEMInitDebugSerial(void)
{
    UINT32 *pDbgSerPhysAddr = (UINT32*) OALArgsQuery(BSP_ARGS_QUERY_DBGSERIAL);

    if (pDbgSerPhysAddr)
    {
        InitDebugSerial(*pDbgSerPhysAddr);
    }
	else
	{
loop:
		InitDebugSerial(PXA255_BASE_REG_PA_FFUART);		// assume FFUART
	    OEMWriteDebugString(TEXT("Invalid Args signature\r\n"));
		OEMWriteDebugString(TEXT("Mismatched bootloader/BSP version??\r\n"));
		goto loop;
	}

    OEMWriteDebugString(TEXT("\r\n"));
	OEMWriteDebugString(TEXT("######################################################\r\n"));
    OEMWriteDebugString(TEXT("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n"));
}


⌨️ 快捷键说明

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