亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
婷婷丁香久久五月婷婷| 91成人免费网站| 日本黄色一区二区| 久久综合九色综合久久久精品综合| 亚洲视频你懂的| 免费观看成人鲁鲁鲁鲁鲁视频| 一本在线高清不卡dvd| 久久久久久久久久看片| 亚洲成精国产精品女| 99免费精品在线观看| www成人在线观看| 日韩制服丝袜先锋影音| 一本久道久久综合中文字幕| 中文字幕av不卡| 国产一区二区三区免费看 | av综合在线播放| 久久―日本道色综合久久| 日本欧美一区二区三区| 欧美性大战久久| 亚洲欧美日本韩国| 99久久夜色精品国产网站| 久久精品人人做人人爽97| 激情综合五月婷婷| 日韩一区二区三区三四区视频在线观看| 亚洲影院久久精品| 在线观看日韩高清av| 亚洲美女淫视频| 日本高清免费不卡视频| 亚洲视频 欧洲视频| 99久久精品情趣| 亚洲人精品午夜| 日本伦理一区二区| 一区av在线播放| 欧美男女性生活在线直播观看| 亚洲va国产天堂va久久en| 欧美精品久久99| 久久精品国产99国产| 26uuu国产电影一区二区| 国产一区二区三区观看| 久久精品一区二区三区四区| 国产91精品欧美| 亚洲图片你懂的| 日本精品一区二区三区高清 | 亚洲欧美日韩国产手机在线| 一本久道中文字幕精品亚洲嫩| 一区二区三区四区五区视频在线观看| 91传媒视频在线播放| 亚洲.国产.中文慕字在线| 精品裸体舞一区二区三区| 国产成人免费在线| 国产精品久久久久久久久果冻传媒| av男人天堂一区| 亚洲图片一区二区| 日韩欧美一区电影| 国产成人av电影免费在线观看| 18欧美亚洲精品| 欧美日韩国产成人在线免费| 国产在线精品一区二区夜色| 1区2区3区精品视频| 制服丝袜中文字幕亚洲| 国产一区二区三区免费看| 亚洲卡通欧美制服中文| 欧美一区二区视频观看视频| 国产精品99久久久久久久vr| 亚洲黄色av一区| 精品久久免费看| 一本到三区不卡视频| 另类小说欧美激情| 亚洲免费在线看| 日韩精品一区二区三区视频播放 | 91麻豆精品一区二区三区| 亚洲18女电影在线观看| 国产欧美精品一区二区色综合朱莉 | 欧美亚洲精品一区| 韩国午夜理伦三级不卡影院| 亚洲精品videosex极品| 精品国产在天天线2019| 91一区二区三区在线观看| 日本欧美肥老太交大片| 国产精品家庭影院| 欧美成人一区二区三区片免费 | a美女胸又www黄视频久久| 久久精品国产77777蜜臀| 亚洲精品乱码久久久久久| 欧美一级xxx| 在线看不卡av| yourporn久久国产精品| 精品亚洲国内自在自线福利| 一区二区久久久久久| 国产精品丝袜91| 国产夜色精品一区二区av| 4438亚洲最大| 欧美日韩一区二区三区四区| 97精品久久久久中文字幕| 国产美女视频91| 久久精品国产第一区二区三区| 亚洲一级二级三级| 综合色中文字幕| 国产精品你懂的在线| 久久奇米777| 久久久久亚洲蜜桃| 精品91自产拍在线观看一区| 欧美一区三区二区| 欧美日韩综合色| 一本一道综合狠狠老| 99麻豆久久久国产精品免费优播| 国产成人aaa| 欧美美女直播网站| 欧美最猛黑人xxxxx猛交| 一本高清dvd不卡在线观看| 成人小视频在线| 成人在线视频一区二区| 国产成人三级在线观看| 国产v日产∨综合v精品视频| 国产成人午夜精品影院观看视频| 国产美女精品在线| 国产·精品毛片| 99麻豆久久久国产精品免费优播| 99re亚洲国产精品| 99re热这里只有精品视频| 91免费观看视频| 日本韩国视频一区二区| 欧美亚洲一区三区| 欧美精品在线观看一区二区| 欧美三级视频在线播放| 欧美日韩国产免费| 日韩一区二区精品在线观看| 26uuu色噜噜精品一区二区| 精品国产电影一区二区| 国产欧美精品一区二区三区四区 | 在线观看三级视频欧美| 欧美亚洲综合在线| 日韩视频一区二区| 久久久久久免费| 综合欧美一区二区三区| 亚洲国产一区视频| 看片的网站亚洲| 成人黄色软件下载| 欧美性生活一区| 欧美xxxx在线观看| 国产精品美女久久久久久2018| 国产精品91一区二区| 99精品偷自拍| 这里只有精品视频在线观看| 国产性天天综合网| 亚洲精品亚洲人成人网在线播放| 无码av免费一区二区三区试看 | 欧美日本在线播放| 久久久久久久久久久久电影| 亚洲欧美日韩系列| 久久精品国产在热久久| 色悠悠久久综合| 欧美本精品男人aⅴ天堂| 综合欧美一区二区三区| 久久精品国内一区二区三区| 色综合天天综合在线视频| 日韩欧美国产午夜精品| 亚洲精品一二三四区| 国产一区中文字幕| 欧美日韩一二三区| 国产亚洲成aⅴ人片在线观看| 亚洲午夜影视影院在线观看| 国产成+人+日韩+欧美+亚洲 | 在线中文字幕一区| 久久综合中文字幕| 天天射综合影视| 91麻豆高清视频| 国产喂奶挤奶一区二区三区| 人人精品人人爱| 日本丶国产丶欧美色综合| 26uuuu精品一区二区| 日韩国产精品久久久久久亚洲| 99久久久精品| 久久精品男人天堂av| 另类综合日韩欧美亚洲| 欧美日韩精品欧美日韩精品| 一区二区中文视频| 国产成人综合自拍| 日韩精品一区二区三区视频在线观看 | 中文字幕中文字幕在线一区| 久久99精品国产麻豆婷婷 | 日本精品视频一区二区| 国产精品五月天| 高清不卡在线观看av| 26uuu国产电影一区二区| 美女性感视频久久| 91精品综合久久久久久| 亚洲一区二区黄色| 日本电影欧美片| 一区二区三区四区中文字幕| 99视频精品在线| 国产精品久久久久久久久免费相片| 国内一区二区在线| 欧美成人欧美edvon| 久久av老司机精品网站导航| 欧美一区二区三区四区高清| 免费观看日韩电影| 日韩免费电影一区| 精品亚洲aⅴ乱码一区二区三区| 日韩精品一区二区三区视频|