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

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

?? isousb.c

?? gec2410開發(fā)板和PC機(jī)用USB連接
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*++

Copyright (c) 1997-1998  Microsoft Corporation

Module Name:

    IsoUsb.c 

Abstract:

    Isochronous USB device driver for Intel 82930 USB test board
    Main module

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 "GUIDISO.h"


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;
    BOOLEAN fRes;

#if DBG
	// should be done before any debug output is done.
    // read our debug verbosity level from the registry
    IsoUsb_GetRegistryDword( ISOUSB_REGISTRY_PARAMETERS_PATH, //absolute registry path
                                     L"DebugLevel",     // REG_DWORD ValueName
                                     &gDebugLevel );    // Value receiver
#endif


    ISOUSB_KdPrint( DBGLVL_MINIMUM ,("Entering DriverEntry(), RegistryPath=\n    %ws\n", RegistryPath->Buffer ));

    //
    // Create dispatch points for create, close, unload
    DriverObject->MajorFunction[IRP_MJ_CREATE] = IsoUsb_Create;
    DriverObject->MajorFunction[IRP_MJ_CLOSE] = IsoUsb_Close;
    DriverObject->DriverUnload = IsoUsb_Unload;

    // User mode DeviceIoControl() calls will be routed here
    DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IsoUsb_ProcessIOCTL;

    // User mode ReadFile()/WriteFile() calls will be routed here
    DriverObject->MajorFunction[IRP_MJ_WRITE] = IsoUsb_Write;
    DriverObject->MajorFunction[IRP_MJ_READ] = IsoUsb_Read;

    // routines for handling system PNP and power management requests
    DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = IsoUsb_ProcessSysControlIrp;
    DriverObject->MajorFunction[IRP_MJ_PNP] = IsoUsb_ProcessPnPIrp;
    DriverObject->MajorFunction[IRP_MJ_POWER] = IsoUsb_ProcessPowerIrp;

    // The Functional Device Object (FDO) will not be created for PNP devices until 
    // this routine is called upon device plug-in.
    DriverObject->DriverExtension->AddDevice = IsoUsb_PnPAddDevice;


    ISOUSB_KdPrint( DBGLVL_DEFAULT,("exiting DriverEntry (%x)\n", ntStatus));

    return ntStatus;
}





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

Routine Description:

    Main dispatch table routine for IRP_MJ_SYSTEM_CONTROL
	We basically just pass these down to the PDO

Arguments:

    DeviceObject - pointer to FDO device object

    Irp          - pointer to an I/O Request Packet

Return Value:

	Status returned from lower driver


--*/
{

    PIO_STACK_LOCATION irpStack;
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    NTSTATUS waitStatus;
    PDEVICE_OBJECT stackDeviceObject;

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

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

    irpStack = IoGetCurrentIrpStackLocation (Irp);

    //
    // Get a pointer to the device extension
    //

    deviceExtension = DeviceObject->DeviceExtension;
    stackDeviceObject = deviceExtension->TopOfStackDeviceObject;

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

    IsoUsb_IncrementIoCount(DeviceObject);

    ISOUSB_ASSERT( IRP_MJ_SYSTEM_CONTROL == irpStack->MajorFunction );

    IoCopyCurrentIrpStackLocationToNext(Irp);


    ntStatus = IoCallDriver(stackDeviceObject,
                            Irp);

    IsoUsb_DecrementIoCount(DeviceObject);

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

    return ntStatus;
}


VOID
IsoUsb_Unload(
    IN PDRIVER_OBJECT DriverObject
    )
/*++

Routine Description:

    Free all the allocated resources, etc.

Arguments:

    DriverObject - pointer to a driver object

Return Value:


--*/
{
    ISOUSB_KdPrint( DBGLVL_HIGH,("enter IsoUsb_Unload\n"));

    //
    // Free any global resources allocated
    // in DriverEntry.
	// We have few or none because for a PNP device, almost all
	// allocation is done in PnpAddDevice() and all freeing 
	// while handling IRP_MN_REMOVE_DEVICE:
    //

    ISOUSB_KdPrint( DBGLVL_DEFAULT,("exit IsoUsb_Unload\n"));


}


