?? init.c
字號:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
//------------------------------------------------------------------------------
//
// File: init.c
//
// Samsung SMDK6410 board initialization code.
//
#include <bsp.h>
UINT32 g_oalIoCtlClockSpeed;
//------------------------------------------------------------------------------
//
// Global: g_oalRtcResetTime
//
// RTC init time after a RTC reset has occured.
//
SYSTEMTIME g_oalRtcResetTime =
{
2007, // wYear
2, // wMonth
3, // wDayofWeek
14, // wDay
12, // wHour
0, // wMinute
0, // wSecond
0 // wMilliseconds
};
static void InitializeGPIO(void);
static void InitializeCLKGating(void);
static void InitializeBlockPower(void);
static void InitializeCLKSource(void);
static void InitializeRTC(void);
extern void InitializeOTGCLK(void);
//------------------------------------------------------------------------------
//
// OEMSetMemoryAttributes
//
// OEM function to change memory attributes that isn't supported by kernel.
// Current implementaion only supports PAGE_WRITECOMBINE.
//
//------------------------------------------------------------------------------
BOOL OEMSetMemoryAttributes (
LPVOID pVirtAddr, // Virtual address of region
LPVOID pPhysAddrShifted,// PhysicalAddress >> 8 (to support up to 40 bit address)
DWORD cbSize, // Size of the region
DWORD dwAttributes // attributes to be set
)
{
if (PAGE_WRITECOMBINE != dwAttributes) {
DEBUGMSG (OAL_ERROR, (L"OEMSetMemoryAttributes: Only PAGE_WRITECOMBINE is supported\r\n"));
return FALSE;
}
return NKVirtualSetAttributes (pVirtAddr, cbSize,
0x4, // on ARMv6, this value means Shared-Device. On ARMv4, Non-cacheable & bufferable
0xC, // Mask of all cache related bits
&dwAttributes);
}
//------------------------------------------------------------------------------
//
// Function: OEMInit
//
// This is Windows CE OAL initialization function. It is called from kernel
// after basic initialization is made.
//
void OEMInit()
{
BOOL *bCleanBootFlag;
OALMSG(OAL_FUNC, (L"[OAL] ++OEMInit()\r\n"));
OALMSG(OAL_FUNC, (TEXT("[OAL] S3C6410_APLL_CLK : %d\n\r"), System_GetAPLLCLK()));
OALMSG(OAL_FUNC, (TEXT("[OAL] ARMCLK : %d\n\r"), System_GetARMCLK()));
OALMSG(OAL_FUNC, (TEXT("[OAL] HCLK : %d\n\r"), System_GetHCLK()));
OALMSG(OAL_FUNC, (TEXT("[OAL] PCLK : %d\n\r"), System_GetPCLK()));
g_oalIoCtlClockSpeed = System_GetARMCLK();
//CEProcessorType = PROCESSOR_STRONGARM;
// Set memory size for DrWatson kernel support
//
dwNKDrWatsonSize = 128 * 1024;
// Intialize optional kernel functions. (Processor Extended Feature)
//
g_pOemGlobal->pfnIsProcessorFeaturePresent = (PFN_IsProcessorFeaturePresent)OALIsProcessorFeaturePresent;
// Set OEMSetMemoryAttributes function
g_pOemGlobal->pfnSetMemoryAttributes = (PFN_SetMemoryAttributes)OEMSetMemoryAttributes;
// Initialize GPIO
//
InitializeGPIO();
// Turn Off all Debug LED
//
OEMWriteDebugLED(0, 0x0);
// Initialize Clock Source
//
InitializeCLKSource();
// Initialize Clock Gating
//
InitializeCLKGating();
// Initialize Block Power
//
InitializeBlockPower();
// Initialize OTG PHY Clock
//
InitializeOTGCLK();
// Initialize BCD registers in RTC to known values
//
InitializeRTC();
// Initilize cache globals
//
OALCacheGlobalsInit();
OALLogSerial(L"DCache: %d sets, %d ways, %d line size, %d size\r\n",
g_oalCacheInfo.L1DSetsPerWay, g_oalCacheInfo.L1DNumWays,
g_oalCacheInfo.L1DLineSize, g_oalCacheInfo.L1DSize);
OALLogSerial(L"ICache: %d sets, %d ways, %d line size, %d size\r\n",
g_oalCacheInfo.L1ISetsPerWay, g_oalCacheInfo.L1INumWays,
g_oalCacheInfo.L1ILineSize, g_oalCacheInfo.L1ISize);
// Check and Initialize the BSP Args area
//
OALArgsInit((BSP_ARGS *)IMAGE_SHARE_ARGS_UA_START);
// Check clean boot flag in BSP Args area
//
OALMSG(OAL_FUNC, (TEXT("[OAL] OEMInit() : BSP Args forces Clean Boot\r\n")));
bCleanBootFlag = (BOOL *)OALArgsQuery(BSP_ARGS_QUERY_CLEANBOOT);
if (*bCleanBootFlag)
{
// Notify to filesys.exe that we want a clean boot.
NKForceCleanBoot();
}
// Initialize Interrupts
//
if (!OALIntrInit())
{
OALMSG(OAL_ERROR, (L"[OAL:ERR] OEMInit() : failed to initialize interrupts\r\n"));
}
// Initialize System Clock
//
OALTimerInit(RESCHED_PERIOD, (OEM_COUNT_1MS ), 0);
// Make high-res Monte Carlo profiling available to the kernel
//
g_pOemGlobal->pfnProfileTimerEnable = OEMProfileTimerEnable;
g_pOemGlobal->pfnProfileTimerDisable = OEMProfileTimerDisable;
// Initialize the KITL connection if required
//
KITLIoctl(IOCTL_KITL_STARTUP, NULL, 0, NULL, 0, NULL);
OALMSG(OAL_FUNC, (L"[OAL] --OEMInit()\r\n"));
}
//------------------------------------------------------------------------------
static void InitializeGPIO()
{
volatile S3C6410_GPIO_REG *pGPIOReg = (S3C6410_GPIO_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_GPIO, FALSE);
OALMSG(OAL_FUNC, (L"[OAL] InitializeGPIO()\r\n"));
// OEM can add GPIO initialization code here
}
static void InitializeCLKGating(void)
{
volatile S3C6410_SYSCON_REG *pSysConReg = (S3C6410_SYSCON_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_SYSCON, FALSE);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -