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

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

?? bulkpwr.c

?? 這是ARM9開發(fā)板上自帶的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一区二区三区免费野_久草精品视频
国产欧美日韩不卡| 一区二区三区加勒比av| 亚洲欧洲日本在线| 美女免费视频一区| 91社区在线播放| 久久五月婷婷丁香社区| 舔着乳尖日韩一区| 欧美伊人久久久久久午夜久久久久| 精品黑人一区二区三区久久| 亚洲午夜久久久久| 成人av片在线观看| 国产婷婷一区二区| 久久99久久久久久久久久久| 欧美日韩精品专区| 亚洲美女视频一区| 99精品国产热久久91蜜凸| 欧美成人女星排行榜| 琪琪一区二区三区| 欧美日韩精品一区二区在线播放| 中文字幕五月欧美| 国产成人综合自拍| 久久免费精品国产久精品久久久久| 肉丝袜脚交视频一区二区| 欧美羞羞免费网站| 亚洲午夜精品在线| 色狠狠色噜噜噜综合网| 亚洲女厕所小便bbb| 99天天综合性| 国产精品欧美经典| 成人免费看视频| 国产精品三级视频| 从欧美一区二区三区| 欧美国产激情二区三区| 成人听书哪个软件好| 亚洲欧洲成人av每日更新| 成人免费av网站| 欧美日韩视频在线观看一区二区三区| 久久久久久久久久电影| 欧美激情一区二区三区全黄| 国产乱国产乱300精品| 久久久久久久久久久99999| 免费av成人在线| 99久精品国产| 成人黄色小视频| 欧美日韩中文字幕一区二区| 国产成人精品免费| 国产精品色在线| 99久久国产综合精品女不卡| 亚洲与欧洲av电影| 欧美一区二区三区视频免费播放| 日韩综合小视频| 日韩免费观看高清完整版| 国模少妇一区二区三区| 国产精品毛片久久久久久| 91麻豆免费看片| 秋霞电影网一区二区| 精品第一国产综合精品aⅴ| 国产aⅴ综合色| 亚洲三级在线播放| 欧美亚洲一区三区| 蜜桃av一区二区三区| 欧美激情一区二区三区蜜桃视频| 久久综合视频网| 天天色天天操综合| 日韩欧美不卡在线观看视频| 国产剧情一区在线| 《视频一区视频二区| 欧美一区二区美女| 成人一区在线看| 亚洲chinese男男1069| 欧美成va人片在线观看| 91在线小视频| 国产一区二三区好的| 亚洲品质自拍视频| 欧美sm美女调教| 99久久婷婷国产综合精品| 日韩精品亚洲一区| 国产精品不卡在线观看| 欧美一区二区三区色| 99在线精品观看| 国内精品国产三级国产a久久| 亚洲男人的天堂av| 久久久久久日产精品| 欧美视频一区二区| 成人激情开心网| 免费视频最近日韩| 亚洲成人av中文| 亚洲视频免费观看| 久久先锋影音av| 欧美一区二区三区播放老司机| 成人h精品动漫一区二区三区| 日本不卡中文字幕| 一二三区精品视频| 国产精品免费久久| 久久久影视传媒| 91精品一区二区三区久久久久久| 色婷婷av一区二区三区软件 | 亚洲精品久久嫩草网站秘色| 日韩一区二区三区在线观看| 色综合久久66| 99久久99精品久久久久久 | 久久亚区不卡日本| 91精品欧美福利在线观看| 欧美在线不卡视频| 99国产欧美另类久久久精品| 国产黄色成人av| 国产成a人亚洲| 国产成人免费xxxxxxxx| 久久aⅴ国产欧美74aaa| 男男成人高潮片免费网站| 亚洲福利电影网| 亚洲r级在线视频| 一区二区三国产精华液| 亚洲精品成人少妇| 亚洲男人电影天堂| 一区二区三区中文字幕电影| 亚洲精品一卡二卡| 亚洲综合男人的天堂| 一级女性全黄久久生活片免费| 亚洲激情在线播放| 亚洲va韩国va欧美va| 午夜欧美2019年伦理| 五月综合激情网| 美日韩一区二区三区| 激情综合色播五月| 国产高清精品在线| 成人手机在线视频| 99精品久久久久久| 欧美三级视频在线观看| 91麻豆精品国产91久久久久久| 欧美一区二区播放| 久久久五月婷婷| 亚洲欧美在线视频| 亚洲综合精品自拍| 奇米一区二区三区av| 精品一区二区综合| 成人短视频下载 | 国产乱码一区二区三区| 高清不卡一二三区| 色婷婷综合久久久久中文| 欧美三级日本三级少妇99| 日韩免费高清视频| 日本一区二区视频在线| 一区二区三区在线高清| 日产国产欧美视频一区精品| 国产乱码精品一区二区三区av| 91视频在线看| 91精品国产全国免费观看| 2022国产精品视频| 1区2区3区欧美| 午夜精品久久久久久久久| 国内成+人亚洲+欧美+综合在线 | 亚洲精品高清视频在线观看| 亚洲.国产.中文慕字在线| 久草在线在线精品观看| 97久久精品人人澡人人爽| 欧美日韩一级片在线观看| 欧美精品一区二区三区在线播放| 综合网在线视频| 裸体一区二区三区| 99久久国产免费看| 26uuu精品一区二区在线观看| 亚洲视频图片小说| 国产成人av一区二区三区在线 | 在线精品视频一区二区三四| 日韩欧美一级二级三级久久久| 中文一区二区在线观看| 日韩av电影免费观看高清完整版 | 激情六月婷婷久久| 在线视频国内一区二区| 国产女人水真多18毛片18精品视频| 午夜激情综合网| 高清国产一区二区三区| 日韩欧美一区二区视频| 亚洲女同ⅹxx女同tv| 国产东北露脸精品视频| 欧美大片顶级少妇| 亚洲高清免费视频| 91日韩一区二区三区| 国产欧美日韩综合精品一区二区| 蜜臀久久久久久久| 欧美三级视频在线观看| 亚洲日本一区二区| 成人手机电影网| 欧美激情一区二区三区| 国产一区二区精品在线观看| 91精品国产综合久久久久久漫画 | 综合婷婷亚洲小说| 成人精品视频.| 中文文精品字幕一区二区| 精品在线视频一区| 欧美成人一区二区三区片免费| 日本亚洲欧美天堂免费| 欧美男生操女生| 日韩中文字幕不卡| 日韩欧美在线123| 日韩欧美成人午夜| 国产在线观看一区二区| 亚洲最快最全在线视频| 69久久99精品久久久久婷婷|