亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? usbfx2lk_selsusp.cpp

?? VisualC++寫的一個USB的驅動程序。
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
///////////////////////////////////////////////////////////////////////////////
//
//    (C) Copyright 2005 OSR Open Systems Resources, Inc.
//    Copyright (c) 2000  Microsoft Corporation
//    All Rights Reserved
//
//    This sofware is supplied for instructional purposes only.
//
//    OSR Open Systems Resources, Inc. (OSR) expressly disclaims any warranty
//    for this software.  THIS SOFTWARE IS PROVIDED  "AS IS" WITHOUT WARRANTY
//    OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
//    THE IMPLIED WARRANTIES OF MECHANTABILITY OR FITNESS FOR A PARTICULAR
//    PURPOSE.  THE ENTIRE RISK ARISING FROM THE USE OF THIS SOFTWARE REMAINS
//    WITH YOU.  OSR's entire liability and your exclusive remedy shall not
//    exceed the price paid for this material.  In no event shall OSR or its
//    suppliers be liable for any damages whatsoever (including, without
//    limitation, damages for loss of business profit, business interruption,
//    loss of business information, or any other pecuniary loss) arising out
//    of the use or inability to use this software, even if OSR has been
//    advised of the possibility of such damages.  Because some states/
//    jurisdictions do not allow the exclusion or limitation of liability for
//    consequential or incidental damages, the above limitation may not apply
//    to you.
//
//    OSR Open Systems Resources, Inc.
//    105 Route 101A Suite 19
//    Amherst, NH 03031  (603) 595-6500 FAX: (603) 595-6503
//    email bugs to: bugs@osr.com
//
//
//    MODULE:
//
//      USBFx2LK_selsusp.cpp
//
//    ABSTRACT:
//
//      This file contains the routines that handle selective suspend
//      processing for the OSR USB FX2 Learning Kit Device
//
//    AUTHOR(S):
//
//      OSR Open Systems Resources, Inc.
// 
///////////////////////////////////////////////////////////////////////////////
#include "usbfx2lk.h"

#ifdef WPP_TRACING
//
// Include the necessary tmh file - this is 
//  just a matter of course if you're using WPP tracing.
//
extern "C" {
#include "usbfx2lk_selsusp.tmh"
}
#endif

//
// Forward declarations
//
#ifndef WIN2K
VOID SSUsbIdleCallback(PVOID Context);
NTSTATUS SSIdleNotificationCompletionRoutine(PDEVICE_OBJECT DeviceObject,
                                             PIRP Irp, PVOID Context);
#endif

VOID SSPowerUpCompleteUpdateSSState(PUSBFX2LK_EXT DevExt);
VOID SSSynchronousPowerIrpCompletionFunc(PDEVICE_OBJECT DeviceObject,
                                         UCHAR MinorFunction, 
                                         POWER_STATE PowerState,
                                         PVOID Context,
                                         PIO_STATUS_BLOCK IoStatus);
VOID SSAsynchronousPowerUpIrpCompletionFunc(PDEVICE_OBJECT DeviceObject,
                                            UCHAR MinorFunction, 
                                            POWER_STATE PowerState,
                                            PVOID Context,
                                            PIO_STATUS_BLOCK IoStatus);


