Example #1
0
//------------------------------------------------------------------------------
//
//  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()));

    OALMSG(1, (TEXT("[OAL] S3C6410_APLL_CLK   : %d\n\r"), System_GetAPLLCLK()));
    OALMSG(1, (TEXT("[OAL] ARMCLK : %d\n\r"), System_GetARMCLK()));
    OALMSG(1, (TEXT("[OAL] HCLK   : %d\n\r"), System_GetHCLK()));
    OALMSG(1, (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;



    // Turn Off all Debug LED
    //

    // Initialize Clock Source
    //
    InitializeCLKSource();

    // Initialize Clock Gating
    //
    InitializeCLKGating();

    // Initialize Block Power
    //
    InitializeBlockPower();

    // Initialize ExtPowerCTL
    //
    InitPowerCTL();

	// Initialize OTG PHY Clock
    //
    InitializeOTGCLK();

    // Initialize BCD registers in RTC to known values
    
    // 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);

	InitializeBank();
    OALMSG(OAL_FUNC, (L"[OAL] --OEMInit()\r\n"));
}
Example #2
0
//------------------------------------------------------------------------------
//
//  Function:  OEMInit
//
//  This is Windows CE OAL initialization function. It is called from kernel
//  after basic initialization is made.
//
void OEMInit()
{
	UINT32 logMask_Backup;
	extern DWORD CEProcessorType;	// From nkarm.h in the private tree.
   	//volatile S3C6410_VIC_REG *pIntr = (S3C6410_VIC_REG*)OALPAtoVA(S3C6410_BASE_REG_PA_VIC0, FALSE);

    //NKForceCleanBoot();
	OALMSG(OAL_FUNC, (L"[OAL] ++OEMInit()\r\n"));
	OALMSG(TRUE, (L"[OAL] ++OEMInit()\r\n"));

    OALMSG(OAL_FUNC, ((L"[OAL] APLLCLK : %d\n\r"), System_GetAPLLCLK()));
    OALMSG(OAL_FUNC, ((L"[OAL] ARMCLK  : %d\n\r"), System_GetARMCLK()));
    OALMSG(OAL_FUNC, ((L"[OAL] HCLK    : %d\n\r"), System_GetHCLK()));
    OALMSG(OAL_FUNC, ((L"[OAL] PCLK    : %d\n\r"), System_GetPCLK()));

	g_oalIoCtlClockSpeed = System_GetARMCLK();

    // Lie about the Processor Type (we do this so that the visual C tools work)
	CEProcessorType = PROCESSOR_STRONGARM;

	logMask_Backup = g_oalLogMask;
	OALLogSetZones( (1<<OAL_LOG_ERROR) | (1<<OAL_LOG_WARN) | (1<<OAL_LOG_FUNC) );

	RETAILMSG(TRUE, (TEXT("CEProcessorType = 0x%x\r\n"),CEProcessorType));
	RETAILMSG(TRUE, (TEXT("APLLCLK: %d, FCLK: %d, HCLK: %d, PCLK: %d\r\n"),
        System_GetAPLLCLK(),
        System_GetARMCLK(),
        System_GetHCLK(),
        System_GetPCLK()));

	// Set memory size for DrWatson kernel support
 	if (dwOEMDrWatsonSize != NOT_FIXEDUP)
 	{
        	dwNKDrWatsonSize = dwOEMDrWatsonSize;      // set size of reserved memory for Watson dump
 	}
	// Intialize optional kernel functions. (Processor Extended Feature)
	//
 	pOEMIsProcessorFeaturePresent = OALIsProcessorFeaturePresent;

	// Set OEMSetMemoryAttributes function
	pfnOEMSetMemoryAttributes = OEMSetMemoryAttributes;

	// Turn Off all Debug LED
	//
	OEMWriteDebugLED(0, 0x0);

	// Initialize INFORM SFR
	// This function should be called for CPU Identification.
	InitializeINFORMSFR();

	// Initialize Clock Source
	//
	InitializeCLKSource();

	// Initialize Clock Gating
	//
	InitializeCLKGating();

	// Initialize Block Power
	//
	InitializeBlockPower();
	// Initialize OTG PHY Clock
	//
	InitializeOTGCLK();

	// 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
	);

	// 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);
	// Initialize GPIO
	//
	InitializeGPIO();

	// Initialize the KITL connection if required
	RETAILMSG(1, (TEXT("OALKitlStart() \n\r")));
	OALKitlStart();

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

	OALLogSetZones(logMask_Backup);
}