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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? sbulkpnp.c

?? s3c2440的usb驅(qū)動代碼
?? 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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91成人在线精品| 国产乱色国产精品免费视频| 91在线无精精品入口| 亚洲图片激情小说| 色婷婷av一区二区三区之一色屋| 亚洲乱码国产乱码精品精98午夜| 91在线国内视频| 亚洲国产成人91porn| 欧美高清视频一二三区 | 制服视频三区第一页精品| 偷拍亚洲欧洲综合| 欧美成人r级一区二区三区| 免费在线看成人av| 国产欧美久久久精品影院| 99久久国产免费看| 亚洲成人第一页| 久久精品视频网| 99精品黄色片免费大全| 亚洲一区在线播放| 亚洲精品一区在线观看| 99精品久久只有精品| 亚洲成a天堂v人片| 国产日韩欧美麻豆| 欧美日韩美女一区二区| 国产精品白丝jk黑袜喷水| 综合在线观看色| 欧美一区二区免费观在线| 成人免费福利片| 日韩精品亚洲专区| 国产精品色噜噜| 欧美一区二区三区在线电影| 成人一级视频在线观看| 亚洲二区在线视频| 国产女人aaa级久久久级| 欧美日韩久久不卡| 欧美一卡二卡在线| 成人免费毛片a| 免费观看一级特黄欧美大片| 国产精品久久久久毛片软件| 欧美精品亚洲一区二区在线播放| 懂色av一区二区三区免费观看| 午夜av一区二区三区| 欧美国产乱子伦 | 久久精品视频网| 欧美日产在线观看| 成人午夜电影网站| 麻豆久久一区二区| 亚洲综合无码一区二区| 欧美激情艳妇裸体舞| 日韩美女视频在线| 欧美日韩视频在线一区二区| 成人app网站| 精品亚洲成av人在线观看| 亚洲综合色丁香婷婷六月图片| 中文字幕av一区二区三区高 | 不卡区在线中文字幕| 九色综合狠狠综合久久| 亚洲第一av色| 一个色综合av| 亚洲欧美日韩小说| 亚洲欧洲无码一区二区三区| 久久午夜国产精品| 久久男人中文字幕资源站| 欧美mv日韩mv亚洲| 日韩一区国产二区欧美三区| 欧美色男人天堂| 欧美日韩在线三区| 欧美日韩一区二区三区高清| 色综合咪咪久久| 色婷婷精品大视频在线蜜桃视频| 99精品视频在线观看免费| 国产sm精品调教视频网站| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 91精品国产手机| 在线不卡的av| 在线播放视频一区| 欧美三级蜜桃2在线观看| 欧美主播一区二区三区美女| 91久久国产最好的精华液| 91网站最新网址| 91久久香蕉国产日韩欧美9色| 99国产精品久久久久久久久久| 91小宝寻花一区二区三区| 91蜜桃在线观看| 91久久精品一区二区二区| 欧美日韩在线播| 91精品国产一区二区三区香蕉| 欧美一级久久久| 精品动漫一区二区三区在线观看| 精品国产露脸精彩对白| 国产三级三级三级精品8ⅰ区| 国产性天天综合网| 综合在线观看色| 亚洲1区2区3区视频| 久久精品99国产精品| 国产一区二区在线看| av中文字幕亚洲| 欧美日韩一卡二卡| 精品不卡在线视频| 亚洲国产成人自拍| 亚洲国产你懂的| 久久国产精品色婷婷| 99视频精品在线| 欧美日韩免费一区二区三区视频| 69久久夜色精品国产69蝌蚪网| 欧美精品一区二区久久婷婷| 欧美韩日一区二区三区| 亚洲国产日韩a在线播放| 久草精品在线观看| 色婷婷精品大在线视频| 欧美一区二区免费| 亚洲婷婷综合久久一本伊一区| 亚洲第一av色| 国产成人av在线影院| 欧美在线观看18| 久久这里只有精品6| 中文字幕亚洲一区二区av在线| 午夜免费欧美电影| 成人一区在线观看| 在线不卡欧美精品一区二区三区| 久久久国产精华| 亚洲成人第一页| 成人av集中营| 欧美电影免费观看高清完整版在 | 亚洲国产中文字幕在线视频综合| 精品一区二区精品| 欧美在线短视频| 中文欧美字幕免费| 免费观看91视频大全| 91蜜桃婷婷狠狠久久综合9色| 欧美不卡一区二区三区| 亚洲综合在线观看视频| 精品一区二区三区视频在线观看 | 国产电影精品久久禁18| 欧美日韩亚洲综合在线| 国产精品国产三级国产aⅴ入口 | 偷偷要91色婷婷| 91捆绑美女网站| 久久综合久久久久88| 日韩和欧美一区二区| 色综合 综合色| 欧美国产亚洲另类动漫| 国产一区在线观看视频| 日韩一区二区电影网| 亚洲va天堂va国产va久| 在线一区二区视频| 亚洲欧洲日韩在线| 国产成人aaaa| 久久午夜电影网| 精品一区二区三区蜜桃| 欧美一区二区三区不卡| 午夜久久福利影院| 91成人在线观看喷潮| 亚洲欧美日韩久久| youjizz国产精品| 国产精品嫩草99a| 成人免费高清在线| 一区精品在线播放| 99精品久久久久久| 亚洲欧美一区二区视频| 99国内精品久久| 亚洲精品自拍动漫在线| 色综合久久88色综合天天6| 亚洲视频一二区| 色哟哟在线观看一区二区三区| 一区二区中文视频| 色网站国产精品| 一区二区三区欧美激情| 在线观看视频欧美| 天天亚洲美女在线视频| 在线综合亚洲欧美在线视频| 日日骚欧美日韩| 欧美一区二区高清| 国产专区综合网| 国产精品色婷婷久久58| 99久久精品免费| 亚洲国产精品久久人人爱蜜臀| 欧美性色综合网| 麻豆一区二区99久久久久| 久久综合久久99| av网站一区二区三区| 亚洲天堂a在线| 欧美日韩一区二区三区不卡| 秋霞国产午夜精品免费视频| 久久只精品国产| 99国产欧美另类久久久精品| 亚洲国产精品久久不卡毛片| 欧美一区二区三区免费| 国产激情91久久精品导航| 亚洲天堂网中文字| 欧美日韩国产高清一区| 极品尤物av久久免费看| 国产精品水嫩水嫩| 欧美性三三影院| 国产一区二区三区观看| 中文字幕一区不卡| 91精品在线免费| 成人精品在线视频观看| 亚洲va韩国va欧美va| 久久蜜桃香蕉精品一区二区三区|