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

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

?? bulkpwr.c

?? 基于linux的s3c2410開發板usb驅動程序
?? C
?? 第 1 頁 / 共 3 頁
字號:
    deviceExtension =  DeviceObject->DeviceExtension;

    // This should have been reset in completion routine
    BULKUSB_ASSERT( !deviceExtension->SelfPowerIrp );

    if (  deviceExtension->CurrentDevicePowerState ==  PowerState.DeviceState )
        return STATUS_SUCCESS;  // nothing to do

    BULKUSB_KdPrint( DBGLVL_HIGH,("Enter BulkUsb_SelfRequestPowerIrp() will request power irp to state %s\n",
        BULKUSB_StringForDevState( PowerState.DeviceState )));

    BulkUsb_IncrementIoCount(DeviceObject);

        // flag we're handling a self-generated power irp
    deviceExtension->SelfPowerIrp = TRUE;

        // actually request the Irp
    ntStatus = PoRequestPowerIrp(deviceExtension->PhysicalDeviceObject,
                         IRP_MN_SET_POWER,
                         PowerState,
                         BulkUsb_PoSelfRequestCompletion,
                         DeviceObject,
                         NULL);


    if  ( ntStatus == STATUS_PENDING ) {
        // status pending is the return code we wanted

        // We only need to wait for completion if we're powering up
        if ( (ULONG) PowerState.DeviceState < deviceExtension->PowerDownLevel ) {

            NTSTATUS waitStatus;

            waitStatus = KeWaitForSingleObject(
                           &deviceExtension->SelfRequestedPowerIrpEvent,
                           Suspended,
                           KernelMode,
                           FALSE,
                           NULL);

        }

        ntStatus = STATUS_SUCCESS;

        deviceExtension->SelfPowerIrp = FALSE;

        BULKUSB_KdPrint( DBGLVL_HIGH, ("BulkUsb_SelfRequestPowerIrp() SUCCESS\n    IRP 0x%x to state %s\n",
            pIrp, BULKUSB_StringForDevState(PowerState.DeviceState) ));


    }
    else {
        // The return status was not STATUS_PENDING; any other codes must be considered in error here;
        //  i.e., it is not possible to get a STATUS_SUCCESS  or any other non-error return from this call;
        BULKUSB_KdPrint( DBGLVL_HIGH, ("BulkUsb_SelfRequestPowerIrp() to state %s FAILED, status = 0x%x\n",
            BULKUSB_StringForDevState( PowerState.DeviceState ),ntStatus));
    }

    return ntStatus;
}



NTSTATUS
BulkUsb_PoSelfRequestCompletion(
    IN PDEVICE_OBJECT       DeviceObject,
    IN UCHAR                MinorFunction,
    IN POWER_STATE          PowerState,
    IN PVOID                Context,
    IN PIO_STATUS_BLOCK     IoStatus
    )
/*++

Routine Description:

    This routine is called when the driver completes a self-originated power IRP
        that was generated by a call to BulkUsb_SelfSuspendOrActivate().
    We power down whenever the last pipe is closed and power up when the first pipe is opened.

    For power-up , we set an event in our FDO extension to signal this IRP done
    so the power request can be treated as a synchronous call.
    We need to know the device is powered up before opening the first pipe, for example.
    For power-down, we do not set the event, as no caller waits for powerdown complete.

Arguments:

    DeviceObject - Pointer to the device object for the class device. ( Physical Device Object )

    Context - Driver defined context, in this case our FDO ( functional device object )

Return Value:

    The function value is the final status from the operation.

--*/
{
    PDEVICE_OBJECT deviceObject = Context;
    PDEVICE_EXTENSION deviceExtension = deviceObject->DeviceExtension;
    NTSTATUS ntStatus = IoStatus->Status;

    // we should not be in the midst of handling a system-generated power irp
    BULKUSB_ASSERT( NULL == deviceExtension->PowerIrp );

    // We only need to set the event if we're powering up;
    // No caller waits on power down complete
    if ( (ULONG) PowerState.DeviceState < deviceExtension->PowerDownLevel ) {

        // Trigger Self-requested power irp completed event;
        //  The caller is waiting for completion
        KeSetEvent(&deviceExtension->SelfRequestedPowerIrpEvent, 1, FALSE);
    }

    BulkUsb_DecrementIoCount(deviceObject);

    BULKUSB_KdPrintCond( DBGLVL_HIGH, !NT_SUCCESS(ntStatus),("Exit BulkUsb_PoSelfRequestCompletion() FAILED, ntStatus = 0x%x\n", ntStatus ));

    return ntStatus;
}


BOOLEAN
BulkUsb_SetDevicePowerState(
    IN PDEVICE_OBJECT DeviceObject,
    IN DEVICE_POWER_STATE DeviceState
    )
/*++

Routine Description:

    This routine is called when An IRP_MN_SET_POWER of type 'DevicePowerState'
    has been received by BulkUsb_ProcessPowerIrp().


Arguments:

    DeviceObject - Pointer to the device object for the class device.

    DeviceState - Device specific power state to set the device in to.


Return Value:

    For requests to DeviceState D0 ( fully on ), returns TRUE to signal caller
    that we must set a completion routine and finish there.

--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PDEVICE_EXTENSION deviceExtension;
    BOOLEAN fRes = FALSE;

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

    switch (DeviceState) {
    case PowerDeviceD3:

        //
        // Device will be going OFF,
                // TODO: add any needed device-dependent code to save state here.
                //  ( We have nothing to do in this sample )
        //

        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_SetDevicePowerState() PowerDeviceD3 (OFF)\n"));

        deviceExtension->CurrentDevicePowerState = DeviceState;
        break;

    case PowerDeviceD1:
    case PowerDeviceD2:
        //
        // power states D1,D2 translate to USB suspend

        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_SetDevicePowerState()  %s\n",
            BULKUSB_StringForDevState(DeviceState) ));

        deviceExtension->CurrentDevicePowerState = DeviceState;
        break;

    case PowerDeviceD0:


        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_SetDevicePowerState() PowerDeviceD0 (ON)\n"));

        // We'll need to finish the rest in the completion routine;
        //   signal caller we're going to D0 and will need to set a completion routine
        fRes = TRUE;

        // Caller will pass on to PDO ( Physical Device object )
        break;

    default:

        BULKUSB_KdPrint( DBGLVL_MEDIUM,(" Bogus DeviceState = %x\n", DeviceState));
    }

    return fRes;
}



NTSTATUS
BulkUsb_QueryCapabilities(
    IN PDEVICE_OBJECT       LowerDeviceObject,
    IN PDEVICE_CAPABILITIES DeviceCapabilities
    )

/*++

Routine Description:

    This routine generates an internal IRP from this driver to the lower portion
    of the driver stack to obtain information on the Device Object's
    capabilities. We are most interested in learning which system power states
    are to be mapped to which device power states for honoring
    IRP_MJ_SET_POWER Irps.

    This is a blocking call which waits for the IRP completion routine
    to set an event on finishing.

Arguments:

    LowerDeviceObject        - DeviceObject beneath this driver in the stack.

Return Value:

    NTSTATUS value from the IoCallDriver() call.

--*/

