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

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

?? ioctliso.c

?? 該代碼是基于S3C2410處理器上USB的驅(qū)動程序代碼
?? C
字號:
/*++

Copyright (c) 1997-1998  Microsoft Corporation

Module Name:

   ioctliso.c

Abstract:

    USB device driver for Intel 82930 USB test board.
    IOCTL handlers

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) 1997-1998 Microsoft Corporation.  All Rights Reserved.


Revision History:

    11/17/97 : created

--*/


#include "wdm.h"
#include "stdarg.h"
#include "stdio.h"


#include "usbdi.h"
#include "usbdlib.h"
#include "Iso82930.h"

#include "IsoUsb.h"
#include "usbdlib.h"



NTSTATUS
IsoUsb_ProcessIOCTL(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP Irp
    )
/*++

Routine Description:

    Dispatch table handler for IRP_MJ_DEVICE_CONTROL; 
    Handle DeviceIoControl() calls  from User mode


Arguments:

    DeviceObject - pointer to the FDO for this instance of the 82930 device.


Return Value:

    NT status code

--*/
{
    PIO_STACK_LOCATION irpStack;
    PVOID ioBuffer;
    ULONG inputBufferLength;
    ULONG outputBufferLength;
    PDEVICE_EXTENSION deviceExtension;
    ULONG ioControlCode;
    NTSTATUS ntStatus;
    ULONG length;
    PUCHAR pch;
    PUSB_CONFIGURATION_DESCRIPTOR configurationDescriptor;

    ISOUSB_KdPrint( DBGLVL_DEFAULT,("IRP_MJ_DEVICE_CONTROL\n"));

    IsoUsb_IncrementIoCount(DeviceObject);

    //
    // Get a pointer to the current location in the Irp. This is where
    //     the function codes and parameters are located.
    //

    deviceExtension = DeviceObject->DeviceExtension;
    

    // Can't accept a new io request if:
    //  1) device is removed, 
    //  2) has never been started, 
    //  3) is stopped,
    //  4) has a remove request pending,
    //  5) has a stop device pending
    if ( !IsoUsb_CanAcceptIoRequests( DeviceObject ) ) {
        ntStatus = STATUS_DELETE_PENDING;
        Irp->IoStatus.Status = ntStatus;
        Irp->IoStatus.Information = 0;

        IoCompleteRequest( Irp, IO_NO_INCREMENT );

        IsoUsb_DecrementIoCount(DeviceObject);                          
        return ntStatus;
    }

    irpStack = IoGetCurrentIrpStackLocation (Irp);

    Irp->IoStatus.Status = STATUS_SUCCESS;
    Irp->IoStatus.Information = 0;

    // get pointers and lengths of the caller's (user's) IO buffer
    ioBuffer           = Irp->AssociatedIrp.SystemBuffer;
    inputBufferLength  = irpStack->Parameters.DeviceIoControl.InputBufferLength;
    outputBufferLength = irpStack->Parameters.DeviceIoControl.OutputBufferLength;

    ioControlCode = irpStack->Parameters.DeviceIoControl.IoControlCode;

    //
    // Handle Ioctls from User mode
    //

    switch (ioControlCode) {

    case IOCTL_ISOUSB_RESET_PIPE:
        {
            PUSBD_PIPE_INFORMATION pipe;
	        PFILE_OBJECT fileObject;

		    // get our context and see if it is a pipe
	        fileObject = irpStack->FileObject;

		    pipe = (PUSBD_PIPE_INFORMATION) fileObject->FsContext;    

		    if(pipe == NULL) {
			    // error, this is not a pipe
	            ntStatus =
		            Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
		    } else {            
                IsoUsb_ResetPipe(DeviceObject, pipe, FALSE );
            
                ntStatus = Irp->IoStatus.Status = STATUS_SUCCESS;
            }
        }
        break;


     case IOCTL_ISOUSB_GET_CONFIG_DESCRIPTOR:

        //
        // This api returns a copy of the configuration descriptor
        // and all endpoint/interface descriptors.
        //

        //
        // inputs  - none
        // outputs - configuration descriptor plus interface
        //          and endpoint descriptors
        //

        pch = (PUCHAR) ioBuffer;

        configurationDescriptor =
            deviceExtension->UsbConfigurationDescriptor;

        if (configurationDescriptor) {
            
            length = configurationDescriptor->wTotalLength;

            if ( outputBufferLength < length ) { // make sure caller has big enough buffer to receive
                Irp->IoStatus.Information = 0;

                ntStatus = Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
            }
            else {
                RtlCopyMemory(pch,
                              (PUCHAR) configurationDescriptor,
                              length);

                Irp->IoStatus.Information = length;

                ntStatus = Irp->IoStatus.Status = STATUS_SUCCESS;
            }
        }
        else {

            Irp->IoStatus.Information = 0;

            ntStatus = Irp->IoStatus.Status = STATUS_DEVICE_DATA_ERROR;
        }

        break;

     case IOCTL_ISOUSB_START_ISO_STREAM:

		ntStatus = IsoUsb_StartIsoStream(DeviceObject, Irp);
        break;

    case IOCTL_ISOUSB_STOP_ISO_STREAM:

		ntStatus = IsoUsb_StopIsoStream(DeviceObject,
                        *((PVOID *) ioBuffer), // a PISOUSB_STREAM_OBJECT passed as a blind ptr input buff from user mode
                        Irp);
        break;


     case IOCTL_ISOUSB_RESET_DEVICE:
        
		ntStatus = IsoUsb_ResetDevice( DeviceObject );
        break;               

    default:

        ntStatus =
            Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
    }

    IoCompleteRequest (Irp,
                       IO_NO_INCREMENT
                       );

    IsoUsb_DecrementIoCount(DeviceObject);                       

    return ntStatus;

}




