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

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

?? d12.c

?? 周立功關于USB1.1的C源碼
?? 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一区二区三区免费野_久草精品视频
亚洲精品在线网站| 午夜激情一区二区三区| 亚洲免费av高清| 蜜桃一区二区三区在线| 欧美亚洲一区三区| 国产日韩欧美综合在线| 日本欧美久久久久免费播放网| 成人精品在线视频观看| 欧美tickling挠脚心丨vk| 一区二区三区精品在线| 成人18视频在线播放| 久久伊人中文字幕| 日韩精品成人一区二区三区| 色综合久久综合网欧美综合网| 久久网站最新地址| 中文一区在线播放| 国产精品影视天天线| 精品久久一区二区三区| 日本午夜一本久久久综合| 欧美日韩一区二区不卡| 亚洲自拍偷拍图区| 91久久免费观看| 国产精品久久久久久久久图文区| 国产一区二区三区电影在线观看| 欧美精品一二三区| 婷婷久久综合九色综合绿巨人| 欧美在线免费观看视频| 亚洲综合成人在线| 欧美日韩精品专区| 天天av天天翘天天综合网色鬼国产| 日本高清视频一区二区| 亚洲精品午夜久久久| 在线一区二区视频| 亚洲成a人片综合在线| 欧美高清你懂得| 免费av网站大全久久| 在线不卡免费欧美| 日韩电影在线看| 精品少妇一区二区三区在线播放 | 久久午夜国产精品| 黑人精品欧美一区二区蜜桃| 久久久噜噜噜久噜久久综合| 高清国产一区二区三区| 国产精品亲子伦对白| 91丨porny丨国产| 一区二区三区美女| 日韩欧美一区二区在线视频| 黄页网站大全一区二区| 国产清纯在线一区二区www| 99精品视频在线免费观看| 一区二区三区四区精品在线视频 | 99在线精品观看| 亚洲免费观看高清完整版在线观看 | 国产一区二区影院| 中文字幕亚洲一区二区va在线| 色综合av在线| 日本免费新一区视频| 日本一区二区三区高清不卡| 色婷婷激情综合| 久久99久久久欧美国产| 国产精品视频九色porn| 欧美日韩一区二区在线观看视频| 久久99精品国产麻豆婷婷洗澡| 欧美国产在线观看| 欧美优质美女网站| 激情六月婷婷久久| 亚洲综合免费观看高清完整版| 精品国产污污免费网站入口| 不卡视频一二三四| 日本不卡中文字幕| 国产精品国产三级国产aⅴ无密码| 色综合久久综合网| 国产一区 二区| 亚洲一级在线观看| 精品国产一区二区三区不卡| 色综合久久九月婷婷色综合| 国产真实乱偷精品视频免| 尤物在线观看一区| 欧美经典一区二区三区| 日韩一级高清毛片| 日本久久一区二区三区| 福利电影一区二区三区| 蜜臀av性久久久久av蜜臀妖精 | 久久久三级国产网站| 欧美三级韩国三级日本一级| 成人一二三区视频| 蜜臀av一区二区在线免费观看 | 国产亚洲自拍一区| 欧美一区二区不卡视频| 91久久精品国产91性色tv| 高清不卡一二三区| 国产毛片精品国产一区二区三区| 亚洲高清免费视频| 亚洲美女区一区| 国产精品亲子乱子伦xxxx裸| 久久人人爽人人爽| 日韩三级伦理片妻子的秘密按摩| 色综合久久中文字幕| 97成人超碰视| 成人午夜免费av| 成人自拍视频在线| 国产91富婆露脸刺激对白| 国产一区二区三区日韩| 久久er精品视频| 黄页视频在线91| 国产美女一区二区| 紧缚奴在线一区二区三区| 另类中文字幕网| 麻豆精品新av中文字幕| 麻豆国产精品一区二区三区| 日本中文字幕一区| 免费成人小视频| 久久超碰97人人做人人爱| 男女男精品视频网| 久久国产乱子精品免费女| 韩国欧美国产1区| 国产一区在线视频| 成人妖精视频yjsp地址| k8久久久一区二区三区| av成人老司机| 在线观看国产一区二区| 欧美日韩精品一区视频| 欧美一级理论片| 国产亚洲一区二区三区四区 | 99热国产精品| 色婷婷综合久久久中文一区二区| 色婷婷精品大在线视频| 欧美日韩免费一区二区三区 | 91传媒视频在线播放| 欧美色综合天天久久综合精品| 欧美日韩国产精选| 日韩欧美亚洲国产另类 | 自拍偷拍亚洲综合| 亚洲一级二级在线| 蓝色福利精品导航| av毛片久久久久**hd| 欧美精品一二三区| 久久久久久久综合日本| 亚洲激情网站免费观看| 亚洲大尺度视频在线观看| 精品在线播放免费| 色哟哟欧美精品| 精品国产一区二区三区四区四 | 99久久精品久久久久久清纯| 在线观看www91| 久久色在线视频| 悠悠色在线精品| 精品在线播放午夜| 色哟哟日韩精品| 久久免费午夜影院| 亚洲一级在线观看| 国产成人三级在线观看| 欧美高清激情brazzers| 国产精品电影院| 久久国产精品99精品国产| 91网页版在线| 精品日韩在线观看| 亚洲与欧洲av电影| 福利91精品一区二区三区| 欧美色欧美亚洲另类二区| 国产日韩精品一区二区三区在线| 一级特黄大欧美久久久| 国产精品88av| 欧美电影免费提供在线观看| 亚洲视频你懂的| 国产成人午夜高潮毛片| 制服丝袜中文字幕一区| 综合婷婷亚洲小说| 国产丶欧美丶日本不卡视频| 欧美狂野另类xxxxoooo| 亚洲色图视频网站| 粉嫩av一区二区三区粉嫩| 日韩欧美一级二级| 午夜电影久久久| 欧美综合一区二区| 亚洲欧美色图小说| av男人天堂一区| 中文字幕va一区二区三区| 精品一区二区三区免费播放 | 日韩专区欧美专区| 色呦呦网站一区| 亚洲欧美综合另类在线卡通| 久久精品999| 7777精品伊人久久久大香线蕉 | 亚洲国产高清在线| 国产成人小视频| 欧美videofree性高清杂交| 视频一区在线视频| 欧美精品一级二级| 视频一区二区不卡| 欧美日韩国产成人在线免费| 亚洲午夜一区二区三区| 欧美午夜精品一区二区三区| 亚洲欧美日韩久久精品| 成人午夜精品在线| 国产精品传媒在线| 色综合天天综合网天天狠天天| 国产精品伦理在线| 99久免费精品视频在线观看| 国产精品久久午夜夜伦鲁鲁|