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

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

?? bulkpwr.c

?? linux環境下USB驅動程序,適用三星ARM2410B
?? 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久久精品亚洲| 成人伦理片在线| 9色porny自拍视频一区二区| 成人小视频免费在线观看| 国产精品99久久久久久似苏梦涵| 国内成人免费视频| 国产一区二区视频在线| 国产mv日韩mv欧美| 成人av在线观| 欧美午夜宅男影院| 日韩欧美在线影院| 2020国产精品| 国产精品剧情在线亚洲| 亚洲人123区| 日韩影视精彩在线| 国产乱码精品一区二区三区av| 国产成人午夜视频| 波多野结衣视频一区| 欧美综合一区二区| 精品国产91乱码一区二区三区| www一区二区| 亚洲婷婷综合久久一本伊一区| 亚洲色图在线播放| 欧美96一区二区免费视频| 国产一区二区三区四区在线观看| 成人中文字幕电影| 欧美三区在线观看| 久久久久久综合| 亚洲图片有声小说| 国产高清在线观看免费不卡| 欧美性猛片aaaaaaa做受| 欧美va亚洲va香蕉在线| 1区2区3区精品视频| 蜜桃av噜噜一区| 色婷婷亚洲综合| 国产欧美一区二区精品秋霞影院| 亚洲精品国产精华液| 韩国精品免费视频| 欧美日韩一区成人| 国产精品久久久久久久久免费丝袜 | 欧美久久久久免费| 26uuu另类欧美亚洲曰本| 一区二区成人在线视频| 国产精品一区在线| 91精品婷婷国产综合久久 | 一区二区三区中文字幕| 久久成人综合网| 91黄视频在线观看| 国产清纯美女被跳蛋高潮一区二区久久w| 一区二区三区日韩欧美| 国产成人精品亚洲777人妖| 欧美精品亚洲二区| 亚洲最新视频在线观看| 成人免费视频一区二区| 欧美精品一区二| 亚洲黄色小视频| av毛片久久久久**hd| 精品国产电影一区二区| 日韩成人免费电影| 欧美性生活大片视频| 亚洲另类春色校园小说| 91在线视频官网| 中文子幕无线码一区tr| 国产精品影视在线观看| 欧美大片在线观看一区| 七七婷婷婷婷精品国产| 在线视频亚洲一区| 一区二区三区产品免费精品久久75| 国产suv精品一区二区6| 国产偷国产偷精品高清尤物 | 久久久精品综合| 精品一区二区三区在线观看国产| 欧美日韩精品二区第二页| 一区二区三区免费网站| 99re热视频精品| 亚洲日本va午夜在线影院| 99久久久精品| 亚洲人一二三区| 欧美日韩免费在线视频| 首页亚洲欧美制服丝腿| 欧美大片在线观看一区| 国产精品18久久久久久久久| 国产三级精品三级| 97久久人人超碰| 一区二区欧美国产| 777奇米四色成人影色区| 日本不卡视频在线| 26uuu久久综合| aa级大片欧美| 亚洲成人av电影| 久久精品这里都是精品| 波多野结衣一区二区三区 | 久久久国产午夜精品| 国产高清成人在线| 成人欧美一区二区三区黑人麻豆| 色呦呦国产精品| 免费看日韩精品| 综合中文字幕亚洲| 91精品国产美女浴室洗澡无遮挡| 韩国av一区二区三区| **性色生活片久久毛片| 欧美久久一二区| 成人黄色777网| 亚洲成a人v欧美综合天堂| 欧美精品一区男女天堂| 99精品热视频| 日韩av中文字幕一区二区三区| 日韩欧美一区二区视频| 9i看片成人免费高清| 五月天激情综合网| 中文成人综合网| 欧美一区二区人人喊爽| 韩国女主播一区| 亚洲一二三四在线观看| 久久综合狠狠综合久久综合88 | www.欧美.com| 婷婷激情综合网| 国产精品乱人伦| 精品国产一区二区在线观看| 成人午夜精品在线| 日韩电影一区二区三区四区| 国产精品伦理一区二区| 91精品国产综合久久精品性色 | 波多野结衣中文字幕一区二区三区| 国产精品久久一级| 欧美一区二区人人喊爽| 色婷婷综合久久久中文一区二区| 美女视频黄频大全不卡视频在线播放 | 99国产精品国产精品久久| 国产综合色产在线精品| 夜夜精品浪潮av一区二区三区| 久久精品亚洲一区二区三区浴池| 欧美三区在线视频| 91美女片黄在线| 丰满放荡岳乱妇91ww| 国产在线一区二区| 夜夜嗨av一区二区三区四季av| 国产亚洲欧美中文| 2020国产精品自拍| 欧美一区二区日韩| 欧美美女一区二区| 欧美在线一区二区| 日本sm残虐另类| 亚洲欧美偷拍卡通变态| 国产欧美一区二区精品性色 | 色女孩综合影院| 成人av小说网| 国产福利一区二区三区视频在线| 麻豆精品在线看| 美女任你摸久久| 亚洲成a人v欧美综合天堂| 亚洲精品久久嫩草网站秘色| 国产精品国产三级国产aⅴ原创| 国产日韩v精品一区二区| 日韩一区二区免费在线电影| 欧美在线观看视频一区二区 | 色菇凉天天综合网| 91网站最新地址| 色婷婷综合久久久久中文| 色综合天天综合网国产成人综合天 | 国产三级欧美三级| 欧美极品美女视频| 国产精品电影一区二区| 一区二区在线电影| 免费观看一级特黄欧美大片| 久久99精品国产.久久久久久| 亚洲精品高清在线观看| 亚洲成av人片一区二区三区| 奇米在线7777在线精品| 国产高清精品网站| 91精品福利视频| 日韩一区二区三区av| 久久亚洲一级片| 国产欧美日韩麻豆91| 亚洲欧洲成人自拍| 视频一区欧美日韩| 国产精品一线二线三线| 成人性色生活片免费看爆迷你毛片| 91在线porny国产在线看| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 制服丝袜亚洲播放| 国产精品入口麻豆九色| 亚洲午夜免费电影| 国产精品一区二区你懂的| 色婷婷国产精品久久包臀| 日韩视频免费观看高清完整版在线观看| 日韩女优制服丝袜电影| 国产精品无码永久免费888| 亚洲成人你懂的| 成人手机电影网| 3d动漫精品啪啪| 亚洲欧美日本韩国| 国产一区二区精品久久99| 在线中文字幕不卡| 久久久久国产精品麻豆ai换脸| 一区二区三区成人在线视频| 狠狠色狠狠色综合|