{
    PIO_STACK_LOCATION nextStack;
    PIRP irp;
    NTSTATUS ntStatus;
    KEVENT event;


    // This is a DDK-defined DBG-only macro that ASSERTS we are not running pageable code
    // at higher than APC_LEVEL.
    PAGED_CODE();


    // Build an IRP for us to generate an internal query request to the PDO
    irp = IoAllocateIrp(LowerDeviceObject->StackSize, FALSE);

    if (!irp) {
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    //
    // Preinit the device capability structures appropriately.
    //
    RtlZeroMemory( DeviceCapabilities, sizeof(DEVICE_CAPABILITIES) );
    DeviceCapabilities->Size = sizeof(DEVICE_CAPABILITIES);
    DeviceCapabilities->Version = 1;
    DeviceCapabilities->Address = -1;
    DeviceCapabilities->UINumber = -1;
    
    //purnnamu:11/23/2001
    //DeviceCapabilities->Removable =1;
    //DeviceCapabilities->SurpriseRemovalOK=1;  
    

    // IoGetNextIrpStackLocation gives a higher level driver access to the next-lower
    // driver's I/O stack location in an IRP so the caller can set it up for the lower driver.
    nextStack = IoGetNextIrpStackLocation(irp);
    nextStack->MajorFunction= IRP_MJ_PNP;
    nextStack->MinorFunction= IRP_MN_QUERY_CAPABILITIES;

    // init an event to tell us when the completion routine's been called
    KeInitializeEvent(&event, NotificationEvent, FALSE);

    // Set a completion routine so it can signal our event when
    //  the next lower driver is done with the Irp
    IoSetCompletionRoutine(irp,
                           BulkUsb_IrpCompletionRoutine,
                           &event,  // pass the event as Context to completion routine
                           TRUE,    // invoke on success
                           TRUE,    // invoke on error
                           TRUE);   // invoke on cancellation of the Irp


    // set our pointer to the DEVICE_CAPABILITIES struct
    nextStack->Parameters.DeviceCapabilities.Capabilities = DeviceCapabilities;

    // preset the irp to report not supported
    irp->IoStatus.Status = STATUS_NOT_SUPPORTED;

    ntStatus = IoCallDriver(LowerDeviceObject,
                            irp);

    BULKUSB_KdPrint( DBGLVL_MEDIUM,(" BulkUsb_QueryCapabilities() ntStatus from IoCallDriver to PCI = 0x%x\n", ntStatus));

    if (ntStatus == STATUS_PENDING) {
       // wait for irp to complete

       KeWaitForSingleObject(
            &event,
            Suspended,
            KernelMode,
            FALSE,
            NULL);

       ntStatus = irp->IoStatus.Status;
    }

    // failed? this is probably a bug
    BULKUSB_KdPrintCond( DBGLVL_DEFAULT,(!NT_SUCCESS(ntStatus)), ("BulkUsb_QueryCapabilities() failed\n"));

    IoFreeIrp(irp);

    return ntStatus;
}








?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆自制传媒国产之光| 久久久久久久久免费| 欧美变态口味重另类| 中文字幕+乱码+中文字幕一区| 亚洲一区二区三区自拍| 国产一区二区三区日韩| 欧美视频一区二区在线观看| 国产精品视频一二三区| 蜜臀av亚洲一区中文字幕| 欧美性一区二区| 中文成人av在线| 奇米影视一区二区三区| 欧美制服丝袜第一页| 国产精品色一区二区三区| 久久精品国内一区二区三区| 欧美日韩三级在线| 亚洲欧美成aⅴ人在线观看| 国产精品乡下勾搭老头1| 日韩三级中文字幕| 五月天丁香久久| 在线免费观看成人短视频| 国产精品久久99| 成人综合在线观看| 国产女人aaa级久久久级| 国产美女主播视频一区| 精品免费99久久| 久久激情五月婷婷| 91精品国产高清一区二区三区 | 一本久道久久综合中文字幕| 国产欧美一区二区精品久导航| 国产在线精品一区二区三区不卡| 欧美一区二区视频在线观看2020| 视频一区视频二区中文| 欧美视频日韩视频| 亚洲国产精品视频| 91精品视频网| 蜜臀久久99精品久久久久宅男| 91精品国产色综合久久久蜜香臀| 午夜电影网一区| 欧美一二三区在线| 狠狠色狠狠色综合| 国产亚洲一区二区三区四区| 国产成人免费在线视频| 国产精品的网站| 在线视频观看一区| 日本欧美肥老太交大片| 欧美成人欧美edvon| 国产一区二区调教| 亚洲图片激情小说| 精品污污网站免费看| 麻豆免费精品视频| 日本一区二区久久| 在线视频你懂得一区| 奇米精品一区二区三区四区| 久久综合九色欧美综合狠狠| 懂色一区二区三区免费观看 | 亚洲一区二区三区中文字幕在线| 欧美日韩在线免费视频| 激情久久五月天| 国产精品国模大尺度视频| 欧美色图片你懂的| 精品无人码麻豆乱码1区2区| 国产精品国产三级国产普通话蜜臀 | 一区二区三区中文免费| 欧美一级生活片| 成人小视频在线| 视频一区二区中文字幕| 欧美激情在线观看视频免费| 欧美性videosxxxxx| 精品一区二区三区欧美| 国产精品美女一区二区| 欧美精品123区| 成人综合婷婷国产精品久久蜜臀 | 97aⅴ精品视频一二三区| 五月开心婷婷久久| 国产精品久久久久久久裸模| 日韩午夜三级在线| 色噜噜狠狠成人网p站| 国产一区二区不卡老阿姨| 一区二区三区高清不卡| 国产亚洲欧美一级| 91精品国产综合久久香蕉麻豆| 成人av网站在线观看免费| 日本大胆欧美人术艺术动态| 亚洲女性喷水在线观看一区| 国产人妖乱国产精品人妖| 欧美在线视频不卡| 99综合电影在线视频| 久久99精品国产| 午夜激情久久久| 一区二区三区高清在线| 欧美国产亚洲另类动漫| 欧美成人激情免费网| 欧美乱熟臀69xxxxxx| 色偷偷一区二区三区| caoporen国产精品视频| 国产福利精品一区二区| 激情综合五月天| 日韩国产精品91| 亚洲成a人片在线观看中文| 亚洲三级电影网站| 欧美国产日韩a欧美在线观看| 日韩免费看网站| 日韩欧美成人一区| 欧美一区二区三区视频在线观看 | 99久久精品免费| 国产一区二区三区观看| 激情欧美一区二区三区在线观看| 男女男精品视频网| 亚洲国产精品久久不卡毛片| 综合亚洲深深色噜噜狠狠网站| 欧美激情一区二区三区| 欧美激情一区在线观看| 欧美国产日产图区| 中文字幕一区二区三区在线观看| 欧美激情中文不卡| 亚洲三级免费电影| 夜夜夜精品看看| 三级欧美韩日大片在线看| 日韩在线a电影| 激情av综合网| 国产精品亚洲成人| 丁香激情综合五月| eeuss影院一区二区三区| 白白色 亚洲乱淫| 色域天天综合网| 欧美精品日韩一本| 欧美电影免费观看高清完整版 | 欧美性色黄大片手机版| 欧美日韩一区二区三区四区 | 奇米777欧美一区二区| 精品夜夜嗨av一区二区三区| 国产福利一区二区三区视频在线 | 久久久精品免费网站| 欧美高清在线精品一区| 亚洲狼人国产精品| 日本系列欧美系列| 国产自产高清不卡| 99久久久久免费精品国产| 欧美日韩亚洲不卡| 久久综合色播五月| 亚洲人成人一区二区在线观看 | 亚洲精品视频免费看| 性欧美大战久久久久久久久| 韩国理伦片一区二区三区在线播放| 国产成人午夜精品影院观看视频 | 欧美大片一区二区| 国产日韩欧美精品电影三级在线 | 日本国产一区二区| 日韩视频一区二区三区| 成人免费在线视频观看| 日韩av电影免费观看高清完整版| 国产精品18久久久久久vr| 欧美亚洲高清一区| 国产校园另类小说区| 亚洲福利一二三区| 国产sm精品调教视频网站| 欧美视频一区二区三区四区| 国产三级精品三级在线专区| 亚洲一二三四区不卡| 国产精品主播直播| 在线电影国产精品| 亚洲欧洲日产国码二区| 精品一区二区三区免费播放| 99国产一区二区三精品乱码| 精品国产一区二区三区忘忧草| 最近日韩中文字幕| 国产精品888| 欧美一区二区视频在线观看2022| 亚洲天堂2014| 高清国产一区二区| 欧美一级二级三级乱码| 亚洲欧洲一区二区在线播放| 国精品**一区二区三区在线蜜桃| 欧洲精品一区二区三区在线观看| 国产婷婷色一区二区三区| 日韩精品视频网| 欧美无乱码久久久免费午夜一区 | 精品国产伦一区二区三区观看体验| 亚洲精品你懂的| 91丨九色丨黑人外教| 26uuu亚洲| 韩国毛片一区二区三区| 欧美一级片在线看| 日韩二区三区在线观看| 在线精品视频免费播放| 日韩一区在线看| 成人av午夜电影| 国产精品色眯眯| 国产91精品露脸国语对白| 日韩欧美一级二级三级| 日韩在线播放一区二区| 欧美美女直播网站| 日韩高清在线观看| 91精品国产一区二区人妖| 图片区小说区区亚洲影院| 欧美影院午夜播放| 亚洲图片有声小说| 91精品国产综合久久香蕉麻豆 | 欧美精品丝袜久久久中文字幕|