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

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

?? isopwr.c

?? linux環(huán)境下USB驅(qū)動程序,適用三星ARM2410B
?? 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"));

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
3atv在线一区二区三区| 久久伊人蜜桃av一区二区| 韩日欧美一区二区三区| 中文字幕亚洲区| 精品久久久久香蕉网| 在线视频你懂得一区| 国产99久久久精品| 久久成人免费日本黄色| 一区二区三区四区视频精品免费 | 国产一区二区看久久| 亚洲黄色小说网站| 国产精品婷婷午夜在线观看| 91麻豆精品国产综合久久久久久| 91污在线观看| 粉嫩av一区二区三区粉嫩| 狠狠色丁香婷婷综合| 日本视频在线一区| 亚洲综合视频在线观看| 国产精品欧美极品| 久久久精品tv| 精品动漫一区二区三区在线观看| 欧美一区二区三区在线视频| 91免费看`日韩一区二区| 懂色av中文字幕一区二区三区| 久久99精品国产91久久来源| 人禽交欧美网站| 天堂一区二区在线| 亚洲一区二区三区在线看| 一区二区三区在线观看国产| 中文字幕一区不卡| 国产精品久久久久久久午夜片| 久久久久9999亚洲精品| 久久婷婷色综合| 国产偷国产偷亚洲高清人白洁| 欧美r级在线观看| 日韩一区二区在线看片| 欧美一区二区三区视频| 欧美一区二区三区啪啪| 欧美一区二区三区的| 欧美高清激情brazzers| 4438x成人网最大色成网站| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 91一区在线观看| 色婷婷精品大视频在线蜜桃视频| 色呦呦日韩精品| 欧洲中文字幕精品| 5858s免费视频成人| 日韩视频一区二区在线观看| 精品少妇一区二区三区在线播放| 日韩一区二区电影在线| 久久一日本道色综合| 亚洲国产成人在线| 亚洲激情欧美激情| 日本午夜精品一区二区三区电影| 激情综合色播激情啊| 国产69精品久久99不卡| 色妞www精品视频| 欧美区在线观看| 欧美精品一区二区精品网| 国产精品久久久久久久第一福利| 玉米视频成人免费看| 秋霞成人午夜伦在线观看| 国产一区二区三区四区五区美女| 成人av资源在线观看| 欧美亚洲国产一区二区三区va| 91 com成人网| 国产午夜精品久久| 亚洲在线免费播放| 国产一区久久久| 色欲综合视频天天天| 日韩欧美的一区二区| 中文字幕av资源一区| 亚洲国产裸拍裸体视频在线观看乱了| 美女视频第一区二区三区免费观看网站 | 欧美乱妇23p| 久久天天做天天爱综合色| 中文字幕一区二区5566日韩| 性欧美大战久久久久久久久| 国产高清精品在线| 欧美日韩一区二区电影| 久久久.com| 亚洲地区一二三色| 国产成a人亚洲精| 制服丝袜在线91| 国产精品麻豆久久久| 日韩—二三区免费观看av| 成人手机电影网| 日韩精品中午字幕| 亚洲精品菠萝久久久久久久| 国产在线一区观看| 欧美日韩激情一区二区| 国产精品卡一卡二| 精品一区精品二区高清| 欧美日韩国产一级| 国产精品不卡在线| 国产真实乱对白精彩久久| 欧美日本一区二区| 亚洲欧洲精品一区二区三区| 狠狠色综合日日| 91精品欧美综合在线观看最新| 亚洲欧美一区二区视频| 国产激情视频一区二区三区欧美| 69堂成人精品免费视频| 亚洲美女少妇撒尿| 成人视屏免费看| 久久精品亚洲精品国产欧美| 日韩激情在线观看| 在线观看成人免费视频| 自拍偷拍亚洲激情| 成人毛片老司机大片| 精品久久久久久最新网址| 午夜精品一区在线观看| 日本韩国欧美一区| 亚洲视频在线一区| 成人av午夜影院| 久久精品欧美日韩精品| 91视频com| 国产精品午夜电影| 国产自产高清不卡| 日韩精品一区二区三区四区| 丝袜国产日韩另类美女| 欧美日韩免费观看一区三区| 亚洲激情自拍视频| 一本久久a久久精品亚洲| 中文字幕在线观看不卡视频| 国产91精品欧美| 亚洲国产电影在线观看| 成人午夜在线免费| 国产精品久久久久久久久图文区 | 国产乱人伦偷精品视频不卡| 欧美成人三级在线| 老司机精品视频导航| 日韩丝袜美女视频| 喷水一区二区三区| 日韩欧美一级二级三级| 久久99国产精品久久99| 精品美女在线播放| 精品影院一区二区久久久| 精品精品国产高清a毛片牛牛| 极品尤物av久久免费看| wwww国产精品欧美| 国产91丝袜在线播放| 国产精品久久久久9999吃药| www.亚洲精品| 一级做a爱片久久| 欧美色网一区二区| 亚洲福利视频一区二区| 欧美一区午夜视频在线观看| 韩日av一区二区| 欧美激情一区二区三区不卡 | 亚洲精品免费电影| 欧美日韩国产色站一区二区三区| 婷婷久久综合九色综合伊人色| 337p亚洲精品色噜噜狠狠| 狠狠色狠狠色合久久伊人| 国产精品天干天干在观线| 91污片在线观看| 日本欧美一区二区在线观看| 精品美女一区二区| youjizz久久| 亚洲.国产.中文慕字在线| 日韩一级欧美一级| 国产99久久久国产精品| 亚洲夂夂婷婷色拍ww47| 欧美成人在线直播| 不卡一区在线观看| 午夜视频在线观看一区| 久久综合九色综合欧美亚洲| 91蜜桃网址入口| 男女性色大片免费观看一区二区 | 成人av动漫在线| 亚洲一二三专区| 精品国产免费久久| 91亚洲精品乱码久久久久久蜜桃| 午夜不卡在线视频| 国产精品青草久久| 7777女厕盗摄久久久| 高清不卡一区二区在线| 亚洲h在线观看| 国产日韩欧美在线一区| 精品视频在线免费观看| 国产高清无密码一区二区三区| 亚洲综合视频在线| 久久亚洲欧美国产精品乐播| 欧美午夜视频网站| 国产福利91精品一区二区三区| 舔着乳尖日韩一区| 国产精品盗摄一区二区三区| 日韩午夜在线播放| 91丨九色porny丨蝌蚪| 激情五月激情综合网| 亚洲国产精品尤物yw在线观看| 中文在线一区二区| 欧美成人video| 欧美性大战久久久久久久| 成人午夜视频在线观看| 久久超碰97中文字幕| 亚洲一区在线观看网站| 国产精品国产精品国产专区不片| 日韩午夜在线播放|