Exemple #1
0
static uint64 GetMicroseconds()
{
	static bool time_init = false;
	if (!time_init) {
		time_init = true;
		Time_Initialize();
	}

	uint64 counter;
	uint64 tick;

	QueryPerformanceCounter((LARGE_INTEGER*) &counter);
	tick = UTGetTickCount64();

	// unfortunately, QueryPerformanceCounter is not guaranteed
	// to be monotonic. Make it so.
	int64 ret = (int64)(((int64)counter - (int64)startPerformanceCounter) / counterPerMicrosecond);
	// if the QPC clock leaps more than one second off GetTickCount64()
	// something is seriously fishy. Adjust QPC to stay monotonic
	int64 tick_diff = tick - startGetTickCount;
	if (abs64(ret / 100000 - tick_diff / 100) > 10) {
		startPerformanceCounter -= (uint64)((int64)(tick_diff * 1000 - ret) * counterPerMicrosecond);
		ret = (int64)((counter - startPerformanceCounter) / counterPerMicrosecond);
	}
	return ret;
}
void ApplicationEntryPoint()
{
    CLR_SETTINGS clrSettings;

    InitCRuntime();

    CPU_Initialize();

    Time_Initialize();

    HAL_Initialize();
    
    // CLR entry point 
    memset(&clrSettings, 0, sizeof(CLR_SETTINGS));

    clrSettings.MaxContextSwitches         = 50;
    clrSettings.WaitForDebugger            = false;
    clrSettings.EnterDebuggerLoopAfterExit = true;

    ClrStartup( clrSettings );

    HAL_Uninitialize();

    Time_Uninitialize();

#if !defined(BUILD_RTM)
    debug_printf( "Exiting.\r\n" );
    CPU_Halt();
#else
    CPU_Reset();
#endif

}
Exemple #3
0
void HAL_Initialize()
{
    HAL_CONTINUATION::InitializeList();
    HAL_COMPLETION  ::InitializeList();

    Events_Initialize();

    CPU_GPIO_Initialize();

    CPU_SPI_Initialize();

    HAL_Time_Initialize();

    Time_Initialize();

    ENABLE_INTERRUPTS();

    BlockStorageList::Initialize();

    BlockStorage_AddDevices();

    BlockStorageList::InitializeDevices();

    FS_Initialize();

    FileSystemVolumeList::Initialize();

    FS_AddVolumes();

    FileSystemVolumeList::InitializeVolumes();



    CPU_InitializeCommunication();

    LCD_Initialize();

    I2C_Initialize();

    PalEvent_Initialize();

    Gesture_Initialize();

    Ink_Initialize();

    TimeService_Initialize();
    

/*
    other drivers init
*/
}