亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲国产精品一区二区尤物区| 欧美日韩国产大片| 粉嫩aⅴ一区二区三区四区五区| 95精品视频在线| 日韩视频一区二区| 最新日韩在线视频| 免费成人av在线播放| 国产在线一区观看| 美腿丝袜在线亚洲一区| 欧美在线观看一二区| 国产精品欧美经典| 欧美一区二区在线免费播放 | 国产成人亚洲综合色影视| bt欧美亚洲午夜电影天堂| 欧美大胆一级视频| 午夜视频在线观看一区二区| 成人午夜激情在线| 久久影院视频免费| 免费成人美女在线观看.| 91久久精品网| 中文字幕精品一区二区精品绿巨人| 日产国产欧美视频一区精品| 91高清在线观看| 亚洲视频在线观看一区| 成人18视频在线播放| 欧美在线观看一区| 精品视频一区三区九区| 久久久天堂av| 国产主播一区二区| 欧美艳星brazzers| 欧美tickling网站挠脚心| 精品成人佐山爱一区二区| 日本一区二区成人在线| 国产成人午夜视频| 国产日韩欧美高清在线| 极品少妇xxxx精品少妇| 中文字幕第一区综合| 成人性生交大片免费| 亚洲国产精品激情在线观看| 国产91精品一区二区麻豆网站| 久久人人97超碰com| 久久99热这里只有精品| 欧美精品一区二区不卡| 国产自产高清不卡| 国产丝袜美腿一区二区三区| 国产成人综合精品三级| 国产精品入口麻豆九色| 成人精品免费视频| 亚洲视频图片小说| 欧美体内she精高潮| 偷窥国产亚洲免费视频| 日韩视频在线你懂得| 激情伊人五月天久久综合| 精品国产乱码久久久久久图片| 国产高清精品在线| 亚洲欧美另类图片小说| 精品视频一区二区不卡| 九九在线精品视频| 中文欧美字幕免费| 在线亚洲+欧美+日本专区| 日本中文字幕一区| 亚洲精品在线三区| 91原创在线视频| 婷婷开心激情综合| 久久久蜜桃精品| 色香蕉成人二区免费| 精品一二三四在线| 在线这里只有精品| 日韩一区二区麻豆国产| 美女视频第一区二区三区免费观看网站 | 国产亚洲va综合人人澡精品 | 亚洲丝袜美腿综合| 777亚洲妇女| 成人国产免费视频| 五月综合激情网| 国产日韩av一区二区| 欧美亚洲精品一区| 狠狠色丁香久久婷婷综| 亚洲伦理在线精品| 日韩视频国产视频| 99久久99精品久久久久久| 日韩高清不卡一区二区| 中文字幕制服丝袜一区二区三区 | 日本三级亚洲精品| 国产精品动漫网站| 欧美一级二级三级乱码| av中文字幕在线不卡| 久久国内精品视频| 亚洲国产欧美在线| 欧美国产禁国产网站cc| 日韩三级中文字幕| 色综合久久99| 国产福利一区在线| 日本欧美一区二区| 亚洲综合色网站| 日韩一区在线播放| 国产婷婷一区二区| 精品久久久久久久久久久久包黑料 | 国产精品久久福利| 日韩精品一区二区三区视频播放| 日本电影欧美片| 成人av网在线| 成人午夜电影小说| 国产一区二区伦理片| 日韩精品电影在线| 一区二区三区丝袜| 亚洲精选在线视频| 亚洲免费在线视频一区 二区| 中文字幕免费不卡在线| 久久久美女毛片| 国产欧美一区二区三区在线看蜜臀 | 久久精品日产第一区二区三区高清版| 3d动漫精品啪啪一区二区竹菊| 成人av在线播放网站| 国产成人在线色| 成人ar影院免费观看视频| 国产精品资源站在线| 国内精品写真在线观看| 精品在线视频一区| 国产乱码精品一区二区三区忘忧草| 午夜精品免费在线| 尤物视频一区二区| 亚洲丝袜另类动漫二区| 一区二区三区中文字幕精品精品 | 精品国产精品网麻豆系列| 91精品国产手机| 欧美日韩另类国产亚洲欧美一级| 国产·精品毛片| 激情偷乱视频一区二区三区| 激情文学综合丁香| 久久99精品国产.久久久久久| 日本午夜一本久久久综合| 久草这里只有精品视频| 奇米色777欧美一区二区| 亚洲 欧美综合在线网络| 秋霞av亚洲一区二区三| 热久久国产精品| 老鸭窝一区二区久久精品| 亚洲一区二区三区免费视频| 亚洲国产另类av| 亚洲午夜日本在线观看| 午夜精品久久久久久不卡8050| 亚洲综合图片区| 午夜影院久久久| 一区二区三区精品在线| 麻豆精品国产传媒mv男同| 美女视频一区二区三区| 九九精品视频在线看| 成人h动漫精品一区二区| 成人激情动漫在线观看| 91浏览器入口在线观看| 在线播放视频一区| 精品国产百合女同互慰| 国产欧美在线观看一区| 欧美tickling挠脚心丨vk| 国产三级精品在线| 亚洲欧美区自拍先锋| 免费观看日韩电影| 国产91精品久久久久久久网曝门| 欧美专区日韩专区| 日韩一区二区不卡| 欧美国产欧美亚州国产日韩mv天天看完整 | 日韩欧美视频在线| 欧美一级午夜免费电影| 国产精品网站一区| 亚洲一区二区三区自拍| 久久爱www久久做| 色综合色综合色综合| 宅男在线国产精品| 久久久综合网站| 亚洲综合在线免费观看| 免费xxxx性欧美18vr| 本田岬高潮一区二区三区| 欧美成人女星排名| 亚洲欧美激情插| 久久66热偷产精品| 欧美一区二区视频网站| 中文字幕永久在线不卡| 黄色成人免费在线| 在线视频你懂得一区| 精品电影一区二区三区| 午夜精品123| av福利精品导航| 日韩免费性生活视频播放| 亚洲成人精品在线观看| 国产69精品久久久久毛片| 欧美精品少妇一区二区三区| 亚洲精品美国一| 国产成人精品亚洲777人妖| 91精彩视频在线观看| 成人欧美一区二区三区视频网页| 麻豆91免费看| 欧美亚洲丝袜传媒另类| 国产精品理伦片| 国产成人精品免费| 日韩欧美亚洲国产精品字幕久久久| 亚洲女同ⅹxx女同tv| 色综合色综合色综合色综合色综合 | 全国精品久久少妇| 欧美日韩电影一区|