///////////////////////////////////////////////////////////////////////////////
//
// EnableSelectiveSuspend
//
//      Enables selective suspend on the device
//
//  INPUTS:
//
//      DevExt  -  One of our device extensions
//
//  OUTPUTS:
//
//      None
//
//  RETURNS:
//
//      An appropriate NTSTATUS value
//
//  IRQL:
//
//      IRQL == PASSIVE_LEVEL
//
//  CONTEXT:
//
//      Arbitrary
//
//  NOTES:
//
///////////////////////////////////////////////////////////////////////////////
VOID EnableSelectiveSuspend(PUSBFX2LK_EXT DevExt)
{
    KIRQL oldIrql;

    OsrTracePrint(TRACE_LEVEL_VERBOSE,OSRDBG_SELECTIVE_SUSPEND,
                                ("EnableSelectiveSuspend: Entered.\n"));

    //
    // We're potentially going to change the state of the selective
    //  suspend members of our device extension, so we must acquire
    //  the selective suspend lock
    //
    KeAcquireSpinLock(&DevExt->SSLock,&oldIrql);

    //
    // ASSERT that we are not suspended or in the process of
    //  suspending. Our logic is written such that we assume that
    //  we are fully powered while enabling/disabling SS for the
    //  device. This is done by the calling function calling
    //  SSPowerDeviceIfSuspended before calling us
    //
    ASSERT(DevExt->SSState == SS_NOT_STARTED);
    ASSERT(KeReadStateEvent(&DevExt->SSDeviceNotSuspendedEvent));

    //
    // If the user doesn't ever want selective suspend, then
    //  we can just get out of here
    //
    if (!DevExt->SSEnabledByUser) {

        OsrTracePrint(TRACE_LEVEL_VERBOSE,OSRDBG_SELECTIVE_SUSPEND,
            ("EnableSelectiveSuspend: SS disabled by user. Exiting\n"));

        KeReleaseSpinLock(&DevExt->SSLock,oldIrql);
        return;

    }


    //
    // See if we've already been here before. If so, we
    //  can just exit
    //
    if (DevExt->SSInitialized) {

        OsrTracePrint(TRACE_LEVEL_VERBOSE,OSRDBG_SELECTIVE_SUSPEND,
            ("EnableSelectiveSuspend: SS already initialized. Exiting\n"));

        KeReleaseSpinLock(&DevExt->SSLock,oldIrql);
        return;

    }

    //
    // Default to not allowing the device to suspend right
    //  now. Because we're called in this routine only as the 
    //  result of an I/O request (either from the User or from
    //  the PnP manager) the I/O count is currently elevated.
    //  When it drops to 0, we will set this to TRUE
    //
    DevExt->SSDeviceCanNowSuspend = FALSE;

    //
    // We're ready to selectively suspend!
    //
    DevExt->SSInitialized = TRUE;

    KeReleaseSpinLock(&DevExt->SSLock,oldIrql);

    OsrTracePrint(TRACE_LEVEL_VERBOSE,OSRDBG_SELECTIVE_SUSPEND,
                                ("EnableSelectiveSuspend: Exit.\n"));

    return;
}

///////////////////////////////////////////////////////////////////////////////
//
// DisableSelectiveSuspend
//
//      Disables selective suspend on the device
//
//  INPUTS:
//
//      DevExt  -  One of our device extensions
//
//  OUTPUTS:
//
//      None
//
//  RETURNS:
//
//      An appropriate NTSTATUS value
//
//  IRQL:
//
//      IRQL == PASSIVE_LEVEL
//
//  CONTEXT:
//
//      Arbitrary
//
//  NOTES:
//
///////////////////////////////////////////////////////////////////////////////
VOID DisableSelectiveSuspend(PUSBFX2LK_EXT DevExt)
{
    KIRQL oldIrql;

    OsrTracePrint(TRACE_LEVEL_VERBOSE,OSRDBG_SELECTIVE_SUSPEND,
                                ("DisableSelectiveSuspend: Entered.\n"));

    //
    // We're potentially going to change the state of the selective
    //  suspend members of our device extension, so we must acquire
    //  the selective suspend lock
    //
    KeAcquireSpinLock(&DevExt->SSLock,&oldIrql);

    //
    // ASSERT that we are not suspended or in the process of
    //  suspending. Our logic is written such that we assume that
    //  we are fully powered while enabling/disabling SS for the
    //  device. This is done by the calling function calling
    //  SSPowerDeviceIfSuspended before calling us
    //
    ASSERT(DevExt->SSState == SS_NOT_STARTED);
    ASSERT(KeReadStateEvent(&DevExt->SSDeviceNotSuspendedEvent));

    //
    // Note that we're called here both when the user doesn't
    //  want SS anymore AND when SS just needs to be disabled 
    //  so that the device can stop or be removed. 
    //

    //
    // See if we've already been here before. If so, we
    //  can just exit
    //
    if (!DevExt->SSInitialized) {

        OsrTracePrint(TRACE_LEVEL_VERBOSE,OSRDBG_SELECTIVE_SUSPEND,
            ("DisableSelectiveSuspend: SS not initialized. Exiting\n"));

        KeReleaseSpinLock(&DevExt->SSLock,oldIrql);
        return;

    }

    //
    // The device can't suspend right now...
    //
    DevExt->SSDeviceCanNowSuspend = FALSE;

    //
    // And it won't suspend in the future...
    //
    DevExt->SSInitialized = FALSE;

    KeReleaseSpinLock(&DevExt->SSLock,oldIrql);

    OsrTracePrint(TRACE_LEVEL_VERBOSE,OSRDBG_SELECTIVE_SUSPEND,
                                ("DisableSelectiveSuspend: Exit.\n"));

    return;
}

