Esempio n. 1
0
ULONG
RspInitialize(
	IN PWSTR StoragePath	
	)
{
	ULONG Status;
	ULONG Length;
	SYSTEMTIME Time;
	WCHAR Buffer[MAX_PATH];

	Status = S_OK;
	RtlZeroMemory(&RspStorage, sizeof(RSP_STORAGE));
	RtlZeroMemory(&RspIndex, sizeof(RSP_INDEX));
	RtlZeroMemory(&RspView, sizeof(RSP_VIEW));

	InitializeListHead(&RspRecordList);
	InitializeListHead(&RspCallbackList);
	InitializeListHead(&RspProbeGroupList);
	InitializeListHead(&RspAddOnGroupList);

	RspHostThreadId = GetCurrentThreadId();
	
	if (WorkMode == CaptureMode) {

		PspGetFilePath(RspStoragePath, MAX_PATH - 1);
		StringCchCat(RspStoragePath, MAX_PATH - 1, L"\\log");

		if (CreateDirectory(RspStoragePath, NULL) != TRUE) {
			if (GetLastError() != ERROR_ALREADY_EXISTS) {
				return S_FALSE;
			}															
		}

		StringCchCopy(Buffer, MAX_PATH, RspStoragePath);
		Length = (ULONG)wcsnlen_s(Buffer, MAX_PATH);

		GetLocalTime(&Time);
		StringCchPrintf(Buffer + Length, MAX_PATH - Length, L"\\dprobe-%02d%02d%02d%02d%02d.dtl", 
						Time.wMonth, Time.wDay, Time.wHour, Time.wMinute, Time.wSecond);

		Status = RspCreateCache(Buffer);
		SspInitialize();

	} else {

		Status = RspLoadCache(StoragePath);
		SspInitialize();
		SspLoadStackTraceDatabase();
	}

	return Status;
}
Esempio n. 2
0
void main(void)
{
  G_u32SystemFlags |= _SYSTEM_INITIALIZING;

  /* Low level initialization */
  WatchDogSetup(); /* During development, set to not reset processor if timeout */
  ClockSetup();
  GpioSetup();
  InterruptSetup();
  SysTickSetup();

  /* Driver initialization */
  MessagingInitialize();
  UartInitialize();
  DebugInitialize();

  /* Debug messages through DebugPrintf() are available from here */

  SspInitialize();
  TWIInitialize();
  
  LcdInitialize();
  LedInitialize();
  ButtonInitialize();
   
  CapTouchInitialize();
  AntInitialize();
  
  /* Application initialization */
  UserAppInitialize();
  
  /* Exit initialization */
  SystemStatusReport();
  G_u32SystemFlags &= ~_SYSTEM_INITIALIZING;
   
  /* Super loop */  
  while(1)
  {
    WATCHDOG_BONE();
    
    /* Drivers */
    LedUpdate();
    ButtonRunActiveState();
    UartRunActiveState();
    SspRunActiveState();
    TWIRunActiveState();
    CapTouchRunActiveState(); /* This function violates 1ms loop timing every 25ms */ 
    MessagingRunActiveState();
    DebugRunActiveState();
    LcdRunActiveState();
    AntRunActiveState();

    /* Applications */
    UserAppRunActiveState();
        
    /* System sleep*/
    HEARTBEAT_OFF();
    SystemSleep();
    HEARTBEAT_ON();
    
  } /* end while(1) main super loop */
  
} /* end main() */