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

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

?? bulkpwr.c

?? 這是ARM9開發板上自帶的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超碰这里只有精品国产| 国内外成人在线| 亚洲一卡二卡三卡四卡| 国产精品视频一二三区 | 狠狠色丁香婷婷综合久久片| 亚洲欧美偷拍三级| 久久久亚洲综合| 91精品麻豆日日躁夜夜躁| jlzzjlzz欧美大全| 国产精品亚洲第一| 日本不卡视频在线| 亚洲成人精品一区二区| 中文字幕在线不卡国产视频| 精品处破学生在线二十三| 欧美日本国产视频| 日本久久电影网| av电影在线观看一区| 国产精品77777| 韩国精品一区二区| 久久99国产精品久久| 日日夜夜免费精品| 国产精品国产a| 99久久精品国产一区| 欧美日韩另类国产亚洲欧美一级| 天堂在线一区二区| 一区二区三区精品在线观看| 亚洲精品一二三区| 一区免费观看视频| 中文字幕中文字幕一区| 国产欧美一区二区精品性色| 精品久久久久久久人人人人传媒| 欧美精品丝袜中出| 69久久夜色精品国产69蝌蚪网| 欧美日韩一级片网站| 欧美色图片你懂的| 欧美日韩中文字幕一区| 欧美日韩亚洲综合| 欧美三级电影网站| 欧美精品电影在线播放| 5566中文字幕一区二区电影| 欧美一级电影网站| 精品久久久久一区| 中文字幕高清一区| 成人免费小视频| 亚洲一区二区视频在线| 亚洲成av人片在线观看| 日韩av电影天堂| 久久精品国产色蜜蜜麻豆| 久久99精品久久久久久| 成人高清免费观看| 一本色道久久加勒比精品| 色94色欧美sute亚洲线路一ni| 欧美亚男人的天堂| 8x8x8国产精品| 精品88久久久久88久久久| 久久九九久久九九| 亚洲视频免费在线| 日日骚欧美日韩| 国产一区二区不卡| 99精品欧美一区二区蜜桃免费 | 久久精品国产99国产| 久久成人精品无人区| 夫妻av一区二区| 欧美三级视频在线| 精品国产三级电影在线观看| 国产精品激情偷乱一区二区∴| 亚洲久草在线视频| 久久精品72免费观看| 成人午夜在线视频| 欧美日韩高清一区二区| 久久蜜桃av一区二区天堂| 亚洲三级理论片| 麻豆91精品视频| 99re这里只有精品视频首页| 欧美精品丝袜久久久中文字幕| 久久久91精品国产一区二区精品 | 99国产欧美久久久精品| 一本大道综合伊人精品热热| 麻豆91在线看| 看国产成人h片视频| av在线不卡观看免费观看| 欧美女孩性生活视频| 国产日韩影视精品| 亚洲v精品v日韩v欧美v专区| 国产精品综合二区| 欧美色精品在线视频| 久久久精品tv| 亚洲不卡在线观看| 成人免费观看视频| 26uuu精品一区二区| 天天色综合天天| 国产成人亚洲综合a∨婷婷| 韩国三级在线一区| 91浏览器打开| 久久久国产精品麻豆| 亚洲午夜一二三区视频| 国产精品亚洲视频| 日韩一区二区三区四区五区六区| 国产精品久久久久影院色老大| 日韩国产精品大片| 一本久久a久久精品亚洲| 久久久91精品国产一区二区精品 | 国产成人亚洲综合a∨婷婷 | 国产日韩欧美亚洲| 日韩电影在线观看一区| 91丨porny丨国产入口| 久久婷婷综合激情| 日本成人在线视频网站| 欧美亚洲动漫制服丝袜| 国产精品成人在线观看| 91视频www| 国产女主播一区| 国产综合久久久久影院| 日韩欧美不卡在线观看视频| 亚洲成a人片综合在线| 欧美综合欧美视频| 亚洲日本一区二区三区| 懂色av中文一区二区三区| 2020国产精品久久精品美国| 日本欧美一区二区三区乱码| 欧美在线观看视频一区二区| 亚洲天堂久久久久久久| av资源网一区| 国产精品激情偷乱一区二区∴| 春色校园综合激情亚洲| 国产视频亚洲色图| 国产一本一道久久香蕉| 久久综合成人精品亚洲另类欧美 | 精品国产伦一区二区三区观看方式 | 欧美午夜精品免费| 亚洲乱码精品一二三四区日韩在线| 不卡视频在线观看| 综合网在线视频| 99久久久久久99| 中文字幕日本不卡| 一本久久a久久精品亚洲| 一区二区三区在线看| 欧洲亚洲精品在线| 亚洲成人av中文| 欧美精品在线一区二区三区| 日本午夜一本久久久综合| 91麻豆精品国产自产在线| 日韩不卡手机在线v区| 精品乱人伦一区二区三区| 国产主播一区二区三区| 国产欧美日韩视频在线观看| 成人黄色软件下载| 一区二区三区四区不卡在线| 欧美三级韩国三级日本一级| 日韩经典中文字幕一区| 欧美大片一区二区| 国产99久久久精品| 亚洲啪啪综合av一区二区三区| 91精品福利视频| 日韩电影一二三区| 久久久国产精华| 色综合久久九月婷婷色综合| 亚洲成人av资源| 久久久久久久免费视频了| av成人动漫在线观看| 亚洲综合一二区| 精品久久99ma| aa级大片欧美| 秋霞电影一区二区| 国产亚洲精品资源在线26u| 成人91在线观看| 亚洲h在线观看| 久久蜜桃av一区精品变态类天堂| 99re热这里只有精品免费视频| 午夜视频久久久久久| 亚洲精品在线免费观看视频| 97久久超碰精品国产| 午夜精品福利久久久| 久久久亚洲高清| 欧美中文字幕不卡| 国产乱子轮精品视频| 又紧又大又爽精品一区二区| 欧美一区二区三区视频在线 | 在线精品视频一区二区三四| 蜜臀99久久精品久久久久久软件| 亚洲国产精品成人综合| 欧美日韩一区视频| 国产成a人亚洲精品| 亚洲va欧美va天堂v国产综合| 久久久久高清精品| 在线不卡免费欧美| 91视频国产资源| 国产精品一卡二卡在线观看| 亚洲成人精品一区| 日韩女同互慰一区二区| 136国产福利精品导航| 亚洲综合激情另类小说区| 在线观看一区日韩| 国产欧美日韩综合精品一区二区| 亚洲三级小视频| 奇米在线7777在线精品| 一区二区三区中文在线观看| 欧美va亚洲va|