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

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

?? bulkpnp.c

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

Copyright (c) 1997-1998  Microsoft Corporation

Module Name:

    mBulkPnp.c

Abstract:

    Bulk USB device driver for Intel 82930 USB test board
    Plug and Play 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/7/98: created
    11/24/01:purnnamu: modified to support SupriseRemoval
--*/


#include "wdm.h"
#include "stdarg.h"
#include "stdio.h"

#include "usbdi.h"
#include "usbdlib.h"
#include "Blk82930.h"



NTSTATUS
BulkUsb_ProcessPnPIrp(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
/*++

Routine Description:

    Dispatch table routine for IRP_MJ_PNP.
    Process the Plug and Play IRPs sent to this device.

Arguments:

    DeviceObject - pointer to our FDO (Functional Device Object)

    Irp          - pointer to an I/O Request Packet

Return Value:

    NT status code

--*/
{

    PIO_STACK_LOCATION irpStack;
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    NTSTATUS waitStatus;
    PDEVICE_OBJECT stackDeviceObject;
    KEVENT startDeviceEvent;

    PDEVICE_CAPABILITIES    deviceCapabilities; //purnnamu:11/23/2001

    //
    // Get a pointer to the current location in the Irp. This is where
    //     the function codes and parameters are located.
    //
    irpStack = IoGetCurrentIrpStackLocation (Irp);

    //
    // Get a pointer to the device extension
    //

    deviceExtension = DeviceObject->DeviceExtension;
    stackDeviceObject = deviceExtension->TopOfStackDeviceObject;

    BULKUSB_KdPrint( DBGLVL_MEDIUM, ( "enter BulkUsb_ProcessPnPIrp() IRP_MJ_PNP, minor %s\n",
        BULKUSB_StringForPnpMnFunc( irpStack->MinorFunction ) ));

        // inc the FDO device extension's pending IO count for this Irp
    BulkUsb_IncrementIoCount(DeviceObject);

    BULKUSB_ASSERT( IRP_MJ_PNP == irpStack->MajorFunction );

    switch (irpStack->MinorFunction) {
    //=========================================
    //purnnamu:11/23/2001:added for the surprise removal
    case IRP_MN_QUERY_CAPABILITIES:
            //TRACE(TL_TRACE, ("t1394Diag_Pnp: IRP_MN_QUERY_CAPABILITIES\n"));

            deviceCapabilities = irpStack->Parameters.DeviceCapabilities.Capabilities;
           
            if(deviceCapabilities->Version < 1)break;
            
            deviceCapabilities->SurpriseRemovalOK = TRUE;
            deviceCapabilities->Removable = TRUE;

            deviceExtension->DeviceCapabilities.Removable =1;
            deviceExtension->DeviceCapabilities.SurpriseRemovalOK=1;;
            
            Irp->IoStatus.Status = STATUS_SUCCESS;
            IoCompleteRequest(Irp, IO_NO_INCREMENT);
            BulkUsb_DecrementIoCount(DeviceObject);
            return STATUS_SUCCESS;
    //=========================================
    case IRP_MN_START_DEVICE:

        // The PnP Manager sends this IRP after it has assigned resources,
        // if any, to the device. The device may have been recently enumerated
        // and is being started for the first time, or the device may be
        // restarting after being stopped for resource reconfiguration.

        // Initialize an event we can wait on for the PDO to be done with this irp
        KeInitializeEvent(&startDeviceEvent, NotificationEvent, FALSE);
        IoCopyCurrentIrpStackLocationToNext(Irp);

        // Set a completion routine so it can signal our event when
        //  the PDO is done with the Irp
        IoSetCompletionRoutine(Irp,
                               BulkUsb_IrpCompletionRoutine,
                               &startDeviceEvent,  // pass the event to the completion routine as the Context
                               TRUE,    // invoke on success
                               TRUE,    // invoke on error
                               TRUE);   // invoke on cancellation


        // let the PDO process the IRP
        ntStatus = IoCallDriver(stackDeviceObject,
                                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

            waitStatus = KeWaitForSingleObject(
                &startDeviceEvent,
                Suspended,
                KernelMode,
                FALSE,
                NULL);

            ntStatus = Irp->IoStatus.Status;
        }

        if (NT_SUCCESS(ntStatus)) {

            // Now we're ready to do our own startup processing.
            // USB client drivers such as us set up URBs (USB Request Packets) to send requests
            // to the host controller driver (HCD). The URB structure defines a format for all
            // possible commands that can be sent to a USB device.
            // Here, we request the device descriptor and store it,
            // and configure the device.
            ntStatus = BulkUsb_StartDevice(DeviceObject);
            Irp->IoStatus.Status = ntStatus;
        }

        IoCompleteRequest (Irp,
                           IO_NO_INCREMENT
                           );

        BulkUsb_DecrementIoCount(DeviceObject);
        return ntStatus;  // end, case IRP_MN_START_DEVICE

    case IRP_MN_QUERY_STOP_DEVICE:

                // The IRP_MN_QUERY_STOP_DEVICE/IRP_MN_STOP_DEVICE sequence only occurs
                // during "polite" shutdowns, such as the user explicitily requesting the
                // service be stopped in, or requesting unplug from the Pnp tray icon.
                // This sequence is NOT received during "impolite" shutdowns,
                // such as someone suddenly yanking the USB cord or otherwise
                // unexpectedly disabling/resetting the device.

        // If a driver sets STATUS_SUCCESS for this IRP,
        // the driver must not start any operations on the device that
        // would prevent that driver from successfully completing an IRP_MN_STOP_DEVICE
        // for the device.
        // For mass storage devices such as disk drives, while the device is in the
        // stop-pending state,the driver holds IRPs that require access to the device,
        // but for most USB devices, there is no 'persistent storage', so we will just
        // refuse any more IO until restarted or the stop is cancelled

        // If a driver in the device stack determines that the device cannot be
        // stopped for resource reconfiguration, the driver is not required to pass
        // the IRP down the device stack. If a query-stop IRP fails,
        // the PnP Manager sends an IRP_MN_CANCEL_STOP_DEVICE to the device stack,
        // notifying the drivers for the device that the query has been cancelled
        // and that the device will not be stopped.


        // It is possible to receive this irp when the device has not been started
        //  ( as on a boot device )
        if (!deviceExtension->DeviceStarted) { // if get when never started, just pass on
            BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPnPIrp() IRP_MN_QUERY_STOP_DEVICE when device not started\n"));
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver (deviceExtension->TopOfStackDeviceObject, Irp);
            BulkUsb_DecrementIoCount(DeviceObject);

            return ntStatus;
        }


        // fail the request if we have any read/write IRPS pending
        if( deviceExtension->StagedPendingIrpCount ) {
            ntStatus = STATUS_UNSUCCESSFUL;
        }
        else {
                        // We'll not veto it; pass it on and flag that stop was requested.
                        // Once StopDeviceRequested is set no new IOCTL or read/write irps will be passed
                        // down the stack to lower drivers; all will be quickly failed
             deviceExtension->StopDeviceRequested = TRUE;
             Irp->IoStatus.Status = STATUS_SUCCESS;
        }

        break; // end, case IRP_MN_QUERY_STOP_DEVICE

    case IRP_MN_CANCEL_STOP_DEVICE:

                // The PnP Manager uses this IRP to inform the drivers for a device
                // that the device will not be stopped for resource reconfiguration.
                // This should only be received after a successful IRP_MN_QUERY_STOP_DEVICE.


        // It is possible to receive this irp when the device has not been started
        if (!deviceExtension->DeviceStarted) { // if get when never started, just pass on
            BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPnPIrp() IRP_MN_CANCEL_STOP_DEVICE when device not started\n"));
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver (deviceExtension->TopOfStackDeviceObject, Irp);
            BulkUsb_DecrementIoCount(DeviceObject);
            return ntStatus;
        }

                // Reset this flag so new IOCTL and IO Irp processing will be re-enabled
        deviceExtension->StopDeviceRequested = FALSE;
        Irp->IoStatus.Status = STATUS_SUCCESS;
        break; // end, case IRP_MN_CANCEL_STOP_DEVICE

    case IRP_MN_STOP_DEVICE:

                // The PnP Manager sends this IRP to stop a device so it can reconfigure
                // its hardware resources. The PnP Manager only sends this IRP if a prior
                // IRP_MN_QUERY_STOP_DEVICE completed successfully.


        // Cancel any pending io requests.  (there shouldn't be any)
        BulkUsb_CancelPendingIo( DeviceObject );
        //
        // Send the select configuration urb with a NULL pointer for the configuration
        // handle, this closes the configuration and puts the device in the 'unconfigured'
        // state.
        //
        ntStatus = BulkUsb_StopDevice(DeviceObject);
        Irp->IoStatus.Status = ntStatus;

        break; // end, case IRP_MN_STOP_DEVICE



    case IRP_MN_QUERY_REMOVE_DEVICE:

        //  In response to this IRP, drivers indicate whether the device can be
        //  removed without disrupting the system.
        //  If a driver determines it is safe to remove the device,
        //  the driver completes any outstanding I/O requests, arranges to hold any subsequent
        //  read/write requests, and sets Irp->IoStatus.Status to STATUS_SUCCESS. Function
        //  and filter drivers then pass the IRP to the next-lower driver in the device stack.
        //  The underlying bus driver calls IoCompleteRequest.

        //  If a driver sets STATUS_SUCCESS for this IRP, the driver must not start any
        //  operations on the device that would prevent that driver from successfully completing
        //  an IRP_MN_REMOVE_DEVICE for the device. If a driver in the device stack determines
        //  that the device cannot be removed, the driver is not required to pass the
        //  query-remove IRP down the device stack. If a query-remove IRP fails, the PnP Manager
        //  sends an IRP_MN_CANCEL_REMOVE_DEVICE to the device stack, notifying the drivers for
        //  the device that the query has been cancelled and that the device will not be removed.

        // It is possible to receive this irp when the device has not been started
        if (!deviceExtension->DeviceStarted) { // if get when never started, just pass on
            BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPnPIrp() IRP_MN_QUERY_STOP_DEVICE when device not started\n"));
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver (deviceExtension->TopOfStackDeviceObject, Irp);
            BulkUsb_DecrementIoCount(DeviceObject);

            return ntStatus;
        }

                // Once RemoveDeviceRequested is set no new IOCTL or read/write irps will be passed
                // down the stack to lower drivers; all will be quickly failed
       deviceExtension->RemoveDeviceRequested = TRUE;

        // Wait for any io request pending in our driver to
        // complete before returning success.
                // This  event is set when deviceExtension->PendingIoCount goes to 1
        waitStatus = KeWaitForSingleObject(
                    &deviceExtension->NoPendingIoEvent,
                    Suspended,
                    KernelMode,
                    FALSE,
                    NULL);


        Irp->IoStatus.Status = STATUS_SUCCESS;
        break; // end, case IRP_MN_QUERY_REMOVE_DEVICE

    case IRP_MN_CANCEL_REMOVE_DEVICE:

                // The PnP Manager uses this IRP to inform the drivers
                // for a device that the device will not be removed.
                // It is sent only after a successful IRP_MN_QUERY_REMOVE_DEVICE.

        if (!deviceExtension->DeviceStarted) { // if get when never started, just pass on

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
www.av精品| 91精品中文字幕一区二区三区| 亚洲图片欧美视频| 亚洲欧洲国产日韩| 国产精品九色蝌蚪自拍| 国产人妖乱国产精品人妖| 精品国产乱码久久久久久久| 国模无码大尺度一区二区三区| 国产精品一区二区在线观看网站| 一区二区三区高清在线| 亚洲女爱视频在线| 亚洲精品中文字幕在线观看| 一区二区在线观看av| 夜夜嗨av一区二区三区中文字幕| 亚洲最大的成人av| 日韩 欧美一区二区三区| 麻豆成人免费电影| 国产精品小仙女| 日本乱码高清不卡字幕| 欧美视频在线观看一区| 日韩欧美中文字幕一区| 国产网站一区二区| 一区二区在线观看视频在线观看| 欧美天天综合网| 91免费观看视频在线| 国产精品1024久久| 99re这里都是精品| 欧美日韩免费电影| 日韩精品专区在线影院重磅| 国产精品视频免费| 亚洲国产成人va在线观看天堂| 久久aⅴ国产欧美74aaa| 99久久精品国产精品久久| 欧美日韩高清一区二区三区| 精品国产乱码91久久久久久网站| 国产精品少妇自拍| 日本视频免费一区| caoporn国产精品| 精品国产乱码久久久久久免费| 亚洲国产激情av| 日韩成人dvd| 色综合久久久久久久| 久久久久国产精品麻豆ai换脸| 亚洲一区二区三区中文字幕 | 国内精品国产成人国产三级粉色| 99久久久久免费精品国产| 欧美精品久久一区| 国产精品亲子伦对白| 麻豆91精品视频| 色狠狠av一区二区三区| 中文字幕精品一区二区精品绿巨人| 丝袜美腿亚洲一区二区图片| 99re热这里只有精品视频| 精品美女在线播放| 日本aⅴ亚洲精品中文乱码| 在线精品视频一区二区| 国产欧美日韩综合精品一区二区| 丝袜美腿亚洲综合| 欧美视频完全免费看| 亚洲欧美日韩国产一区二区三区| 国产一区二区在线影院| 日韩一级视频免费观看在线| 亚洲国产一区二区视频| 在线这里只有精品| 亚洲欧美另类久久久精品2019| 国产精品一区二区三区乱码| 欧美一区二区精美| 亚洲夂夂婷婷色拍ww47 | 欧美精品一区二区久久久| 亚洲精品中文在线影院| 91亚洲精品久久久蜜桃| 日韩一区中文字幕| 粉嫩在线一区二区三区视频| 精品国产乱码久久久久久蜜臀| 日韩综合在线视频| 日韩一区二区视频在线观看| 日韩精品一区第一页| 91麻豆精品国产自产在线观看一区| 一区二区三区国产豹纹内裤在线| 色狠狠av一区二区三区| 亚洲综合男人的天堂| 欧美无砖砖区免费| 日韩av一区二区三区| 欧美一区二区三区视频在线| 日本成人在线网站| 久久久午夜精品| 国产精品18久久久久久vr| 亚洲三级在线免费| 亚洲福利视频一区二区| 欧美日韩高清在线播放| 日av在线不卡| 国产亚洲欧美在线| 成人高清在线视频| 国产精品美女一区二区三区| 99免费精品在线| 亚洲成人一区二区在线观看| 欧美电影一区二区| 国产九色sp调教91| 亚洲日本护士毛茸茸| 欧美日韩国产成人在线免费| 久久国产精品区| 国产欧美一区二区精品秋霞影院 | 亚洲三级在线看| 制服丝袜亚洲精品中文字幕| 国模娜娜一区二区三区| 亚洲欧美激情在线| 日韩欧美色综合网站| 成人激情小说乱人伦| 亚洲va天堂va国产va久| www亚洲一区| 欧洲亚洲精品在线| 国产在线精品一区二区| 亚洲综合色婷婷| 精品国产乱码久久久久久免费| 99国产一区二区三精品乱码| 偷拍亚洲欧洲综合| 国产精品丝袜91| 欧美一区二区成人| 色综合激情久久| 国产在线视视频有精品| 夜夜爽夜夜爽精品视频| 久久精品视频一区二区| 欧美精品123区| 91色综合久久久久婷婷| 国产中文一区二区三区| 日韩精品一区第一页| 亚洲人成网站精品片在线观看| 精品国产成人在线影院| 欧美日韩三级在线| 91在线视频免费91| 国产成人亚洲综合色影视| 日韩电影在线免费| 亚洲一区自拍偷拍| 中文字幕在线观看一区二区| 久久精品人人做人人爽人人| 91精品国产一区二区人妖| 在线免费一区三区| gogogo免费视频观看亚洲一| 国产美女在线精品| 美女一区二区在线观看| 天堂午夜影视日韩欧美一区二区| 亚洲欧美成aⅴ人在线观看| 国产精品久久久久天堂| 国产精品系列在线| 久久精品视频免费观看| 久久久亚洲精品一区二区三区 | 亚洲三级电影全部在线观看高清| 久久久91精品国产一区二区三区| 日韩欧美www| 欧美tickle裸体挠脚心vk| 欧美一区二区三区四区久久| 欧美另类久久久品| 欧美精品亚洲二区| 911精品国产一区二区在线| 欧美日韩欧美一区二区| 欧美久久久久久蜜桃| 欧美老肥妇做.爰bbww视频| 欧美色手机在线观看| 欧美理论片在线| 欧美精品aⅴ在线视频| 欧美一区二区视频网站| 成人综合在线网站| 99riav久久精品riav| 一本色道a无线码一区v| 欧洲精品在线观看| 欧美美女bb生活片| 日本亚洲一区二区| 看国产成人h片视频| 国产精一区二区三区| 成人av网址在线| 在线影视一区二区三区| 欧美日韩一区二区三区视频| 欧美一区二区免费视频| 久久久久久免费毛片精品| 国产精品视频一二三| 亚洲在线观看免费视频| 青青草一区二区三区| 国产成人精品免费一区二区| 色综合久久中文字幕综合网| 欧美日韩在线播放一区| 精品国产人成亚洲区| 中文字幕不卡一区| 亚洲一本大道在线| 精品一区二区三区久久久| 国产精品一二三四| 欧美在线免费播放| 91黄色在线观看| 久久久午夜精品理论片中文字幕| 国产性色一区二区| 亚洲电影中文字幕在线观看| 日韩 欧美一区二区三区| 国产sm精品调教视频网站| 日本高清免费不卡视频| 精品999在线播放| 一区二区三区在线高清| 免费av成人在线| 一本久久综合亚洲鲁鲁五月天| 日韩一区二区视频在线观看| 综合久久久久久久| 麻豆国产欧美日韩综合精品二区|