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

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

?? isopwr.c

?? Appliction => rs232測試 應用程式 Driver => usb to rs232 驅動程式(wdm ddk) DLL => 應用程式 Firmware =&g
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*++

Copyright (c) 1997-1998  Microsoft Corporation

Module Name:

    IsoPwr.c 

Abstract:

    Isochronous 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 "Iso82930.h"


NTSTATUS
IsoUsb_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;

    ISOUSB_KdPrint( DBGLVL_MEDIUM,(" IsoUsb_ProcessPowerIrp() IRP_MJ_POWER\n"));

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
    irpStack = IoGetCurrentIrpStackLocation (Irp);
    IsoUsb_IncrementIoCount(DeviceObject);

    switch (irpStack->MinorFunction) {
    case IRP_MN_WAIT_WAKE:
        ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_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 );
            ISOUSB_KdPrint( DBGLVL_HIGH, ( "Exit IsoUsb_ProcessPowerIrp(), ntStatus STATUS_INVALID_DEVICE_STATE\n" ) );
            IsoUsb_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,
                               IsoUsb_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);

            ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_ProcessPowerIrp() done waiting for PDO to finish IRP_MN_WAIT_WAKE\n"));
        }

		// now tell the device to actually wake up
		IsoUsb_SelfSuspendOrActivate( DeviceObject, FALSE );

        // flag we're done with wakeup irp
        deviceExtension->EnabledForWakeup = FALSE;

        IsoUsb_DecrementIoCount(DeviceObject);

        ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_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.

        ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_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;

                ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_ProcessPowerIrp() Set Power, type SystemPowerState = %s\n",
                    ISOUSB_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;

                     ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_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 IsoUsb_PnPAddDevice() )
                        desiredDevicePowerState.DeviceState =
                            deviceExtension->DeviceCapabilities.DeviceState[ sysPowerState.SystemState ];

                        ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_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;

                        ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_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?
                //

                ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_ProcessPowerIrp() Set Power, desiredDevicePowerState = %s\n",
                    ISOUSB_StringForDevState( desiredDevicePowerState.DeviceState ) ));

                if (desiredDevicePowerState.DeviceState !=
                    deviceExtension->CurrentDevicePowerState) {


                    // 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
                                               IsoUsb_PoRequestCompletion, 
                                               DeviceObject,
                                               NULL);

                } else {
                    // Yes, just pass it on to PDO (Physical Device Object)
                    IoCopyCurrentIrpStackLocationToNext(Irp);
                    PoStartNextPowerIrp(Irp);
                    ntStatus = PoCallDriver(deviceExtension->TopOfStackDeviceObject,
                                            Irp);

                    IsoUsb_DecrementIoCount(DeviceObject);
                    ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_ProcessPowerIrp() Exit IRP_MN_SET_POWER\n"));

                }
                break;

            case DevicePowerState:

                ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_ProcessPowerIrp() Set Power, type DevicePowerState = %s\n",
                    ISOUSB_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 = IsoUsb_SetDevicePowerState(DeviceObject,
                                                      irpStack->Parameters.Power.State.DeviceState
                                                      ); // returns TRUE for D0

                IoCopyCurrentIrpStackLocationToNext(Irp);

                if (fGoingToD0) {
                    ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_ProcessPowerIrp() Set PowerIrp Completion Routine, fGoingToD0 =%d\n", fGoingToD0));
                    IoSetCompletionRoutine(Irp,
                           IsoUsb_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
                    IsoUsb_DecrementIoCount(DeviceObject);

                ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲韩国一区二区三区| 日韩三级精品电影久久久| 国产精品资源站在线| 日本怡春院一区二区| 性欧美大战久久久久久久久| 亚洲综合免费观看高清完整版| 最新国产成人在线观看| 中文一区二区在线观看| 日本一区二区成人| 国产精品福利在线播放| 日韩毛片精品高清免费| 亚洲日本在线天堂| 一区二区三区中文字幕电影 | 六月丁香婷婷久久| 热久久免费视频| 蜜桃精品视频在线| 九一九一国产精品| 国产suv精品一区二区6| 丁香亚洲综合激情啪啪综合| 成人免费精品视频| 色先锋aa成人| 欧美日韩亚洲综合在线 | 8v天堂国产在线一区二区| 欧美丰满一区二区免费视频| 日韩欧美在线综合网| 久久伊人中文字幕| 国产精品久久久久久久久搜平片| 国产精品成人免费在线| 亚洲亚洲人成综合网络| 日本免费在线视频不卡一不卡二| 精品一区二区三区免费毛片爱| 国产麻豆精品在线观看| 99国产一区二区三精品乱码| 欧美视频一区二| 久久看人人爽人人| 亚洲精品欧美激情| 精品在线播放免费| 91麻豆免费观看| 欧美一二三四区在线| 国产拍揄自揄精品视频麻豆| 亚洲一区二区不卡免费| 国产一区二区三区在线观看免费 | 亚洲国产一二三| 奇米影视在线99精品| 成人激情免费电影网址| 欧美视频在线不卡| 国产精品欧美久久久久无广告 | 一区二区三区日韩在线观看| 精品中文字幕一区二区| 欧美午夜片在线观看| 精品国产电影一区二区| 亚洲国产中文字幕在线视频综合 | 久久精品国产亚洲高清剧情介绍| 成人国产亚洲欧美成人综合网| 欧美视频在线观看一区| 中文字幕免费不卡| 久久精品999| 欧美日韩小视频| 成人欧美一区二区三区在线播放| 美女看a上一区| 欧美性大战xxxxx久久久| 国产农村妇女精品| 精品一区二区久久| 91精品国模一区二区三区| 亚洲日本丝袜连裤袜办公室| 激情久久五月天| 欧美一区二区三区精品| 午夜欧美一区二区三区在线播放| 丰满亚洲少妇av| 国产天堂亚洲国产碰碰| 久久99精品一区二区三区| 欧美精品欧美精品系列| 亚洲国产精品人人做人人爽| 91色九色蝌蚪| 国产精品传媒入口麻豆| 成人av在线看| 天天av天天翘天天综合网色鬼国产| 成人丝袜视频网| 中文字幕av一区 二区| 国产不卡视频一区二区三区| 久久精品人人做| 国产传媒日韩欧美成人| 久久综合色播五月| 激情亚洲综合在线| 欧美精品一区二| 国产精品亚洲第一| 国产精品国产a| 色妹子一区二区| 亚洲综合无码一区二区| 欧美日韩情趣电影| 丝袜国产日韩另类美女| 日韩一区二区在线播放| 久久精品国产亚洲高清剧情介绍| 精品福利二区三区| 国产99一区视频免费| 日韩理论片一区二区| 欧美亚洲一区二区三区四区| 天天爽夜夜爽夜夜爽精品视频| 日韩午夜三级在线| 国产91在线观看丝袜| 亚洲丝袜自拍清纯另类| 欧洲精品一区二区三区在线观看| 亚洲在线中文字幕| 日韩午夜在线播放| 成人免费毛片片v| 亚洲午夜视频在线| 精品国产免费视频| 91小视频在线观看| 奇米精品一区二区三区四区 | 精品欧美乱码久久久久久1区2区| 色婷婷久久久综合中文字幕| 亚洲成人在线免费| 久久久一区二区三区| 91天堂素人约啪| 蜜桃视频一区二区| 亚洲丝袜自拍清纯另类| 欧美一级在线免费| 97se亚洲国产综合在线| 日韩精品1区2区3区| 欧美国产乱子伦| 91精品在线免费| av影院午夜一区| 另类小说一区二区三区| 18成人在线观看| 欧美成人女星排行榜| 91老司机福利 在线| 激情小说欧美图片| 午夜私人影院久久久久| 国产女主播一区| 日韩欧美精品在线视频| 91浏览器入口在线观看| 国产精品一线二线三线| 五月天欧美精品| 亚洲日本一区二区三区| 精品国内二区三区| 欧美日韩国产经典色站一区二区三区| 国产成人精品免费网站| 五月婷婷久久丁香| 亚洲黄一区二区三区| 国产视频一区二区三区在线观看| 欧美精品国产精品| 欧洲av一区二区嗯嗯嗯啊| 成人av先锋影音| 国产不卡视频在线观看| 麻豆久久久久久| 亚洲成人精品一区二区| 亚洲男人的天堂在线观看| 中文字幕av在线一区二区三区| 精品噜噜噜噜久久久久久久久试看| 欧美日韩精品一区二区天天拍小说| 波多野结衣中文字幕一区二区三区| 激情丁香综合五月| av在线不卡电影| 成人理论电影网| 懂色av一区二区在线播放| 国产精品系列在线播放| 国产真实乱子伦精品视频| 久久99精品国产.久久久久| 日本va欧美va瓶| 免费视频最近日韩| 免费在线观看成人| 久久国产综合精品| 国产最新精品免费| 国产精品综合一区二区| 国产精品一区在线观看乱码| 国产一区二区三区高清播放| 国产福利一区二区三区视频| 国产精品羞羞答答xxdd| 成人a区在线观看| 日本乱码高清不卡字幕| 欧亚洲嫩模精品一区三区| 欧美日韩国产在线观看| 欧美男女性生活在线直播观看| 欧美色综合影院| 91精品午夜视频| 国产日产欧美一区| 亚洲人午夜精品天堂一二香蕉| 亚洲女女做受ⅹxx高潮| 亚洲丰满少妇videoshd| 美女诱惑一区二区| 成人一区二区在线观看| 91原创在线视频| 欧美男男青年gay1069videost| 欧美一区二区观看视频| 国产午夜亚洲精品不卡 | 丁香婷婷深情五月亚洲| 色婷婷综合久久| 欧美酷刑日本凌虐凌虐| 欧美一区二区三区影视| 国产视频不卡一区| 亚洲一区二区欧美| 狠狠色伊人亚洲综合成人| 成人h精品动漫一区二区三区| 欧美日韩免费电影| 亚洲精品一区二区三区在线观看 | 国产精品乱子久久久久| 亚洲成av人片一区二区梦乃| 国产成人免费高清| 欧美午夜一区二区| 国产精品色呦呦|