///////////////////////////////////////////////////////////////////////////////
//
// SSPowerDeviceIfSuspended
//
//      This routine synchronously powers the device up if it is 
//      suspended or in the process of being suspended
//
//  INPUTS:
//
//      DevExt  -  One of our device extensions
//
//  OUTPUTS:
//
//      None
//
//  RETURNS:
//
//      An appropriate NTSTATUS value
//
//  IRQL:
//
//      IRQL == PASSIVE_LEVEL
//
//  CONTEXT:
//
//      Arbitrary
//
//  NOTES:
//
//      This routine synchronously powers the device and therefore
//      MUST be called at PASSIVE_LEVEL. 
//
///////////////////////////////////////////////////////////////////////////////
VOID SSPowerDeviceIfSuspended(PUSBFX2LK_EXT DevExt) 
{

    PAGED_CODE();
    
    //
    // See if the device is currently suspended. If it 
    //  is, this routine will attempt to asynchronously power 
    //  the device back up and will return TRUE. In that
    //  case, we want to synchronously wait for the power up 
    //  to occur.
    //
    // However, if this routine returns FALSE the device is 
    //  already powered up and we can simply return
    //
    if (SSPowerDeviceIfSuspendedAsync(DevExt)) {

        //
        // Wait for the suspend to be over
        //
        (VOID)OsrWaitForSingleObject(&DevExt->SSDeviceNotSuspendedEvent);
    }

    return;

}

