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

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

?? bulkpwr.c

?? TUSB3410 win9x和win xp 驅動源代碼,包含開發測試工具
?? 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.
		//

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人午夜视频| 国产91在线看| 国产99久久久国产精品| 国产精品色哟哟网站| 91日韩精品一区| 久色婷婷小香蕉久久| 国产欧美日韩久久| 日韩午夜精品电影| 色噜噜狠狠成人中文综合| 精品在线亚洲视频| 亚洲国产精品影院| 1024成人网| 欧美精品一区二区三区蜜桃视频| 91香蕉视频mp4| 国产精品一区二区果冻传媒| 天天影视色香欲综合网老头| ...xxx性欧美| 国产午夜精品美女毛片视频| 欧美一级欧美一级在线播放| 欧美羞羞免费网站| 99精品视频在线播放观看| 国产精品一区二区男女羞羞无遮挡| 一区二区三区在线观看视频| 欧美国产成人在线| 国产欧美视频一区二区三区| 精品国产一区二区三区久久影院| 欧美日韩精品一区二区三区蜜桃 | 香蕉久久一区二区不卡无毒影院| 亚洲国产岛国毛片在线| 中文字幕高清一区| 国产精品第一页第二页第三页| 国产日韩亚洲欧美综合| 国产欧美日韩卡一| 尤物av一区二区| 天天av天天翘天天综合网色鬼国产| 亚洲第一二三四区| 麻豆成人免费电影| 国产不卡在线视频| 91亚洲国产成人精品一区二三| 欧美日韩成人综合天天影院| 91精品国产色综合久久ai换脸 | 欧美日韩在线观看一区二区 | 麻豆精品国产91久久久久久| 国产乱理伦片在线观看夜一区| 成年人网站91| 国产婷婷一区二区| 亚洲愉拍自拍另类高清精品| 麻豆精品视频在线| www.欧美.com| 日韩欧美的一区| 亚洲欧美日韩久久| 国精产品一区一区三区mba桃花 | 99久久国产免费看| 国产精品18久久久久久久久久久久 | 国产精品乱码一区二区三区软件| 亚洲综合在线第一页| 成人性生交大片免费看视频在线| 欧美久久一二三四区| 国产精品毛片大码女人| 狠狠色丁香久久婷婷综合_中| 色菇凉天天综合网| 综合激情网...| 成人免费的视频| 国产日韩视频一区二区三区| 久久精品国产亚洲高清剧情介绍| 色综合久久综合中文综合网| 欧美国产精品一区| 国产成人午夜电影网| 国产视频一区二区在线| 久久精工是国产品牌吗| 日韩一级片在线观看| 日精品一区二区三区| 欧美人与z0zoxxxx视频| 亚洲国产综合在线| 欧美日韩国产精品自在自线| 亚洲综合在线免费观看| 暴力调教一区二区三区| 国产精品乱码妇女bbbb| 成人免费高清在线观看| 国产精品久久久久久久岛一牛影视| 国产精品一区一区| 国产精品久久一级| 91福利国产精品| 亚洲主播在线播放| 日韩欧美成人激情| 国产成人午夜精品5599| 亚洲三级视频在线观看| 91香蕉视频污| 麻豆一区二区三区| 国产蜜臀av在线一区二区三区 | 成人白浆超碰人人人人| 中文字幕一区二区三区不卡在线 | 99精品久久免费看蜜臀剧情介绍| 亚洲美女偷拍久久| 欧美一区二区精品| 国产一区二三区好的| 亚洲男同1069视频| 日韩欧美一级二级三级| 91免费看片在线观看| 日本不卡一区二区三区| 国产精品嫩草影院com| 欧美一区二区三区婷婷月色| 国产一区二区三区高清播放| 国产精品嫩草影院com| 91精品国产免费| 91免费小视频| 成人黄色大片在线观看| 美女网站在线免费欧美精品| 亚洲乱码国产乱码精品精小说| 日韩视频在线永久播放| 色成人在线视频| 国产成人综合精品三级| 青青草原综合久久大伊人精品| 国产精品久久久久久久蜜臀| 色偷偷一区二区三区| 欧美亚洲综合另类| 韩国av一区二区| 麻豆成人久久精品二区三区小说| 亚洲乱码日产精品bd| 国产精品日韩成人| 欧美成人video| 欧美一卡在线观看| 欧美日韩久久一区| 制服丝袜亚洲网站| 欧美绝品在线观看成人午夜影视| 色嗨嗨av一区二区三区| 色香蕉久久蜜桃| 一本大道久久a久久精二百| 99久久99久久精品免费观看| 丰满少妇在线播放bd日韩电影| 精品一区二区av| 国内精品伊人久久久久av影院| 日韩电影在线观看电影| 免费日本视频一区| 国产一区免费电影| 成人一级黄色片| 欧美亚日韩国产aⅴ精品中极品| 91色九色蝌蚪| 日韩一区二区不卡| 国产午夜精品一区二区三区视频 | 久久精品夜夜夜夜久久| 中文在线免费一区三区高中清不卡| 日本一区二区免费在线观看视频| 欧美激情一区不卡| 亚洲一区二区三区激情| 日本免费新一区视频| 国产高清在线观看免费不卡| 色偷偷成人一区二区三区91| 宅男在线国产精品| 久久久精品国产99久久精品芒果| 亚洲三级小视频| 激情综合网激情| 欧美亚洲尤物久久| 久久嫩草精品久久久久| 一区二区三区日韩欧美| 国产伦精一区二区三区| 欧美中文字幕一区二区三区| 久久精品一区八戒影视| 日韩av中文在线观看| 91麻豆成人久久精品二区三区| 精品美女一区二区三区| 国产视频一区二区在线观看| 日本系列欧美系列| 欧美日韩另类一区| 亚洲激情图片一区| 波波电影院一区二区三区| 久久综合九色综合欧美98| 日韩av一级电影| 欧美精品九九99久久| 一区二区三区高清不卡| 91农村精品一区二区在线| 国产精品久久福利| 成人一区在线观看| 国产精品久久午夜夜伦鲁鲁| 国产成人啪午夜精品网站男同| 欧美丰满高潮xxxx喷水动漫| 亚洲福利国产精品| 欧美男男青年gay1069videost| 亚洲第一搞黄网站| 欧美精品在线视频| 日本不卡的三区四区五区| 日韩一区二区视频| 国产在线精品不卡| 欧美高清一级片在线观看| 国产成人久久精品77777最新版本| 久久久亚洲精华液精华液精华液| 精品一区二区三区视频在线观看| 精品久久久久香蕉网| 国产一区二区在线观看视频| 国产日产欧美一区| 成人小视频免费在线观看| 日韩精品一区二| 国产成人精品亚洲午夜麻豆| 91精品国产综合久久久久久久| 久久国产尿小便嘘嘘| 国产日韩成人精品| 精品视频1区2区| 国内不卡的二区三区中文字幕| 中文字幕日韩一区二区| 欧美日韩在线观看一区二区|