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

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

?? isopwr.c

?? S3C2410X平臺下的USB驅動程序
?? 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
		// the system or device power state, typically to go to sleep.
		//

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美女一区二区三区在线观看| 成人午夜激情影院| 国产精品乱人伦中文| 欧美三级资源在线| 成人爱爱电影网址| 久久99精品国产| 亚洲第一激情av| 国产精品久久久久影视| 欧美大黄免费观看| 欧美视频一二三区| 色国产精品一区在线观看| 成人在线视频首页| 国产综合色视频| 日本亚洲天堂网| 亚洲成人先锋电影| 亚洲一区二区三区四区五区黄 | 欧美午夜影院一区| 成人h动漫精品| 国产成人免费在线视频| 美女精品自拍一二三四| 午夜国产精品一区| 亚洲第一在线综合网站| 一区二区在线免费| 亚洲精品国产a| 亚洲精选一二三| 中文一区一区三区高中清不卡| 日韩免费视频一区| 91精品国产乱码久久蜜臀| 欧美曰成人黄网| 96av麻豆蜜桃一区二区| 成人激情午夜影院| 国产iv一区二区三区| 国产高清在线精品| 国产成人欧美日韩在线电影| 国内外精品视频| 国产露脸91国语对白| 美女任你摸久久 | jlzzjlzz国产精品久久| 成人听书哪个软件好| 不卡高清视频专区| av一区二区三区四区| 99国产精品99久久久久久| 99久久免费精品| 在线观看亚洲成人| 欧美日韩国产欧美日美国产精品| 欧美性生交片4| 欧美精品v国产精品v日韩精品| 宅男噜噜噜66一区二区66| 欧美一级免费大片| 久久人人97超碰com| 久久久国际精品| 亚洲欧洲国产日韩| 亚洲国产中文字幕| 欧美aaa在线| 国产成人精品三级| 99re亚洲国产精品| 欧美三级视频在线播放| 欧美一区二区精品久久911| 精品国产不卡一区二区三区| 国产亚洲一区字幕| 亚洲色图在线视频| 日本 国产 欧美色综合| 国产综合久久久久久鬼色 | 欧美精品一二三区| 欧美精品一区男女天堂| 国产精品毛片a∨一区二区三区 | 亚洲一区影音先锋| 奇米色777欧美一区二区| 国产乱妇无码大片在线观看| 91在线观看成人| 欧美一区二区三区啪啪| 国产精品伦理在线| 日韩不卡一二三区| 成人综合激情网| 在线不卡免费av| 欧美国产精品一区二区三区| 亚洲一卡二卡三卡四卡无卡久久| 久久99热这里只有精品| 91麻豆国产在线观看| 日韩欧美国产一区在线观看| 中文字幕亚洲成人| 美女视频一区二区| 成人av片在线观看| 欧美一级欧美三级| 亚洲黄色av一区| 国产一区二区三区蝌蚪| 91色porny在线视频| 日韩精品一区二区三区四区| 国产精品乱人伦中文| 免费观看在线色综合| 99精品热视频| 久久久久久久久久久久久久久99 | 日韩欧美一区电影| 日韩理论片在线| 国产自产高清不卡| 欧美蜜桃一区二区三区| 日本一二三四高清不卡| 日本aⅴ精品一区二区三区 | 欧美精品久久一区二区三区| 国产欧美精品一区aⅴ影院| 偷窥国产亚洲免费视频| 91在线视频网址| 欧美国产日韩亚洲一区| 老鸭窝一区二区久久精品| 欧美视频一区二区三区在线观看| 国产精品久久网站| 国产精品亚洲专一区二区三区| 欧美电影在线免费观看| 亚洲欧美激情一区二区| 国产成人av影院| 精品1区2区在线观看| 爽好多水快深点欧美视频| 91高清视频在线| 亚洲日本va午夜在线电影| 成人免费高清在线观看| 国产亚洲精品免费| 国产麻豆91精品| 欧美mv和日韩mv国产网站| 日日摸夜夜添夜夜添国产精品| 色综合天天综合网国产成人综合天| 久久久精品免费免费| 精品一区二区三区日韩| 欧美一区二区三区色| 天堂va蜜桃一区二区三区漫画版| 91免费观看国产| 亚洲日本在线看| 色一区在线观看| 亚洲精品综合在线| 色综合咪咪久久| 一区二区三区日韩欧美精品| 91社区在线播放| 亚洲女与黑人做爰| 色丁香久综合在线久综合在线观看| 亚洲人妖av一区二区| 色偷偷久久一区二区三区| 亚洲欧洲美洲综合色网| 97精品久久久午夜一区二区三区 | 色8久久人人97超碰香蕉987| 亚洲欧美日韩国产一区二区三区 | 精品伦理精品一区| 极品美女销魂一区二区三区免费| 精品国产伦理网| 国产一区二区三区四区五区入口| 26uuuu精品一区二区| 国产精选一区二区三区| 欧美国产一区视频在线观看| 99视频有精品| 一区二区三区视频在线看| 精品视频一区三区九区| 日韩一区精品字幕| 久久亚洲影视婷婷| 懂色av一区二区三区免费观看| 国产日韩欧美高清| 91女人视频在线观看| 午夜激情综合网| 久久麻豆一区二区| 99视频国产精品| 亚洲福利一区二区三区| 91精品国产综合久久婷婷香蕉| 蓝色福利精品导航| 国产精品久久久久影院亚瑟| 欧美在线观看一二区| 美女网站一区二区| 国产精品免费免费| 欧美色图第一页| 国产精品一区不卡| 亚洲精品国产精品乱码不99| 欧美一级欧美三级在线观看| 国产成人a级片| 午夜a成v人精品| 中文字幕精品—区二区四季| 91官网在线免费观看| 激情五月婷婷综合网| 中文字幕佐山爱一区二区免费| 欧美一区二区视频在线观看2020| 国产一区高清在线| 亚洲影视在线观看| 国产午夜精品福利| 欧美日韩的一区二区| 成人精品免费视频| 美女网站色91| 尤物视频一区二区| 久久久亚洲精品一区二区三区| 91久久人澡人人添人人爽欧美| 美国av一区二区| 亚洲美女一区二区三区| 精品国产一区二区亚洲人成毛片| 91蜜桃婷婷狠狠久久综合9色| 久久精品国产99国产精品| 一区二区三区在线免费观看| 久久丝袜美腿综合| 欧美丰满美乳xxx高潮www| 成人午夜电影网站| 精品一区二区三区免费播放| 一区二区三区欧美在线观看| 欧美大片在线观看一区二区| 欧洲国产伦久久久久久久| 国产精品自产自拍| 奇米777欧美一区二区| 亚洲一区二区av在线|