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

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

?? bulkpwr.c

?? smdk2410 wince 4 bsp
?? 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一区二区三区免费野_久草精品视频
欧美日韩国产在线播放网站| 色婷婷一区二区| 一区二区三区日韩欧美| 国产精品国产三级国产aⅴ中文 | 日韩欧美国产一区二区三区| 欧美色视频在线观看| 欧美午夜在线一二页| 欧美丰满嫩嫩电影| 欧美一区日韩一区| 精品国产a毛片| 久久久久国产免费免费| 国产精品五月天| **性色生活片久久毛片| 亚洲人吸女人奶水| 亚洲电影你懂得| 久久精品国产精品亚洲综合| 国产一区二区福利视频| 成人激情综合网站| 欧美视频一区二区三区四区 | 久久99精品久久久久久动态图| 美腿丝袜亚洲一区| 国产精品一区二区不卡| 成人福利视频网站| 在线观看不卡视频| 日韩精品中午字幕| 日韩毛片高清在线播放| 亚洲国产精品影院| 国内国产精品久久| 色丁香久综合在线久综合在线观看| 欧美人与性动xxxx| 国产亚洲欧洲997久久综合| 亚洲色图在线播放| 麻豆久久久久久久| 91麻豆6部合集magnet| 91精品国产一区二区三区| 国产丝袜美腿一区二区三区| 亚洲伊人伊色伊影伊综合网| 国产一区二区三区在线观看精品| 不卡大黄网站免费看| 欧美一区二区三区在线视频| 国产精品美女久久久久久久久| 亚洲午夜在线观看视频在线| 国产麻豆精品久久一二三| 欧美中文字幕一区| 久久久久国色av免费看影院| 香蕉久久夜色精品国产使用方法| 国产成人在线视频网址| 欧美午夜一区二区| 国产精品五月天| 韩国一区二区三区| 欧美日韩亚洲不卡| 亚洲人成网站精品片在线观看| 国产一区二区三区四| 欧美久久久久免费| 亚洲欧洲另类国产综合| 国产尤物一区二区在线| 69久久夜色精品国产69蝌蚪网| 日韩一区有码在线| 国产精品69毛片高清亚洲| 欧美一个色资源| 亚洲www啪成人一区二区麻豆| av不卡一区二区三区| 精品日本一线二线三线不卡| 日本欧美一区二区在线观看| 在线一区二区三区四区五区| √…a在线天堂一区| 国产高清不卡二三区| 精品日韩99亚洲| 六月丁香综合在线视频| 91精品国产91久久综合桃花| 亚洲亚洲精品在线观看| 91视频在线观看| 中文字幕日韩一区| thepron国产精品| 亚洲国产精品99久久久久久久久 | 日韩一区二区三区三四区视频在线观看| 亚洲蜜臀av乱码久久精品| 波多野结衣精品在线| 国产午夜精品久久| 成人av影院在线| 亚洲欧美激情插 | 亚洲成av人片在www色猫咪| 91福利在线看| 亚洲国产日韩a在线播放性色| 欧美少妇bbb| 婷婷国产在线综合| 欧美一级高清片| 国模套图日韩精品一区二区| 久久久国际精品| 91天堂素人约啪| 亚洲国产精品一区二区www在线 | 国产一区二区美女| 国产拍欧美日韩视频二区| www.亚洲激情.com| 亚洲综合小说图片| 欧美一卡2卡三卡4卡5免费| 精品在线观看视频| 国产精品午夜电影| 欧美视频在线观看一区二区| 蜜桃av一区二区| 久久久久亚洲蜜桃| 91在线观看美女| 青青青伊人色综合久久| 久久亚洲捆绑美女| 91免费视频网| 蜜桃av一区二区三区| 国产精品视频一二三区| 欧美视频一区二区三区四区 | 综合电影一区二区三区 | 蜜桃av一区二区三区电影| 国产三级精品三级| 欧美亚洲免费在线一区| 狠狠色综合日日| 亚洲色图.com| 日韩精品一区二区三区四区视频| 成人一级黄色片| 日韩在线一区二区三区| 国产精品区一区二区三区| 911精品产国品一二三产区| 国产v日产∨综合v精品视频| 婷婷久久综合九色国产成人| 国产精品国产三级国产普通话蜜臀| 欧美日韩电影在线| 99视频热这里只有精品免费| 久久99精品国产91久久来源| 亚洲激情自拍视频| 亚洲国产精品99久久久久久久久| 91麻豆精品国产91久久久久| 99久久er热在这里只有精品15 | 亚洲欧美激情小说另类| 久久中文娱乐网| 欧美一级精品在线| 欧美日本乱大交xxxxx| 色婷婷av一区二区三区之一色屋| 国产成人综合网站| 美女mm1313爽爽久久久蜜臀| 亚洲成人精品在线观看| 一区二区三区日本| 国产精品久久毛片a| 精品sm在线观看| 日韩一区二区三免费高清| 欧美日韩国产片| 欧美三级三级三级| 91免费国产在线| 成人黄色小视频| 成人免费观看视频| 国内精品伊人久久久久av影院| 日韩中文欧美在线| 视频一区二区三区中文字幕| 天天综合色天天| 午夜精品影院在线观看| 午夜日韩在线观看| 亚洲高清视频在线| 亚洲成人你懂的| 日韩成人一级片| 日韩av不卡一区二区| 午夜视频一区二区| 日本欧美一区二区三区| 麻豆精品一二三| 国产呦精品一区二区三区网站| 国产毛片精品一区| 成人免费高清在线| 99在线视频精品| 91久久精品日日躁夜夜躁欧美| 色国产综合视频| 欧美日韩一区二区三区在线看| 7777精品伊人久久久大香线蕉| 欧美麻豆精品久久久久久| 91精品蜜臀在线一区尤物| 日韩美女视频一区二区在线观看| 久久综合久久综合九色| 国产日韩视频一区二区三区| 国产日本欧美一区二区| 国产精品短视频| 亚洲午夜av在线| 激情六月婷婷久久| 99国产一区二区三精品乱码| 欧美日韩一区高清| 日韩精品一区二区在线| 国产精品久久久久久久久免费樱桃| 亚洲欧美欧美一区二区三区| 日本不卡一二三区黄网| 国产高清精品网站| 一本一道久久a久久精品| 6080yy午夜一二三区久久| 久久久久久毛片| 亚洲精品欧美二区三区中文字幕| 亚洲成人av免费| 国产成人免费在线观看不卡| 91高清视频在线| 国产亚洲成aⅴ人片在线观看| 亚洲一区二区三区四区在线免费观看 | voyeur盗摄精品| 宅男在线国产精品| 国产精品久久久久四虎| 日韩av网站在线观看| 99国产精品一区| 久久综合久久鬼色中文字| 一区二区三区自拍| 国产高清精品网站|