Example #1
0
//------------------------------------------------------------------------------
//
//  Function: OEMInitDebugSerial
//
//  Initializes the debug serial port
//
VOID OEMInitDebugSerial()
{
    UINT32 DivSlot;
    UINT32 uPCLK;
    float Div;

    // Map SFR Address
    //
    if (g_pUARTReg == NULL)
    {
        // UART0
        g_pUARTReg = (S3C6410_UART_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_UART0, FALSE);

    }

    if (g_pGPIOReg == NULL)
    {
        g_pGPIOReg = (S3C6410_GPIO_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_GPIO, FALSE);
    }

    if (g_pSysConReg == NULL)
    {
        g_pSysConReg = (S3C6410_SYSCON_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_SYSCON, FALSE);
    }

    // UART I/O port initialize
    // UART0 Clock Enable
    g_pSysConReg->PCLK_GATE |= (1<<1);        // UART0
    g_pSysConReg->SCLK_GATE |= (1<<5);        // UART0~3
    // UART0 Port Initialize (RXD0 : GPA0, TXD0: GPA1)
    g_pGPIOReg->GPACON = (g_pGPIOReg->GPACON & ~(0xff<<0)) | (0x22<<0);        // GPA0->RXD0, GPA1->TXD0
    g_pGPIOReg->GPAPUD = (g_pGPIOReg->GPAPUD & ~(0xf<<0)) | (0x1<<0);            // RXD0: Pull-down, TXD0: pull up/down disable


    // Initialize UART
    //
    g_pUARTReg->ULCON = (0<<6)|(0<<3)|(0<<2)|(3<<0);                    // Normal Mode, No Parity, 1 Stop Bit, 8 Bit Data
    g_pUARTReg->UCON = (0<<10)|(1<<9)|(1<<8)|(0<<7)|(0<<6)|(0<<5)|(0<<4)|(1<<2)|(1<<0);    // PCLK divide, Polling Mode
    g_pUARTReg->UFCON = (0<<6)|(0<<4)|(0<<2)|(0<<1)|(0<<0);            // Disable FIFO
    g_pUARTReg->UMCON = (0<<5)|(0<<4)|(0<<0);                        // Disable Auto Flow Control

    uPCLK = System_GetPCLK();

    Div = (float)((float)uPCLK/(16.0*(float)DEBUG_BAUDRATE)) - 1;        //< S3C6410_PCLK is macro code defined in soc_cfg.h
    DivSlot = (UINT32)((Div-(int)Div)*16);

    g_pUARTReg->UBRDIV = (UINT32)Div;                                    // Baud rate
    g_pUARTReg->UDIVSLOT = aSlotTable[DivSlot];
}
Example #2
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 #3
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);
}