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

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

?? isopwr.c

?? 嵌入式系統的USB驅動(S3C2410)
?? 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一区二区三区免费野_久草精品视频
国产不卡在线播放| 欧美va亚洲va国产综合| www.欧美精品一二区| 国产一区二区在线看| 男女男精品网站| 狠狠色丁香九九婷婷综合五月| 天涯成人国产亚洲精品一区av| 亚洲成av人影院| 日韩国产欧美一区二区三区| 三级影片在线观看欧美日韩一区二区 | 亚洲免费视频成人| 日韩一区有码在线| 亚洲综合视频网| 樱桃国产成人精品视频| 一区二区三区**美女毛片| 亚洲制服欧美中文字幕中文字幕| 亚洲成人激情av| 免费xxxx性欧美18vr| 国产在线视视频有精品| 国产精品一区2区| 成人精品视频一区| 日本丶国产丶欧美色综合| 欧美国产日韩精品免费观看| 久久久亚洲午夜电影| 国产色一区二区| 亚洲精品成人精品456| 亚洲一区av在线| 丝袜诱惑制服诱惑色一区在线观看 | 欧美大胆人体bbbb| 久久久久久免费| 国产欧美精品一区二区三区四区| 国产日韩精品一区| 亚洲欧美日韩电影| 日韩一区欧美二区| 国产精品18久久久久久久久| 在线看一区二区| 欧美一区二区黄色| 中文字幕在线观看一区二区| 同产精品九九九| 国产综合色精品一区二区三区| 99久久免费视频.com| 欧美视频在线观看一区二区| 欧美成人一区二区三区在线观看 | 亚洲男人的天堂在线观看| 亚洲成人av中文| 韩国一区二区在线观看| 色综合网色综合| 欧美一级在线观看| 最新不卡av在线| 蜜桃av一区二区| 成人自拍视频在线| 日韩一级二级三级精品视频| 国产人久久人人人人爽| 亚洲国产精品久久艾草纯爱| 激情六月婷婷综合| 欧美性大战久久久久久久蜜臀| 久久久久久久久一| 亚洲二区视频在线| 成人av动漫在线| 日韩欧美综合在线| 一区二区三区欧美在线观看| 精品一区二区在线播放| 欧美亚洲国产一区二区三区| 久久亚洲一级片| 午夜精品一区二区三区三上悠亚| 国产黄色精品视频| 日韩一区二区中文字幕| 一区二区三区色| 国产成人亚洲综合色影视| 在线成人午夜影院| 亚洲乱码精品一二三四区日韩在线| 久久9热精品视频| 欧美日韩精品电影| 中文字幕制服丝袜一区二区三区| 久久av老司机精品网站导航| 欧美色成人综合| 国产精品麻豆网站| 国产精品亚洲专一区二区三区| 欧美另类高清zo欧美| 亚洲精品免费看| 成人性视频网站| 国产欧美一区二区三区沐欲| 免费成人你懂的| 91精品国产综合久久久久久漫画| 亚洲美女少妇撒尿| 99精品国产99久久久久久白柏| 国产亚洲一本大道中文在线| 日韩在线播放一区二区| 欧美系列在线观看| 亚洲黄色av一区| 91在线免费看| 亚洲欧美电影院| 99视频精品免费视频| 中文字幕乱码一区二区免费| 国产乱子轮精品视频| 欧美刺激午夜性久久久久久久| 视频在线观看一区二区三区| 欧美做爰猛烈大尺度电影无法无天| 亚洲天堂免费看| 成人av午夜电影| 国产精品人成在线观看免费| 国产成人综合亚洲网站| 精品乱码亚洲一区二区不卡| 免费精品视频最新在线| 日韩久久免费av| 经典三级在线一区| 久久亚洲精品小早川怜子| 国产丶欧美丶日本不卡视频| 久久久久9999亚洲精品| 福利一区二区在线观看| 1024成人网| 色婷婷国产精品| 亚洲v精品v日韩v欧美v专区| 欧美三片在线视频观看| 日本中文一区二区三区| 日韩精品一区二区三区swag| 精品在线一区二区| 久久久久国产精品麻豆| 成人精品一区二区三区四区 | 韩国精品免费视频| 久久久久久久av麻豆果冻| 福利电影一区二区| 国产精品亲子伦对白| 色婷婷国产精品久久包臀| 亚州成人在线电影| 欧美一区二区三区日韩| 国产综合成人久久大片91| 欧美国产成人精品| 色综合久久久久综合体桃花网| 亚洲最大色网站| 在线播放视频一区| 国产在线播放一区三区四| 国产精品网友自拍| 欧美在线观看视频一区二区三区| 日韩精品91亚洲二区在线观看 | 三级影片在线观看欧美日韩一区二区| 91精品婷婷国产综合久久| 国模一区二区三区白浆| 1024成人网| 欧美一区二区三区视频在线| 成人小视频免费观看| 一级日本不卡的影视| 精品奇米国产一区二区三区| 99久久精品情趣| 偷拍亚洲欧洲综合| 中文字幕av不卡| 欧美日精品一区视频| 国产一区二区看久久| 亚洲精品国产精品乱码不99| 欧美一区二区三区视频免费播放| 成人视屏免费看| 日本不卡在线视频| 国产精品美女久久久久av爽李琼 | 51午夜精品国产| 国产一本一道久久香蕉| 亚洲电影一区二区三区| 久久久综合视频| 欧美日韩视频在线一区二区| 国产老女人精品毛片久久| 亚洲精品乱码久久久久久久久| 欧美草草影院在线视频| 91丨porny丨户外露出| 久久超碰97中文字幕| 亚洲电影你懂得| 国产精品视频一区二区三区不卡| 欧美日韩精品一区二区在线播放| 福利电影一区二区| 免费xxxx性欧美18vr| 亚洲第一综合色| 中文字幕亚洲区| 久久综合色天天久久综合图片| 欧美日韩一区二区欧美激情| 暴力调教一区二区三区| 国产一区二区三区| 日本一不卡视频| 亚洲高清视频在线| 亚洲美女偷拍久久| 日本一区免费视频| 亚洲精品一区二区三区精华液| 欧美日韩国产一级| 99综合电影在线视频| 国产成a人亚洲| 激情图区综合网| 蜜臀久久99精品久久久久宅男| 亚洲综合色在线| 一区二区三区免费在线观看| 国产三级精品视频| 久久久久一区二区三区四区| 欧美日韩中文精品| 91搞黄在线观看| 94色蜜桃网一区二区三区| 国产精品白丝av| 国产精品资源站在线| 精品一区免费av| 久久精品免费观看| 久久国产剧场电影| 久久精品二区亚洲w码| 日韩主播视频在线| 午夜电影网一区| 日韩制服丝袜av|