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

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

?? sbulkpnp.c

?? S3C2410X平臺下的USB驅動程序
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*++

Copyright (c) 1997-1998  Microsoft Corporation

Module Name:

    SBulkPnp.c

Abstract:

    Modified Bulk USB device driver for SEC SOC 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一区二区三区免费野_久草精品视频
欧美肥大bbwbbw高潮| 欧美日韩久久久一区| 日韩国产高清在线| 亚洲免费观看高清在线观看| 欧美成人精品1314www| 欧美精品日韩一区| 欧美乱妇20p| 欧美久久久影院| 欧美日韩免费不卡视频一区二区三区| 99久久久无码国产精品| av高清不卡在线| 成人免费视频一区| 成人av电影免费在线播放| 成人午夜电影小说| aaa亚洲精品一二三区| 99re免费视频精品全部| 99免费精品视频| 91亚洲国产成人精品一区二三 | 精品国产乱码久久| 日韩一区二区三区视频在线 | 欧美日韩午夜影院| 欧美日本国产视频| 久久久久青草大香线综合精品| 亚洲精品一区二区三区精华液 | 亚洲线精品一区二区三区| 丝袜诱惑亚洲看片| 国产一区在线观看视频| av激情综合网| 日韩视频一区在线观看| 欧美国产综合色视频| 亚洲综合一区二区三区| 日本系列欧美系列| 国产91清纯白嫩初高中在线观看| 成人高清av在线| 欧美一级国产精品| 1024国产精品| 蜜桃一区二区三区在线观看| www.视频一区| 欧美第一区第二区| 亚洲精品国产第一综合99久久| 日韩avvvv在线播放| 成人黄色在线网站| 日韩一区二区电影| 亚洲乱码中文字幕| 韩国三级中文字幕hd久久精品| 色婷婷香蕉在线一区二区| 精品理论电影在线观看| 一区二区三区四区视频精品免费| 久久9热精品视频| 欧美亚洲国产一卡| 亚洲国产精品传媒在线观看| 日韩av网站在线观看| 91免费视频网址| 久久九九久久九九| 麻豆国产精品官网| 精品视频全国免费看| 国产精品久久久久影视| 久久国产尿小便嘘嘘| 欧美久久免费观看| 亚洲综合无码一区二区| 99精品国产99久久久久久白柏| 精品久久久久久久久久久久久久久久久 | 亚洲欧洲av一区二区三区久久| 国产最新精品精品你懂的| 欧美性猛交xxxx黑人交| 亚洲精品欧美专区| 色婷婷av一区二区三区软件| 欧美激情一区二区三区蜜桃视频| 精品一区二区三区在线视频| 欧美日韩一区三区| 亚洲va欧美va国产va天堂影院| 一本一道综合狠狠老| 国产精品美女久久久久久久久| 国产精品一区二区视频| 久久亚洲一区二区三区四区| 久久精品国产99国产| 日韩亚洲欧美成人一区| 青青草国产成人99久久| 日韩一区二区电影在线| 久久国产免费看| 精品国产第一区二区三区观看体验| 日本午夜精品一区二区三区电影| 91精品在线麻豆| 日韩高清一区在线| 欧美一区二区三区在| 老司机免费视频一区二区三区| 日韩一级免费观看| 国产在线不卡一区| 国产精品久久久久久久久免费丝袜| 国产精品影视天天线| 中文av一区特黄| 99精品视频在线观看| 一区二区三区中文在线观看| 欧美性色黄大片| 奇米影视一区二区三区小说| 久久一区二区三区四区| 粉嫩13p一区二区三区| 亚洲欧美日韩中文字幕一区二区三区| 一本久久a久久免费精品不卡| 亚洲伊人色欲综合网| 777午夜精品免费视频| 精品一区二区影视| 亚洲男人都懂的| 欧美一区二区在线不卡| 懂色av一区二区在线播放| 亚洲精品菠萝久久久久久久| 欧美一区二区三区视频免费| 国产激情偷乱视频一区二区三区| 亚洲女爱视频在线| 欧美xxxx老人做受| 一本一道久久a久久精品| 麻豆91在线播放| 国产精品不卡在线| 日韩一区二区三区精品视频 | 91高清视频免费看| 免费观看日韩电影| 亚洲一区二区高清| 精品国产91洋老外米糕| 91污片在线观看| 美女视频网站久久| 亚洲精品视频自拍| 久久女同精品一区二区| 欧美亚洲综合久久| 国产成人在线免费观看| 午夜影院在线观看欧美| 国产精品成人一区二区三区夜夜夜 | 精品国产三级电影在线观看| 成人网在线播放| 五月激情丁香一区二区三区| 中文字幕av一区二区三区免费看| 在线免费观看成人短视频| 国产精品综合在线视频| 亚洲午夜成aⅴ人片| 久久久噜噜噜久噜久久综合| 欧美剧在线免费观看网站| 国产激情一区二区三区| 免费观看成人鲁鲁鲁鲁鲁视频| 亚洲丝袜精品丝袜在线| 久久久久久综合| 欧美成人官网二区| 欧美日韩一区视频| 日本道精品一区二区三区| 国产黄人亚洲片| 国产在线一区观看| 日韩高清欧美激情| 亚洲高清免费视频| 一区二区三区四区激情| 国产女人18水真多18精品一级做 | 青青草国产精品97视觉盛宴| 亚洲图片另类小说| 国产欧美日产一区| 欧美本精品男人aⅴ天堂| 91精品国产入口| 91精品国模一区二区三区| 欧美午夜片在线观看| 日本道色综合久久| 日本二三区不卡| 91电影在线观看| 欧美亚洲综合在线| 欧美日韩中文另类| 欧美剧在线免费观看网站 | 亚洲国产综合色| 亚洲综合激情网| 樱桃国产成人精品视频| 一区二区三区视频在线看| 亚洲精品午夜久久久| 亚洲精品综合在线| 亚洲一级二级三级在线免费观看| 亚洲综合一区二区精品导航| 亚洲高清在线视频| 久久精品国产亚洲5555| 国产另类ts人妖一区二区| 粉嫩蜜臀av国产精品网站| 成人免费毛片嘿嘿连载视频| 99精品欧美一区二区三区综合在线| 91色porny| 欧美三级资源在线| 日韩久久久精品| 久久久www成人免费毛片麻豆| 国产精品丝袜久久久久久app| 国产精品国产三级国产a| 一区二区三区中文字幕精品精品| 亚洲风情在线资源站| 青青草精品视频| 国产不卡免费视频| 欧美在线免费观看亚洲| 欧美一级黄色录像| 国产精品福利电影一区二区三区四区| 亚洲理论在线观看| 久久精品99国产精品| 不卡的电影网站| 欧美三日本三级三级在线播放| 精品日韩成人av| 亚洲天堂av老司机| 蜜乳av一区二区三区| 成人精品鲁一区一区二区| 欧美在线观看视频在线| 精品日韩一区二区三区免费视频| 亚洲特级片在线| 热久久国产精品|