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

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

?? sbulkpnp.c

?? linux環境下USB驅動程序,適用三星ARM2410B
?? 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一区二区三区免费野_久草精品视频
日韩影院免费视频| 国产精品欧美一级免费| 国产成人精品www牛牛影视| 国产精品福利一区| 日韩欧美在线综合网| 94-欧美-setu| 国产最新精品免费| 亚洲国产综合色| 国产精品色哟哟| 精品国产露脸精彩对白| 欧美美女视频在线观看| 99re这里只有精品首页| 国产大陆a不卡| 久久爱www久久做| 日韩中文字幕不卡| 亚洲欧美激情小说另类| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 欧洲人成人精品| 国产精品自拍一区| 精品在线观看免费| 日韩av一二三| 国内偷窥港台综合视频在线播放| 亚洲高清免费视频| 亚洲裸体xxx| 亚洲色图欧洲色图婷婷| 国产精品久久久久影视| 国产午夜一区二区三区| 精品福利一区二区三区免费视频| 在线观看国产91| 日本精品一区二区三区高清| www.欧美日韩国产在线| 国产69精品久久99不卡| 国产精品66部| 国产ts人妖一区二区| 国产成人精品三级| 国产成人久久精品77777最新版本| 极品少妇一区二区| 精品一区二区三区久久久| 蜜臀av一级做a爰片久久| 日本不卡视频一二三区| 蜜臀av性久久久久av蜜臀妖精| 视频一区在线播放| 日韩高清一区在线| 久久精品72免费观看| 另类小说一区二区三区| 极品少妇xxxx精品少妇偷拍 | 91免费看片在线观看| 不卡电影免费在线播放一区| 国产一区二区不卡在线| 国产91精品免费| 99精品视频中文字幕| 色一情一乱一乱一91av| 精品视频在线免费看| 91精品国产综合久久香蕉麻豆| 91精品国产综合久久福利软件| 欧美一区二区福利视频| 欧美精品一区二区高清在线观看 | 久久精品一区二区三区四区| 国产网红主播福利一区二区| 国产日韩亚洲欧美综合| 亚洲天天做日日做天天谢日日欢 | 亚洲一区在线观看免费观看电影高清| 蜜桃一区二区三区在线观看| 色婷婷久久久久swag精品| 99精品偷自拍| 欧美日韩在线播放三区四区| 在线欧美日韩精品| 91精品国产免费| 久久影院电视剧免费观看| 国产精品无圣光一区二区| 中文字幕中文字幕在线一区| 亚洲国产日日夜夜| 激情成人综合网| 99综合影院在线| 欧美日韩精品二区第二页| 精品播放一区二区| 亚洲少妇30p| 六月丁香综合在线视频| 成人中文字幕电影| 欧美剧情片在线观看| 国产校园另类小说区| 亚洲午夜免费福利视频| 国产尤物一区二区| 日本精品裸体写真集在线观看 | 99视频有精品| 日韩欧美在线综合网| 国产欧美日韩在线| 亚洲综合色噜噜狠狠| 久久国产麻豆精品| 在线日韩国产精品| 国产亚洲婷婷免费| 调教+趴+乳夹+国产+精品| 国产成人日日夜夜| 欧美二区三区的天堂| 中文字幕av资源一区| 青青草国产精品97视觉盛宴| 91小宝寻花一区二区三区| 欧美zozozo| 亚洲福利一二三区| 99久久久无码国产精品| 精品国产一区二区在线观看| 亚洲在线一区二区三区| 国产不卡视频在线观看| 日韩精品一区二区三区在线播放 | 久久久电影一区二区三区| 亚洲一级二级三级| 99久久99久久综合| 久久精品人人做| 麻豆视频观看网址久久| 欧美视频一二三区| 亚洲人成人一区二区在线观看| 天天综合天天综合色| 欧美精品一区二区精品网| 欧美日本在线观看| 国内精品第一页| 国产一区二区三区日韩| 国产suv精品一区二区6| 欧美一区二区不卡视频| 亚洲一区二区av电影| 91小视频在线| 国产精品卡一卡二| 国产乱码精品一区二区三区忘忧草| 欧美美女直播网站| 亚洲国产毛片aaaaa无费看| 色婷婷国产精品久久包臀| 国产精品水嫩水嫩| 国产成人精品免费在线| 久久久一区二区三区捆绑**| 久久精品国产精品亚洲红杏| 欧美精选午夜久久久乱码6080| 亚洲综合丝袜美腿| 欧洲激情一区二区| 亚洲国产综合色| 欧美精品少妇一区二区三区| 午夜精品福利久久久| 欧美日韩亚洲综合在线| 天堂影院一区二区| 在线不卡一区二区| 日本不卡视频一二三区| 黑人精品欧美一区二区蜜桃 | 中文字幕第一区第二区| 国产精华液一区二区三区| 久久婷婷国产综合国色天香| 久久99国产精品久久99果冻传媒| 日韩三级精品电影久久久| 美脚の诱脚舐め脚责91| 精品国产亚洲一区二区三区在线观看| 久久国产人妖系列| 久久免费的精品国产v∧| 国产伦精品一区二区三区免费迷| 国产日韩欧美不卡| 波波电影院一区二区三区| 亚洲日本在线看| 欧美日韩国产精品自在自线| 天堂久久久久va久久久久| 精品久久人人做人人爰| 久久99最新地址| 91成人在线观看喷潮| 亚洲一区二区三区四区在线观看| 欧美日韩国产综合草草| 九色porny丨国产精品| 中文字幕免费在线观看视频一区| 成人av资源网站| 午夜精品福利一区二区三区av| 日韩欧美亚洲一区二区| 成人免费观看视频| 亚洲国产日日夜夜| 久久久国产午夜精品| 欧洲另类一二三四区| 国内久久婷婷综合| 亚洲免费伊人电影| 欧美一卡2卡三卡4卡5免费| 国产精品亚洲成人| 亚洲一区欧美一区| av不卡在线观看| 亚洲国产精品麻豆| 久久久久久久久久看片| 色狠狠一区二区| 久久黄色级2电影| 亚洲女同一区二区| 欧美不卡视频一区| 欧美亚洲丝袜传媒另类| 国产伦精一区二区三区| 激情文学综合网| 久久先锋资源网| 欧美日韩在线播放一区| 丁香网亚洲国际| 日韩高清一级片| 中文字幕综合网| 亚洲精品一区在线观看| 欧美午夜电影网| 成人夜色视频网站在线观看| 日本成人在线看| 一区二区三区在线影院| 精品sm在线观看| 日韩午夜精品视频| 欧美专区在线观看一区| 成人免费高清在线| 精油按摩中文字幕久久| 午夜国产精品影院在线观看|