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

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

?? isousb.c

?? 這是ARM9開發板上自帶的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",

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区美女视频| 国产一区二区三区| 蜜臀av性久久久久蜜臀aⅴ| 国产成人综合亚洲网站| 欧美日韩精品是欧美日韩精品| 国产偷国产偷精品高清尤物| 午夜日韩在线观看| 日本高清不卡一区| 久久精品一二三| 久久精品噜噜噜成人av农村| 一本到三区不卡视频| 国产女人18毛片水真多成人如厕| 日韩成人一区二区三区在线观看| 91免费精品国自产拍在线不卡| 久久久久久麻豆| 久久av资源站| 欧美一区二区精美| 日韩福利视频网| 欧美日韩电影在线| 亚洲午夜免费电影| 欧美色图激情小说| 亚洲精品乱码久久久久| 色综合天天综合色综合av| 国产精品欧美一级免费| 岛国精品在线观看| 日本一区二区三区高清不卡| 国产一区二区三区电影在线观看 | 成人高清免费观看| 久久综合色综合88| 国产在线一区观看| 久久久蜜桃精品| 国产精品区一区二区三区| 青青草伊人久久| 欧美二区三区91| 爽好久久久欧美精品| 6080yy午夜一二三区久久| 日本91福利区| 精品国产成人系列| 国产电影精品久久禁18| 中文字幕的久久| 91国模大尺度私拍在线视频| 一级特黄大欧美久久久| 欧美丰满一区二区免费视频| 免费在线观看视频一区| 精品久久久久一区二区国产| 国产一区二区在线免费观看| 久久九九国产精品| 91天堂素人约啪| 污片在线观看一区二区 | 不卡视频一二三| 亚洲欧美国产高清| 欧美日韩国产首页| 国产综合色精品一区二区三区| 久久久精品人体av艺术| 一本色道久久综合狠狠躁的推荐| 亚洲无人区一区| 久久无码av三级| 91美女精品福利| 日韩激情中文字幕| 国产欧美日韩在线视频| 欧美在线免费播放| 国精产品一区一区三区mba桃花 | 亚洲精品乱码久久久久久久久 | 久久免费看少妇高潮| 91日韩一区二区三区| 日本不卡的三区四区五区| 国产精品视频麻豆| 欧美乱妇一区二区三区不卡视频| 国产精品一区不卡| 亚洲午夜精品网| 国产日韩精品一区| 91精品国产欧美日韩| 91美女福利视频| 国产麻豆91精品| 午夜精品成人在线视频| 国产色产综合产在线视频| 欧美日精品一区视频| 国产成人免费在线观看| 日韩电影一区二区三区| 亚洲欧美激情小说另类| 久久久久久日产精品| 678五月天丁香亚洲综合网| www.日韩精品| 久久精品国产99久久6| 夜夜夜精品看看| 国产精品乱子久久久久| 欧美精品一区二区三区很污很色的| 色婷婷久久99综合精品jk白丝| 国产一区二区导航在线播放| 天堂午夜影视日韩欧美一区二区| 成人欧美一区二区三区视频网页| ww亚洲ww在线观看国产| 91精品婷婷国产综合久久性色| 色吊一区二区三区| 成人h版在线观看| 国产精品一区二区三区乱码| 青青青伊人色综合久久| 亚洲成人自拍偷拍| 亚洲免费观看高清在线观看| 国产精品麻豆99久久久久久| 久久久久国产精品麻豆| 精品国产乱码久久久久久图片 | 精品va天堂亚洲国产| 欧美丰满美乳xxx高潮www| 欧美在线免费观看亚洲| 欧美自拍偷拍午夜视频| 在线观看日韩高清av| 色综合天天综合网天天狠天天| www.亚洲精品| 一本色道久久综合精品竹菊| 波多野结衣中文一区| 99久久er热在这里只有精品15| 粉嫩一区二区三区性色av| 国产 日韩 欧美大片| 国产福利精品一区| 成人激情免费电影网址| gogogo免费视频观看亚洲一| aa级大片欧美| 欧美在线视频全部完| 欧美日韩国产bt| 日韩免费在线观看| 久久久青草青青国产亚洲免观| 国产午夜精品在线观看| 中文乱码免费一区二区| 成人欧美一区二区三区黑人麻豆| 亚洲欧美日韩国产一区二区三区 | 色综合一区二区三区| 在线视频欧美区| 欧美精品粉嫩高潮一区二区| 欧美成人免费网站| 欧美激情综合五月色丁香| 亚洲色图.com| 亚洲一区二区三区国产| 日本一不卡视频| 国产精品99久久久久久似苏梦涵| 国产成人在线观看| 在线视频亚洲一区| 精品美女在线播放| 国产精品全国免费观看高清| 亚洲午夜免费视频| 精品系列免费在线观看| 99精品国产一区二区三区不卡| 欧美少妇xxx| 久久久影视传媒| 亚洲国产乱码最新视频| 国内精品视频666| 91一区在线观看| 日韩一级二级三级精品视频| 国产视频911| 午夜精品久久久| 高清国产一区二区| 欧美理论在线播放| 国产日韩成人精品| 亚洲.国产.中文慕字在线| 国产成人亚洲综合a∨婷婷图片| 91黄色免费网站| 久久久噜噜噜久久中文字幕色伊伊| 亚洲另类在线一区| 寂寞少妇一区二区三区| 色噜噜狠狠成人中文综合| 精品久久国产老人久久综合| 亚洲精品国产视频| 国产精品69毛片高清亚洲| 欧美三级蜜桃2在线观看| 国产欧美日韩精品a在线观看| 亚洲123区在线观看| av电影在线观看一区| 精品国产污污免费网站入口| 亚洲综合999| caoporen国产精品视频| 久久免费看少妇高潮| 日韩精品久久理论片| 在线精品视频免费播放| 亚洲国产高清在线| 激情综合色播激情啊| 欧美乱妇一区二区三区不卡视频| 亚洲人精品午夜| jvid福利写真一区二区三区| 久久你懂得1024| 精品在线一区二区三区| 欧美高清激情brazzers| 亚洲一线二线三线久久久| av成人免费在线| 国产精品久久久久久久午夜片 | 精品久久一区二区三区| 视频在线观看一区| 欧美日韩高清影院| 亚洲在线中文字幕| 欧美综合视频在线观看| 亚洲人成在线观看一区二区| 99精品视频在线播放观看| 国产精品久久久久aaaa| 成人激情开心网| 亚洲视频一区二区免费在线观看| 国产99精品视频| 中文字幕精品—区二区四季| 国产不卡视频在线播放| 国产精品视频在线看| 成人黄色网址在线观看| 中文字幕日韩一区二区|