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

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

?? callback.c

?? a sample WDM stream class video capture driver that supports two IEEE 1394 digital cameras. The sam
?? C
?? 第 1 頁 / 共 2 頁
字號:
//===========================================================================
//
// 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 - 2000  Microsoft Corporation.  All Rights Reserved.
//
//===========================================================================
/*++

Module Name:

    dcampkt.c

Abstract:

    This file contains code to handle callback from the bus/class driver.
    They might be running in DISPATCH level.

Author:   

    Yee J. Wu 15-Oct-97

Environment:

    Kernel mode only

Revision History:


--*/


#include "strmini.h"
#include "ksmedia.h"
#include "1394.h"
#include "wdm.h"       // for DbgBreakPoint() defined in dbg.h
#include "dbg.h"
#include "dcamdef.h"
#include "dcampkt.h"
#include "sonydcam.h"
#include "capprop.h"


NTSTATUS
DCamToInitializeStateCompletionRoutine(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP pIrp,
    IN PDCAM_IO_CONTEXT pDCamIoContext
    )

/*++

Routine Description:

    Completion routine called after the device is initialize to a known state.

Arguments:

    DriverObject - Pointer to driver object created by system.

    pIrp - Irp that just completed

    pDCamIoContext - A structure that contain the context of this IO completion routine.

Return Value:

    None.

--*/

{
    PDCAM_EXTENSION pDevExt;
    PSTREAMEX pStrmEx;
    PIRB pIrb;

    if(!pDCamIoContext) {
        return STATUS_MORE_PROCESSING_REQUIRED;
    }


    pIrb = pDCamIoContext->pIrb;
    pDevExt = pDCamIoContext->pDevExt;
    
    DbgMsg2(("\'DCamToInitializeStateCompletionRoutine: completed DeviceState=%d; pIrp->IoStatus.Status=%x\n", 
        pDCamIoContext->DeviceState, pIrp->IoStatus.Status));

    // Free MDL
    if(pIrb->FunctionNumber == REQUEST_ASYNC_WRITE) {
        DbgMsg3(("DCamToInitializeStateCompletionRoutine: IoFreeMdl\n"));
        IoFreeMdl(pIrb->u.AsyncWrite.Mdl);
    }


    // CAUTION:
    //     Do we need to retry if the return is STATUS_TIMEOUT or invalid generation number ?
    //


    if(pIrp->IoStatus.Status != STATUS_SUCCESS) {
        ERROR_LOG(("DCamToInitializeStateCompletionRoutine: Status=%x != STATUS_SUCCESS; cannot restart its state.\n", pIrp->IoStatus.Status));

        if(pDCamIoContext->pSrb) {
            pDCamIoContext->pSrb->Status = STATUS_UNSUCCESSFUL;
            StreamClassStreamNotification(StreamRequestComplete, pDCamIoContext->pSrb->StreamObject, pDCamIoContext->pSrb);
        }
        DCamFreeIrbIrpAndContext(pDCamIoContext, pDCamIoContext->pIrb, pIrp);

        return STATUS_MORE_PROCESSING_REQUIRED;      
    }

    //
    // Done here if we are in STOP or PAUSE state;
    // else setting to RUN state.
    //
    pStrmEx = (PSTREAMEX) pDevExt->pStrmEx;

    //
    // No stream is open, job is done.
    //
    if(!pStrmEx) {
        if(pDCamIoContext->pSrb) {
            pDCamIoContext->pSrb->Status = STATUS_SUCCESS;
            StreamClassStreamNotification(StreamRequestComplete, pDCamIoContext->pSrb->StreamObject, pDCamIoContext->pSrb);
        }
        return STATUS_MORE_PROCESSING_REQUIRED;      
    }

    switch(pStrmEx->KSStateFinal) {
    case KSSTATE_STOP:
    case KSSTATE_PAUSE:
        pStrmEx->KSState = pStrmEx->KSStateFinal;
        if(pDCamIoContext->pSrb) {
            pDCamIoContext->pSrb->Status = STATUS_SUCCESS;
            StreamClassStreamNotification(StreamRequestComplete, pDCamIoContext->pSrb->StreamObject, pDCamIoContext->pSrb);
        }
        DCamFreeIrbIrpAndContext(pDCamIoContext, pDCamIoContext->pIrb, pIrp);
        break;

    case KSSTATE_RUN:
        if(pDCamIoContext->pSrb) {
            pDCamIoContext->pSrb->Status = STATUS_SUCCESS;
            StreamClassStreamNotification(StreamRequestComplete, pDCamIoContext->pSrb->StreamObject, pDCamIoContext->pSrb);
        }

        // Restart the stream.
        DCamSetKSStateRUN(pDevExt, pDCamIoContext->pSrb);

        // Need pDCamIoContext->pSrb; so free it after DCamSetKSStateRUN().
        DCamFreeIrbIrpAndContext(pDCamIoContext, pDCamIoContext->pIrb, pIrp);
        break;
    }

    return STATUS_MORE_PROCESSING_REQUIRED;      
}

