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

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

?? bulkpwr.c

?? 這是ARM9開發(fā)板上自帶的USB驅(qū)動程序
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*++

Copyright (c) 1997-1998  Microsoft Corporation

Module Name:

    BulkPwr.c

Abstract:

    Bulk 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 "Blk82930.h"


NTSTATUS
BulkUsb_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;

    BULKUSB_KdPrint( DBGLVL_MEDIUM,(" BulkUsb_ProcessPowerIrp() IRP_MJ_POWER\n"));

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
    irpStack = IoGetCurrentIrpStackLocation (Irp);
    BulkUsb_IncrementIoCount(DeviceObject);

    switch (irpStack->MinorFunction) {
    case IRP_MN_WAIT_WAKE:
        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_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 );
            BULKUSB_KdPrint( DBGLVL_HIGH, ( "Exit BulkUsb_ProcessPowerIrp(), ntStatus STATUS_INVALID_DEVICE_STATE\n" ) );
            BulkUsb_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,
                               BulkUsb_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);

            BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() done waiting for PDO to finish IRP_MN_WAIT_WAKE\n"));
        }

                // now tell the device to actually wake up
                BulkUsb_SelfSuspendOrActivate( DeviceObject, FALSE );

        // flag we're done with wakeup irp
        deviceExtension->EnabledForWakeup = FALSE;

        BulkUsb_DecrementIoCount(DeviceObject);

        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_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.

        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_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;

                BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Set Power, type SystemPowerState = %s\n",
                    BULKUSB_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;

                     BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_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 BulkUsb_PnPAddDevice() )
                        desiredDevicePowerState.DeviceState =
                            deviceExtension->DeviceCapabilities.DeviceState[ sysPowerState.SystemState ];

                        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_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;

                        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_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?
                //

                BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Set Power, desiredDevicePowerState = %s\n",
                    BULKUSB_StringForDevState( desiredDevicePowerState.DeviceState ) ));

                if (desiredDevicePowerState.DeviceState !=
                    deviceExtension->CurrentDevicePowerState) {

                    // BulkUsb_IncrementIoCount(DeviceObject);

                    // 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
                                               BulkUsb_PoRequestCompletion,
                                               DeviceObject,
                                               NULL);

                } else {
                    // Yes, just pass it on to PDO (Physical Device Object)
                    IoCopyCurrentIrpStackLocationToNext(Irp);
                    PoStartNextPowerIrp(Irp);
                    ntStatus = PoCallDriver(deviceExtension->TopOfStackDeviceObject,
                                            Irp);

                    BulkUsb_DecrementIoCount(DeviceObject);
                    BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Exit IRP_MN_SET_POWER\n"));

                }
                break;

            case DevicePowerState:

                BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Set Power, type DevicePowerState = %s\n",
                    BULKUSB_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 = BulkUsb_SetDevicePowerState(DeviceObject,
                                                      irpStack->Parameters.Power.State.DeviceState
                                                      ); // returns TRUE for D0

                IoCopyCurrentIrpStackLocationToNext(Irp);

                if (fGoingToD0) {
                    BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() Set PowerIrp Completion Routine, fGoingToD0 =%d\n", fGoingToD0));
                    IoSetCompletionRoutine(Irp,
                           BulkUsb_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
                    BulkUsb_DecrementIoCount(DeviceObject);

                BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_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.
                //

        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPowerIrp() IRP_MN_QUERY_POWER\n"));

        // We do nothing special here, just let the PDO handle it
        IoCopyCurrentIrpStackLocationToNext(Irp);
        PoStartNextPowerIrp(Irp);
        ntStatus = PoCallDriver(deviceExtension->TopOfStackDeviceObject,

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品77777| 在线播放视频一区| 精品欧美乱码久久久久久| 亚洲啪啪综合av一区二区三区| 日韩精品福利网| 91国偷自产一区二区使用方法| 欧美成人video| 日精品一区二区| 欧美日韩亚洲丝袜制服| 1000精品久久久久久久久| 美女诱惑一区二区| 欧美精品乱码久久久久久按摩| 欧美福利一区二区| 一区二区三区加勒比av| 在线免费av一区| 亚洲一区二区四区蜜桃| 色菇凉天天综合网| 亚洲国产日韩综合久久精品| 色老综合老女人久久久| 一区二区成人在线| 欧美午夜电影在线播放| 亚洲一区二区成人在线观看| 欧美少妇bbb| 一区二区三国产精华液| 91精品福利在线| 日韩精品视频网站| 日本一区二区三级电影在线观看 | 91精品国产91久久久久久一区二区| 亚洲精品伦理在线| 色88888久久久久久影院按摩| 一级精品视频在线观看宜春院 | 亚洲精品欧美综合四区| 国产剧情在线观看一区二区| 欧美二区在线观看| 成人午夜免费av| 亚洲一级二级三级在线免费观看| 91麻豆精品国产无毒不卡在线观看 | 亚洲成a人片综合在线| 久久综合久久综合九色| 欧美日韩中文另类| 国产伦精一区二区三区| 亚洲成人精品影院| 亚洲欧美色综合| 中文字幕五月欧美| 欧美一区二区成人| 91福利在线播放| 粗大黑人巨茎大战欧美成人| 蜜桃av一区二区三区| 亚洲一区二区三区自拍| 中文字幕中文在线不卡住| 久久综合色播五月| 7777精品久久久大香线蕉| 99国产精品国产精品久久| 国产高清在线精品| 国产成人精品影视| 国产精品99久久久久久似苏梦涵| 美国毛片一区二区| 久久不见久久见免费视频7| 麻豆成人久久精品二区三区小说| 香蕉成人伊视频在线观看| 婷婷六月综合网| 欧美性大战久久久久久久蜜臀| 91蝌蚪porny九色| 欧美中文字幕一区二区三区| 成人精品小蝌蚪| 91在线精品秘密一区二区| 91小视频免费看| 欧美日韩国产美| 国产日韩欧美综合在线| 欧美韩国日本一区| 亚洲成av人片| 国产乱对白刺激视频不卡| 99精品久久只有精品| 欧日韩精品视频| 26uuu成人网一区二区三区| 国产精品久久夜| 视频在线观看一区二区三区| 麻豆成人久久精品二区三区小说| 韩国三级在线一区| 欧美性猛片xxxx免费看久爱| 欧美va日韩va| 亚洲成人免费在线| 成人免费观看男女羞羞视频| 欧美在线不卡视频| 2023国产一二三区日本精品2022| ●精品国产综合乱码久久久久| 日韩av中文在线观看| 成人动漫精品一区二区| 欧美大片日本大片免费观看| 最好看的中文字幕久久| 国内欧美视频一区二区| 欧美日韩成人综合| 亚洲少妇30p| 97精品视频在线观看自产线路二| 欧美成人乱码一区二区三区| 亚洲已满18点击进入久久| 成人av动漫网站| 国产精品视频观看| 国产盗摄一区二区| 欧美激情艳妇裸体舞| 麻豆精品国产传媒mv男同| 欧洲精品一区二区三区在线观看| 日韩欧美激情一区| 麻豆精品国产传媒mv男同| 欧美va天堂va视频va在线| 国产激情视频一区二区在线观看 | 另类中文字幕网| 久久综合国产精品| 99精品久久久久久| 日韩高清不卡一区二区三区| 国产网站一区二区| 欧美在线制服丝袜| 捆绑紧缚一区二区三区视频| 中文幕一区二区三区久久蜜桃| 91麻豆产精品久久久久久| 天天色天天操综合| 中文字幕第一区| 制服丝袜国产精品| 91视频国产观看| 国产米奇在线777精品观看| 亚洲精品一二三四区| 欧美电影免费观看高清完整版在| www.亚洲色图.com| 麻豆成人免费电影| 无码av免费一区二区三区试看 | 依依成人精品视频| 欧美哺乳videos| 欧美日韩高清一区二区三区| 成人精品gif动图一区| 轻轻草成人在线| 日本视频免费一区| 亚洲精品视频在线看| 中文字幕 久热精品 视频在线| 日韩亚洲电影在线| 欧美一区二区三区在线看| 欧美视频日韩视频| 色婷婷久久99综合精品jk白丝| 国产激情一区二区三区| 精品一区二区三区视频| 麻豆精品视频在线| 久久精品久久久精品美女| 天堂成人国产精品一区| 亚洲va韩国va欧美va精品| 亚洲一区二区三区免费视频| 亚洲自拍偷拍图区| 亚洲国产另类av| 奇米精品一区二区三区四区| 日韩福利电影在线观看| 麻豆视频观看网址久久| 国内精品久久久久影院薰衣草| 久久不见久久见免费视频7 | 一区二区三区加勒比av| 亚洲一区欧美一区| 免费欧美高清视频| 国产东北露脸精品视频| 色综合色狠狠综合色| 欧美亚洲国产一卡| 精品国产免费人成在线观看| 26uuu另类欧美亚洲曰本| 国产精品入口麻豆九色| 一区二区三区欧美激情| 日本视频中文字幕一区二区三区| 黄色成人免费在线| 91黄色在线观看| 精品免费国产一区二区三区四区| 国产精品国产三级国产aⅴ无密码| 亚洲精品v日韩精品| 久久精品国产亚洲a| 色一情一乱一乱一91av| 精品av久久707| 亚洲九九爱视频| 激情久久五月天| 欧美性videosxxxxx| 久久综合五月天婷婷伊人| 午夜精品123| 91久久线看在观草草青青| 久久久久久97三级| 美腿丝袜亚洲三区| 欧美日韩一区二区三区四区| 国产精品国产精品国产专区不蜜| 精品一区二区国语对白| 欧美久久久久久蜜桃| 久久女同性恋中文字幕| 91超碰这里只有精品国产| 中文字幕一区二区三区在线播放| 国产精品三级视频| 免费不卡在线视频| 欧美美女视频在线观看| 亚洲五码中文字幕| 欧美亚洲国产一区二区三区va | 午夜精品视频在线观看| 欧美在线观看视频在线| 亚洲成人你懂的| 欧美老年两性高潮| 秋霞午夜鲁丝一区二区老狼| 欧美一区二区三区性视频| 免费成人结看片| 久久久精品蜜桃| 成人免费电影视频| 一区二区三区免费网站|