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

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

?? isopnp.c

?? softusb for atmel avr
?? C
?? 第 1 頁 / 共 3 頁
字號:
	/*++

Copyright (c) 1997-1998  Microsoft Corporation

Module Name:

    IsoPnp.c 

Abstract:

    Isochronous 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

--*/


#include "wdm.h"
#include "stdarg.h"
#include "stdio.h"

#include "usbdi.h"
#include "usbdlib.h"
#include "Iso82930.h"



NTSTATUS
IsoUsb_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;
    UNICODE_STRING DeviceLinkUniCodeString;
    WCHAR DeviceLinkName[] = L"\\DosDevices\\AVR309USB_0";

    //
    // 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;

    ISOUSB_KdPrint( DBGLVL_MEDIUM, ( "enter IsoUsb_ProcessPnPIrp() IRP_MJ_PNP, minor %s\n",
        ISOUSB_StringForPnpMnFunc( irpStack->MinorFunction ) ));

	// inc the FDO device extension's pending IO count for this Irp
    IsoUsb_IncrementIoCount(DeviceObject);

    ISOUSB_ASSERT( IRP_MJ_PNP == irpStack->MajorFunction );

    switch (irpStack->MinorFunction) {
    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,
                               IsoUsb_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);
        }

        // 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 = IsoUsb_StartDevice(DeviceObject);
        Irp->IoStatus.Status = ntStatus;

		IoCompleteRequest (Irp,
						   IO_NO_INCREMENT
						   );

		IsoUsb_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
            ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_ProcessPnPIrp() IRP_MN_QUERY_STOP_DEVICE when device not started\n"));
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver (deviceExtension->TopOfStackDeviceObject, Irp);
            IsoUsb_DecrementIoCount(DeviceObject);

            return ntStatus;
        }


        // fail the request if we have any read/write IRPS pending
        if( deviceExtension->PendingIoCount > 1 ) {
            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;
             ntStatus = STATUS_SUCCESS;
        }
        Irp->IoStatus.Status = ntStatus;

        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
            ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_ProcessPnPIrp() IRP_MN_CANCEL_STOP_DEVICE when device not started\n"));
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver (deviceExtension->TopOfStackDeviceObject, Irp);
            IsoUsb_DecrementIoCount(DeviceObject);
            return ntStatus;
        }

		// Reset this flag so new IOCTL and IO Irp processing will be re-enabled
        deviceExtension->StopDeviceRequested = FALSE;
        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.


        //
        // 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 = IsoUsb_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
            ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_ProcessPnPIrp() IRP_MN_QUERY_STOP_DEVICE when device not started\n"));
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver (deviceExtension->TopOfStackDeviceObject, Irp);
            IsoUsb_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 = ntStatus;

        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
            ISOUSB_KdPrint( DBGLVL_MEDIUM,("IsoUsb_ProcessPnPIrp() IRP_MN_CANCEL_REMOVE_DEVICE when device not started\n"));

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产电影| 蜜桃视频一区二区| 久久一夜天堂av一区二区三区| 欧美日韩精品欧美日韩精品一| 色94色欧美sute亚洲线路一ni| av一区二区三区黑人| 成人av在线资源| 色噜噜夜夜夜综合网| 欧美少妇性性性| 日韩欧美视频在线| 久久精品一区八戒影视| 国产亚洲短视频| 亚洲蜜桃精久久久久久久| 亚洲国产综合在线| 理论电影国产精品| 成人动漫中文字幕| 欧美裸体bbwbbwbbw| 久久综合网色—综合色88| 成人欧美一区二区三区黑人麻豆| 亚洲bt欧美bt精品777| 久久99国产精品麻豆| 色悠悠久久综合| 精品噜噜噜噜久久久久久久久试看| 国产精品久久久久影院| 天堂成人免费av电影一区| 国产·精品毛片| 日韩一二在线观看| 亚洲精品中文字幕乱码三区| 久久99精品一区二区三区| 91国内精品野花午夜精品| 精品盗摄一区二区三区| 综合久久一区二区三区| 国产一区二区0| 日韩欧美国产一区二区三区 | 国产精品成人一区二区艾草 | 久久激五月天综合精品| 一本色道久久综合狠狠躁的推荐| 精品国产一区二区亚洲人成毛片| 亚洲自拍偷拍九九九| 成人h动漫精品| 国产亚洲欧美中文| 激情五月婷婷综合| 日韩午夜激情免费电影| 午夜视频在线观看一区二区三区| 3d成人动漫网站| 国产精品视频一二三区| 丁香婷婷综合色啪| 久久婷婷综合激情| 在线电影一区二区三区| 亚洲欧美另类小说| 波波电影院一区二区三区| 中文字幕 久热精品 视频在线| 国产一区二区三区高清播放| 久久伊人蜜桃av一区二区| 国产不卡在线视频| 综合网在线视频| 在线这里只有精品| 婷婷久久综合九色国产成人| 欧美精品三级日韩久久| 免费国产亚洲视频| 久久精品亚洲国产奇米99| 94色蜜桃网一区二区三区| 一个色在线综合| 欧美变态凌虐bdsm| 99re热视频精品| 日韩高清一级片| 欧美大白屁股肥臀xxxxxx| 开心九九激情九九欧美日韩精美视频电影| 日韩一区二区三区精品视频| 国产成人在线观看| 亚洲一区二区三区免费视频| 日韩久久久精品| 色哟哟欧美精品| 久久国产福利国产秒拍| 亚洲免费观看高清完整版在线观看| 在线中文字幕一区二区| 国内精品视频一区二区三区八戒 | 亚洲不卡一区二区三区| 欧美一级久久久久久久大片| 99久久婷婷国产| 国产超碰在线一区| 奇米影视7777精品一区二区| 亚洲乱码国产乱码精品精小说 | 国产精品久久久久一区二区三区 | 国产无遮挡一区二区三区毛片日本| 色欧美乱欧美15图片| 国产成人av在线影院| 狠狠色丁香久久婷婷综合_中| 美女脱光内衣内裤视频久久影院| 制服.丝袜.亚洲.另类.中文| 蜜桃精品视频在线| 日本一区二区三区在线不卡| 国产盗摄一区二区三区| 亚洲黄色小视频| 欧美电视剧在线观看完整版| 国产成人免费xxxxxxxx| 亚洲乱码日产精品bd| 国产无遮挡一区二区三区毛片日本| 欧美精品1区2区| 91亚洲精品久久久蜜桃| 国产999精品久久| 国产一区二区影院| 另类人妖一区二区av| 美国一区二区三区在线播放| 麻豆久久一区二区| 婷婷综合在线观看| 婷婷久久综合九色国产成人| 亚洲欧洲综合另类| 亚洲国产va精品久久久不卡综合| 国产精品网曝门| 亚洲欧美一区二区在线观看| 最新国产成人在线观看| 亚洲人成在线观看一区二区| 亚洲蜜桃精久久久久久久| 一区二区三区电影在线播| 亚洲国产中文字幕在线视频综合 | 国产激情一区二区三区四区| 成人综合婷婷国产精品久久蜜臀| 国产一区二区三区高清播放| 国产精品99久久不卡二区| 日本伊人色综合网| 成人午夜av在线| 欧美日韩国产另类一区| 欧美mv和日韩mv的网站| 国产精品免费视频观看| 亚洲精品免费在线观看| 日韩中文字幕av电影| 国产麻豆午夜三级精品| 97久久精品人人做人人爽| 欧美日韩精品一区二区三区| 久久久久亚洲蜜桃| 日产国产高清一区二区三区 | 日本一区二区三区在线不卡| 亚洲精品菠萝久久久久久久| 国产综合色精品一区二区三区| 色综合久久综合| 国产校园另类小说区| 午夜欧美视频在线观看| youjizz久久| 国产三级一区二区| 麻豆成人av在线| 欧美色综合天天久久综合精品| 国产午夜亚洲精品不卡| 亚洲一线二线三线视频| fc2成人免费人成在线观看播放| 日韩一区二区高清| 亚洲国产成人私人影院tom| 免费观看30秒视频久久| 激情综合色丁香一区二区| 在线观看亚洲精品视频| 亚洲欧美日韩系列| 成人高清视频在线| 亚洲国产电影在线观看| 国产精品12区| 久久久www成人免费毛片麻豆| 亚洲第一福利一区| 在线播放中文一区| 蜜桃在线一区二区三区| 欧美精品v日韩精品v韩国精品v| 一区二区三区欧美日| 精品污污网站免费看| 国产一区二区三区高清播放| 久久人人97超碰com| 国产二区国产一区在线观看| 国产亚洲短视频| 成人av资源下载| 一区二区三区91| 欧美一三区三区四区免费在线看 | 久久亚洲捆绑美女| 成人一道本在线| 亚洲男同性恋视频| 欧美日韩一区视频| 夜夜嗨av一区二区三区中文字幕| 99这里都是精品| 中文字幕一区二区三区在线观看| 97久久超碰国产精品| 亚洲午夜激情网页| 欧美电影免费提供在线观看| 成人中文字幕在线| 午夜欧美在线一二页| 久久久精品人体av艺术| 色综合色狠狠综合色| 久久国内精品自在自线400部| 1024亚洲合集| 精品美女在线播放| 91九色02白丝porn| 国产99久久久精品| 日本午夜精品视频在线观看| 国产精品第四页| 欧美一二三区在线观看| 在线区一区二视频| 国产成人精品一区二| 天堂va蜜桃一区二区三区| 国产精品网站在线播放| 欧美成人bangbros| 日韩欧美一二区| 色偷偷88欧美精品久久久| 国产电影一区二区三区| 国内精品久久久久影院薰衣草 | 婷婷综合在线观看|