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

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

?? isopwr.c

?? ARM2410的USB的源碼
?? C
?? 第 1 頁 / 共 3 頁
字號(hào):
/*++

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"));

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色欧美乱欧美15图片| 另类调教123区 | 蜜桃久久久久久| 日韩一区二区三区在线| 激情偷乱视频一区二区三区| www激情久久| 成人高清免费在线播放| 一区二区三区中文字幕| 欧美精品久久久久久久多人混战| 丝袜美腿亚洲色图| 精品美女一区二区三区| 国产99精品国产| 一二三四社区欧美黄| 欧美精品一卡两卡| 国产一区二区福利视频| 亚洲视频电影在线| 日韩一区二区不卡| 成人18视频日本| 日韩av一区二| 国产精品素人一区二区| 欧美性欧美巨大黑白大战| 青青草精品视频| 国产欧美综合在线| 欧美视频精品在线| 国产很黄免费观看久久| 亚洲国产日韩一级| 2021中文字幕一区亚洲| 91久久精品网| 国产在线日韩欧美| 亚洲影视在线播放| 久久中文字幕电影| 精品一区二区成人精品| 亚洲欧美激情插| 久久看人人爽人人| 欧美日韩久久一区二区| 国产精品性做久久久久久| 亚洲图片欧美综合| 黄页视频在线91| 国产精品久久久久影院| 亚洲mv大片欧洲mv大片精品| 欧美三级日韩三级国产三级| 麻豆国产精品777777在线| 亚洲一区影音先锋| 一区二区三区鲁丝不卡| 亚洲精品第1页| 亚洲电影一级黄| 亚洲成在线观看| 日韩av电影天堂| 奇米精品一区二区三区四区 | 91网站在线播放| 99久久伊人久久99| av一区二区不卡| 91成人免费网站| 欧美精品乱码久久久久久按摩| 欧美视频日韩视频在线观看| 91麻豆精品国产综合久久久久久| 91精品国产综合久久精品麻豆| 欧美一区二区三区在线看| 欧美一级淫片007| 亚洲精品一区二区精华| 国产欧美日韩精品a在线观看| 欧美国产成人在线| 一区二区三区视频在线看| 亚洲成人免费视频| 国内偷窥港台综合视频在线播放| 成人激情综合网站| 欧美视频一区二区三区| 精品欧美一区二区久久| 国产蜜臀av在线一区二区三区| 亚洲精品福利视频网站| 青青草国产精品亚洲专区无| 国产精华液一区二区三区| 91在线你懂得| 91精品国产高清一区二区三区| 久久久亚洲精华液精华液精华液| 成人免费视频在线观看| 视频一区二区不卡| 国产精品888| 欧美日韩国产在线观看| 国产亚洲欧美一级| 亚洲国产中文字幕在线视频综合| 国产在线国偷精品免费看| 色综合网站在线| 日韩三级中文字幕| 1000部国产精品成人观看| 日韩精品视频网站| 成人黄色网址在线观看| 欧美顶级少妇做爰| 最新高清无码专区| 激情综合网天天干| 91成人免费网站| 日本一区二区三区久久久久久久久不 | 国产亚洲短视频| 午夜视频在线观看一区二区三区| 国产成人av电影免费在线观看| 欧美日韩三级一区| 中文天堂在线一区| 精品一区二区三区免费视频| 在线观看av一区二区| 久久久久久99精品| 蜜桃视频在线一区| 色又黄又爽网站www久久| 久久人人97超碰com| 亚洲成人综合网站| 99r国产精品| 日本一区二区视频在线观看| 久久精品久久久精品美女| 欧美伊人久久大香线蕉综合69| 国产视频一区在线播放| 美女视频免费一区| 欧美在线观看视频一区二区| 国产精品久线观看视频| 国产一区二区看久久| 91精品国产综合久久精品图片| 亚洲欧美偷拍三级| av亚洲精华国产精华| 精品国产91乱码一区二区三区 | 91日韩精品一区| 中文一区二区完整视频在线观看| 久久精品99国产精品日本| 欧美丰满嫩嫩电影| 亚洲mv大片欧洲mv大片精品| 91色porny蝌蚪| 亚洲视频一区二区免费在线观看| 国产精品亚洲а∨天堂免在线| 精品国产自在久精品国产| 蜜臀av一区二区| 日韩午夜在线观看| 日本强好片久久久久久aaa| 欧美日韩亚洲综合| 天天综合色天天综合色h| 在线观看欧美黄色| 亚洲最新视频在线播放| 在线亚洲高清视频| 亚洲一级不卡视频| 欧美日本在线看| 午夜精彩视频在线观看不卡| 欧美在线啊v一区| 亚洲成人黄色小说| 日韩一级二级三级精品视频| 青青草精品视频| 久久综合色天天久久综合图片| 国产一区二区在线看| 国产亚洲一区二区三区在线观看 | 欧美三级日本三级少妇99| 亚洲综合图片区| 欧美剧在线免费观看网站| 日韩精彩视频在线观看| 日韩一区二区三区电影| 寂寞少妇一区二区三区| 久久久久久日产精品| 成人av网站免费| 亚洲精品日韩一| 欧美一区二区视频免费观看| 麻豆国产精品视频| 国产亚洲一本大道中文在线| heyzo一本久久综合| 亚洲宅男天堂在线观看无病毒| 欧美三级欧美一级| 精品亚洲porn| 国产精品久久网站| 欧美日韩电影一区| 狠狠色丁香婷婷综合| 欧美激情一区二区在线| 91黄色在线观看| 久久精品国产亚洲aⅴ| 国产精品人成在线观看免费 | 91精品在线观看入口| 精品一区二区三区视频在线观看 | 国产一区二区精品久久91| 国产精品热久久久久夜色精品三区| 91热门视频在线观看| 日本欧美一区二区在线观看| 2020国产成人综合网| 色综合久久中文字幕综合网| 蜜桃精品视频在线| 国产精品国产自产拍高清av王其 | 久久综合狠狠综合久久综合88| www.综合网.com| 日韩影院在线观看| 欧美国产一区在线| 欧美日韩国产大片| 国产黑丝在线一区二区三区| 亚洲高清免费一级二级三级| 国产夜色精品一区二区av| 欧美日韩高清影院| 成人午夜电影网站| 日韩av不卡在线观看| 国产精品激情偷乱一区二区∴| 日韩一区二区三区电影在线观看 | 国产乱码精品一品二品| 综合激情网...| 2014亚洲片线观看视频免费| 色噜噜夜夜夜综合网| 精久久久久久久久久久| 一区二区久久久久久| 中文字幕av一区二区三区免费看 | 亚洲老妇xxxxxx| 国产欧美一区二区精品秋霞影院| 欧美日韩精品一区二区天天拍小说 |