NTSTATUS
IsoUsb_ResetDevice(
    IN PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:
	Checks port status; if OK, return success and  do no more;
	If bad, attempt reset

Arguments:

    DeviceObject - pointer to the device object for this instance of the 82930
                    device.


Return Value:

    NT status code

--*/
{
    NTSTATUS ntStatus;
    ULONG portStatus;

    ISOUSB_KdPrint(DBGLVL_MEDIUM,("Enter IsoUsb_ResetDevice()\n"));
    
    //
    // Check the port state, if it is disabled we will need 
    // to re-enable it
    //
    ntStatus = IsoUsb_GetPortStatus(DeviceObject, &portStatus);

    if (NT_SUCCESS(ntStatus) && !(portStatus & USBD_PORT_ENABLED) &&
        portStatus & USBD_PORT_CONNECTED) {
        //
        // port is disabled, attempt reset
        //
		ISOUSB_KdPrint( DBGLVL_DEFAULT,("IsoUsb_ResetDevice() will reset\n"));
        ntStatus = IsoUsb_ResetParentPort(DeviceObject);
    }
	return ntStatus;
}



NTSTATUS
IsoUsb_GetPortStatus(
    IN PDEVICE_OBJECT DeviceObject,
    IN PULONG PortStatus
    )
/*++

Routine Description:

    returns the port status for our device

Arguments:

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS ntStatus, status = STATUS_SUCCESS;
    PIRP irp;
    KEVENT event;
    IO_STATUS_BLOCK ioStatus;
    PIO_STACK_LOCATION nextStack;
    PDEVICE_EXTENSION deviceExtension;

    ISOUSB_KdPrint( DBGLVL_DEFAULT,("enter IsoUsb_GetPortStatus\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    *PortStatus = 0;

    //
    // issue a synchronous request
    //

    KeInitializeEvent(&event, NotificationEvent, FALSE);

    // IoBuildDeviceIoControlRequest allocates and sets up an IRP for a device control request
    irp = IoBuildDeviceIoControlRequest(
                IOCTL_INTERNAL_USB_GET_PORT_STATUS,
                deviceExtension->TopOfStackDeviceObject, //next-lower driver's device object, representing the target device.
                NULL, // no input or output buffers
                0,
                NULL,
                0,
                TRUE, // internal ( use IRP_MJ_INTERNAL_DEVICE_CONTROL )
                &event, // event to be signalled on completion ( we wait for it below )
                &ioStatus);

    //
    // Call the class driver to perform the operation.  If the returned status
    // is PENDING, wait for the request to complete.
    //

    // IoGetNextIrpStackLocation gives a higher level driver access to the next-lower 
    // driver's I/O stack location in an IRP so the caller can set it up for the lower driver.
    nextStack = IoGetNextIrpStackLocation(irp);
    ISOUSB_ASSERT(nextStack != NULL);

    nextStack->Parameters.Others.Argument1 = PortStatus;

    ISOUSB_KdPrint( DBGLVL_DEFAULT,("IsoUsb_GetPortStatus() calling USBD port status api\n"));

    ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject,
                            irp);

    ISOUSB_KdPrint( DBGLVL_DEFAULT,("IsoUsb_GetPortStatus() return from IoCallDriver USBD %x\n", ntStatus));

    if (ntStatus == STATUS_PENDING) {

        ISOUSB_KdPrint( DBGLVL_DEFAULT,("Wait for single object\n"));

        status = KeWaitForSingleObject(
                       &event,
                       Suspended,
                       KernelMode,
                       FALSE,
                       NULL);

        ISOUSB_KdPrint( DBGLVL_DEFAULT,("IsoUsb_GetPortStatus() Wait for single object, returned %x\n", status));
        
    } else {
        ioStatus.Status = ntStatus;
    }

    ISOUSB_KdPrint( DBGLVL_DEFAULT,("IsoUsb_GetPortStatus() Port status = %x\n", *PortStatus));

    //
    // USBD maps the error code for us
    //
    ntStatus = ioStatus.Status;

    ISOUSB_KdPrint( DBGLVL_DEFAULT,("Exit IsoUsb_GetPortStatus (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
IsoUsb_ResetParentPort(
    IN IN PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    Reset the our parent port

Arguments:

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS ntStatus, status = STATUS_SUCCESS;
    PIRP irp;
    KEVENT event;
    IO_STATUS_BLOCK ioStatus;
    PIO_STACK_LOCATION nextStack;
    PDEVICE_EXTENSION deviceExtension;

    ISOUSB_KdPrint( DBGLVL_HIGH,("enter IsoUsb_ResetParentPort\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    //
    // issue a synchronous request
    //

    KeInitializeEvent(&event, NotificationEvent, FALSE);

    irp = IoBuildDeviceIoControlRequest(
                IOCTL_INTERNAL_USB_RESET_PORT,
                deviceExtension->TopOfStackDeviceObject,
                NULL,
                0,
                NULL,
                0,
                TRUE, // internal ( use IRP_MJ_INTERNAL_DEVICE_CONTROL )
                &event,
                &ioStatus);

    //
    // Call the class driver to perform the operation.  If the returned status
    // is PENDING, wait for the request to complete.
    //

    nextStack = IoGetNextIrpStackLocation(irp);
    ISOUSB_ASSERT(nextStack != NULL);

    ISOUSB_KdPrint( DBGLVL_HIGH,("IsoUsb_ResetParentPort() calling USBD enable port api\n"));

    ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject,
                            irp);
                            
    ISOUSB_KdPrint( DBGLVL_HIGH,("IsoUsb_ResetParentPort() return from IoCallDriver USBD %x\n", ntStatus));

    if (ntStatus == STATUS_PENDING) {

        ISOUSB_KdPrint( DBGLVL_HIGH,("IsoUsb_ResetParentPort() Wait for single object\n"));

        status = KeWaitForSingleObject(
                       &event,
                       Suspended,
                       KernelMode,
                       FALSE,
                       NULL);

        ISOUSB_KdPrint( DBGLVL_HIGH,("IsoUsb_ResetParentPort() Wait for single object, returned %x\n", status));
        
    } else {
        ioStatus.Status = ntStatus;
    }

    //
    // USBD maps the error code for us
    //
    ntStatus = ioStatus.Status;

    ISOUSB_KdPrint( DBGLVL_HIGH,("Exit IsoUsb_ResetPort (%x)\n", ntStatus));

    return ntStatus;
}





?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产在线精品国自产拍免费| 精品一区二区国语对白| 日韩女优电影在线观看| 91日韩在线专区| 久久精品国产在热久久| 一区二区三区精品在线| 国产蜜臀av在线一区二区三区| 在线视频一区二区三区| 成人aa视频在线观看| 毛片av一区二区三区| 亚洲午夜电影网| 国产精品国产三级国产aⅴ原创| 欧美成人激情免费网| 欧美三级在线播放| 91丨porny丨国产| 国产ts人妖一区二区| 老司机精品视频线观看86| 亚洲v日本v欧美v久久精品| 1000部国产精品成人观看| 国产日韩欧美制服另类| 日韩欧美国产一区二区三区| 欧美欧美欧美欧美首页| 色激情天天射综合网| 成人爱爱电影网址| 成人久久视频在线观看| 成人中文字幕在线| 国产黄色成人av| 国产在线视频一区二区| 麻豆国产欧美日韩综合精品二区| 亚洲国产aⅴ成人精品无吗| 一区二区三区四区激情| 一区二区三区四区在线播放| 亚洲人妖av一区二区| 国产精品视频看| 中文字幕一区二区三区精华液| 国产女人18毛片水真多成人如厕 | 日本午夜精品视频在线观看| 亚洲精品国产高清久久伦理二区| 最新日韩av在线| 亚洲欧洲av色图| 亚洲欧美区自拍先锋| 亚洲欧美日韩一区二区| 亚洲精品综合在线| 亚洲图片欧美一区| 五月婷婷综合网| 久久国产精品露脸对白| 黑人精品欧美一区二区蜜桃| 国产一区二区0| heyzo一本久久综合| 色综合久久久久久久久久久| 欧美自拍丝袜亚洲| 欧美高清视频www夜色资源网| 欧美精品在线一区二区三区| 欧美一级精品大片| 久久亚洲一区二区三区四区| 亚洲国产精品传媒在线观看| 亚洲视频网在线直播| 亚洲一区视频在线| 蜜桃久久精品一区二区| 国产乱淫av一区二区三区| 从欧美一区二区三区| 在线免费观看视频一区| 正在播放一区二区| 国产视频视频一区| 日韩理论片在线| 人人狠狠综合久久亚洲| 国产精品一区二区不卡| 色婷婷香蕉在线一区二区| 欧美日韩国产小视频在线观看| 日韩手机在线导航| 国产精品热久久久久夜色精品三区| 亚洲欧美另类图片小说| 五月天一区二区三区| 韩国v欧美v亚洲v日本v| 91论坛在线播放| 日韩三级视频在线观看| 国产精品毛片大码女人| 日韩制服丝袜av| 国产成人在线影院| 精品视频一区二区三区免费| 久久伊人中文字幕| 一区二区三区不卡视频| 国产一区二区电影| 欧美视频在线一区二区三区| 26uuu亚洲| 亚洲一区欧美一区| 懂色av中文字幕一区二区三区| 欧美色图第一页| 国产精品妹子av| 蜜臀91精品一区二区三区| 91首页免费视频| 欧美xxx久久| 艳妇臀荡乳欲伦亚洲一区| 国产高清久久久久| 欧美精品第1页| 亚洲色图视频网| 国产一区二区三区在线观看免费视频| 在线免费亚洲电影| 国产精品欧美综合在线| 美腿丝袜在线亚洲一区| 一本色道久久加勒比精品| 久久蜜桃av一区精品变态类天堂| 亚洲午夜精品一区二区三区他趣| 国产高清不卡二三区| 日韩欧美国产一区二区三区 | 蜜桃久久久久久| 欧美艳星brazzers| 中文字幕在线不卡一区二区三区| 麻豆91在线观看| 欧美丰满少妇xxxbbb| 亚洲免费av在线| 成人激情av网| 日本一区免费视频| 精品在线播放午夜| 91精品欧美一区二区三区综合在| 亚洲精品欧美二区三区中文字幕| 成人免费毛片嘿嘿连载视频| 欧美精品一区二区三区视频| 青青青爽久久午夜综合久久午夜| 欧美日韩在线亚洲一区蜜芽| 亚洲同性同志一二三专区| 成人精品在线视频观看| 国产欧美一区二区三区沐欲| 国产一区不卡在线| 精品国产一二三| 激情亚洲综合在线| 精品少妇一区二区三区日产乱码| 五月天欧美精品| 欧美日韩国产大片| 午夜电影网一区| 欧美精品一卡二卡| 日韩电影一二三区| 欧美一区二区在线播放| 蜜桃视频在线观看一区二区| 欧美一区二区久久| 久久精工是国产品牌吗| 精品国产免费人成电影在线观看四季| 麻豆精品精品国产自在97香蕉| 日韩一区二区在线观看| 麻豆极品一区二区三区| 26uuu色噜噜精品一区| 国产激情视频一区二区三区欧美| 欧美国产一区视频在线观看| 成人黄色在线视频| 亚洲精品一二三| 欧美日本在线一区| 久久精品99国产精品| 久久综合成人精品亚洲另类欧美 | 精品在线你懂的| 久久综合九色综合欧美就去吻| 国产精品123区| 国产精品久久久久久久浪潮网站| 99免费精品在线| 亚洲h精品动漫在线观看| 欧美一区二区三区小说| 国产一区二区美女| 亚洲欧美日韩小说| 欧美一区二区三区视频| 狠狠狠色丁香婷婷综合激情| 国产精品护士白丝一区av| 欧美伊人精品成人久久综合97| 全国精品久久少妇| 欧美激情一区二区三区蜜桃视频 | 一区二区三区久久久| 91精品国产91热久久久做人人 | 亚洲国产毛片aaaaa无费看 | 精品国产1区2区3区| 国产**成人网毛片九色| 亚洲美腿欧美偷拍| 日韩一区二区三区在线观看| 丁香六月久久综合狠狠色| 亚洲综合色网站| 精品国产sm最大网站免费看| 91视频.com| 韩国一区二区三区| 亚洲综合清纯丝袜自拍| 精品少妇一区二区三区日产乱码| 成人a免费在线看| 日本成人中文字幕| 国产精品伦理在线| 日韩欧美专区在线| 91视频免费播放| 激情另类小说区图片区视频区| 亚洲色图在线播放| 久久亚洲精精品中文字幕早川悠里 | 亚洲网友自拍偷拍| 精品国精品国产| 欧美写真视频网站| 国产91丝袜在线观看| 午夜精品福利一区二区蜜股av| 中文字幕免费观看一区| 欧美精品三级在线观看| 波多野结衣亚洲一区| 麻豆成人久久精品二区三区红 | 免费成人在线视频观看| 伊人性伊人情综合网| 久久亚洲精品国产精品紫薇| 欧美巨大另类极品videosbest| 丁香啪啪综合成人亚洲小说| 老司机午夜精品99久久|