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

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

?? bulkpwr.c

?? S3C2410X平臺下的USB驅(qū)動程序
?? 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,

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区高清在线| 亚洲第一搞黄网站| 欧美精品日韩一本| 国产福利精品一区| 午夜日韩在线观看| 亚洲日本免费电影| 26uuu亚洲| 日韩欧美第一区| 欧美日韩一区二区三区四区五区| 国产福利一区在线观看| 午夜激情一区二区| 夜夜嗨av一区二区三区网页| 久久午夜国产精品| 日韩女同互慰一区二区| 91成人在线精品| 国产99久久久国产精品| 国内精品嫩模私拍在线| 日韩电影免费一区| 午夜精品久久久久久久蜜桃app| 中文字幕在线一区免费| 国产精品热久久久久夜色精品三区| 91精品国产aⅴ一区二区| 欧美在线影院一区二区| 色综合久久天天综合网| 91福利在线观看| 在线观看日韩电影| 777xxx欧美| 欧美va亚洲va| 欧美激情一区二区三区蜜桃视频| 久久一区二区三区四区| 久久精品夜夜夜夜久久| 中文字幕不卡的av| 亚洲免费观看视频| 手机精品视频在线观看| 日本不卡中文字幕| 国产精品夜夜嗨| 97久久精品人人做人人爽50路| 91蝌蚪porny| 91精品黄色片免费大全| 国产午夜精品一区二区三区视频 | 亚洲日本va在线观看| 樱桃视频在线观看一区| 人妖欧美一区二区| 成人成人成人在线视频| 欧美精品乱码久久久久久 | 精品久久免费看| 在线视频国内自拍亚洲视频| 国产一区二区中文字幕| 丰满白嫩尤物一区二区| 欧美无砖专区一中文字| 国产情人综合久久777777| 自拍偷拍国产精品| 久久精品国产秦先生| 91在线视频免费91| 欧美精品一区二区三区视频 | 亚洲福利电影网| 成人午夜碰碰视频| 欧美电视剧免费观看| 亚洲国产综合在线| 91女厕偷拍女厕偷拍高清| 2023国产精品自拍| 日韩精品1区2区3区| 色国产综合视频| 国产精品久久久久久久浪潮网站| 久久精品国产99| 日韩欧美资源站| 热久久国产精品| 欧美丰满少妇xxxbbb| 亚洲综合精品自拍| 在线观看一区日韩| 亚洲午夜羞羞片| 欧美日韩国产乱码电影| 亚洲成人资源在线| 91精品中文字幕一区二区三区| 亚洲美女在线国产| 色婷婷综合中文久久一本| 亚洲女同一区二区| 欧美三级视频在线| 奇米一区二区三区av| 91精品国产91久久综合桃花 | 日韩精品一区二区三区视频在线观看| 亚洲成av人影院| 日韩西西人体444www| 另类小说色综合网站| 久久精品视频免费| 91在线porny国产在线看| 亚洲专区一二三| 日韩一区和二区| 国产激情精品久久久第一区二区| 国产精品视频在线看| 色狠狠一区二区三区香蕉| 午夜激情久久久| 国产视频亚洲色图| 日本精品免费观看高清观看| 日韩电影免费在线| 中文字幕亚洲一区二区av在线 | 日韩一级精品视频在线观看| 国内外成人在线| 亚洲国产精品尤物yw在线观看| 欧美精品第一页| 99免费精品视频| 久久成人免费网| 亚洲国产成人高清精品| 国产拍揄自揄精品视频麻豆| 欧美亚洲禁片免费| 成人国产精品免费观看动漫| 日韩精品欧美成人高清一区二区| 国产亚洲欧美日韩俺去了| 欧美精品v国产精品v日韩精品| 国产成人在线影院| 天天免费综合色| 7777精品伊人久久久大香线蕉完整版 | 一区二区三区在线不卡| 久久午夜羞羞影院免费观看| 欧美日韩国产一级二级| eeuss鲁片一区二区三区在线观看| 亚洲一区二区三区不卡国产欧美| 欧美激情一区三区| 久久婷婷色综合| 精品国产乱码久久久久久老虎 | 欧美日本一区二区三区四区| 91视频免费看| 在线观看亚洲成人| 色婷婷久久久亚洲一区二区三区| 91麻豆免费观看| 日本高清不卡一区| 在线亚洲欧美专区二区| 色88888久久久久久影院按摩| 丁香婷婷综合色啪| 成人伦理片在线| 99久久伊人久久99| 欧洲av在线精品| 欧美日韩国产一级片| 日韩欧美国产精品一区| 欧美精品一区二区不卡| 中文字幕精品在线不卡| 国产精品的网站| 亚欧色一区w666天堂| 九色综合狠狠综合久久| www.日本不卡| 欧美日韩你懂得| wwww国产精品欧美| 国产精品国产三级国产普通话99 | 欧美日韩在线综合| 日韩午夜电影av| 国产精品久久久久久久第一福利| 亚洲欧洲韩国日本视频| 日韩电影一区二区三区四区| 国产伦精品一区二区三区免费| 成人av网址在线| 欧美一区二区人人喊爽| 国产精品网站在线观看| 午夜激情一区二区| 成人午夜视频在线| 欧美精品自拍偷拍动漫精品| 久久精品视频免费| 五月婷婷久久综合| 99久久免费国产| 精品国产精品一区二区夜夜嗨| 最新欧美精品一区二区三区| 日本不卡中文字幕| 在线欧美小视频| 成人免费一区二区三区视频 | 欧美一区二区三区男人的天堂| 国产女人18水真多18精品一级做| 亚洲午夜一区二区三区| 不卡电影免费在线播放一区| 久久亚洲免费视频| 日韩av网站在线观看| 欧美日韩你懂得| 亚洲高清免费观看| 欧洲av在线精品| 亚洲一区二区在线免费观看视频| 国产成人av一区二区三区在线 | 欧美日韩精品欧美日韩精品一| 亚洲欧洲日产国产综合网| 亚洲蜜桃精久久久久久久| 午夜视频一区二区三区| 色综合色狠狠综合色| 亚洲蜜臀av乱码久久精品| 99久久777色| 亚洲综合一区二区| 在线视频国产一区| 亚洲高清三级视频| 欧美一区二区人人喊爽| 老司机午夜精品| 国产三级一区二区| 成a人片亚洲日本久久| 一区二区三区四区高清精品免费观看| 91色乱码一区二区三区| 亚洲第一会所有码转帖| 日韩久久久久久| 国产成a人无v码亚洲福利| 亚洲色欲色欲www在线观看| 欧美日韩一级二级三级| 久久精品999| 亚洲欧美另类图片小说| 欧美一区二区三区四区久久| 国产精品一区二区久久不卡 | 色婷婷av一区|