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

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

?? bulkpnp.c

?? 基于linux的s3c2410開發板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一区二区三区免费野_久草精品视频
亚洲欧美电影一区二区| 亚洲欧美国产高清| 欧美日韩不卡在线| 欧美亚洲图片小说| 欧美性猛交xxxxxxxx| 欧美怡红院视频| 欧美伊人久久久久久午夜久久久久| 色综合久久久久久久久| 99热精品一区二区| 99久久精品免费| 色婷婷av一区| 在线不卡中文字幕| 精品久久国产字幕高潮| 久久久综合九色合综国产精品| 久久精品夜色噜噜亚洲a∨| 久久精品欧美日韩精品 | 水蜜桃久久夜色精品一区的特点| 亚洲一区二区3| 日本少妇一区二区| 国产成人精品三级| 色婷婷久久一区二区三区麻豆| 日本韩国一区二区| 欧美草草影院在线视频| 亚洲国产成人私人影院tom| 综合久久久久久| 午夜精品久久久久久| 国内精品伊人久久久久影院对白| 成人一区二区在线观看| 欧美三级电影在线看| 欧美成人r级一区二区三区| 国产精品免费av| 亚洲成av人片在线| 国产成人精品一区二 | 亚洲一区二区高清| 狠狠色丁香婷综合久久| 99久久精品一区| 欧美一级淫片007| 国产精品久久久久桃色tv| 亚洲国产精品久久艾草纯爱| 国产精品一区二区在线看| 91小视频在线免费看| 日韩女优av电影在线观看| 成人免费在线视频观看| 久久99精品视频| 欧美亚洲国产bt| 国产精品三级电影| 美女性感视频久久| 91亚洲资源网| 国产精品天干天干在线综合| 日日夜夜免费精品| 91年精品国产| 国产日韩欧美精品综合| 亚洲成a人v欧美综合天堂下载| 成人h精品动漫一区二区三区| 69堂精品视频| 一区二区三区在线免费观看| 国产成人久久精品77777最新版本| 欧美一级免费大片| 亚州成人在线电影| 欧美视频一区二区三区| 日韩理论片网站| 成人精品一区二区三区四区| 精品国产91久久久久久久妲己 | 91精品国产综合久久香蕉的特点 | 久久久久国产精品麻豆ai换脸| 亚洲一区在线电影| 在线观看亚洲精品| 亚洲欧美日韩小说| 91在线观看视频| 亚洲色欲色欲www在线观看| 国产成人av一区| 日本一区二区三区国色天香| 国产精品一区在线| 久久综合精品国产一区二区三区| 麻豆freexxxx性91精品| 这里只有精品免费| 日本va欧美va欧美va精品| 538在线一区二区精品国产| 亚洲成在人线免费| 91精品国产入口| 全国精品久久少妇| 精品久久免费看| 国产精品中文欧美| 中文字幕一区二区在线观看| 波多野结衣亚洲一区| 最新热久久免费视频| 91精品办公室少妇高潮对白| 亚洲综合在线观看视频| 欧美日韩一区在线| 免费不卡在线视频| 国产婷婷色一区二区三区在线| 国产成人av一区二区三区在线| 国产欧美在线观看一区| k8久久久一区二区三区| 亚洲黄色小视频| 欧美精品 日韩| 国产在线不卡一区| 国产精品二三区| 在线亚洲一区观看| 看电影不卡的网站| 国产精品丝袜一区| 欧美卡1卡2卡| 国产aⅴ精品一区二区三区色成熟| 中文字幕在线观看一区二区| 在线亚洲欧美专区二区| 日韩不卡免费视频| 国产精品国产三级国产普通话99| 色视频欧美一区二区三区| 美女看a上一区| 中文字幕日本乱码精品影院| 91精品国产综合久久福利软件| 国产成人精品影院| 日韩电影免费在线观看网站| 国产日韩欧美精品一区| 欧美日本一道本| 成人动漫一区二区在线| 日韩电影在线一区| 亚洲男帅同性gay1069| 欧美一级午夜免费电影| 91免费国产视频网站| 国产自产v一区二区三区c| 亚洲精品国久久99热| 久久久久久久久久电影| 欧美日韩1区2区| 色婷婷国产精品| 岛国精品在线播放| 久久国产精品第一页| 亚洲国产中文字幕在线视频综合| 国产午夜亚洲精品羞羞网站| 91麻豆精品久久久久蜜臀 | 麻豆国产一区二区| 一区二区三区欧美日韩| 国产香蕉久久精品综合网| 日韩视频一区在线观看| 欧美色电影在线| 色婷婷综合激情| 99视频一区二区| av不卡免费电影| 国产乱码精品一区二区三| 日韩av电影天堂| 亚洲国产视频在线| 亚洲一区二区偷拍精品| ...中文天堂在线一区| 中文字幕第一区第二区| 国产午夜亚洲精品羞羞网站| 精品欧美一区二区三区精品久久| 欧美日韩视频在线第一区| 色女孩综合影院| 99国产精品久久久久久久久久| 国产不卡在线一区| 国产精品一区久久久久| 国产麻豆视频精品| 国产毛片精品视频| 国产在线视频一区二区| 国产精品一区三区| 成人av电影免费在线播放| 成人精品一区二区三区中文字幕 | 亚洲欧美一区二区三区久本道91| 国产欧美日韩在线| 中文字幕乱码亚洲精品一区| 国产精品区一区二区三区| 亚洲欧美视频在线观看视频| 亚洲视频每日更新| 亚洲国产精品久久久久秋霞影院| 午夜精品aaa| 蜜臀av性久久久久蜜臀aⅴ四虎| 天天爽夜夜爽夜夜爽精品视频| 日韩国产一二三区| 韩国视频一区二区| 高清视频一区二区| 在线一区二区观看| 欧美一区日本一区韩国一区| 精品国产自在久精品国产| 久久久亚洲国产美女国产盗摄| 中文字幕va一区二区三区| 亚洲日本电影在线| 婷婷开心激情综合| 国产制服丝袜一区| 色哟哟精品一区| 欧美一区二区免费视频| 欧美激情中文字幕| 亚洲chinese男男1069| 精品亚洲国内自在自线福利| 成人黄色av网站在线| 欧美日韩在线电影| 国产欧美精品一区二区三区四区| 成人欧美一区二区三区视频网页| 亚洲欧洲综合另类在线| 日韩av在线发布| 成人av在线一区二区三区| 欧美日韩精品电影| 中文子幕无线码一区tr | 欧美一二三四区在线| 国产欧美一区视频| 亚洲1区2区3区视频| 不卡免费追剧大全电视剧网站| 欧美美女网站色| 国产精品黄色在线观看| 美女在线观看视频一区二区| 日本黄色一区二区|