NTSTATUS
DCamSetKSStateInitialize(
    PDCAM_EXTENSION pDevExt
    )
/*++

Routine Description:

    Set KSSTATE to KSSTATE_RUN.

Arguments:

    pDevExt - 

Return Value:

    Nothing

--*/
{

    PSTREAMEX pStrmEx;
    PIRB pIrb;
    PIRP pIrp;
    PDCAM_IO_CONTEXT pDCamIoContext;
    PIO_STACK_LOCATION NextIrpStack;
    NTSTATUS Status;


    ASSERT(pDevExt);
    pStrmEx = (PSTREAMEX) pDevExt->pStrmEx;                  
    

    if(!DCamAllocateIrbIrpAndContext(&pDCamIoContext, &pIrb, &pIrp, pDevExt->BusDeviceObject->StackSize)) {
        return STATUS_INSUFFICIENT_RESOURCES;
    } 



    //
    // Initialize the device to a known state 
    // may need to do this due to power down??
    //

    pDCamIoContext->DeviceState = DCAM_SET_INITIALIZE;  // Keep track of device state that we just set.
    pDCamIoContext->pDevExt     = pDevExt;
    pDCamIoContext->RegisterWorkArea.AsULONG = 0;
    pDCamIoContext->RegisterWorkArea.Initialize.Initialize = TRUE;
    pDCamIoContext->RegisterWorkArea.AsULONG = bswap(pDevExt->RegisterWorkArea.AsULONG);
    pIrb->FunctionNumber = REQUEST_ASYNC_WRITE;
    pIrb->Flags = 0;
    pIrb->u.AsyncWrite.DestinationAddress.IA_Destination_Offset.Off_High = INITIAL_REGISTER_SPACE_HI;
    pIrb->u.AsyncWrite.DestinationAddress.IA_Destination_Offset.Off_Low =  
              pDevExt->BaseRegister + FIELDOFFSET(CAMERA_REGISTER_MAP, Initialize);
    pIrb->u.AsyncWrite.nNumberOfBytesToWrite = sizeof(ULONG);
    pIrb->u.AsyncWrite.nBlockSize = 0;
    pIrb->u.AsyncWrite.fulFlags = 0;
    InterlockedExchange(&pIrb->u.AsyncWrite.ulGeneration, pDevExt->CurrentGeneration);        
    pIrb->u.AsyncWrite.Mdl = 
        IoAllocateMdl(&pDCamIoContext->RegisterWorkArea, sizeof(ULONG), FALSE, FALSE, NULL);
    MmBuildMdlForNonPagedPool(pIrb->u.AsyncWrite.Mdl);

    NextIrpStack = IoGetNextIrpStackLocation(pIrp);
    NextIrpStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
    NextIrpStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_1394_CLASS;
    NextIrpStack->Parameters.Others.Argument1 = pIrb;
          
    IoSetCompletionRoutine(
        pIrp,
        DCamToInitializeStateCompletionRoutine,
        pDCamIoContext,
        TRUE,
        TRUE,
        TRUE
        );

    Status = 
        IoCallDriver(
            pDevExt->BusDeviceObject,
            pIrp
            );

    return STATUS_SUCCESS;
}

VOID
DCamBusResetNotification(
    IN PVOID Context
    )
/*++

Routine Description:

    We receive this callback notification after a bus reset and if the device is still attached.
    This can happen when a new device is plugged in or an existing one is removed, or due to 
    awaken from sleep state. We will restore the device to its original streaming state by
    (1) Initialize the device to a known state and then 
    (2) launch a state machine to restart streaming.
    We will stop the state machine if previous state has failed.  This can happen if the generation 
    count is changed before the state mahcine is completed.
    
    The freeing and realocation of isoch bandwidth and channel are done in the bus reset irp.
    It is passed down by stream class in SRB_UNKNOWN_DEVICE_COMMAND. This IRP is guarantee to 
    call after this bus reset notification has returned and while the state machine is going on.   

    This is a callback at IRQL_DPC level; there are many 1394 APIs cannot be called at this level
    if it does blocking using KeWaitFor*Object().  Consult 1394 docuement for the list.

    
Arguments:

    Context - Pointer to the context of this registered notification.

Return Value:

    Nothing

--*/
{

    PDCAM_EXTENSION pDevExt = (PDCAM_EXTENSION) Context;
    PSTREAMEX pStrmEx;
    NTSTATUS Status;
    PIRP pIrp;
    PIRB pIrb;

    
    if(!pDevExt) {
        ERROR_LOG(("DCamBusResetNotification:pDevExt is 0.\n\n"));  
        ASSERT(pDevExt);        
        return;
    }

    //
    // Check a field in the context that must be valid to make sure that it is Ok to continue. 
    //
    if(!pDevExt->BusDeviceObject) {
        ERROR_LOG(("DCamBusResetNotification:pDevExtBusDeviceObject is 0.\n\n"));  
        ASSERT(pDevExt->BusDeviceObject);        
        return;
    }  
    DbgMsg2(("DCamBusResetNotification: pDevExt %x, pDevExt->pStrmEx %x, pDevExt->BusDeviceObject %x\n", 
        pDevExt, pDevExt->pStrmEx, pDevExt->BusDeviceObject));

    //
    //
    // Get the current generation count first
    //
    // CAUTION: 
    //     not all 1394 APIs can be called in DCamSubmitIrpSynch() if in DISPATCH_LEVEL;
    //     Getting generation count require no blocking so it is OK.
    if(!DCamAllocateIrbAndIrp(&pIrb, &pIrp, pDevExt->BusDeviceObject->StackSize)) {
        ERROR_LOG(("DCamBusResetNotification: DcamAllocateIrbAndIrp has failed!!\n\n\n"));
        ASSERT(FALSE);            
        return;   
    } 

    pIrb->FunctionNumber = REQUEST_GET_GENERATION_COUNT;
    pIrb->Flags = 0;
    Status = DCamSubmitIrpSynch(pDevExt, pIrp, pIrb);
    if(Status) {
        ERROR_LOG(("\'DCamBusResetNotification: Status=%x while trying to get generation number\n", Status));
        // Done with them; free resources.
        DCamFreeIrbIrpAndContext(0, pIrb, pIrp);
        return;
    }
    ERROR_LOG(("DCamBusResetNotification: Generation number from %d to %d\n", 
        pDevExt->CurrentGeneration, pIrb->u.GetGenerationCount.GenerationCount));

    InterlockedExchange(&pDevExt->CurrentGeneration, pIrb->u.GetGenerationCount.GenerationCount);


    // Done with them; free resources.
    DCamFreeIrbIrpAndContext(0, pIrb, pIrp);

    pStrmEx = (PSTREAMEX) pDevExt->pStrmEx;
    DbgMsg2(("\'%d:%s) DCamBusResetNotification: !!! pDevExt, %x; pStrmEx, %x !!!\n", 
          pDevExt->idxDev, pDevExt->pchVendorName, pDevExt, pStrmEx));

    //
    // If the stream was open (pStrmEx != NULL && pStrmEx->pVideoInfoHeader != NULL),
    // then we need to restore its streaming state.
    //
    if (pStrmEx &&
        pStrmEx->pVideoInfoHeader != NULL) {
        DbgMsg2(("\'%d:%s) DCamBusResetNotification: Stream was open; Try allocate them again.\n", pDevExt->idxDev, pDevExt->pchVendorName));
    } else {
        DbgMsg2(("DCamBusResetNotification:Stream has not open on this device.  Done!\n"));
        return;
    }


    //
    // Save the original state as the final state.
    //
    if(pStrmEx)
        pStrmEx->KSStateFinal = pStrmEx->KSState;     

    //
    // Initialize the device, and restore to its original streaming state.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
...xxx性欧美| 9191成人精品久久| 欧美在线999| 久久婷婷国产综合国色天香| 国产乱子轮精品视频| av欧美精品.com| 亚洲精品一区二区三区精华液| 亚洲欧美日韩国产手机在线| 蜜桃视频第一区免费观看| av电影一区二区| 久久久久久久久久久久电影 | 欧美日韩一区二区三区在线| 国产日韩欧美a| 久久电影国产免费久久电影| 欧美色精品在线视频| ...中文天堂在线一区| 国产激情精品久久久第一区二区| 91麻豆精品国产91久久久久久久久 | 欧美丰满美乳xxx高潮www| 国产精品久久久久久久久快鸭| 狠狠色丁香婷综合久久| 91.成人天堂一区| 波多野结衣91| 欧美—级在线免费片| 韩国av一区二区| 精品久久久久久久久久久久久久久 | 99精品一区二区| 国产目拍亚洲精品99久久精品| 久久99国产精品麻豆| 9191精品国产综合久久久久久| 亚洲午夜一区二区三区| 91九色最新地址| 亚洲精品成人在线| 色吊一区二区三区| 亚洲一区二区综合| 欧美在线观看视频一区二区三区| 一区二区三区免费| 在线观看亚洲精品视频| 一区二区三区欧美| 精品污污网站免费看| 石原莉奈在线亚洲二区| 日韩免费视频线观看| 久久精品国产77777蜜臀| 欧美电影免费观看高清完整版| 美女免费视频一区| 精品乱人伦一区二区三区| 国内精品国产成人国产三级粉色| 中文字幕日韩欧美一区二区三区| 久久国产麻豆精品| 精品国产免费视频| av激情成人网| 亚洲制服丝袜一区| 91精品国产综合久久精品| 麻豆一区二区三| 久久精品在这里| 国产喂奶挤奶一区二区三区| 国产精品一区二区三区四区| 中文字幕一区免费在线观看| 在线观看视频欧美| 美女视频网站久久| 国产精品视频一二| 欧美视频在线一区| 韩国欧美国产一区| 亚洲手机成人高清视频| 欧美电影影音先锋| 国产精品一区二区三区99| 亚洲欧美经典视频| 日韩欧美一二三四区| 成人午夜激情视频| 午夜婷婷国产麻豆精品| 精品久久人人做人人爱| 91免费在线看| 国精品**一区二区三区在线蜜桃| 国产精品灌醉下药二区| 91精品国产综合久久福利| 粉嫩一区二区三区性色av| 五月天激情综合| 国产精品天干天干在观线| 69成人精品免费视频| 99精品国产91久久久久久| 日本三级亚洲精品| 亚洲日本va在线观看| 精品国产不卡一区二区三区| 欧美特级限制片免费在线观看| 国产精品99久久久久久久女警| 亚洲国产视频在线| 国产剧情一区二区三区| 亚洲第一综合色| 中文字幕不卡的av| 精品国产一区a| 在线91免费看| 欧美日韩国产首页| 色偷偷一区二区三区| 国产精品性做久久久久久| 视频一区国产视频| 亚洲一二三四区| 日韩伦理av电影| 中文字幕高清不卡| 国产日韩影视精品| 欧美精品一区二区三区很污很色的 | 欧美亚洲一区二区在线| 成人国产视频在线观看 | 亚洲精品免费一二三区| 精品国产一区二区在线观看| 欧美一区二区日韩一区二区| 欧美丝袜丝交足nylons图片| 成人h动漫精品一区二区| 国产一区二区三区黄视频 | 一二三区精品视频| 国产精品成人免费在线| 久久婷婷综合激情| 精品国产一区二区三区不卡| 欧美大片拔萝卜| 欧美不卡123| 欧美一级专区免费大片| 欧美欧美午夜aⅴ在线观看| 欧美四级电影网| 欧美精品日韩精品| 91精品国产一区二区三区香蕉| 欧美人xxxx| 91精品国产aⅴ一区二区| 91精品国产一区二区三区香蕉| 在线不卡的av| 精品日本一线二线三线不卡| 久久这里只精品最新地址| 国产亚洲综合av| 国产精品久久久久久亚洲毛片 | 精品国产精品网麻豆系列| 精品电影一区二区三区 | 亚洲欧美日韩中文字幕一区二区三区 | 亚洲福利一区二区三区| 爽好久久久欧美精品| 奇米888四色在线精品| 捆绑调教美女网站视频一区| 国产精品一区二区无线| av成人免费在线| 欧美色成人综合| 欧美成人a视频| 国产精品乱码人人做人人爱| 国产精品羞羞答答xxdd| 日本乱人伦aⅴ精品| 制服.丝袜.亚洲.中文.综合| 欧美一区二区日韩一区二区| 日本一区二区三区久久久久久久久不| 国产精品久久精品日日| 亚洲地区一二三色| 精品午夜久久福利影院| 91麻豆精品一区二区三区| 欧美日韩一级视频| 久久精品亚洲精品国产欧美kt∨| 亚洲人成人一区二区在线观看| 午夜精品爽啪视频| 国产毛片一区二区| 色狠狠综合天天综合综合| 日韩欧美成人一区| 日韩一区欧美一区| 麻豆精品久久精品色综合| 99在线视频精品| 日韩一二三区不卡| 日韩理论在线观看| 久久99精品国产.久久久久久| 91麻豆产精品久久久久久| 777色狠狠一区二区三区| 欧美国产精品专区| 日本成人在线视频网站| 一本到三区不卡视频| 精品国产自在久精品国产| 夜夜嗨av一区二区三区网页| 国产精品系列在线观看| 欧美日韩国产成人在线免费| 国产精品每日更新在线播放网址| 免费久久99精品国产| 欧美最猛黑人xxxxx猛交| 久久亚洲一区二区三区四区| 91国偷自产一区二区开放时间| 精品国产免费人成电影在线观看四季| 亚洲激情图片小说视频| 成人网男人的天堂| 精品精品欲导航| 日韩不卡在线观看日韩不卡视频| 色丁香久综合在线久综合在线观看 | 亚洲色图一区二区| 国产精品一区二区三区网站| 日韩丝袜情趣美女图片| 亚洲成人精品一区二区| 日本道精品一区二区三区| 亚洲国产精品99久久久久久久久| 久久精品国产**网站演员| 欧美一区二区三区思思人| 亚洲制服丝袜av| 在线欧美日韩精品| 亚洲美女在线国产| a级高清视频欧美日韩| 国产精品亲子伦对白| 国产激情精品久久久第一区二区| 精品国免费一区二区三区| 久久狠狠亚洲综合| 日韩精品一区二区三区中文不卡 | 精品写真视频在线观看| 日韩欧美的一区二区|