NTSTATUS
IsoUsb_SymbolicLink(
    IN PDEVICE_OBJECT DeviceObject,
    IN OUT PUNICODE_STRING deviceLinkUnicodeString

    )
/*++

Routine Description:

    This routine is called to create and initialize
    a GUID-based symbolic link to our device to be used to open/create 
    instances of us from user mode.

    Called from IsoUsb_CreateDeviceObject() to create the link. 

Arguments:

    DeviceObject - pointer to our Physical Device Object ( PDO )

    deviceLinkUnicodeString - Points to a unicode string structure allocated by the caller. 
        If this routine is successful, it initializes the unicode string and allocates 
        the string buffer containing the kernel-mode path to the symbolic link for this 
        device interface. 


Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/{
    NTSTATUS ntStatus = STATUS_SUCCESS;


    //  Create the symbolic link
     
    // IoRegisterDeviceInterface registers device functionality (a device interface) 
    // that a driver will enable for use by applications or other system components.

    ntStatus = IoRegisterDeviceInterface(
                DeviceObject,
                (LPGUID)&GUID_CLASS_I82930_ISO,
                NULL,
                deviceLinkUnicodeString);

    ISOUSB_KdPrintCond( DBGLVL_MEDIUM, (!(NT_SUCCESS(ntStatus))),
            ("FAILED to IoRegisterDeviceInterface()\n"));

   if (NT_SUCCESS(ntStatus)) {

       // IoSetDeviceInterfaceState enables or disables a previously 
       // registered device interface. Applications and other system components 
       // can open only interfaces that are enabled.

        ntStatus = IoSetDeviceInterfaceState(deviceLinkUnicodeString, TRUE);

        ISOUSB_KdPrintCond( DBGLVL_MEDIUM,
                (!(NT_SUCCESS(ntStatus))),
                ("FAILED to IoSetDeviceInterfaceState()\n"));

        ISOUSB_KdPrintCond( DBGLVL_MEDIUM,
                ((NT_SUCCESS(ntStatus))),
                ("SUCCEEDED  IoSetDeviceInterfaceState()\n"));

    }

    return ntStatus;
}



NTSTATUS
IsoUsb_CreateDeviceObject(
    IN PDRIVER_OBJECT DriverObject,
    IN PDEVICE_OBJECT PhysicalDeviceObject,
    IN PDEVICE_OBJECT *DeviceObject
    )
/*++

Routine Description:

    Creates a Functional DeviceObject

Arguments:

    DriverObject - pointer to the driver object for device

    DeviceObject - pointer to DeviceObject pointer to return
                    created device object.

    Instance - instance of the device create.

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS ntStatus;
    UNICODE_STRING deviceLinkUnicodeString;
    PDEVICE_EXTENSION deviceExtension;
    USHORT i;

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

    ntStatus = IsoUsb_SymbolicLink( PhysicalDeviceObject, &deviceLinkUnicodeString );

    ISOUSB_KdPrintCond( DBGLVL_DEFAULT,
            (NT_SUCCESS(ntStatus)),
            ("IsoUsb_CreateDeviceObject() SUCCESS Create GUID_CLASS_IsoUsb_ISO-based Device name\n   %ws\n Length decimal %d, MaximumLength decimal %d\n",
            deviceLinkUnicodeString.Buffer,
            deviceLinkUnicodeString.Length,
            deviceLinkUnicodeString.MaximumLength));

    ISOUSB_KdPrintCond( DBGLVL_DEFAULT,
            (!(NT_SUCCESS(ntStatus))),
            ("IsoUsb_CreateDeviceObject() FAILED to Create GUID_CLASS_ISO-based Device name\n"));

    if (NT_SUCCESS(ntStatus)) {

        ntStatus = IoCreateDevice (DriverObject,
                           sizeof (DEVICE_EXTENSION),
                           NULL,
                           FILE_DEVICE_UNKNOWN,
                           FILE_AUTOGENERATED_DEVICE_NAME,
                           FALSE,
                           DeviceObject);

        if (NT_SUCCESS(ntStatus))  {
             deviceExtension = (PDEVICE_EXTENSION) ((*DeviceObject)->DeviceExtension);

        }

        ISOUSB_KdPrintCond( DBGLVL_DEFAULT,
                (!(NT_SUCCESS(ntStatus))),
                ("IsoUsb_CreateDeviceObject() IoCreateDevice() FAILED\n"));

         ISOUSB_KdPrintCond( DBGLVL_DEFAULT,
                ((NT_SUCCESS(ntStatus))),
                ("IsoUsb_CreateDeviceObject() IoCreateDevice() SUCCESS\n"));

 
        if (!NT_SUCCESS(ntStatus))  {
             return ntStatus;
        }


        //default maximum transfer size per io request
        deviceExtension->MaximumTransferSize =  ISO_MAX_TRANSFER_SIZE ;

#if DBG
        // may be overridden in registry
        IsoUsb_GetRegistryDword( ISOUSB_REGISTRY_PARAMETERS_PATH,
                                         L"MaximumTransferSize",
                                         &(deviceExtension->MaximumTransferSize) );
#endif

        // Name buffer for our named Functional device object link
        // The name is generated based on the driver's class GUID
        RtlCopyMemory(deviceExtension->DeviceLinkNameBuffer,
                      deviceLinkUnicodeString.Buffer,
                      deviceLinkUnicodeString.Length);


        // this event is triggered when there is no pending io of any kind and device is removed
        KeInitializeEvent(&deviceExtension->RemoveEvent, NotificationEvent, FALSE);

        // this event is triggered when self-requested power irps complete
        KeInitializeEvent(&deviceExtension->SelfRequestedPowerIrpEvent, NotificationEvent, FALSE);

        // this event is triggered when there is no pending io  (pending io count == 1 )
        KeInitializeEvent(&deviceExtension->NoPendingIoEvent, NotificationEvent, FALSE);

		//free buffer from unicode string we used to init interface
		RtlFreeUnicodeString( &deviceLinkUnicodeString );
    }

     ISOUSB_KdPrintCond( DBGLVL_DEFAULT,
            ((NT_SUCCESS(ntStatus))),
            ("Exit IsoUsb_CreateDeviceObject() IoCreateDevice() SUCCESS\n"));

 
    return ntStatus;
}


NTSTATUS
IsoUsb_CallUSBD(
    IN PDEVICE_OBJECT DeviceObject,
    IN PURB Urb
    )
/*++

Routine Description:

    Passes a URB to the USBD class driver
	The client device driver passes USB request block (URB) structures 
	to the class driver as a parameter in an IRP with Irp->MajorFunction
	set to IRP_MJ_INTERNAL_DEVICE_CONTROL and the next IRP stack location 
	Parameters.DeviceIoControl.IoControlCode field set to 
	IOCTL_INTERNAL_USB_SUBMIT_URB. 

Arguments:

    DeviceObject - pointer to the physical device object (PDO)

    Urb - pointer to an already-formatted Urb request block

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

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

    ISOUSB_KdPrint( DBGLVL_MAXIMUM,("enter IsoUsb_CallUSBD\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    //
    // issue a synchronous request
    //

    KeInitializeEvent(&event, NotificationEvent, FALSE);

    irp = IoBuildDeviceIoControlRequest(
                IOCTL_INTERNAL_USB_SUBMIT_URB,
                deviceExtension->TopOfStackDeviceObject, //Points to the next-lower driver's device object
                NULL, // optional input bufer; none needed here
                0,	  // input buffer len if used
                NULL, // optional output bufer; none needed here
                0,    // output buffer len if used
                TRUE, // If InternalDeviceControl is TRUE the target driver's Dispatch
				      //  outine for IRP_MJ_INTERNAL_DEVICE_CONTROL or IRP_MJ_SCSI 
					  // is called; otherwise, the Dispatch routine for 
					  // IRP_MJ_DEVICE_CONTROL is called.
                &event,     // event to be signalled on completion
                &ioStatus);  // Specifies an I/O status block to be set when the request is completed the lower driver. 

    //
    // 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);

    //
    // pass the URB to the USB driver stack
    //
    nextStack->Parameters.Others.Argument1 = Urb;

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

    ISOUSB_KdPrint( DBGLVL_MAXIMUM,("IsoUsb_CallUSBD() return from IoCallDriver USBD %x\n", ntStatus));

    if (ntStatus == STATUS_PENDING) {

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

    } else {
        ioStatus.Status = ntStatus;
    }

    ISOUSB_KdPrint( DBGLVL_MAXIMUM,("IsoUsb_CallUSBD() URB status = %x status = %x irp status %x\n",

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产91综合网| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 日本特黄久久久高潮| 亚洲制服丝袜av| 亚洲综合在线第一页| 亚洲婷婷国产精品电影人久久| 久久久久国色av免费看影院| 久久综合久久鬼色| 久久色.com| 国产午夜精品福利| 国产精品午夜电影| 中文字幕第一区二区| 国产精品欧美一区二区三区| 欧美国产一区视频在线观看| 国产精品区一区二区三| 中文字幕乱码久久午夜不卡| 中文字幕日韩av资源站| 亚洲视频一区二区在线观看| 一区二区三区加勒比av| 亚洲高清一区二区三区| 日韩黄色一级片| 蜜臂av日日欢夜夜爽一区| 蜜桃视频一区二区| 国产大陆亚洲精品国产| 不卡一二三区首页| 欧美自拍偷拍午夜视频| 欧美蜜桃一区二区三区| 日韩免费观看高清完整版在线观看| 日韩欧美一级二级三级久久久 | 石原莉奈一区二区三区在线观看| 日本vs亚洲vs韩国一区三区| 久久成人免费电影| 成人免费看的视频| 在线视频国产一区| 日韩久久久久久| 国产精品乱码一区二三区小蝌蚪| 最新中文字幕一区二区三区| 午夜伦理一区二区| 国产精品一区在线观看乱码| 99国产精品久久久久| 欧美精品久久一区| 久久精品在线观看| 亚洲国产精品一区二区久久恐怖片| 免费看欧美美女黄的网站| 福利一区在线观看| 欧美日韩国产美| 久久九九99视频| 亚洲成人一二三| 国产精品1024久久| 在线观看日韩av先锋影音电影院| 日韩一二三区视频| 亚洲日本va午夜在线影院| 日韩高清在线观看| 99久久精品久久久久久清纯| 欧美疯狂性受xxxxx喷水图片| 国产欧美综合在线观看第十页 | 成人h精品动漫一区二区三区| 欧美午夜在线观看| 国产日产欧美一区二区视频| 五月婷婷色综合| 99久久免费精品| 26uuu精品一区二区三区四区在线| 亚洲人123区| 极品少妇xxxx精品少妇| 在线一区二区观看| 久久精品视频免费观看| 日韩和欧美一区二区| 波多野结衣在线aⅴ中文字幕不卡| 91精品蜜臀在线一区尤物| 中文字幕在线播放不卡一区| 国内精品国产成人国产三级粉色| 欧美在线色视频| 国产精品久久久久久户外露出| 蜜臀av国产精品久久久久| 在线看国产一区二区| 中文字幕免费不卡在线| 六月婷婷色综合| 欧美日韩mp4| 亚洲主播在线播放| 99精品国产热久久91蜜凸| 久久久久久久久久久久电影| 日本在线观看不卡视频| 欧美亚洲综合一区| 亚洲同性gay激情无套| 成人午夜激情视频| 2021国产精品久久精品| 蜜臀va亚洲va欧美va天堂| 欧美性一二三区| 一区二区三区免费网站| 972aa.com艺术欧美| 国产欧美一区视频| 激情国产一区二区| 日韩欧美在线影院| 免费在线一区观看| 欧美一二三区精品| 免费av网站大全久久| 91精品国产色综合久久久蜜香臀| 亚洲成a人v欧美综合天堂下载| 色婷婷久久久久swag精品| 自拍视频在线观看一区二区| aa级大片欧美| 国产精品麻豆99久久久久久| 波多野结衣在线一区| 国产精品毛片高清在线完整版| 国产成人综合亚洲91猫咪| 精品国产成人系列| 国产精品一区免费在线观看| 国产日韩影视精品| 成人a免费在线看| 《视频一区视频二区| 日本久久电影网| 亚洲电影你懂得| 欧美日韩国产综合草草| 日韩专区中文字幕一区二区| 日韩亚洲欧美在线观看| 欧美aaaaaa午夜精品| 日韩精品一区二区在线| 国产一区二区三区精品欧美日韩一区二区三区 | 国产曰批免费观看久久久| 久久综合色8888| 成人精品小蝌蚪| 亚洲免费在线观看| 欧洲av在线精品| 日韩电影免费一区| 欧美精品一区二区三区在线播放| 国内成+人亚洲+欧美+综合在线| 国产欧美一区二区精品婷婷| 97久久精品人人澡人人爽| 伊人色综合久久天天人手人婷| 欧美精品xxxxbbbb| 国内精品国产成人国产三级粉色| 国产日韩成人精品| 欧美在线观看视频一区二区| 免费观看在线综合色| 久久精品视频一区二区| 99精品国产一区二区三区不卡 | 在线观看日韩电影| 日韩精品乱码免费| 日本一区免费视频| 欧美午夜片在线观看| 精品在线免费视频| 成人免费在线观看入口| 9191精品国产综合久久久久久 | 欧日韩精品视频| 蜜桃久久av一区| 国产精品电影一区二区三区| 欧美日韩一区久久| 国内久久精品视频| 一区二区三区 在线观看视频| 91精品婷婷国产综合久久性色 | 免费日韩伦理电影| 国产精品久久影院| 欧美裸体一区二区三区| 丁香啪啪综合成人亚洲小说 | 国产麻豆成人传媒免费观看| 中文字幕在线不卡一区| 正在播放亚洲一区| 成人a区在线观看| 蜜乳av一区二区| 亚洲激情图片小说视频| 26uuu精品一区二区在线观看| 91福利精品第一导航| 国产精品一区二区免费不卡| 午夜成人在线视频| 中文字幕欧美一区| 日韩美女一区二区三区四区| 色婷婷狠狠综合| 国内久久婷婷综合| 三级亚洲高清视频| 亚洲免费在线观看视频| 国产区在线观看成人精品| 欧美精品aⅴ在线视频| 91麻豆精品一区二区三区| 国产一区欧美一区| 五月激情丁香一区二区三区| 国产精品久久久久久久久免费相片 | 日韩精品一区二区三区视频播放| 色婷婷综合久久久中文一区二区| 国产一区二区三区四区五区美女 | 久久精品一区二区| 欧美一区二区三区免费大片| 日本道色综合久久| 成人av电影在线观看| 国产做a爰片久久毛片| 日韩中文字幕1| 亚洲一区二区三区影院| 亚洲天天做日日做天天谢日日欢| 久久久久综合网| 日韩欧美亚洲国产另类 | 久久久久久久精| 日韩亚洲欧美高清| 精品视频在线看| 色婷婷久久综合| 91性感美女视频| k8久久久一区二区三区| 成人一级视频在线观看| 国产九色精品成人porny| 极品尤物av久久免费看| 经典三级在线一区| 九九在线精品视频|