///////////////////////////////////////////////////////////////////////////////
//
// SSPowerDeviceIfSuspendedAsync
//
//      This routine checks to see if the device is suspended or in the 
//      process of being suspsended and takes the appropriate action
//      to get the device powered again. 
//
//  INPUTS:
//
//      DevExt  -  One of our device extensions
//
//  OUTPUTS:
//
//      None
//
//  RETURNS:
//
//      TRUE if the device is suspended, FALSE if the device is 
//      fully powered
//
//  IRQL:
//
//      IRQL == PASSIVE_LEVEL
//
//  CONTEXT:
//
//      Arbitrary
//
//  NOTES:
//
//
///////////////////////////////////////////////////////////////////////////////
BOOLEAN SSPowerDeviceIfSuspendedAsync(PUSBFX2LK_EXT DevExt) 
{
    BOOLEAN queuePowerUp = FALSE;
    BOOLEAN powerUpQueued = FALSE;
    KIRQL oldIrql;
#ifndef W2K
    PIRP idleIrp = NULL;
#endif

    PAGED_CODE();

    //
    // We'll need the SS lock for this 
    //
    KeAcquireSpinLock(&DevExt->SSLock,&oldIrql);

    //
    // Only if SS is setup to we need to do any 
    //  checks. 
    //
    if (DevExt->SSInitialized) {

        //
        // Indicate that we do not want the device to suspend
        //  because we're about to send a request to it.
        //
        DevExt->SSDeviceCanNowSuspend = FALSE;

        //
        // Check the state. 
        //
        switch (DevExt->SSState) {

            case SS_SUSPENDED: {

                DevExt->SSState = SS_PROCESSING;

                //
                // We'll be powering up...
                //
                queuePowerUp = TRUE;
                break;
            }

            case SS_PROCESSING: {

                powerUpQueued = TRUE;

#ifndef W2K

                //
                // On XP and later, we need to submit and idle
                //  notification IRP to the bus driver and wait
                //  to be called back in order to suspend. If we're
                //  on a hub with a device that is not suspending,
                //  this request may still be pending. If so, we
                //  need to cancel it before we can do anything
                //

                //
                // Grab the idle IRP out of the extension
                //
                idleIrp = DevExt->SSIdleIrp;

                //
                // And set it to NULL. This is the clue to the
                //  completion routine that we will be freeing
                //  the IRP
                //
                DevExt->SSIdleIrp = NULL;

#endif
                break;

            }
            case SS_NOT_STARTED: {

                //
                // Nothing to do here, we're powered up and active
                //  already
                //
                break;
            }
            default: {

                //
                // Shouldn't be here...
                //
                ASSERT(FALSE);
                break;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品伦理在线| 国产精品免费观看视频| 亚洲成av人片在线观看| 欧美日韩免费一区二区三区| 亚洲电影中文字幕在线观看| 欧美剧情电影在线观看完整版免费励志电影 | 精品欧美一区二区久久 | 亚洲福利电影网| 日韩一区二区在线看片| 国产裸体歌舞团一区二区| 国产日韩欧美在线一区| 99久久精品免费| 亚洲成人av电影在线| 精品国精品自拍自在线| 成人av电影免费观看| 性做久久久久久免费观看| 欧美精品一区视频| 色婷婷亚洲一区二区三区| 日日摸夜夜添夜夜添国产精品 | 亚洲国产精品二十页| 91视频国产观看| 麻豆国产欧美日韩综合精品二区 | 久久综合色综合88| 97精品超碰一区二区三区| 五月天激情综合| 久久蜜桃一区二区| 在线观看一区二区视频| 国产在线视频一区二区| 亚洲精品福利视频网站| 精品国产乱码久久久久久牛牛 | 亚洲欧美日韩中文字幕一区二区三区 | 欧美一级欧美一级在线播放| www.亚洲人| 免费一级片91| 亚洲男人天堂一区| 久久亚洲精品国产精品紫薇| 欧美性受极品xxxx喷水| 久久精品国产99久久6| 亚洲卡通动漫在线| 国产亚洲短视频| 91精品蜜臀在线一区尤物| 成人性生交大片| 久久国产日韩欧美精品| 亚洲黄色免费网站| 国产欧美日韩在线视频| 日韩午夜电影av| 一本色道a无线码一区v| 国产精品一区在线观看乱码 | 日本精品视频一区二区三区| 美女视频黄 久久| 一区二区激情小说| 中文字幕在线不卡| 精品国产伦理网| 日韩欧美不卡在线观看视频| 欧美视频中文一区二区三区在线观看| 成人综合在线观看| 国产成人精品aa毛片| 另类小说视频一区二区| 天天综合网天天综合色| 亚洲综合激情另类小说区| 亚洲色图20p| 中文字幕+乱码+中文字幕一区| 91精品国产综合久久精品app | 欧美欧美欧美欧美| 欧美伊人精品成人久久综合97| av在线不卡电影| av成人动漫在线观看| 成人毛片视频在线观看| 国产精品自产自拍| 精品一二线国产| 久久91精品久久久久久秒播| 日韩—二三区免费观看av| 日韩电影免费在线看| 奇米亚洲午夜久久精品| 免费在线观看一区二区三区| 日韩电影一区二区三区四区| 美腿丝袜一区二区三区| 国内成人免费视频| 激情综合色播激情啊| 国产永久精品大片wwwapp| 国产曰批免费观看久久久| 国产成人免费视频一区| 成人国产一区二区三区精品| 成人av先锋影音| 日本福利一区二区| 欧美日韩国产123区| 日韩欧美一区二区视频| 久久综合色综合88| 中文字幕不卡三区| 一区二区三区鲁丝不卡| 亚洲福利电影网| 久久99久久久久| 国产黑丝在线一区二区三区| 99久久777色| 欧美精品免费视频| 久久只精品国产| 一区在线观看视频| 天天色图综合网| 国产尤物一区二区在线| 99久久精品免费看| 欧美精品xxxxbbbb| 久久精品视频在线看| 亚洲欧美日韩国产手机在线| 午夜不卡在线视频| 国产精品一区在线| 在线视频你懂得一区二区三区| 欧美精品久久99| 欧美激情在线看| 欧美日韩国产电影| av电影天堂一区二区在线观看| 不卡一区在线观看| 欧美日韩一级大片网址| 在线观看亚洲成人| 国产成都精品91一区二区三| 色婷婷综合久久久久中文一区二区| 欧美剧情电影在线观看完整版免费励志电影 | 亚洲三级视频在线观看| 亚洲日本青草视频在线怡红院| 欧美激情一区在线观看| 欧美日韩精品欧美日韩精品一 | 日韩电影在线一区| 欧美精品黑人性xxxx| 亚洲电影你懂得| 色狠狠色噜噜噜综合网| 日韩理论片中文av| 波多野结衣的一区二区三区| 久久精品亚洲精品国产欧美| 国产美女在线精品| 久久久精品日韩欧美| 国产美女精品人人做人人爽| 精品乱码亚洲一区二区不卡| 奇米777欧美一区二区| 欧美精品三级在线观看| 日韩专区一卡二卡| 欧美一区二区三区免费| 日本va欧美va欧美va精品| 日韩欧美成人午夜| 国产制服丝袜一区| 国产日韩综合av| 成人网在线播放| 国产精品久久久久aaaa| 91年精品国产| 亚洲一区二区三区四区五区中文| 在线观看亚洲精品视频| 三级在线观看一区二区 | 制服.丝袜.亚洲.中文.综合| 亚洲va欧美va人人爽| 欧美一级一级性生活免费录像| 免费观看一级特黄欧美大片| 精品国产乱码久久久久久浪潮| 国产精品一级二级三级| 中文字幕av不卡| 欧美丝袜丝nylons| 乱一区二区av| 国产精品久久看| 在线观看免费视频综合| 日日夜夜免费精品| 久久久美女艺术照精彩视频福利播放| 国产精品主播直播| 亚洲你懂的在线视频| 欧美一区二区精美| 国产成人亚洲综合a∨婷婷| 亚洲视频在线观看三级| 欧美日韩中文国产| 寂寞少妇一区二区三区| 亚洲日本丝袜连裤袜办公室| 欧美精品视频www在线观看 | 亚洲第四色夜色| 精品国产123| 91免费看`日韩一区二区| 午夜精品久久久久久不卡8050| 日韩一级在线观看| 北条麻妃国产九九精品视频| 亚洲成人一区二区| 国产日产精品一区| 欧美色窝79yyyycom| 久久99国产精品久久99| 一区二区三区丝袜| 久久综合色8888| 精品视频免费在线| 国产不卡在线视频| 日韩中文字幕麻豆| 国产精品国产精品国产专区不片| 欧美日韩精品欧美日韩精品一综合| 国产老女人精品毛片久久| 亚洲精品成人精品456| 亚洲精品在线观看网站| 欧美影视一区二区三区| 国产一区二区精品久久91| 亚洲综合色在线| 国产亚洲综合av| 欧美一区二区视频观看视频| 91一区二区三区在线观看| 精油按摩中文字幕久久| 亚洲一级二级在线| 国产精品国产三级国产普通话三级 | 国产成人99久久亚洲综合精品| 午夜伦欧美伦电影理论片| 国产精品乱人伦一区二区| 精品国产3级a|