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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? bulkpwr.c

?? 基于linux的s3c2410開(kāi)發(fā)板usb驅(qū)動(dòng)程序
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/*++

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,

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人免费视频视频在线观看免费| 色域天天综合网| 一区二区三区四区不卡在线| 欧美mv日韩mv国产| 欧洲另类一二三四区| 国产宾馆实践打屁股91| 五月婷婷综合网| 亚洲女同一区二区| 国产午夜亚洲精品理论片色戒| 欧美日韩黄色影视| 99久久精品免费看| 国产精品一区一区三区| 男人的j进女人的j一区| 亚洲综合在线第一页| 国产精品毛片久久久久久久| 日韩一区二区电影在线| 欧美视频在线一区二区三区| 99热精品国产| 懂色一区二区三区免费观看 | 人人狠狠综合久久亚洲| 亚洲人成7777| 国产精品久久久久久一区二区三区 | 天天av天天翘天天综合网| 日韩毛片视频在线看| 久久久一区二区三区捆绑**| 日韩一级片网站| 欧美理论片在线| 欧美日韩免费视频| 91豆麻精品91久久久久久| 91社区在线播放| 97精品国产露脸对白| 99综合电影在线视频| 成人免费毛片高清视频| 国产传媒日韩欧美成人| 国产精品综合一区二区| 国产精品一二三| 国产福利精品导航| 欧美一区二区三区免费大片 | 成人app下载| 成人性生交大片免费看视频在线| 国产高清一区日本| 国产99久久久久| 丰满少妇在线播放bd日韩电影| 国产成人精品综合在线观看| 高清久久久久久| 99久久综合国产精品| 色婷婷久久一区二区三区麻豆| 色香蕉成人二区免费| 欧美影视一区在线| 在线成人免费观看| 欧美成人女星排名| 国产清纯美女被跳蛋高潮一区二区久久w| 久久女同精品一区二区| 中文字幕av免费专区久久| 国产精品国产三级国产aⅴ中文 | 中文乱码免费一区二区| 亚洲欧洲国产日本综合| 亚洲最大成人综合| 蜜桃视频在线观看一区二区| 国产综合色在线视频区| 丁香桃色午夜亚洲一区二区三区| 99久久精品国产导航| 欧美三级韩国三级日本三斤| 91精品国产91久久久久久一区二区| 日韩欧美国产一区二区在线播放 | 色综合天天在线| 欧美日韩高清影院| 精品欧美一区二区在线观看| 欧美激情在线看| 一区二区三区免费网站| 免费观看一级特黄欧美大片| 国产激情一区二区三区四区 | 亚洲成人av一区二区三区| 精品亚洲成av人在线观看| 福利一区福利二区| 在线日韩国产精品| 欧美mv日韩mv| 一区二区在线观看视频在线观看| 日本麻豆一区二区三区视频| 顶级嫩模精品视频在线看| 91国内精品野花午夜精品| 欧美一二区视频| 国产精品久久久久一区| 人人狠狠综合久久亚洲| 成av人片一区二区| 日韩欧美色综合| 一区二区三区在线播| 国产一区二区三区免费看 | 在线观看成人免费视频| 日韩精品中午字幕| 亚洲综合色在线| 国产91精品在线观看| 56国语精品自产拍在线观看| 中文成人综合网| 久久成人羞羞网站| 在线看日本不卡| 国产亚洲美州欧州综合国| 日韩精品亚洲专区| 色狠狠一区二区三区香蕉| 欧美精品一区二区精品网| 亚洲国产综合在线| 不卡在线视频中文字幕| 精品剧情v国产在线观看在线| 亚洲黄色小视频| www.亚洲色图.com| 久久女同性恋中文字幕| 美洲天堂一区二卡三卡四卡视频| 色综合一区二区| 国产欧美日韩不卡| 韩国欧美国产一区| 欧美精品久久久久久久多人混战 | 强制捆绑调教一区二区| 欧美在线|欧美| 亚洲欧洲99久久| 国产九色sp调教91| 亚洲精品一区二区三区在线观看| 性做久久久久久免费观看| 色哟哟日韩精品| 日韩一区欧美一区| 99视频精品免费视频| 国产精品毛片高清在线完整版| 欧美三区在线观看| 亚洲色图.com| 91美女福利视频| 亚洲精品高清在线| 97国产一区二区| 亚洲免费av高清| 91色.com| 一区二区三区四区高清精品免费观看 | 久久婷婷一区二区三区| 理论片日本一区| 日韩午夜在线观看视频| 免费在线看成人av| 91精品国产乱码| 五月综合激情日本mⅴ| 欧美系列一区二区| 亚洲18影院在线观看| 欧美日韩国产片| 日本成人在线电影网| 日韩视频免费观看高清完整版| 老司机午夜精品| 久久久五月婷婷| 成人精品免费视频| 亚洲天堂福利av| 在线观看区一区二| 天堂精品中文字幕在线| 日韩一区二区三区视频| 精品一区二区三区蜜桃| 久久久久久久久久美女| 国产a区久久久| 亚洲精品成人悠悠色影视| 欧美视频一区二区三区四区 | 欧美tickling网站挠脚心| 黄页视频在线91| 国产精品五月天| 欧美综合视频在线观看| 热久久国产精品| 国产日韩欧美制服另类| 97久久精品人人澡人人爽| 亚洲高清免费观看 | 欧美美女一区二区在线观看| 男男视频亚洲欧美| 2020国产成人综合网| 不卡的av电影在线观看| 亚洲成人免费观看| 免费成人深夜小野草| 久久精品亚洲一区二区三区浴池| 99久久精品国产毛片| 日韩电影免费在线观看网站| 久久精品亚洲一区二区三区浴池| 91麻豆国产在线观看| 秋霞午夜av一区二区三区| 国产三级精品三级在线专区| 在线观看免费成人| 国产在线视视频有精品| 亚洲精品视频观看| 精品久久久三级丝袜| 色哟哟亚洲精品| 国产一区二区不卡老阿姨| 一级日本不卡的影视| 久久老女人爱爱| 欧美最猛性xxxxx直播| 狠狠色丁香久久婷婷综合_中| 国产精品久久久久婷婷| 日韩精品在线网站| 91在线视频免费观看| 国产一区激情在线| 亚洲国产精品麻豆| 久久综合中文字幕| 欧美日韩一区二区三区视频| 国产成人精品免费一区二区| 亚洲国产成人高清精品| 中文字幕欧美区| 欧美不卡一区二区三区| 欧美三级午夜理伦三级中视频| 国产成都精品91一区二区三 | 91在线视频免费91| 免费久久99精品国产| 亚洲免费大片在线观看| 欧美极品aⅴ影院|