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

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

?? sbulkpnp.c

?? 該代碼是基于S3C2410處理器上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一区二区三区免费野_久草精品视频
懂色av一区二区在线播放| 成人免费观看av| 亚洲与欧洲av电影| 亚洲欧美激情视频在线观看一区二区三区 | 99久久婷婷国产综合精品| 国产99久久久国产精品| 国产91综合网| aaa亚洲精品一二三区| 99这里都是精品| 在线观看成人免费视频| 欧美日韩一区成人| 日韩欧美国产不卡| 久久久91精品国产一区二区精品| 日本一区二区久久| 亚洲在线一区二区三区| 偷偷要91色婷婷| 国产一区二区三区四| caoporn国产精品| 欧美视频三区在线播放| 日韩精品一区二区三区三区免费 | 欧美日韩一区在线| 欧美一区二区视频在线观看2022 | 欧美岛国在线观看| 国产女主播一区| 亚洲国产日韩综合久久精品| 免费亚洲电影在线| 成人精品免费看| 欧美日韩中文另类| 久久综合999| 亚洲美女精品一区| 免费的国产精品| 97久久超碰精品国产| 欧美一级欧美一级在线播放| 国产精品国产自产拍在线| 天天综合日日夜夜精品| 不卡一区二区在线| 67194成人在线观看| 国产精品久久久久影视| 日韩av一二三| 91精彩视频在线观看| 日韩你懂的在线播放| 亚洲欧美一区二区三区国产精品| 免费黄网站欧美| 色天使久久综合网天天| 久久综合狠狠综合久久激情| 一区二区三区四区在线| 国产一区二区三区四区五区美女| 色诱视频网站一区| 久久九九久久九九| 捆绑变态av一区二区三区| 94-欧美-setu| 国产欧美精品国产国产专区| 蜜桃视频在线一区| 一本大道av伊人久久综合| 国产亚洲视频系列| 毛片av一区二区| 欧美日韩在线播放一区| 中文字幕视频一区| 国产aⅴ综合色| 欧美xxxx老人做受| 日产国产欧美视频一区精品| 欧美偷拍一区二区| 亚洲中国最大av网站| 色婷婷综合在线| 亚洲欧美电影院| 91在线播放网址| 中文字幕日本不卡| www..com久久爱| 中文字幕一区二区三区四区不卡 | 欧美日韩色综合| 亚洲一二三级电影| 欧美在线不卡一区| 亚洲在线观看免费视频| 欧美日韩亚洲国产综合| 亚洲成av人影院| 欧美肥大bbwbbw高潮| 日韩精品乱码av一区二区| 777午夜精品视频在线播放| 天天综合日日夜夜精品| 日韩一卡二卡三卡四卡| 精品在线播放免费| wwww国产精品欧美| 国产成人免费xxxxxxxx| 国产精品毛片a∨一区二区三区| 懂色av一区二区三区免费看| 国产精品毛片无遮挡高清| 99视频在线精品| 一区二区三区在线免费观看| 欧美欧美午夜aⅴ在线观看| 日韩影视精彩在线| 久久综合九色综合欧美亚洲| 岛国精品在线观看| 一区二区三区欧美亚洲| 日韩一二三四区| 岛国精品一区二区| 亚洲不卡av一区二区三区| 日韩欧美激情在线| 99国内精品久久| 日韩成人精品在线| 久久人人爽爽爽人久久久| 91丝袜美女网| 奇米777欧美一区二区| 中文字幕av免费专区久久| 欧洲一区二区av| 韩国精品久久久| 亚洲激情欧美激情| 精品久久久久久无| 色婷婷综合久久久中文字幕| 久久99国产乱子伦精品免费| 中文字幕亚洲一区二区av在线| 欧美性videosxxxxx| 国产成人午夜精品影院观看视频 | 国产成人高清在线| 午夜国产不卡在线观看视频| 国产欧美一区二区精品性色| 欧美日韩美女一区二区| 粉嫩高潮美女一区二区三区 | 欧美精品一区二区三区蜜臀| 91视频国产资源| 国产最新精品精品你懂的| 亚洲国产精品久久人人爱蜜臀| 久久久午夜精品| 欧美精品在线一区二区三区| 国产成人福利片| 久久国产剧场电影| 亚洲图片欧美综合| 亚洲激情五月婷婷| 国产精品理论在线观看| 精品国产91亚洲一区二区三区婷婷| 欧美自拍丝袜亚洲| av一二三不卡影片| 国产不卡在线视频| 久久国产福利国产秒拍| 日韩激情中文字幕| 亚洲成人动漫一区| 亚洲精品国产高清久久伦理二区| 中文无字幕一区二区三区 | 欧美日韩在线三区| 91豆麻精品91久久久久久| kk眼镜猥琐国模调教系列一区二区| 狠狠色狠狠色综合| 久久精品噜噜噜成人av农村| 午夜精品久久久久影视| 亚洲精品国产第一综合99久久| 中文字幕一区二区三区四区| 国产精品国产三级国产有无不卡 | 一区二区三区日韩精品| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 色呦呦一区二区三区| 99久久精品免费| jlzzjlzz亚洲日本少妇| 成年人国产精品| 北岛玲一区二区三区四区| 成人不卡免费av| 99在线热播精品免费| 一本一道久久a久久精品| 成人国产精品免费观看| 91啪亚洲精品| 欧美亚洲一区二区在线| 精品视频1区2区3区| 欧美一级欧美一级在线播放| 欧美刺激午夜性久久久久久久| 精品国产乱码久久久久久久久| 久久蜜桃av一区二区天堂| 亚洲国产精品成人综合| 亚洲天堂精品视频| 五月天一区二区三区| 狠狠色综合播放一区二区| 成人国产精品免费| 欧美色图一区二区三区| 欧美一区二区人人喊爽| 久久综合久久综合九色| 亚洲婷婷在线视频| 日韩黄色一级片| 国产毛片精品视频| 在线一区二区视频| 日韩欧美一二区| 国产精品美女一区二区在线观看| 一个色综合网站| 久88久久88久久久| 成人黄色777网| 欧美一区二区网站| 国产精品沙发午睡系列990531| 亚洲一区二区三区三| 国产在线视视频有精品| 91麻豆国产在线观看| 日韩亚洲欧美中文三级| 1000部国产精品成人观看| 视频一区二区中文字幕| 成人av在线资源网| 日韩一区二区视频在线观看| 国产精品久久久久久久久久免费看 | aaa欧美日韩| 欧美成人女星排行榜| 亚洲美女偷拍久久| 国产精品99久久久久久宅男| 欧美日韩国产成人在线91| 中文字幕欧美激情一区| 蜜桃久久久久久久| 日本高清无吗v一区|