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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? bulkpwr.c

?? USB驅(qū)動(dòng)程序文件
?? C
?? 第 1 頁 / 共 3 頁
字號(hào):
/*++

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,

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩国产手机在线 | 99在线精品观看| 欧美亚洲国产一区二区三区va| 26uuu成人网一区二区三区| 亚洲综合免费观看高清在线观看| 精品一区二区综合| 日韩欧美一二三| 激情综合网最新| 亚洲国产激情av| 六月丁香综合在线视频| 欧美精品一区二区三区一线天视频 | 亚洲免费观看高清在线观看| 国产精品影视在线| 欧美日韩精品高清| 美国av一区二区| 久久亚洲综合色| 五月婷婷色综合| 粉嫩av一区二区三区粉嫩| 亚洲欧美怡红院| 久久激情综合网| 欧美日韩免费观看一区三区| 亚洲女与黑人做爰| 91美女片黄在线观看91美女| 日韩一级免费观看| 亚洲少妇中出一区| 成人高清免费观看| 337p亚洲精品色噜噜| 国产精品免费久久| 日韩精品一区第一页| 欧美最猛黑人xxxxx猛交| 亚洲影院在线观看| 91麻豆精品国产91久久久使用方法| 亚洲男人的天堂在线aⅴ视频| 久久久精品免费观看| 欧美日韩国产123区| 日本国产一区二区| 99精品国产99久久久久久白柏| 国产原创一区二区三区| 日韩国产精品久久久久久亚洲| 亚洲韩国一区二区三区| 亚洲一区二区三区四区在线观看| 亚洲人成人一区二区在线观看| 国产精品丝袜久久久久久app| 久久综合色天天久久综合图片| 日韩精品一区二区三区在线播放| k8久久久一区二区三区| 国产精品18久久久久久vr| 亚洲国产日韩一级| a级精品国产片在线观看| 国产一区高清在线| 国产乱妇无码大片在线观看| 经典三级视频一区| 国产精一区二区三区| 国产精品亚洲视频| 成人免费三级在线| 91浏览器打开| 欧美视频一区二区三区在线观看| 欧美色图12p| 美腿丝袜亚洲一区| 免费成人结看片| 国产一区日韩二区欧美三区| 国产福利精品一区| 91麻豆精东视频| 欧美日韩中文一区| 精品欧美久久久| 中文字幕av资源一区| 亚洲日穴在线视频| 香蕉久久一区二区不卡无毒影院 | 美女一区二区视频| 国产精品嫩草影院com| 欧美日韩一区二区三区视频| 91.com视频| 日韩免费一区二区| 日本一区二区综合亚洲| 一区二区高清在线| 蜜桃av一区二区在线观看 | 高清日韩电视剧大全免费| 99精品视频中文字幕| 欧美日韩精品一区二区三区蜜桃| 欧美精品乱码久久久久久按摩| 日韩精品综合一本久道在线视频| 国产嫩草影院久久久久| 91精品国产综合久久精品麻豆| 久久精品免视看| 一区二区成人在线观看| 久久精品国产亚洲5555| 91在线精品一区二区| 91精品在线一区二区| 国产人久久人人人人爽| 中文字幕日韩一区二区| 国产在线国偷精品产拍免费yy| 久久精品欧美一区二区三区不卡| 日韩欧美亚洲国产精品字幕久久久 | 亚洲二区在线视频| 国产精品亚洲一区二区三区在线| 欧美性猛交xxxx黑人交| 久久精品一区二区三区av| 亚洲国产成人av好男人在线观看| 国产成人综合亚洲网站| 欧美三区免费完整视频在线观看| 久久久综合视频| 午夜视频一区在线观看| 不卡一卡二卡三乱码免费网站 | 国产精品久久福利| 免费日本视频一区| 一本久久综合亚洲鲁鲁五月天 | ww亚洲ww在线观看国产| 亚洲成在人线在线播放| 成人av一区二区三区| 成人精品视频网站| 国产精品毛片a∨一区二区三区 | 久久av中文字幕片| 在线视频一区二区三区| 国产欧美一区二区精品秋霞影院 | 亚洲成a天堂v人片| 国产精品一色哟哟哟| 精品免费国产一区二区三区四区| 精品国一区二区三区| 日本一区二区三区久久久久久久久不| 日韩高清不卡在线| www日韩大片| 在线免费精品视频| 粉嫩绯色av一区二区在线观看| 国产成人综合自拍| 精品久久久久99| 成人午夜激情影院| 亚洲一级电影视频| 欧美日韩一区视频| 国产91精品一区二区| 日本欧美一区二区三区乱码 | 99久久精品国产一区| 国产激情一区二区三区桃花岛亚洲| 亚洲综合一区二区精品导航| 国产精品免费视频网站| 久久久不卡网国产精品一区| 日韩三级在线观看| 欧美日本高清视频在线观看| 91麻豆国产精品久久| 成人性生交大片免费看视频在线| 国产真实乱偷精品视频免| 美国十次了思思久久精品导航| 午夜影院久久久| 天堂蜜桃91精品| 日本一道高清亚洲日美韩| 日本欧美韩国一区三区| 免费观看久久久4p| 丰满放荡岳乱妇91ww| 成人av在线一区二区三区| av在线播放不卡| 欧美专区日韩专区| 日韩欧美国产高清| 成人国产精品免费| 欧美一区二区三区精品| 夜夜嗨av一区二区三区网页| 欧美色图天堂网| 国产一区三区三区| 亚洲免费av高清| 精品免费99久久| 精品视频在线免费| 成人午夜大片免费观看| 亚洲与欧洲av电影| 国产精品另类一区| 欧美变态tickling挠脚心| 国内精品伊人久久久久av影院| 中文字幕精品一区二区三区精品| 欧美日免费三级在线| 欧美另类变人与禽xxxxx| 亚洲激情av在线| 亚洲蜜臀av乱码久久精品| 亚洲宅男天堂在线观看无病毒| 亚洲欧美日韩在线播放| 亚洲制服欧美中文字幕中文字幕| 国产精品主播直播| 一本一本久久a久久精品综合麻豆| 91视频国产资源| 7777精品伊人久久久大香线蕉超级流畅 | 亚洲理论在线观看| 亚洲愉拍自拍另类高清精品| 国产丝袜欧美中文另类| 国产精品三级电影| 久久99精品久久久久久国产越南 | 国产另类ts人妖一区二区| 蜜桃视频免费观看一区| 成人精品在线视频观看| 色哦色哦哦色天天综合| 日韩一级大片在线| 日本一区二区免费在线| 亚洲色图在线播放| 91网址在线看| 色吧成人激情小说| 国产原创一区二区三区| 亚洲色图视频网| 亚洲精品在线电影| 色偷偷88欧美精品久久久| 精品一区二区三区免费毛片爱| 亚洲人成影院在线观看| 精品乱人伦一区二区三区| 色综合久久中文字幕综合网| 麻豆极品一区二区三区| 欧美日韩国产成人在线91|