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

📄 timer.c

📁 Atheros无线芯片AR-6000系列wince 6驱动源代码(这东西我也没用过别问我,我是搜别的wince资源搜到的) AR6K SDIO support. Requires firmware
💻 C
字号:
//------------------------------------------------------------------------------
// <copyright file="timer.c" company="Atheros">
//    Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
//    Copyright (c) 2006 Atheros Corporation.  All rights reserved.
//
//    The use and distribution terms for this software are covered by the
//    Microsoft Limited Permissive License (Ms-LPL) 
//    http://www.microsoft.com/resources/sharedsource/licensingbasics/limitedpermissivelicense.mspx 
//    which can be found in the file MS-LPL.txt at the root of this distribution.
//    By using this software in any fashion, you are agreeing to be bound by
//    the terms of this license.
//
//    You must not remove this notice, or any other, from this software.
// </copyright>
// 
// <summary>
//    Windows CE Wifi Driver for AR-6000
// </summary>
//------------------------------------------------------------------------------
//==============================================================================
// Timer functions
//
// Author(s): ="Atheros"
//==============================================================================
#include "athdefs.h"
#include "athtypes.h"
#include "osapi.h"
#include <windows.h>
#include <mmsystem.h>
#include <ndis.h>

/*
 * This function will call the Timer Function registered
 * by the other modules through A_INIT_TIMER
 */

static void
ar6000_wrapper_timeout (unsigned int timerID, unsigned int uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
	A_TIMER  *pTimer = (A_TIMER *)dwUser;

	if ((pTimer) && (pTimer->callback)) {
	    pTimer->callback(pTimer->arg);
    }
	return;
}

A_STATUS
ar6000_delete_timer (A_TIMER *timer)
{
	timer->callback = NULL;
	timer->arg = NULL;

	return A_OK;
}

void
ar6000_set_timer (A_TIMER *timer, unsigned long timeout, A_INT32 periodic)
{
	if (periodic) {
		NDIS_DEBUG_PRINTF(ATH_LOG_ERR, "Periodic Timer not implemented\n");
		return;
	}
    timer->timerId = timeSetEvent(
                         timeout,
                         0,
                         ar6000_wrapper_timeout,
                         (DWORD)timer,
                         (TIME_ONESHOT | 
                         TIME_CALLBACK_FUNCTION));
	return;
}

A_STATUS
ar6000_cancel_timer (A_TIMER *timer)
{
    MMRESULT ret;

    ret = timeKillEvent(timer->timerId);

    if (ret != TIMERR_NOERROR) {
        return A_ERROR;
    }

	return A_OK;
}

A_STATUS
ar6000_init_timer (A_TIMER *timer, A_TIMER_FN proc_timer, 
				   PVOID arg)
{
	timer->callback = proc_timer;
	timer->arg = arg;

	return A_OK;
}

A_UINT32
ar6000_ms_tickget()
{
    A_UINT32 upTime;

    NdisGetSystemUpTime(&upTime);

    return upTime;
}

⌨️ 快捷键说明

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