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

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

?? bulkpnp.c

?? s3c2440的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一区二区三区免费野_久草精品视频
日本乱人伦一区| 麻豆一区二区在线| 久久免费看少妇高潮| 欧美日韩中字一区| 欧美体内she精高潮| 一本大道久久a久久综合| 成人h动漫精品| 成人激情综合网站| 91网页版在线| 在线看不卡av| 欧美午夜精品理论片a级按摩| 99精品国产视频| 一本色道亚洲精品aⅴ| 色婷婷av一区二区三区之一色屋| 97久久超碰国产精品| 在线观看三级视频欧美| 欧美精品v国产精品v日韩精品| 欧美一区二区三区视频免费播放| 91精品国产福利| 精品国精品国产| 国产精品第四页| 亚洲成人激情自拍| 国内欧美视频一区二区| 成人a级免费电影| 欧美体内she精视频| 日韩精品一区二区三区三区免费| 久久日韩精品一区二区五区| 国产日韩欧美a| 亚洲午夜三级在线| 国产一区二区福利| 91网站视频在线观看| 91麻豆精品国产91| 久久久久久夜精品精品免费| 日韩美女久久久| 日本在线不卡一区| 成人午夜激情在线| 欧美老女人第四色| 欧美激情在线一区二区三区| 一区2区3区在线看| 国产一区二区毛片| 欧美日韩日日骚| 亚洲国产精品二十页| 性做久久久久久免费观看| 丰满白嫩尤物一区二区| 欧美巨大另类极品videosbest | 亚洲色图丝袜美腿| 日本欧美一区二区三区| 91片黄在线观看| 26uuu精品一区二区三区四区在线| 国产精品美女久久久久高潮| 日韩精品91亚洲二区在线观看| 成人亚洲一区二区一| 9191久久久久久久久久久| 国产精品二三区| 国产一区福利在线| 3751色影院一区二区三区| 日韩伦理电影网| 国产999精品久久久久久绿帽| 欧美日韩成人综合在线一区二区| 国产精品久久久久久亚洲伦 | 91影院在线观看| 日韩亚洲欧美一区二区三区| 亚洲欧美视频一区| 9i看片成人免费高清| 久久香蕉国产线看观看99| 日韩精品91亚洲二区在线观看| 色欧美片视频在线观看在线视频| 久久久777精品电影网影网| 麻豆91精品视频| 欧美一区二区三区男人的天堂| 亚洲一区av在线| 91精品福利视频| 亚洲精品一二三区| av午夜一区麻豆| 亚洲欧美自拍偷拍色图| 成人美女视频在线观看| 国产亚洲制服色| 国产精品99久久久久久久女警| 日韩精品一区二区三区老鸭窝| 青青草原综合久久大伊人精品| 欧美日韩一区二区三区高清| 亚洲一区二三区| 欧美日韩免费电影| 丝袜美腿亚洲色图| 日韩精品一区二区三区蜜臀| 激情五月播播久久久精品| 久久网站最新地址| 欧美精选一区二区| 日本三级亚洲精品| 精品福利二区三区| 懂色av一区二区在线播放| 国产精品免费观看视频| 色哟哟精品一区| 亚洲成a人在线观看| 日韩欧美一卡二卡| 国产精品影音先锋| 亚洲男人的天堂网| 欧美片在线播放| 麻豆成人av在线| 国产欧美日本一区二区三区| av成人动漫在线观看| 爽爽淫人综合网网站| 精品99一区二区| av网站免费线看精品| 亚洲成人资源在线| 久久美女高清视频| 91免费观看视频| 免费成人av在线| 国产精品久线在线观看| 91麻豆精品国产自产在线 | 一区二区高清视频在线观看| 欧美视频一区二区三区四区| 久88久久88久久久| 亚洲激情av在线| 日韩一区二区三区av| 国产精品一区二区免费不卡| 一区二区三区小说| 精品国产乱码久久久久久图片| www.欧美.com| 久久国产精品无码网站| 亚洲免费毛片网站| 精品粉嫩超白一线天av| 欧美日韩在线不卡| gogo大胆日本视频一区| 久久狠狠亚洲综合| 一区二区三区日韩精品| 久久九九全国免费| 欧美日韩一二区| 成人免费毛片aaaaa**| 麻豆久久久久久| 亚洲影视在线播放| 中文字幕一区二区不卡| 亚洲精品一区二区在线观看| 欧美视频一二三区| 91一区二区三区在线播放| 国产福利91精品一区二区三区| 亚洲高清视频的网址| 成人欧美一区二区三区| 久久综合久久99| 日韩一级免费观看| 欧美性xxxxxxxx| 欧美亚洲高清一区二区三区不卡| 成人综合婷婷国产精品久久| 极品瑜伽女神91| 免费在线观看日韩欧美| 久久99精品久久久久久久久久久久| 日韩一区二区三区免费看| 福利视频网站一区二区三区| 日韩综合小视频| 首页国产欧美日韩丝袜| 天堂一区二区在线| 午夜av一区二区三区| 亚洲欧美激情小说另类| 亚洲午夜视频在线观看| 香蕉乱码成人久久天堂爱免费| 亚洲靠逼com| 亚洲综合丁香婷婷六月香| 欧美性猛交一区二区三区精品| 日韩国产高清影视| 久88久久88久久久| 美国毛片一区二区三区| 欧美色涩在线第一页| 欧美在线视频全部完| 丝袜诱惑制服诱惑色一区在线观看| 亚洲精品福利视频网站| 亚洲欧洲另类国产综合| 亚洲欧美另类小说| 亚洲欧美国产77777| 亚洲精品日产精品乱码不卡| 夜夜爽夜夜爽精品视频| 偷窥国产亚洲免费视频| 蜜乳av一区二区| 国产激情视频一区二区在线观看 | 91成人国产精品| 欧美日韩国产小视频在线观看| 欧美理论片在线| 精品国产免费一区二区三区四区| 2022国产精品视频| 中文字幕视频一区二区三区久| 亚洲另类色综合网站| 天堂精品中文字幕在线| 国产一区啦啦啦在线观看| caoporn国产一区二区| 欧美精品在线观看一区二区| 精品日韩欧美在线| 中文字幕欧美一| 秋霞电影一区二区| 欧美一区二区人人喊爽| 久久久久国产成人精品亚洲午夜 | 国产亚洲欧美在线| 中文字幕av一区 二区| **欧美大码日韩| 日韩1区2区日韩1区2区| 国产福利电影一区二区三区| 在线免费一区三区| 国产区在线观看成人精品| 亚洲午夜久久久久久久久电影网 | 56国语精品自产拍在线观看| 国产欧美一区二区三区沐欲| 亚洲午夜电影在线观看|