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

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

?? d12.c

?? s3c44b0的開發程序
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*++

Copyright (c) 1995  Microsoft Corporation

Module Name:

    D12.c

Abstract:

    USB device driver for Philips D12 USB test board

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) 1996 Microsoft Corporation.  All Rights Reserved.


Revision History:

    5-4-96 : created

--*/

#define DRIVER

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

#include "usbdi.h"
#include "usbdlib.h"
#include "D12.h"
#include "d12irp.h"
#include "guid829.h"

//
// Global pointer to Driver Object
//

PDRIVER_OBJECT D12_DriverObject;

NTSTATUS
DriverEntry(
    IN PDRIVER_OBJECT DriverObject,
    IN PUNICODE_STRING RegistryPath
    )
/*++

Routine Description:

    Installable driver initialization entry point.
    This entry point is called directly by the I/O system.

Arguments:

    DriverObject - pointer to the driver object

    RegistryPath - pointer to a unicode string representing the path
                   to driver-specific key in the registry

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PDEVICE_OBJECT deviceObject = NULL;

    D12_KdPrint (("D12TEST.SYS: entering (D12) DriverEntry\n"));

    D12_DriverObject = DriverObject;

    //
    // Create dispatch points for device control, create, close.
    //

    DriverObject->MajorFunction[IRP_MJ_CREATE] = D12_Create;
    DriverObject->MajorFunction[IRP_MJ_CLOSE] = D12_Close;
    DriverObject->DriverUnload = D12_Unload;

    DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = D12_ProcessIOCTL;
    DriverObject->MajorFunction[IRP_MJ_WRITE] = D12_Write;
    DriverObject->MajorFunction[IRP_MJ_READ] = D12_Read;

    DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] =
    DriverObject->MajorFunction[IRP_MJ_PNP] = D12_Dispatch;
    DriverObject->MajorFunction[IRP_MJ_POWER] = D12_ProcessPowerIrp;
    DriverObject->DriverExtension->AddDevice = D12_PnPAddDevice;

    D12_KdPrint (("D12TEST.SYS: exiting (D12) DriverEntry (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
D12_PoRequestCompletion(
    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 port driver completes an IRP.

Arguments:

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

    Context - Driver defined context.

Return Value:

    The function value is the final status from the operation.

--*/
{
    PIRP irp;
    PDEVICE_EXTENSION deviceExtension;
    PDEVICE_OBJECT deviceObject = Context;
    NTSTATUS ntStatus;

    deviceExtension = deviceObject->DeviceExtension;
    irp = deviceExtension->PowerIrp;
    
    ntStatus = IoStatus->Status;

    D12_KdPrint(("'D12_PoRequestCompletion\n"));
    
    IoCopyCurrentIrpStackLocationToNext(irp);      
    PoStartNextPowerIrp(irp);
    PoCallDriver(deviceExtension->TopOfStackDeviceObject,
                 irp);   

    D12_DecrementIoCount(deviceObject);                 

    return ntStatus;
}


NTSTATUS
D12_PowerIrp_Complete(
    IN PDEVICE_OBJECT NullDeviceObject,
    IN PIRP Irp,
    IN PVOID Context
    )
/*++

Routine Description:

    This routine is called when the port driver completes an IRP.


Arguments:

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

    Irp - Irp completed.

    Context - Driver defined context.

Return Value:

    The function value is the final status from the operation.

--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PDEVICE_OBJECT deviceObject;
    PIO_STACK_LOCATION irpStack;
    PDEVICE_EXTENSION deviceExtension;

    D12_KdPrint(("D12TEST.SYS:   enter D12_PowerIrp_Complete\n"));

    deviceObject = (PDEVICE_OBJECT) Context;

    deviceExtension = (PDEVICE_EXTENSION) deviceObject->DeviceExtension;

    // BUGBUG
    // kenray sez we should be calling IoMarkIrpPending
    // from our completion routine.
    //

    if (Irp->PendingReturned) {
        IoMarkIrpPending(Irp);
    }

    irpStack = IoGetCurrentIrpStackLocation (Irp);

    ASSERT(irpStack->MajorFunction == IRP_MJ_POWER);
    ASSERT(irpStack->MinorFunction == IRP_MN_SET_POWER);
    ASSERT(irpStack->Parameters.Power.Type==DevicePowerState);
    ASSERT(irpStack->Parameters.Power.State.DeviceState==PowerDeviceD0);

    deviceExtension->CurrentDevicePowerState = PowerDeviceD0;
    KdPrint(("D12TEST.SYS:  enter D0 complete\n"));
    
    Irp->IoStatus.Status = ntStatus;

    D12_DecrementIoCount(deviceObject); 

    return ntStatus;
}


NTSTATUS
D12_SetDevicePowerState(
    IN PDEVICE_OBJECT DeviceObject,
    IN DEVICE_POWER_STATE DeviceState,
    IN PBOOLEAN HookIt
    )
/*++

Routine Description:

Arguments:

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

    Irp - Irp completed.

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

Return Value:


--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PDEVICE_EXTENSION deviceExtension;

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

    switch (DeviceState) {
    case PowerDeviceD3:

        //
        // device will be going OFF, save any state now.
        //

        D12_KdPrint(("D12TEST.SYS:  PowerDeviceD3 (OFF)\n"));

        KdPrint(("D12: PM power off\n"));
        deviceExtension->CurrentDevicePowerState = DeviceState;
        break;

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

        D12_KdPrint(("D12TEST.SYS:  PowerDeviceD1/D2 (SUSPEND)\n"));        

        KdPrint(("D12: device entered D%d\n", DeviceState-1));
        deviceExtension->CurrentDevicePowerState = DeviceState;
        break;

    case PowerDeviceD0:


        D12_KdPrint(("D12TEST.SYS:  PowerDeviceD0 (ON)\n"));

        //
        // finish the rest in the completion routine
        //

        *HookIt = TRUE;

        // pass on to PDO
        break;

    default:
        
        D12_KdPrint(("D12TEST.SYS:  Bogus DeviceState = %x\n", DeviceState));
    }

    return ntStatus;
}


NTSTATUS
D12_DeferIrpCompletion(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP Irp,
    IN PVOID Context
    )
/*++

Routine Description:

    This routine is called when the port driver completes an IRP.


Arguments:

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

    Irp - Irp completed.

    Context - Driver defined context.

Return Value:

    The function value is the final status from the operation.

--*/
{
    PKEVENT event = Context;


    KeSetEvent(event,
               1,
               FALSE);

    return STATUS_MORE_PROCESSING_REQUIRED;
    
}


NTSTATUS
D12_QueryCapabilities(
    IN PDEVICE_OBJECT PdoDeviceObject,
    IN PDEVICE_CAPABILITIES DeviceCapabilities
    )

/*++

Routine Description:

    This routine reads or write config space.

Arguments:

    DeviceObject        - Physical DeviceObject for this USB controller.

Return Value:

    None.

--*/

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

    PAGED_CODE();
    irp = IoAllocateIrp(PdoDeviceObject->StackSize, FALSE);

    if (!irp) {
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    nextStack = IoGetNextIrpStackLocation(irp);
    ASSERT(nextStack != NULL);
    nextStack->MajorFunction= IRP_MJ_PNP;
    nextStack->MinorFunction= IRP_MN_QUERY_CAPABILITIES;

    KeInitializeEvent(&event, NotificationEvent, FALSE);

    IoSetCompletionRoutine(irp,
                           D12_DeferIrpCompletion,
                           &event,
                           TRUE,
                           TRUE,
                           TRUE);
                           
    //BUGBUG this is different from the latest version of busdd.doc
    nextStack->Parameters.DeviceCapabilities.Capabilities = DeviceCapabilities;

    ntStatus = IoCallDriver(PdoDeviceObject,
                            irp);

    D12_KdPrint(("D12TEST.SYS:  ntStatus from IoCallDriver to PCI = 0x%x\n", ntStatus));

    if (ntStatus == STATUS_PENDING) {
       // wait for irp to complete
       
       TRAP(); // first time we hit this
       
       KeWaitForSingleObject(
            &event,
            Suspended,
            KernelMode,
            FALSE,
            NULL);
    }

#if DBG                    
    if (!NT_SUCCESS(ntStatus)) {
        // failed? this is probably a bug
        D12_KdPrint(("D12TEST.SYS:  QueryCapabilities failed, why?\n"));
    }
#endif

    IoFreeIrp(irp);

    return STATUS_SUCCESS;
}


NTSTATUS
D12_ProcessPowerIrp(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
/*++

Routine Description:

    Process the Power IRPs sent to the PDO for this device.

    

Arguments:

    DeviceObject - pointer to a hcd device object (FDO)

    Irp          - pointer to an I/O Request Packet

Return Value:

    NT status code

--*/
{

    PIO_STACK_LOCATION irpStack;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PDEVICE_EXTENSION deviceExtension;
    BOOLEAN hookIt = FALSE;

    D12_KdPrint(("D12TEST.SYS:  IRP_MJ_POWER\n"));

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
    irpStack = IoGetCurrentIrpStackLocation (Irp);
    D12_IncrementIoCount(DeviceObject);
     
    switch (irpStack->MinorFunction) {
    case IRP_MN_WAIT_WAKE:
        D12_KdPrint(("D12TEST.SYS:  IRP_MN_WAIT_WAKE\n"));

        //
        // someone is enabling us for wakeup
        //
        TRAP();  // never seen this before?
        // pass this on to our PDO
        break;

    case IRP_MN_SET_POWER:
        {

        switch (irpStack->Parameters.Power.Type) {
        case SystemPowerState:
            //
            // find the device power state equivalent to the given system state
            //
        
            {
            POWER_STATE powerState;

            D12_KdPrint(("D12TEST.SYS:  Set Power, SystemPowerState (%d)\n", 
                irpStack->Parameters.Power.State.SystemState));                    

            if (irpStack->Parameters.Power.State.SystemState == 
                PowerSystemWorking) {
                                
                powerState.DeviceState = PowerDeviceD0;
            } else if (/* deviceExtension->EnabledForWakeup*/FALSE) {
            
                // BUGBUG for now act as if we are always enabled for wakeup
                D12_KdPrint(("D12TEST.SYS:  D12 always enabled for wakeup\n"));

                powerState.DeviceState =
                    deviceExtension->DeviceCapabilities.DeviceState[
                        irpStack->Parameters.Power.State.SystemState];

            } else {
                //
                // wakeup not enabled, just go in to the 'OFF' state.
                //
                powerState.DeviceState = PowerDeviceD3;
            } //irpStack->Parameters.Power.State.SystemState
            
            //
            // are we already in this state?
            //
            
            if (powerState.DeviceState != 
                deviceExtension->CurrentDevicePowerState) {
                
                // No,
                // request that we be put into this state
                deviceExtension->PowerIrp = Irp;
                ntStatus = PoRequestPowerIrp(deviceExtension->PhysicalDeviceObject,
                                           IRP_MN_SET_POWER,
                                           powerState,
                                           D12_PoRequestCompletion,
                                           DeviceObject,
                                           NULL);

            } else {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久久综合日本| 国产一区日韩二区欧美三区| 亚洲精品中文字幕在线观看| 久久精品国产第一区二区三区| 成人精品国产免费网站| 日韩一区二区三区四区| 亚洲宅男天堂在线观看无病毒| 国产伦精品一区二区三区在线观看| 欧美日本韩国一区二区三区视频| 欧美国产欧美亚州国产日韩mv天天看完整 | 色婷婷久久99综合精品jk白丝| 欧美大胆人体bbbb| 亚洲成人在线观看视频| 色成年激情久久综合| 国产欧美日韩一区二区三区在线观看| 午夜av一区二区| 91成人网在线| 一区二区三区在线观看国产| 成人影视亚洲图片在线| 精品美女被调教视频大全网站| 视频一区二区中文字幕| 欧美日韩美女一区二区| 一区二区三区在线免费播放| 成人中文字幕在线| 国产女主播在线一区二区| 激情综合色播激情啊| 91精品麻豆日日躁夜夜躁| 亚洲国产精品久久艾草纯爱| 欧美中文字幕亚洲一区二区va在线 | 欧美精品色一区二区三区| 一区二区三区小说| 一本在线高清不卡dvd| 中文字幕在线不卡视频| 9人人澡人人爽人人精品| 中文字幕不卡的av| 成人国产一区二区三区精品| 中文字幕成人av| 在线区一区二视频| 亚洲欧美另类久久久精品| 91啪亚洲精品| 五月天网站亚洲| 日韩一区二区三区在线观看| 卡一卡二国产精品| 久久久久久久网| 99久久夜色精品国产网站| 亚洲人成伊人成综合网小说| 色综合久久九月婷婷色综合| 亚洲一区二区免费视频| 日韩午夜电影av| 国产很黄免费观看久久| 亚洲欧美中日韩| 欧美丝袜自拍制服另类| 日本最新不卡在线| 国产日韩av一区二区| 一本大道av伊人久久综合| 偷拍一区二区三区| 久久嫩草精品久久久精品一| av成人免费在线| 石原莉奈在线亚洲三区| 欧美大度的电影原声| 99久久99久久久精品齐齐| 亚洲1区2区3区4区| 国产日韩高清在线| 欧美日韩亚洲综合在线 | 成人黄动漫网站免费app| 亚洲欧洲精品天堂一级| 欧美绝品在线观看成人午夜影视| 麻豆传媒一区二区三区| 亚洲欧洲国产日韩| 91麻豆精品国产91久久久久久久久| 国产综合久久久久久鬼色| 亚洲天堂2014| 精品不卡在线视频| 色88888久久久久久影院按摩| 日韩高清一级片| 亚洲欧美色综合| 精品99一区二区| 欧美午夜影院一区| 成人禁用看黄a在线| 日本欧美加勒比视频| 亚洲色图丝袜美腿| 久久这里只有精品6| 欧美日韩一区小说| av中文字幕一区| 国产一区二区毛片| 免费亚洲电影在线| 亚洲国产日韩在线一区模特| 国产欧美日韩不卡| 欧美v日韩v国产v| 欧美日韩视频在线一区二区| caoporn国产精品| 精东粉嫩av免费一区二区三区| 亚洲一级不卡视频| 综合久久久久久| 国产精品成人免费在线| 久久九九久久九九| www成人在线观看| 精品少妇一区二区三区视频免付费 | 国产成人精品一区二 | 午夜欧美大尺度福利影院在线看| 国产精品麻豆一区二区| 精品国产伦一区二区三区免费| 欧美日韩久久久| 欧美日韩一区二区三区在线| 色婷婷综合在线| 8v天堂国产在线一区二区| 91在线观看地址| 成年人国产精品| 成人激情综合网站| av中文字幕亚洲| 色综合天天综合网国产成人综合天 | 九九在线精品视频| 蜜桃精品在线观看| 日韩经典一区二区| 日韩在线一区二区三区| 午夜激情一区二区三区| 午夜久久久久久久久| 亚洲精品国久久99热| 亚洲色图制服诱惑| 亚洲男人的天堂一区二区| 亚洲欧美日韩在线播放| 亚洲激情自拍视频| 五月激情综合网| 日本成人超碰在线观看| 青青青爽久久午夜综合久久午夜| 日韩成人午夜精品| 黄色精品一二区| 成人综合激情网| 在线精品亚洲一区二区不卡| 在线电影一区二区三区| 欧美一二三四在线| 欧美高清在线一区二区| 综合欧美一区二区三区| 亚洲成人午夜影院| 精品在线观看视频| 粉嫩aⅴ一区二区三区四区| 不卡电影一区二区三区| 在线亚洲精品福利网址导航| 欧美精品自拍偷拍动漫精品| 欧美一区二区三区婷婷月色| 欧美tk—视频vk| 亚洲欧洲在线观看av| 亚洲r级在线视频| 国产在线观看免费一区| 99精品国产91久久久久久| 欧美综合一区二区| 久久只精品国产| 亚洲一区二区三区不卡国产欧美| 免费看欧美女人艹b| 成人少妇影院yyyy| 91精品黄色片免费大全| 国产三级一区二区| 亚洲高清久久久| 国产成人啪午夜精品网站男同| 91农村精品一区二区在线| 欧美大度的电影原声| 日韩理论片在线| 久久av资源站| 欧美日韩在线免费视频| 中文字幕av资源一区| 日韩av高清在线观看| zzijzzij亚洲日本少妇熟睡| 欧美一区二区人人喊爽| 国产精品久久网站| 看电影不卡的网站| 欧美吞精做爰啪啪高潮| 欧美国产成人精品| 另类专区欧美蜜桃臀第一页| 91久久人澡人人添人人爽欧美| 久久亚洲捆绑美女| 天天综合网天天综合色| 99国产欧美另类久久久精品| 久久亚洲综合av| 日本 国产 欧美色综合| 91丝袜美腿高跟国产极品老师| wwww国产精品欧美| 免费国产亚洲视频| 欧美精品丝袜中出| 亚洲综合视频在线| 97se亚洲国产综合在线| 欧美va亚洲va国产综合| 亚洲一区视频在线观看视频| 成人av网站在线| 国产精品少妇自拍| 国产精品一区二区久久不卡 | 看电影不卡的网站| 91麻豆精品国产91久久久久久久久 | 日韩欧美综合在线| 一区二区在线观看视频| 成人app软件下载大全免费| www久久久久| 国产精品中文有码| 国产日韩三级在线| 国产精品主播直播| 久久精品日韩一区二区三区| 国产一区在线视频| 国产午夜精品一区二区三区视频 | 国产精品久久久久久久久动漫| 国产高清精品久久久久| 久久综合五月天婷婷伊人|