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

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

?? bulkpwr.c

?? USB驅動程序文件
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*++

Copyright (c) 1997-1998  Microsoft Corporation

Module Name:

    BulkPwr.c

Abstract:

    Bulk USB device driver for Intel 82930 USB test board
    Power Management module


Environment:

    kernel mode only

Notes:

  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) 1997-1998 Microsoft Corporation.  All Rights Reserved.


Revision History:

    2/8/98: created

--*/


#include "wdm.h"
#include "stdarg.h"
#include "stdio.h"

#include "usbdi.h"
#include "usbdlib.h"
#include "Blk82930.h"


NTSTATUS
BulkUsb_ProcessPowerIrp(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
/*++

Routine Description:

    This is our FDO's dispatch table function for IRP_MJ_POWER.
    It processes the Power IRPs sent to the PDO for this device.

    For every power IRP, drivers must call PoStartNextPowerIrp and use PoCallDriver
    to pass the IRP all the way down the driver stack to the underlying PDO.


Arguments:

    DeviceObject - pointer to our device object (FDO)

    Irp          - pointer to an I/O Request Packet

Return Value:

    NT status code

--*/
{

    PIO_STACK_LOCATION irpStack;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PDEVICE_EXTENSION deviceExtension;
    BOOLEAN fGoingToD0 = FALSE;
    POWER_STATE sysPowerState, desiredDevicePowerState;
    KEVENT event;

    BULKUSB_KdPrint( DBGLVL_MEDIUM,(" BulkUsb_ProcessPowerIrp() IRP_MJ_POWER\n"));

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
    irpStack = IoGetCurrentIrpStackLocation (Irp);
    BulkUsb_IncrementIoCount(DeviceObject);

    switch (irpStack->MinorFunction) {
    case IRP_MN_WAIT_WAKE:
        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Enter IRP_MN_WAIT_WAKE\n"));

                // A driver sends IRP_MN_WAIT_WAKE to indicate that the system should
                // wait for its device to signal a wake event. The exact nature of the event
                // is device-dependent.
                // Drivers send this IRP for two reasons:
                // 1) To allow a device to wake the system
                // 2) To wake a device that has been put into a sleep state to save power
                //    but still must be able to communicate with its driver under certain circumstances.
                // When a wake event occurs, the driver completes the IRP and returns
                // STATUS_SUCCESS. If the device is sleeping when the event occurs,
                // the driver must first wake up the device before completing the IRP.
                // In a completion routine, the driver calls PoRequestPowerIrp to send a
                // PowerDeviceD0 request. When the device has powered up, the driver can
                //  handle the IRP_MN_WAIT_WAKE request.

        // deviceExtension->DeviceCapabilities.DeviceWake specifies the lowest device power state (least powered)
        // from which the device can signal a wake event
        deviceExtension->PowerDownLevel = deviceExtension->DeviceCapabilities.DeviceWake;


        if  ( ( PowerDeviceD0 == deviceExtension->CurrentDevicePowerState )  ||
              ( deviceExtension->DeviceCapabilities.DeviceWake > deviceExtension->CurrentDevicePowerState ) ) {
                        //
                        //    STATUS_INVALID_DEVICE_STATE is returned if the device in the PowerD0 state
                        //    or a state below which it can support waking, or if the SystemWake state
                        //    is below a state which can be supported. A pending IRP_MN_WAIT_WAKE will complete
                        //    with this error if the device's state is changed to be incompatible with the wake
                        //    request.

            //  If a driver fails this IRP, it should complete the IRP immediately without
            //  passing the IRP to the next-lower driver.
            ntStatus = STATUS_INVALID_DEVICE_STATE;
            Irp->IoStatus.Status = ntStatus;
            IoCompleteRequest (Irp,IO_NO_INCREMENT );
            BULKUSB_KdPrint( DBGLVL_HIGH, ( "Exit BulkUsb_ProcessPowerIrp(), ntStatus STATUS_INVALID_DEVICE_STATE\n" ) );
            BulkUsb_DecrementIoCount(DeviceObject);
            return ntStatus;
        }

        // flag we're enabled for wakeup
        deviceExtension->EnabledForWakeup = TRUE;

        // init an event for our completion routine to signal when PDO is done with this Irp
        KeInitializeEvent(&event, NotificationEvent, FALSE);

       // If not failing outright, pass this on to our PDO for further handling
        IoCopyCurrentIrpStackLocationToNext(Irp);

        // Set a completion routine so it can signal our event when
        //  the PDO is done with the Irp
        IoSetCompletionRoutine(Irp,
                               BulkUsb_IrpCompletionRoutine,
                               &event,  // pass the event to the completion routine as the Context
                               TRUE,    // invoke on success
                               TRUE,    // invoke on error
                               TRUE);   // invoke on cancellation

        PoStartNextPowerIrp(Irp);
        ntStatus = PoCallDriver(deviceExtension->TopOfStackDeviceObject,
                                Irp);

         // if PDO is not done yet, wait for the event to be set in our completion routine
        if (ntStatus == STATUS_PENDING) {
             // wait for irp to complete

            NTSTATUS waitStatus = KeWaitForSingleObject(
                &event,
                Suspended,
                KernelMode,
                FALSE,
                NULL);

            BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() done waiting for PDO to finish IRP_MN_WAIT_WAKE\n"));
        }

                // now tell the device to actually wake up
                BulkUsb_SelfSuspendOrActivate( DeviceObject, FALSE );

        // flag we're done with wakeup irp
        deviceExtension->EnabledForWakeup = FALSE;

        BulkUsb_DecrementIoCount(DeviceObject);

        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Exit IRP_MN_WAIT_WAKE\n"));
        break;

    case IRP_MN_SET_POWER:
        {

                // The system power policy manager sends this IRP to set the system power state.
                // A device power policy manager sends this IRP to set the device power state for a device.

        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Enter IRP_MN_SET_POWER\n"));

        // Set Irp->IoStatus.Status to STATUS_SUCCESS to indicate that the device
        // has entered the requested state. Drivers cannot fail this IRP.

        switch (irpStack->Parameters.Power.Type) {
            case SystemPowerState:

                // Get input system power state
                sysPowerState.SystemState = irpStack->Parameters.Power.State.SystemState;

                BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Set Power, type SystemPowerState = %s\n",
                    BULKUSB_StringForSysState( sysPowerState.SystemState ) ));

                // If system is in working state always set our device to D0
                //  regardless of the wait state or system-to-device state power map
                if ( sysPowerState.SystemState ==  PowerSystemWorking) {
                    desiredDevicePowerState.DeviceState = PowerDeviceD0;

                     BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() PowerSystemWorking, will set D0, not use state map\n"));


                } else {
                     // set to corresponding system state if IRP_MN_WAIT_WAKE pending
                    if ( deviceExtension->EnabledForWakeup ) { // got a WAIT_WAKE IRP pending?

                        // Find the device power state equivalent to the given system state.
                        // We get this info from the DEVICE_CAPABILITIES struct in our device
                        // extension (initialized in BulkUsb_PnPAddDevice() )
                        desiredDevicePowerState.DeviceState =
                            deviceExtension->DeviceCapabilities.DeviceState[ sysPowerState.SystemState ];

                        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() IRP_MN_WAIT_WAKE pending, will use state map\n"));

                    } else {
                        // if no wait pending and the system's not in working state, just turn off
                        desiredDevicePowerState.DeviceState = PowerDeviceD3;

                        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Not EnabledForWakeup and the system's not in working state,\n  settting PowerDeviceD3 (off )\n"));
                    }
                }

                //
                // We've determined the desired device state; are we already in this state?
                //

                BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Set Power, desiredDevicePowerState = %s\n",
                    BULKUSB_StringForDevState( desiredDevicePowerState.DeviceState ) ));

                if (desiredDevicePowerState.DeviceState !=
                    deviceExtension->CurrentDevicePowerState) {

                    // BulkUsb_IncrementIoCount(DeviceObject);

                    // No, request that we be put into this state
                                        // by requesting a new Power Irp from the Pnp manager
                    deviceExtension->PowerIrp = Irp;
                    ntStatus = PoRequestPowerIrp(deviceExtension->PhysicalDeviceObject,
                                               IRP_MN_SET_POWER,
                                               desiredDevicePowerState,
                                                                                           // completion routine will pass the Irp down to the PDO
                                               BulkUsb_PoRequestCompletion,
                                               DeviceObject,
                                               NULL);

                } else {
                    // Yes, just pass it on to PDO (Physical Device Object)
                    IoCopyCurrentIrpStackLocationToNext(Irp);
                    PoStartNextPowerIrp(Irp);
                    ntStatus = PoCallDriver(deviceExtension->TopOfStackDeviceObject,
                                            Irp);

                    BulkUsb_DecrementIoCount(DeviceObject);
                    BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Exit IRP_MN_SET_POWER\n"));

                }
                break;

            case DevicePowerState:

                BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Set Power, type DevicePowerState = %s\n",
                    BULKUSB_StringForDevState( irpStack->Parameters.Power.State.DeviceState ) ));

                // For requests to D1, D2, or D3 ( sleep or off states ),
                                // sets deviceExtension->CurrentDevicePowerState to DeviceState immediately.
                                // This enables any code checking state to consider us as sleeping or off
                                // already, as this will imminently become our state.

                // For requests to DeviceState D0 ( fully on ), sets fGoingToD0 flag TRUE
                // to flag that we must set a completion routine and update
                                // deviceExtension->CurrentDevicePowerState there.
                                // In the case of powering up to fully on, we really want to make sure
                                // the process is completed before updating our CurrentDevicePowerState,
                                // so no IO will be attempted or accepted before we're really ready.

                fGoingToD0 = BulkUsb_SetDevicePowerState(DeviceObject,
                                                      irpStack->Parameters.Power.State.DeviceState
                                                      ); // returns TRUE for D0

                IoCopyCurrentIrpStackLocationToNext(Irp);

                if (fGoingToD0) {
                    BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Set PowerIrp Completion Routine, fGoingToD0 =%d\n", fGoingToD0));
                    IoSetCompletionRoutine(Irp,
                           BulkUsb_PowerIrp_Complete,
                           // Always pass FDO to completion routine as its Context;
                           // This is because the DriverObject passed by the system to the routine
                           // is the Physical Device Object ( PDO ) not the Functional Device Object ( FDO )
                           DeviceObject,
                           TRUE,            // invoke on success
                           TRUE,            // invoke on error
                           TRUE);           // invoke on cancellation of the Irp
                }

                PoStartNextPowerIrp(Irp);
                ntStatus = PoCallDriver(deviceExtension->TopOfStackDeviceObject,
                                        Irp);

                if ( !fGoingToD0 ) // completion routine will decrement
                    BulkUsb_DecrementIoCount(DeviceObject);

                BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Exit IRP_MN_SET_POWER\n"));
                break;
            } /* case irpStack->Parameters.Power.Type */

        }
        break; /* IRP_MN_SET_POWER */

    case IRP_MN_QUERY_POWER:
                //
                // A power policy manager sends this IRP to determine whether it can change
                // the system or device power state, typically to go to sleep.
                //

        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() IRP_MN_QUERY_POWER\n"));

        // We do nothing special here, just let the PDO handle it
        IoCopyCurrentIrpStackLocationToNext(Irp);
        PoStartNextPowerIrp(Irp);
        ntStatus = PoCallDriver(deviceExtension->TopOfStackDeviceObject,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文在线资源观看网站视频免费不卡| 国内成+人亚洲+欧美+综合在线 | 久久久久国产一区二区三区四区| 午夜精品免费在线| 7777女厕盗摄久久久| 日韩高清在线不卡| 日韩欧美一二三四区| 麻豆国产精品官网| 久久精品亚洲国产奇米99| 国产高清在线精品| 国产精品黄色在线观看| 94-欧美-setu| 日本不卡中文字幕| 国产日韩欧美精品综合| av动漫一区二区| 亚洲欧美电影院| 欧美日韩成人综合在线一区二区| 亚洲一级二级三级| 欧美一卡二卡在线观看| 国产99久久久久| 亚洲va天堂va国产va久| 久久久久久久久免费| 91丨porny丨户外露出| 性久久久久久久久久久久| 亚洲精品在线网站| 在线视频国内一区二区| 精品一区二区日韩| 午夜视频一区在线观看| 国产精品女同互慰在线看| 91精品国产91综合久久蜜臀| 99久久精品国产导航| 激情亚洲综合在线| 一二三区精品视频| 亚洲欧洲精品成人久久奇米网| 欧美大片日本大片免费观看| 欧美亚洲综合久久| 色综合久久久久久久久| 成人精品视频一区二区三区| 九九九久久久精品| 免播放器亚洲一区| 日本美女一区二区| 日韩精品乱码av一区二区| 亚洲精选一二三| 一区二区三区中文字幕精品精品 | 欧美喷水一区二区| 色老综合老女人久久久| 欧美伊人久久久久久午夜久久久久| 欧洲亚洲精品在线| 亚洲乱码中文字幕| 国产精品国产馆在线真实露脸| 国产精品久久久久一区| 奇米888四色在线精品| 成人午夜看片网址| 8x8x8国产精品| 一个色综合网站| 一区二区三区丝袜| 亚洲免费观看在线视频| 国产精品免费久久| 久久综合九色综合欧美就去吻| 欧美一区二区日韩| 精品美女被调教视频大全网站| 欧美一区二区三区在线视频| 欧美日韩免费一区二区三区视频 | 日韩成人av影视| 老司机精品视频导航| 激情六月婷婷久久| 成人综合在线观看| 色婷婷国产精品| 精品国精品自拍自在线| 国产亚洲女人久久久久毛片| 亚洲欧美精品午睡沙发| 亚洲国产色一区| 激情小说欧美图片| 91免费在线看| 国产婷婷色一区二区三区在线| 欧美一卡二卡在线| 伊人婷婷欧美激情| 成人av集中营| 久久久精品2019中文字幕之3| 亚洲成人精品一区二区| 粉嫩av一区二区三区粉嫩| 欧美一区永久视频免费观看| 亚洲欧美色图小说| 国产专区欧美精品| 日韩精品中文字幕一区| 午夜欧美电影在线观看| 欧美日韩一级二级三级| 亚洲欧美区自拍先锋| 99久久精品费精品国产一区二区| 久久久精品国产免大香伊| 国产激情一区二区三区桃花岛亚洲| 日韩欧美在线影院| 九色综合国产一区二区三区| 欧美一区二区三区爱爱| 日韩影院在线观看| 欧美一级视频精品观看| 日韩综合在线视频| 日韩视频永久免费| 国产成人亚洲精品青草天美| 国产精品美女久久久久高潮| 成人中文字幕合集| 一区二区三区电影在线播| 欧美视频完全免费看| 亚洲日本欧美天堂| 欧美日韩国产免费一区二区| 国产精品素人视频| 亚洲欧洲成人精品av97| 精品一区二区在线免费观看| 综合欧美一区二区三区| 欧美军同video69gay| 丁香婷婷综合激情五月色| 久久99精品久久久久| 午夜精品久久久久久不卡8050| 中文字幕一区二区三区不卡在线 | 亚洲一二三四久久| 欧美日韩亚洲丝袜制服| 久久99蜜桃精品| 一卡二卡欧美日韩| 久久综合九色综合久久久精品综合| 91免费版在线看| 久久aⅴ国产欧美74aaa| 亚洲一区二区三区精品在线| 精品99一区二区| 69久久夜色精品国产69蝌蚪网| av一区二区不卡| 国产成a人无v码亚洲福利| 日韩电影在线免费| 综合久久给合久久狠狠狠97色| 久久精品一区二区三区av| 欧美日韩在线三级| 欧美视频一区二区三区在线观看| 国产大陆亚洲精品国产| 久久99九九99精品| 激情六月婷婷综合| 国产精品一区二区在线观看不卡 | 国产精品国产三级国产有无不卡 | 欧美性感一区二区三区| 99久久婷婷国产综合精品| 91麻豆免费观看| 欧美视频一区二区| 3d动漫精品啪啪1区2区免费| 欧美老年两性高潮| 日韩欧美中文字幕制服| 日韩亚洲欧美一区二区三区| 欧美sm美女调教| 国产女人18水真多18精品一级做| 久久久国产午夜精品| 国产精品拍天天在线| 一区二区三区在线播| 亚洲妇熟xx妇色黄| 麻豆国产精品一区二区三区| 麻豆精品一二三| 成人午夜电影小说| 欧美性一区二区| 欧美成人猛片aaaaaaa| 国产精品久久777777| 亚洲另类在线制服丝袜| 秋霞成人午夜伦在线观看| 99久久精品费精品国产一区二区| 激情成人综合网| 91免费看`日韩一区二区| 欧美一区二区视频在线观看| 欧美经典一区二区三区| 亚洲国产精品久久人人爱蜜臀 | 综合欧美一区二区三区| 国产一区二区三区不卡在线观看| 一本久久a久久免费精品不卡| 欧美mv日韩mv国产网站| 尤物在线观看一区| 99免费精品在线| 国产日韩欧美亚洲| 国产伦精品一区二区三区在线观看 | 91久久国产最好的精华液| 国产精品黄色在线观看| 国产成人亚洲综合a∨婷婷| 欧美成人精品1314www| 蜜桃一区二区三区在线观看| 91精品国产综合久久久蜜臀粉嫩| 日本午夜精品一区二区三区电影| 在线91免费看| 激情文学综合插| 国产欧美日韩三级| 91视视频在线观看入口直接观看www | 亚洲综合精品自拍| 国产福利一区在线观看| 精品电影一区二区| 日本欧美一区二区三区| 欧美午夜精品理论片a级按摩| 国产欧美精品国产国产专区 | 亚洲四区在线观看| 岛国一区二区在线观看| 久久婷婷国产综合精品青草| 国产一区在线观看麻豆| 精品福利视频一区二区三区| 九色|91porny| 久久久久亚洲蜜桃| 国产传媒日韩欧美成人| 国产清纯白嫩初高生在线观看91 | 91免费小视频| 一区二区三区在线看|