⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdprof.c

📁 Wince4.2 BSP for SH4 engineering development board
💻 C
字号:
//
//      Copyright (c) Renesas Technology Corp. 2002-2003 All Rights Reserved.
//
//      OEM Adaptation Layer
//
//----------------------------------------------------------------------------
//
//  FILE      : mdprof.c
//  CREATED   : 2002.1.31
//  MODIFIED  : 2003.08.06
//  AUTHOR    : Renesas Technology Corp.
//  HARDWARE  : RENESAS HS7751RSTC01H (S1-E, ITS-DS5)
//  TARGET OS : Microsoft(R) Windows(R) CE .NET 4.2
//  NOTES     : 
//  HISTORY   :
//        		2002.1.31 
//        		- Created
//        		2002.9.26
//        		- Released for HS7751RSTC01H (S1-E, ITS-DS5)


/*++
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.
Copyright (c) 1995-2000 Microsoft Corporation.  All rights reserved.

Module Name:  mdprof.c

Abstract:  
 This file implements the platform specific profiler support 

Functions:


Notes: 

--*/

#include <windows.h>
#include <nkintr.h>
//#include <profiler.h>

#include "s1e.h"
#include "shx.h"

#define PROFILER_RAM_START	0xae000000	// start of profile to RAM buffer
#define PROFILER_RAM_END	0xaf000000	// end of profile to RAM buffer

BOOL	bProfileEnabled=FALSE;			// platform profiler enabled flag
LPDWORD	lpdwProfileBufStart=NULL;		// platform profile buffer start
LPDWORD	lpdwProfileBufNext=NULL;		// platform profile buffer next
PDWORD	lpdwProfileBufEnd=NULL;			// platform profile buffer end

extern	BOOL bProfileObjCall;			// profile object calls flag
extern	BOOL bProfileKCall;				// profile KCalls flag
extern	BOOL bProfileBuffer;			// profile to buffer flag
extern	DWORD dwProfileCount;

void	OEMProfilerISR(void);
void	OEMProfilerBufferISR(void);

void OEMProfileTimerInit(void)
{
	// nothing to initialize
}

/*
	@func	void | OEMProfileTimerDisable | Disable profiler timer
	@rdesc	none
	@comm 	OEMProfilerTimerDisable is called to stop the profiler timer.
*/            

void OEMProfileTimerDisable(void)
{
	WRITE_REGISTER_UCHAR(TMU_TSTR, READ_REGISTER_UCHAR(TMU_TSTR)&(~TMU_TSTR_STR2));	// make sure timer2 is stopped
	UnhookInterrupt((0x440-0x200)/0x20, (FARPROC)OEMProfilerISR);
}

/*
	@func	void | OEMProfileTimerEnable | Enable profiler timer
	@rdesc	none
	@comm 	OEMProfilerTimerEnable 
*/            
void OEMProfileTimerEnable(DWORD dwUSec)
{
	extern BYTE IntrPrio[];

	if (dwUSec < 500)
		dwUSec= 500;
	
	WRITE_REGISTER_UCHAR(TMU_TSTR, READ_REGISTER_UCHAR(TMU_TSTR)&(~TMU_TSTR_STR2));		// make sure timer2 is stopped
	WRITE_REGISTER_USHORT(TMU_TCR2, TMU_TCR_UNIE|TMU_TCR_D16);
	WRITE_REGISTER_ULONG(TMU_TCOR2, dwUSec);
	WRITE_REGISTER_ULONG(TMU_TCNT2, dwUSec);
	WRITE_REGISTER_USHORT(INTC_IPRA, 
		(READ_REGISTER_USHORT(INTC_IPRA)&(INTC_IPRA_TMU2_MASK)) | INTC_IPRA_TMU2_INT);	// priority 15 interrupt
	HookInterrupt((0x440-0x200)/0x20, (FARPROC)OEMProfilerISR);										// hook the interrupt
	IntrPrio[(0x440-0x200)/0x20]=0xf;
	WRITE_REGISTER_UCHAR(TMU_TSTR, READ_REGISTER_UCHAR(TMU_TSTR)|(TMU_TSTR_STR2));		// make sure timer2 is started
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -