📄 init.c
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
//------------------------------------------------------------------------------
//
// File: init.c
//
// Plato board initialization code.
//
#include <bsp.h>
// External function prototypes.
//
extern TURN_ON_BTB(void);
extern void InitDebugSerial(UINT32 DbgSerPhysAddr);
extern void BSPPowerInit();
// Cache-related variables.
//
#define ZBANK_BASE_C_VIRTUAL 0x8A600000
DWORD CacheBufferFlag; // NOTE: this needn't be a const variable and OEMCacheRangeFlush won't be called before KernelRe locate.
const LPVOID gpvCacheFlushBaseMemoryAddress = (LPVOID)ZBANK_BASE_C_VIRTUAL;
// Common timer routine constants.
//
const DWORD OEMTimerFreq = OEM_CLOCK_FREQ;
const int OEMMinTickDistance = (OEM_CLOCK_FREQ / 20000); // 50 us
/*
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;
//------------------------------------------------------------------------------
//
// Function: OEMInit
//
// This is Windows CE OAL initialization function. It is called from kernel
// after basic initialization is made.
//
void OEMInit()
{
OALMSG(0, (L"+OEMInit\r\n"));
// Enable the branch-target buffer.
//
TURN_ON_BTB();
OALLogSetZones(initialOALLogZones);
// Set memory size for DrWatson kernel support.
//
dwNKDrWatsonSize = 0;
if (dwOEMDrWatsonSize != DR_WATSON_SIZE_NOT_FIXEDUP) {
dwNKDrWatsonSize = dwOEMDrWatsonSize;
}
// Intialize optional kernel functions.
//
pOEMIsProcessorFeaturePresent = OALIsProcessorFeaturePresent;
// profiling support
//
g_pOemGlobal->pfnProfileTimerEnable = OEMProfileTimerEnable;
g_pOemGlobal->pfnProfileTimerDisable = OEMProfileTimerDisable;
// Check clean boot flag in BSP Args area
//
{
// This is the global shared Args flag
BOOL *bCleanBootFlag = (BOOL*) OALArgsQuery(BSP_ARGS_QUERY_CLEANBOOT);
if(*bCleanBootFlag)
{
OALMSG(1, (TEXT("OEM: Force clean boot.\r\n")));
// Clear the flag so that we don't get here in the next boot unless it is set again.
*bCleanBootFlag = FALSE;
// Tell filesys.exe that we want a clean boot.
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);
//OALKitlStart();
// Initialize power supply chip and suspend/resume functionality
BSPPowerInit();
OALMSG(1, (L"Platfrom Kernel Init. Complete!\r\n"));
OALMSG(0, (L"-OEMInit\r\n"));
}
VOID OALStall(UINT32 microSec)
{
volatile PBULVERDE_OST_REG pOSTRegs = NULL;
pOSTRegs = (PBULVERDE_OST_REG)OALPAtoVA(BULVERDE_BASE_REG_PA_OST, FALSE);
XllpOstDelayMicroSeconds(pOSTRegs, microSec);
}
VOID OEMInitDebugSerial(void)
{
UINT32 *pDbgSerPhysAddr = (UINT32*)BULVERDE_BASE_REG_PA_FFUART; //(UINT32*) OALArgsQuery(BSP_ARGS_QUERY_DBGSERIAL);
if (pDbgSerPhysAddr)
{
InitDebugSerial((UINT32)pDbgSerPhysAddr);
}
}
//------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -