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

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

?? bulkpnp.c

?? s3c2440開發(fā)板的usb驅(qū)動(dòng)程序經(jīng)過測(cè)試完全適用
?? C
?? 第 1 頁 / 共 3 頁
字號(hào):
            BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPnPIrp() IRP_MN_CANCEL_REMOVE_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->RemoveDeviceRequested = FALSE;
        Irp->IoStatus.Status = STATUS_SUCCESS;

        break; // end, case IRP_MN_CANCEL_REMOVE_DEVICE

    case IRP_MN_SURPRISE_REMOVAL:
        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPnPIrp() IRP_MN_SURPRISE_REMOVAL\n"));

        // For a surprise-style device removal ( i.e. sudden cord yank ),
        // the physical device has already been removed so the PnP Manager sends
        // the remove IRP without a prior query-remove. A device can be in any state
        // when it receives a remove IRP as a result of a surprise-style removal.

        // match the inc at the begining of the dispatch routine
        BulkUsb_DecrementIoCount(DeviceObject);

        //
        // Once DeviceRemoved is set no new IOCTL or read/write irps will be passed
        // down the stack to lower drivers; all will be quickly failed
        //
        deviceExtension->DeviceRemoved = TRUE;

        // Cancel any pending io requests; we may not have gotten a query first!
        BulkUsb_CancelPendingIo( DeviceObject );

        // If any pipes are still open, call USBD with URB_FUNCTION_ABORT_PIPE
        // This call will also close the pipes; if any user close calls get through,
        // they will be noops
        BulkUsb_AbortPipes( DeviceObject );

        //
        // Mark this handled
        //
        Irp->IoStatus.Status = STATUS_SUCCESS;

        // We don't explicitly wait for the below driver to complete, but just make
        // the call and go on, finishing cleanup
        IoCopyCurrentIrpStackLocationToNext(Irp);

        ntStatus = IoCallDriver(stackDeviceObject,
                                Irp);

        return ntStatus;

    case IRP_MN_REMOVE_DEVICE:

        // The PnP Manager uses this IRP to direct drivers to remove a device.
        // For a "polite" device removal, the PnP Manager sends an
        // IRP_MN_QUERY_REMOVE_DEVICE prior to the remove IRP. In this case,
        // the device is in the remove-pending state when the remove IRP arrives.
        // For a surprise-style device removal ( i.e. sudden cord yank ),
        // the physical device has already been removed and the PnP Manager may not
        //  have sent IRP_MN_SURPRISE_REMOVAL. A device can be in any state
        // when it receives a remove IRP as a result of a surprise-style removal.

        // match the inc at the begining of the dispatch routine
        BulkUsb_DecrementIoCount(DeviceObject);

        //
        // Once DeviceRemoved is set no new IOCTL or read/write irps will be passed
        // down the stack to lower drivers; all will be quickly failed
        //
        deviceExtension->DeviceRemoved = TRUE;

        // Cancel any pending io requests; we may not have gotten a query first!
        BulkUsb_CancelPendingIo( DeviceObject );

        // If any pipes are still open, call USBD with URB_FUNCTION_ABORT_PIPE
        // This call will also close the pipes; if any user close calls get through,
        // they will be noops
        BulkUsb_AbortPipes( DeviceObject );

        // We don't explicitly wait for the below driver to complete, but just make
        // the call and go on, finishing cleanup
        IoCopyCurrentIrpStackLocationToNext(Irp);

        ntStatus = IoCallDriver(stackDeviceObject,
                                Irp);
        //
        // The final decrement to device extension PendingIoCount == 0
                // will set deviceExtension->RemoveEvent, enabling device removal.
                // If there is no pending IO at this point, the below decrement will be it.
        //
        BulkUsb_DecrementIoCount(DeviceObject);


        // wait for any io request pending in our driver to
        // complete for finishing the remove

        KeWaitForSingleObject(
                    &deviceExtension->RemoveEvent,
                    Suspended,
                    KernelMode,
                    FALSE,
                    NULL);

        //
        // Delete the link and FDO we created
        //
        BulkUsb_RemoveDevice(DeviceObject);


        BULKUSB_KdPrint( DBGLVL_DEFAULT,("BulkUsb_ProcessPnPIrp() Detaching from %08X\n",
                         deviceExtension->TopOfStackDeviceObject));

        IoDetachDevice(deviceExtension->TopOfStackDeviceObject);

        BULKUSB_KdPrint( DBGLVL_DEFAULT,("BulkUsb_ProcessPnPIrp() Deleting %08X\n",
                         DeviceObject));

        IoDeleteDevice (DeviceObject);

        return ntStatus; // end, case IRP_MN_REMOVE_DEVICE


    default:

        //
        // In this case we must not touch the status. As ntstatus is
        // STATUS_SUCCESS, we will skip the failure case and pass down the IRP
        // untouched.
        //
        BULKUSB_KdPrint( DBGLVL_MAXIMUM,("BulkUsb_ProcessPnPIrp() Minor PnP IOCTL not handled\n"));
    } /* case MinorFunction  */


    if (!NT_SUCCESS(ntStatus)) {

        // if anything went wrong, return failure  without passing Irp down
        Irp->IoStatus.Status = ntStatus;
        IoCompleteRequest (Irp,
                                           IO_NO_INCREMENT
                                           );

        BulkUsb_DecrementIoCount(DeviceObject);

        BULKUSB_KdPrint( DBGLVL_MAXIMUM,("BulkUsb_ProcessPnPIrp() Exit BulkUsb_ProcessPnPIrp FAILURE %x\n", ntStatus));
        return ntStatus;
    }

    IoCopyCurrentIrpStackLocationToNext(Irp);

    //
    // All PNP_POWER messages get passed to the TopOfStackDeviceObject
    // we were given in PnPAddDevice
    //

    BULKUSB_KdPrint( DBGLVL_MAXIMUM,("BulkUsb_ProcessPnPIrp() Passing PnP Irp down, status = %x\n", ntStatus));

    ntStatus = IoCallDriver(stackDeviceObject,
                            Irp);

    BulkUsb_DecrementIoCount(DeviceObject);

    BULKUSB_KdPrint( DBGLVL_MAXIMUM,("BulkUsb_ProcessPnPIrp() Exit BulkUsb_ProcessPnPIrp %x\n", ntStatus));

    return ntStatus;
}


NTSTATUS
BulkUsb_PnPAddDevice(
    IN PDRIVER_OBJECT DriverObject,
    IN PDEVICE_OBJECT PhysicalDeviceObject
    )
/*++

Routine Description:

    This routine is called to create and initialize our Functional Device Object (FDO).
    For monolithic drivers, this is done in DriverEntry(), but Plug and Play devices
    wait for a PnP event

Arguments:

    DriverObject - pointer to the driver object for this instance of BulkUsb

    PhysicalDeviceObject - pointer to a device object created by the bus

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS                ntStatus = STATUS_SUCCESS;
    PDEVICE_OBJECT          deviceObject = NULL;
    PDEVICE_EXTENSION       deviceExtension;
    USBD_VERSION_INFORMATION versionInformation;
    ULONG i;



    BULKUSB_KdPrint( DBGLVL_DEFAULT,("enter BulkUsb_PnPAddDevice()\n"));

    //
    // create our funtional device object (FDO)
    //

    ntStatus =
        BulkUsb_CreateDeviceObject(DriverObject, PhysicalDeviceObject, &deviceObject);

    if (NT_SUCCESS(ntStatus)) {
        deviceExtension = deviceObject->DeviceExtension;

        //
        // we support direct io for read/write
        //
        deviceObject->Flags |= DO_DIRECT_IO;


        //Set this flag causes the driver to not receive a IRP_MN_STOP_DEVICE
        //during suspend and also not get an IRP_MN_START_DEVICE during resume.
        //This is neccesary because during the start device call,
        // the GetDescriptors() call  will be failed by the USB stack.
        deviceObject->Flags |= DO_POWER_PAGABLE;

        // initialize our device extension
        //
        // remember the Physical device Object
        //
        deviceExtension->PhysicalDeviceObject=PhysicalDeviceObject;

        //
        // Attach to the PDO
        //

        deviceExtension->TopOfStackDeviceObject =
            IoAttachDeviceToDeviceStack(deviceObject, PhysicalDeviceObject);

        // Get a copy of the physical device's capabilities into a
        // DEVICE_CAPABILITIES struct in our device extension;
        // We are most interested in learning which system power states
        // are to be mapped to which device power states for handling
        // IRP_MJ_SET_POWER Irps.
        BulkUsb_QueryCapabilities(deviceExtension->TopOfStackDeviceObject,
                                 &deviceExtension->DeviceCapabilities);


                // We want to determine what level to auto-powerdown to; This is the lowest
                //  sleeping level that is LESS than D3;
                // If all are set to D3, auto powerdown/powerup will be disabled.

        deviceExtension->PowerDownLevel = PowerDeviceUnspecified; // init to disabled
        for (i=PowerSystemSleeping1; i<= PowerSystemSleeping3; i++) {

                        if ( deviceExtension->DeviceCapabilities.DeviceState[i] < PowerDeviceD3 )
                                deviceExtension->PowerDownLevel = deviceExtension->DeviceCapabilities.DeviceState[i];
        }

#if DBG

        // May want override auto power-down level from registry;
        // ( CurrentControlSet\Services\BulkUsb\Parameters )
                // Setting to 0 or 1 in registry disables auto power-down
        BulkUsb_GetRegistryDword( BULKUSB_REGISTRY_PARAMETERS_PATH,
                                         L"PowerDownLevel",
                                         &(deviceExtension->PowerDownLevel) );



        //
        // display the device  caps
        //

        BULKUSB_KdPrint( DBGLVL_MEDIUM,(" >>>>>> DeviceCaps\n"));
        BULKUSB_KdPrint( DBGLVL_MEDIUM,(" SystemWake = %s\n",
            BULKUSB_StringForSysState( deviceExtension->DeviceCapabilities.SystemWake ) ));
        BULKUSB_KdPrint( DBGLVL_MEDIUM,(" DeviceWake = %s\n",
            BULKUSB_StringForDevState( deviceExtension->DeviceCapabilities.DeviceWake) ));

        for (i=PowerSystemUnspecified; i< PowerSystemMaximum; i++) {

            BULKUSB_KdPrint( DBGLVL_MEDIUM,(" Device State Map: sysstate %s = devstate %s\n",
                 BULKUSB_StringForSysState( i ),
                 BULKUSB_StringForDevState( deviceExtension->DeviceCapabilities.DeviceState[i] ) ));
        }
        BULKUSB_KdPrint( DBGLVL_MEDIUM,(" <<<<<<<<DeviceCaps\n"));
#endif
        // We keep a pending IO count ( extension->PendingIoCount )  in the device extension.
        // The first increment of this count is done on adding the device.
        // Subsequently, the count is incremented for each new IRP received and
        // decremented when each IRP is completed or passed on.

        // Transition to 'one' therefore indicates no IO is pending and signals
        // deviceExtension->NoPendingIoEvent. This is needed for processing
        // IRP_MN_QUERY_REMOVE_DEVICE

        // Transition to 'zero' signals an event ( deviceExtension->RemoveEvent )
        // to enable device removal. This is used in processing for IRP_MN_REMOVE_DEVICE
        //
        BulkUsb_IncrementIoCount(deviceObject);

    }

    USBD_GetUSBDIVersion(&versionInformation);



    if( NT_SUCCESS( ntStatus ) )
    {
        NTSTATUS actStat;
        // try to power down device until IO actually requested
        actStat = BulkUsb_SelfSuspendOrActivate( deviceObject, TRUE );

        deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
    }


    BULKUSB_KdPrint( DBGLVL_DEFAULT,("exit BulkUsb_PnPAddDevice() (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩激情一区| www欧美成人18+| 国产一区不卡视频| 一级中文字幕一区二区| 精品精品国产高清a毛片牛牛| 成人美女视频在线观看18| 日韩高清在线一区| 一区二区三区日韩| 国产女主播在线一区二区| 欧美一区二区三区视频| 日本电影亚洲天堂一区| 国产999精品久久久久久绿帽| 日韩精品午夜视频| 一区二区视频在线看| 欧美激情资源网| 久久精品免视看| 日韩欧美亚洲国产另类| 欧美精品日韩一本| 欧洲精品在线观看| 一本到高清视频免费精品| 国产精品白丝av| 极品美女销魂一区二区三区免费| 亚洲第一在线综合网站| 亚洲精品福利视频网站| 亚洲欧洲精品一区二区精品久久久 | 日韩女同互慰一区二区| 在线视频你懂得一区二区三区| 成人久久18免费网站麻豆| 国产在线视频精品一区| 激情综合网av| 精一区二区三区| 国模少妇一区二区三区| 精品一区二区三区免费| 久久精品久久久精品美女| 蜜臀久久99精品久久久画质超高清| 亚洲国产视频a| 亚洲一区在线视频观看| 亚洲成人动漫一区| 日韩国产欧美三级| 热久久国产精品| 久久国产精品色婷婷| 久久99久久久欧美国产| 精品一二三四在线| 国产成人av电影| 不卡的av中国片| 在线观看亚洲一区| 欧美巨大另类极品videosbest| 在线观看日产精品| 欧美福利电影网| 精品国产sm最大网站免费看| 精品久久人人做人人爰| 久久久久久久久岛国免费| 日本一区二区三区四区在线视频| 久久精品在这里| 国产精品白丝在线| 亚洲综合色视频| 久久精品国产一区二区| 国产成人免费视频| 91蜜桃在线免费视频| 欧美三级电影一区| 日韩精品一区国产麻豆| 久久久久亚洲综合| 国产精品久久久久一区| 亚洲成人免费av| 国产专区综合网| 91网站黄www| 3atv在线一区二区三区| 国产亚洲婷婷免费| 一区二区三区日本| 久久97超碰国产精品超碰| 成人av网站在线观看免费| 欧美日韩不卡在线| 精品国产网站在线观看| 国产精品乱码人人做人人爱| 亚洲小说欧美激情另类| 国产在线观看免费一区| 色综合一个色综合| 日韩一区二区三区电影在线观看 | 亚洲最大成人综合| 久久 天天综合| 91色综合久久久久婷婷| 欧美一区二区三区免费在线看| 国产亚洲精品资源在线26u| 亚洲色图丝袜美腿| 蜜桃视频第一区免费观看| aaa亚洲精品| 日韩午夜精品电影| 亚洲精品中文字幕在线观看| 久久成人羞羞网站| 色婷婷综合久久久中文一区二区 | 亚洲国产va精品久久久不卡综合| 激情五月播播久久久精品| 97se亚洲国产综合自在线不卡| 日韩亚洲国产中文字幕欧美| 最新不卡av在线| 韩国v欧美v日本v亚洲v| 欧美喷水一区二区| 亚洲欧美自拍偷拍| 国产精品资源站在线| 欧美色图12p| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 中文字幕精品一区二区精品绿巨人| 亚洲午夜久久久久| 风间由美一区二区av101| 欧美一区二区三区性视频| 亚洲天堂精品视频| 国产精品1024| 欧美一区二区二区| 亚洲国产综合在线| 国产欧美综合色| 毛片基地黄久久久久久天堂| 欧美日韩一区国产| 亚洲欧洲精品一区二区三区| 激情久久久久久久久久久久久久久久| 色诱视频网站一区| 中文字幕免费在线观看视频一区| 蜜乳av一区二区三区| 欧美亚洲综合色| 亚洲男人天堂av网| 99亚偷拍自图区亚洲| 欧美—级在线免费片| 国产一区在线观看视频| 日韩欧美aaaaaa| 久久国产精品色婷婷| 日韩一区二区三区高清免费看看| 亚洲第一精品在线| 欧美人妖巨大在线| 亚洲综合久久av| av不卡一区二区三区| 国产精品成人在线观看| 成人深夜在线观看| 国产欧美一区二区三区在线看蜜臀| 狠狠久久亚洲欧美| 精品国产亚洲在线| 国产精品亚洲一区二区三区在线 | 奇米精品一区二区三区四区| 色综合天天综合在线视频| 亚洲色图欧洲色图婷婷| 一本在线高清不卡dvd| 伊人性伊人情综合网| 欧美日韩在线播放一区| 亚洲成人激情综合网| 欧美一区二区黄| 久久99久久久久| 精品国产乱码久久久久久蜜臀| 久久国产综合精品| 久久九九99视频| www.欧美精品一二区| 亚洲少妇30p| 91久久精品一区二区| 亚洲国产日韩一级| 欧美一区二区性放荡片| 精品一区二区综合| 国产精品欧美极品| 91美女片黄在线观看91美女| 伊人夜夜躁av伊人久久| 7777女厕盗摄久久久| 国产在线精品一区二区夜色| 久久精品视频在线免费观看| av在线不卡免费看| 亚洲午夜精品一区二区三区他趣| 69精品人人人人| 国产成人啪免费观看软件 | 中文字幕永久在线不卡| 欧美伊人精品成人久久综合97| 视频在线观看一区| 久久这里都是精品| av高清久久久| 日本强好片久久久久久aaa| 久久久欧美精品sm网站| av一区二区三区在线| 性久久久久久久久久久久| 久久一区二区三区国产精品| 99久久精品情趣| 日韩av一区二区三区四区| 国产欧美综合在线观看第十页| 欧美自拍丝袜亚洲| 国产一区欧美一区| 一区二区三区在线不卡| 精品国产免费人成在线观看| 91女人视频在线观看| 看国产成人h片视频| 亚洲免费大片在线观看| 精品国产一区二区国模嫣然| 色婷婷综合久久久久中文一区二区 | 在线欧美日韩国产| 精品一区二区三区免费观看| 国产精品福利av| 欧美成人艳星乳罩| 色乱码一区二区三区88| 国产麻豆成人传媒免费观看| 亚洲一区二区三区三| 欧美国产综合一区二区| 欧美一级在线免费| 91麻豆高清视频| 国产不卡视频一区| 韩国成人福利片在线播放| 午夜精品久久久久影视| 国产精品理伦片| 欧美va亚洲va在线观看蝴蝶网|