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

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

?? isopwr.c

?? 這是ARM9開發板上自帶的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一区二区三区免费野_久草精品视频
国产大陆亚洲精品国产| 欧美亚洲国产一区二区三区| 亚洲免费资源在线播放| 国产精品福利影院| 国产精品久久久久影院老司| 中文字幕 久热精品 视频在线| 欧美大肚乱孕交hd孕妇| 欧美成人伊人久久综合网| 日韩一区二区三区四区| 精品久久久久99| 久久久久久免费网| 国产精品久久久久三级| 亚洲欧美另类综合偷拍| 亚洲国产wwwccc36天堂| 天天影视涩香欲综合网| 久久不见久久见免费视频1| 国产露脸91国语对白| 成人激情小说乱人伦| 色综合网站在线| 91精品婷婷国产综合久久性色| 欧美一级欧美三级| 国产亚洲午夜高清国产拍精品| 国产精品久久久久久久久图文区| 中文字幕一区视频| 午夜精品视频一区| 精品一区二区三区免费| av高清久久久| 国产99久久精品| 国产综合久久久久久鬼色| 国产精品 欧美精品| 91一区二区三区在线播放| 欧美在线观看视频一区二区三区| 91精品国产综合久久香蕉的特点| 久久综合一区二区| 亚洲欧美日韩国产手机在线| 天堂蜜桃一区二区三区| 国产精品一区在线观看乱码| 色综合中文字幕国产 | 成人教育av在线| 色综合欧美在线视频区| 欧美一级爆毛片| 亚洲色图丝袜美腿| 麻豆精品视频在线观看视频| 欧美亚洲综合在线| 91美女片黄在线观看91美女| 欧美性生活影院| 国产精品无遮挡| 亚洲精品老司机| 国产在线播放一区三区四| 91麻豆国产自产在线观看| 精品国产一区二区三区忘忧草| 国产精品久久久久久一区二区三区| 亚洲国产精品久久不卡毛片 | 亚洲国产日韩在线一区模特| 国精产品一区一区三区mba视频 | 久久一区二区视频| 亚洲二区视频在线| 欧美大片在线观看| 国产精品主播直播| 精品1区2区3区| 国产精品美女www爽爽爽| 日韩成人精品在线| 91国内精品野花午夜精品| 久久精品视频网| 久久99国产精品麻豆| 欧美挠脚心视频网站| 亚洲男同1069视频| 色综合久久综合网97色综合| 国产精品视频九色porn| 国产mv日韩mv欧美| 国产日产欧美一区二区视频| 狠狠色伊人亚洲综合成人| 91精品国产综合久久久蜜臀图片| 亚洲风情在线资源站| 91黄色激情网站| 亚洲精品高清在线| 在线区一区二视频| 激情综合色综合久久综合| 久久免费精品国产久精品久久久久| 亚洲色图欧美在线| 91在线观看成人| 日韩一区中文字幕| 91亚洲永久精品| 一区二区三区久久| 欧美视频一区二区在线观看| 亚洲成人黄色小说| 欧美一区二区黄| 国产一区二区三区久久悠悠色av| 久久久久九九视频| 成人丝袜18视频在线观看| 中文字幕一区av| 91福利社在线观看| 日本一不卡视频| 久久久久久久久久久久久夜| av在线播放一区二区三区| 自拍偷拍欧美精品| 欧美精品一卡两卡| 久久99久久久欧美国产| 国产欧美日韩另类一区| 97精品国产97久久久久久久久久久久 | 欧美乱妇23p| 加勒比av一区二区| 国产精品久久久久影院亚瑟| 欧美性猛交xxxx黑人交| 日韩中文字幕麻豆| 国产女人18毛片水真多成人如厕| 91在线porny国产在线看| 丝袜美腿亚洲综合| 久久综合999| 在线亚洲欧美专区二区| 精品午夜久久福利影院| 国产精品久久久久久久久动漫 | 国产日韩欧美综合在线| 色婷婷国产精品综合在线观看| 日韩国产欧美三级| 国产欧美一区二区精品忘忧草| 91福利视频网站| 国产精品996| 亚洲国产精品久久久男人的天堂| 精品国产免费人成电影在线观看四季| av中文字幕不卡| 精品一区二区免费| 亚洲夂夂婷婷色拍ww47| 久久久亚洲午夜电影| 欧美日韩高清一区二区不卡| 丁香婷婷综合色啪| 奇米精品一区二区三区在线观看一| 亚洲国产精品黑人久久久| 91精品久久久久久久99蜜桃| 91视频在线看| 国产精品99久久久久| 麻豆91免费看| 婷婷综合久久一区二区三区| 亚洲欧洲日产国码二区| 久久久99精品免费观看不卡| 欧美一级二级在线观看| 欧美日韩三级在线| 在线观看精品一区| 9i在线看片成人免费| 国产精品一色哟哟哟| 麻豆国产一区二区| 日av在线不卡| 日韩电影在线一区二区| 亚洲无人区一区| 一区二区三区在线影院| 最新日韩在线视频| 成人欧美一区二区三区| 国产精品嫩草99a| 中文字幕精品一区| 中文字幕精品三区| 国产精品欧美极品| 1区2区3区精品视频| 中文字幕一区日韩精品欧美| 亚洲欧洲av另类| 亚洲免费观看视频| 亚洲资源在线观看| 亚洲成人av一区二区| 天天色综合成人网| 日韩国产高清在线| 久99久精品视频免费观看| 国产资源在线一区| 国产精一区二区三区| 成人深夜福利app| 99在线视频精品| 欧美性欧美巨大黑白大战| 欧美日韩精品一区二区在线播放| 欧美日韩国产精选| 日韩欧美一区二区三区在线| 精品久久久久久无| 国产精品视频线看| 一区二区三区日韩在线观看| 亚洲aaa精品| 韩国精品主播一区二区在线观看| 国产一区二区看久久| aaa亚洲精品| 欧美日韩国产欧美日美国产精品| 日韩你懂的电影在线观看| 久久亚区不卡日本| 17c精品麻豆一区二区免费| 午夜国产精品影院在线观看| 美美哒免费高清在线观看视频一区二区 | 在线视频综合导航| 91精品一区二区三区在线观看| 精品欧美一区二区久久| 国产精品激情偷乱一区二区∴| 亚洲乱码国产乱码精品精小说| 亚洲第一狼人社区| 国产成人在线电影| 欧美综合一区二区| 久久伊人蜜桃av一区二区| 一区二区三区在线视频免费| 久久成人麻豆午夜电影| www.一区二区| 欧美一区二区三区爱爱| 欧美激情在线一区二区三区| 亚洲小说欧美激情另类| 国产99一区视频免费| 欧美日韩国产另类一区| 一区精品在线播放| 狠狠狠色丁香婷婷综合激情|