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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? d12.c

?? s3c44b0的USB測試源碼
?? 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 {

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲日本va在线观看| 国产成人免费在线观看| 国产精品午夜电影| 久久精品欧美一区二区三区麻豆| 欧美日韩一区不卡| 在线欧美一区二区| 欧美色老头old∨ideo| 欧美亚洲高清一区| 欧美狂野另类xxxxoooo| 日韩亚洲欧美高清| 日韩欧美激情一区| 欧美激情一区二区在线| 国产精品黄色在线观看| 国产精品女同一区二区三区| 中文字幕在线播放不卡一区| 亚洲欧美激情插| 午夜欧美在线一二页| 蜜臀久久99精品久久久久久9 | 亚洲欧美激情视频在线观看一区二区三区 | 午夜免费欧美电影| 美女视频黄a大片欧美| 国产精品99久久不卡二区| 成人黄色在线网站| 欧美蜜桃一区二区三区| 久久综合成人精品亚洲另类欧美| 日本一区二区成人在线| 夜夜嗨av一区二区三区四季av| 日韩影视精彩在线| 成人va在线观看| 91精品国产综合久久久久久久| 久久先锋影音av鲁色资源网| 1区2区3区国产精品| 五月天丁香久久| www.爱久久.com| 日韩亚洲欧美高清| 亚洲视频每日更新| 国产乱码字幕精品高清av | 日本不卡在线视频| 国产大陆a不卡| 欧美一区二区三区婷婷月色 | 色婷婷精品久久二区二区蜜臀av| 欧美人妇做爰xxxⅹ性高电影| 久久精品网站免费观看| 午夜成人免费电影| 91亚洲精品乱码久久久久久蜜桃| 日韩欧美国产小视频| 亚洲综合另类小说| 成人av资源网站| 久久―日本道色综合久久| 一区二区三区日韩| 国产成人免费av在线| 欧美一区二视频| 亚洲综合免费观看高清完整版在线| 亚洲一区欧美一区| 国产**成人网毛片九色 | 日本不卡1234视频| 色综合一区二区三区| 久久人人爽人人爽| 蜜臀av性久久久久蜜臀aⅴ流畅| 91在线观看地址| 中文字幕国产一区| 精品亚洲aⅴ乱码一区二区三区| 日本乱码高清不卡字幕| 中文字幕一区在线观看视频| 国产成人综合在线观看| 日韩欧美一区在线观看| 日日欢夜夜爽一区| 精品婷婷伊人一区三区三| 日韩伦理电影网| www.欧美色图| 亚洲人成小说网站色在线| 成人国产亚洲欧美成人综合网 | 欧美自拍偷拍午夜视频| 中文字幕av资源一区| 国产成人av影院| 2024国产精品| 国产老妇另类xxxxx| 欧美成人福利视频| 久久国产夜色精品鲁鲁99| 欧美一卡二卡三卡四卡| 五月天激情小说综合| 91精品欧美久久久久久动漫| 午夜激情综合网| 欧美写真视频网站| 日韩成人一区二区三区在线观看| 欧美精品乱人伦久久久久久| 日韩精品一二三区| 日韩精品中午字幕| 国产福利精品导航| 中文字幕一区二区视频| 一本一道综合狠狠老| 亚洲制服丝袜av| 欧美一区二区私人影院日本| 日韩精品一级中文字幕精品视频免费观看| 欧美日韩国产综合一区二区三区 | 欧美日韩中文字幕一区| 日本午夜精品一区二区三区电影| 日韩三级伦理片妻子的秘密按摩| 麻豆国产精品一区二区三区| 国产欧美日韩久久| 欧美亚洲综合网| 久久9热精品视频| 国产精品麻豆一区二区| 欧日韩精品视频| 麻豆免费看一区二区三区| 国产日韩欧美激情| 色偷偷久久一区二区三区| 亚洲色欲色欲www在线观看| 欧美视频在线观看一区| 九色|91porny| 专区另类欧美日韩| 日韩免费观看高清完整版| 高清成人免费视频| 午夜精品视频一区| 国产精品美女www爽爽爽| 欧美视频在线一区| 国产精品一区二区久激情瑜伽| 亚洲蜜臀av乱码久久精品| 日韩免费观看高清完整版| 91看片淫黄大片一级在线观看| 日韩高清电影一区| 日韩伦理免费电影| 久久久国际精品| 8x福利精品第一导航| 99re这里只有精品首页| 美日韩一区二区| 亚洲精品免费电影| 国产亚洲综合在线| 日韩一区二区三区免费观看| 99久精品国产| 国产一区欧美日韩| 日韩va亚洲va欧美va久久| 成人免费一区二区三区视频| xvideos.蜜桃一区二区| 欧美日韩免费观看一区二区三区 | 在线一区二区三区四区| 国产69精品久久久久毛片 | 国产精品福利一区二区三区| 日韩午夜精品视频| 在线播放一区二区三区| 色狠狠av一区二区三区| jiyouzz国产精品久久| 国产精品白丝av| 激情丁香综合五月| 毛片av中文字幕一区二区| 亚洲一区二区精品久久av| 日韩一区中文字幕| 中文字幕一区二区三区不卡| 26uuu成人网一区二区三区| 在线播放一区二区三区| 欧美性感一区二区三区| 在线区一区二视频| 在线观看www91| 欧洲一区二区三区免费视频| 色综合久久中文字幕综合网| 91视频你懂的| 色综合久久中文字幕| 91久久精品午夜一区二区| 91成人看片片| 欧美天堂一区二区三区| 欧美日韩一区精品| 日韩免费一区二区三区在线播放| 欧美揉bbbbb揉bbbbb| 9191国产精品| 日韩女优制服丝袜电影| 欧美videossexotv100| 欧美精品一区二区高清在线观看| 欧美成人官网二区| 国产日韩欧美综合在线| 亚洲欧洲另类国产综合| 亚洲一区二区视频在线观看| 午夜视频久久久久久| 蜜臀99久久精品久久久久久软件| 久久精品久久综合| 成年人国产精品| 色婷婷av久久久久久久| 欧美二区在线观看| 久久精品免费在线观看| 亚洲精品乱码久久久久久久久| 亚洲成人黄色影院| 激情六月婷婷久久| 91免费看`日韩一区二区| 这里是久久伊人| 国产三区在线成人av| 亚洲一区二区三区四区五区中文| 首页国产丝袜综合| 岛国精品一区二区| 精品1区2区3区| 久久久精品日韩欧美| 亚洲精品国产无套在线观| 视频在线观看一区二区三区| 国产综合一区二区| 欧美日韩日日骚| 国产精品私人自拍| 青青草97国产精品免费观看无弹窗版| 国产成人一区在线| 欧美精品一卡二卡| 中文字幕中文在线不卡住| 美女网站在线免费欧美精品| 91丝袜美腿高跟国产极品老师|