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

📄 wince.c

📁 mx27 f14v2 源代码。包括ADS板上诸多驱动的源码。
💻 C
字号:
//---------------------------------------------------------------------------
// Copyright (C) 2006, Freescale Semiconductor, Inc. All Rights Reserved.
// THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
// AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT 
//--------------------------------------------------------------------------
//
// File:  wince.c
// Source file for platform specific SDIO WLAN functions
//------------------------------------------------------------------------------
#include "precomp.h"

//
// Debug settings.
//

#ifdef	DEBUG

// initialize debug zones
SD_DEBUG_INSTANTIATE_ZONES(
	 TEXT("CommASICNdisSD"),	// module name
	 ZONE_ENABLE_INIT | ZONE_ENABLE_ERROR | ZONE_ENABLE_WARN,	// initial settings
	 TEXT(""),
	 TEXT(""), 
	 TEXT(""), 
	 TEXT(""),
	 TEXT(""), 
	 TEXT(""), 
	 TEXT(""), 
	 TEXT(""),
	 TEXT(""),
	 TEXT(""),
	 TEXT(""));

#endif // DEBUG

#ifdef RUNNING_LOG

#define DEBUG_FILENAME		"\\My Documents\\SD_DBG.txt"
#define DEBUG_FILENAME_OLD	"\\My Documents\\SD_DBG_1.txt"

// initialize to maxint, registry will set later
ULONG ulWINCEmaxDbgFileSize = -1;

// Redirect debug print to a file.
void PrintFile( const char *fmt, ... )
{
	va_list		argP;
	FILE		*Dbgfp;
	DWORD		dwThreadID;
	DWORD		dwTick;
	BOOL		movefailure = FALSE;
	WIN32_FILE_ATTRIBUTE_DATA	filedata;

	if (GetFileAttributesEx(_T(DEBUG_FILENAME), GetFileExInfoStandard,
			&filedata))
	{
		// File exists.  If max file size is 0, assume debug file unwanted
		// and delete it
		if (ulWINCEmaxDbgFileSize == 0)
		{
			DeleteFile(_T(DEBUG_FILENAME));
			DeleteFile(_T(DEBUG_FILENAME_OLD));
			return;
		}

		// Check file size.  We estimate the length of the message to be
		// added by the length of the format string - this may cause us to
		// overrun the "max size" by a few bytes but should generally keep us
		// from going too far over
		if ((filedata.nFileSizeHigh != 0) ||
			((filedata.nFileSizeLow + strlen(fmt)) > ulWINCEmaxDbgFileSize))
		{
			DeleteFile(_T(DEBUG_FILENAME_OLD));
			movefailure = !MoveFile(_T(DEBUG_FILENAME), _T(DEBUG_FILENAME_OLD));
		}
	}
	else
	{
		// File doesn't exist.  Check if we should create it; if max file
		// size is 0, that means we shouldn't.
		if (ulWINCEmaxDbgFileSize == 0)
			return;
	}

	Dbgfp = fopen(DEBUG_FILENAME, "a+");

	if ( Dbgfp == NULL )
		return;

	if (movefailure)
	{
		fprintf(Dbgfp, "Failed to move \"%s\" to \"%s\"!\n",
			DEBUG_FILENAME, DEBUG_FILENAME_OLD);
	}

	dwThreadID = GetCurrentThreadId();
	dwTick = GetTickCount();

	fprintf(Dbgfp, "%8x:%d: ", dwThreadID, dwTick);

	va_start(argP, fmt);
	vfprintf(Dbgfp, fmt, argP);

	fflush(Dbgfp);

	va_end(argP);

	fclose(Dbgfp);
}

#endif	// RUNNING_LOG

//
// DllEntry.
//

BOOL
DllEntry(
	HANDLE	hInstDll,
	DWORD	dwOp,
	LPVOID	lpvReserved)
{
	switch (dwOp)
	{
		case DLL_PROCESS_ATTACH:
			DEBUGREGISTER(hInstDll);
			DisableThreadLibraryCalls((HMODULE) hInstDll);
			break;

		case DLL_PROCESS_DETACH:
		default:
			break;
	}

	return (TRUE);
}

⌨️ 快捷键说明

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