📄 iltiming.c
字号:
//
// Copyright(C) Renesas Technology Corp. 2005. All rights reserved.
//
// generic timer or system tick code for ITS-DS7 Ver.0.8.0
//
// FILE : iltiming.c
// CREATED : 2005.08.10
// MODIFIED :
// AUTHOR : Renesas Technology Corp.
// HARDWARE : RENESAS ITS-DS7
// HISTORY :
// 2005.08.10
// - Created release code.
// (based on SMDK2410/MAINSTONEII for WCE5.0)
//
//
// 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.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Module Name:
iltiming.c
Abstract:
This module implements the code to support iltiming measurement.
Notes:
--*/
#include <windows.h>
#include <nkintr.h>
#include <pkfuncs.h>
#include <iltiming.h>
extern volatile BOOL fIntrTime, fProfilerRunning;
extern DWORD SHxTimer2CountSinceTick(void);
extern DWORD PerfCountFreq (void);
extern void SHxStartTimer2 (DWORD dwUsec);
extern void SHxStopTimer2 (void);
DWORD dwIsrTime1;
DWORD dwIsrTime2;
DWORD dwSPC;
WORD wNumInterrupts;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//DWORD SHxHandleIlTiming (PILTIMING_MESSAGE pITM)
BOOL OALIoCtlHalILTiming (UINT32 code, VOID *lpInBuf, UINT32 nInBufSize, VOID *lpOutBuf, UINT32 nOutBufSize, UINT32 *lpBytesReturned)
{
BOOL fEnable;
int nMSec;
PILTIMING_MESSAGE pITM = (PILTIMING_MESSAGE)lpInBuf;
switch (pITM->wMsg) {
case ILTIMING_MSG_ENABLE :
if (fProfilerRunning) {
RETAILMSG (1, (TEXT("Cannot start ILTiming while Monte Carlo Profiler is running\r\n")));
return FALSE;
}
if (!(nMSec = (int) pITM->dwFrequency)) {
RETAILMSG (1, (TEXT("ILTiming dwFreqency cannot b 0\r\n")));
return FALSE;
}
fEnable = INTERRUPTS_ENABLE (FALSE);
if (!fIntrTime) {
wNumInterrupts = 0;
dwIsrTime1 = 0xFFFFFFFF;
fIntrTime = TRUE;
DEBUGMSG (1, (TEXT("SHxStartTimer2( %d )\r\n"),nMSec*1000));
SHxStartTimer2 (nMSec * 1000);
}
INTERRUPTS_ENABLE (fEnable);
RETAILMSG (1, (TEXT("ILTiming Enable (@ every %d MSec)\r\n"), nMSec));
break;
case ILTIMING_MSG_DISABLE :
RETAILMSG (1, (TEXT("ILTiming Disable\r\n")));
fEnable = INTERRUPTS_ENABLE (FALSE);
if (fIntrTime) {
fIntrTime = FALSE;
DEBUGMSG (1, (TEXT("SHxStopTimer2()\r\n")));
SHxStopTimer2 ();
}
INTERRUPTS_ENABLE (fEnable);
break;
case ILTIMING_MSG_GET_TIMES :
pITM->dwIsrTime1 = dwIsrTime1;
pITM->dwIsrTime2 = dwIsrTime2;
pITM->wNumInterrupts = wNumInterrupts;
pITM->dwSPC = dwSPC;
pITM->dwFrequency = PerfCountFreq();
wNumInterrupts = 0;
// RETAILMSG (1, (TEXT("ILTiming GetTime @ 0x%08X:%08X\r\n"), pITM->dwParam1, pITM->dwParam2));
break;
case ILTIMING_MSG_GET_PFN :
pITM->pfnPerfCountSinceTick = (PVOID) SHxTimer2CountSinceTick;
RETAILMSG (1, (TEXT("ILTiming GetPFN\r\n")));
break;
default :
RETAILMSG (1, (TEXT("IOCTL_HAL_ILTIMING : BAD MESSAGE!!!\r\n")));
return (FALSE);
}
return (TRUE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -