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

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

?? d12.c

?? PHILIPS USB芯片 D12 的通用驅動,VC++ 平臺
?? 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一区二区三区免费野_久草精品视频
成人精品免费网站| 欧美日韩aaa| 欧美一区二区三区思思人| 欧美白人最猛性xxxxx69交| 中文字幕日韩一区| 免费在线观看日韩欧美| 91在线播放网址| 久久婷婷色综合| 日本欧洲一区二区| 91蝌蚪porny成人天涯| 亚洲精品一区二区三区香蕉 | 欧美精品一区二区三区一线天视频 | 色综合久久久久网| 国产日韩欧美制服另类| 99久久精品一区| 久久精品一区二区| 日产国产高清一区二区三区| 色欧美乱欧美15图片| 国产精品不卡一区二区三区| 国产精品一区二区久久精品爱涩| 国产精品18久久久| 盗摄精品av一区二区三区| 91丝袜国产在线播放| 在线亚洲精品福利网址导航| 7777精品伊人久久久大香线蕉的 | 成人av影视在线观看| 久久美女高清视频| 色综合久久综合网97色综合| 亚洲私人黄色宅男| 久久久精品免费网站| a美女胸又www黄视频久久| 亚洲一区中文日韩| 91丨porny丨国产入口| 亚洲精品一区二区三区影院| 免费成人在线观看| 日韩精品一区二区三区蜜臀| 美女视频一区二区三区| 欧美挠脚心视频网站| 亚洲成av人片观看| 欧美欧美午夜aⅴ在线观看| 亚洲国产另类精品专区| 欧美性猛片xxxx免费看久爱| 一区二区三区四区视频精品免费| 91国产视频在线观看| 亚洲精品高清在线观看| 91激情五月电影| 午夜精品久久久久久久99水蜜桃| 欧美日韩国产不卡| 蜜臀av性久久久久蜜臀av麻豆| 欧美人狂配大交3d怪物一区| 日韩电影在线观看网站| 日韩午夜精品视频| 国产91丝袜在线观看| 国产精品电影院| 色狠狠一区二区三区香蕉| 亚洲国产一区二区三区青草影视| 精品1区2区3区| 久久精品99久久久| 国产片一区二区三区| av中文一区二区三区| 一区二区三区中文字幕电影 | 久久综合狠狠综合| 69av一区二区三区| 色吊一区二区三区| 三级欧美韩日大片在线看| 欧美一卡2卡三卡4卡5免费| 狠狠色综合色综合网络| 中文字幕一区二区三区在线不卡 | 久久久精品天堂| 91丨九色丨蝌蚪丨老版| 亚洲bt欧美bt精品| 欧美刺激午夜性久久久久久久| 激情综合色综合久久综合| 中文在线一区二区| 欧美日韩一区视频| 国产一区啦啦啦在线观看| 亚洲精品视频自拍| 精品捆绑美女sm三区| 91麻豆精品视频| 久久精品国产99国产| 成人免费一区二区三区在线观看| 91精品综合久久久久久| 国产成人免费高清| 亚洲一区成人在线| 国产精品美女www爽爽爽| 欧美无砖专区一中文字| 国产成人亚洲综合色影视| 亚洲午夜久久久久| 久久精品人人做人人爽97| 欧美日韩不卡一区| 99久久免费国产| 国产资源在线一区| 亚洲福利一区二区| 中文字幕一区二区三区乱码在线| 日韩精品一区二区在线| 欧美性大战xxxxx久久久| 国产黄色精品视频| 麻豆精品一区二区综合av| 亚洲精品日韩一| 国产精品久久久久久一区二区三区 | 亚洲视频图片小说| 久久精品人人爽人人爽| 欧美一区二区三区免费| 欧洲亚洲精品在线| 91色porny蝌蚪| 一本久久综合亚洲鲁鲁五月天| 国产91清纯白嫩初高中在线观看| 久久99精品国产麻豆不卡| 亚洲成人资源网| 亚洲福利视频一区| 午夜电影久久久| 偷窥少妇高潮呻吟av久久免费| 亚洲精品国产精华液| 亚洲精品写真福利| 亚洲一区二区在线免费看| 亚洲欧美国产毛片在线| 亚洲日本欧美天堂| 亚洲蜜臀av乱码久久精品蜜桃| 成人欧美一区二区三区| 亚洲欧洲日韩在线| 亚洲一区二区三区三| 亚洲成人精品一区| 视频一区视频二区中文| 日韩av二区在线播放| 欧美裸体一区二区三区| 国产成人啪免费观看软件| 日韩高清中文字幕一区| 日本伊人色综合网| 蜜臀av性久久久久蜜臀aⅴ| 美国十次了思思久久精品导航| 喷白浆一区二区| 国产河南妇女毛片精品久久久| 国产精品一二三四区| 99久久99久久精品免费看蜜桃| 在线一区二区三区| 欧美精品国产精品| 国产欧美一区二区精品性| 中文字幕亚洲综合久久菠萝蜜| 亚洲精品美腿丝袜| 日本在线不卡视频一二三区| 久久超碰97人人做人人爱| 懂色一区二区三区免费观看| 97久久人人超碰| 日韩三级在线观看| 国产精品欧美综合在线| 亚洲精品视频在线观看网站| 免费高清在线视频一区·| 国产成人亚洲综合a∨婷婷 | 日本不卡高清视频| 国产成人午夜视频| 欧美色综合网站| 久久夜色精品一区| 怡红院av一区二区三区| 久久国产精品色婷婷| 91免费看视频| 欧美电影免费观看高清完整版| 中文字幕欧美一| 捆绑调教一区二区三区| 97精品久久久午夜一区二区三区| 91精品国产乱码| 亚洲欧洲精品一区二区三区不卡| 日韩精品成人一区二区三区 | 三级欧美韩日大片在线看| 国产69精品一区二区亚洲孕妇| 欧美男女性生活在线直播观看| 国产亚洲精品精华液| 亚洲va天堂va国产va久| 国产精品夜夜爽| 欧美一区二区三区四区久久 | 欧美精品久久99| 中文字幕中文乱码欧美一区二区| 日韩精品1区2区3区| 成人性视频网站| 欧美成人a∨高清免费观看| 一级女性全黄久久生活片免费| 国产老肥熟一区二区三区| 欧美乱熟臀69xxxxxx| 一区二区三区欧美日| 高清不卡一区二区在线| 日韩欧美在线不卡| 午夜精品一区二区三区免费视频 | 欧美一区二区三区在线视频| 亚洲天堂免费看| 国产成人亚洲综合a∨猫咪| 日韩欧美你懂的| 爽好久久久欧美精品| 欧美亚洲尤物久久| 综合激情成人伊人| 懂色中文一区二区在线播放| 久久综合九色综合欧美亚洲| 蜜臀精品一区二区三区在线观看 | 中文字幕欧美国产| 韩国三级在线一区| 日韩视频在线一区二区| 日韩国产高清在线| 日韩欧美在线一区二区三区| 美女视频一区在线观看| 日韩你懂的在线播放| 日韩av在线发布| 日韩精品自拍偷拍|