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

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

?? isousb.c

?? 嵌入式系統的USB驅動(S3C2410)
?? 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一区二区三区免费野_久草精品视频
日韩精品久久久久久| 日韩高清不卡在线| 91精品国产综合久久久蜜臀图片| 国内精品伊人久久久久av一坑 | 91成人在线观看喷潮| 久久精品久久综合| 亚洲免费av网站| 久久影院午夜论| 91精品国产一区二区人妖| 99精品国产视频| 国产在线视频精品一区| 日韩激情在线观看| 亚洲免费在线观看视频| 国产亚洲欧美日韩日本| 日韩欧美综合一区| 欧美日韩国产高清一区二区三区| eeuss鲁片一区二区三区| 韩国av一区二区三区四区| 亚洲成人免费视频| 亚洲主播在线观看| 亚洲女与黑人做爰| 国产精品久久久久9999吃药| 久久青草国产手机看片福利盒子| 正在播放亚洲一区| 欧美人妖巨大在线| 欧美日韩亚洲高清一区二区| 在线看日本不卡| 色噜噜狠狠成人网p站| 色综合久久综合网| 91麻豆精品在线观看| 91亚洲资源网| 9l国产精品久久久久麻豆| 国产精品99久久久久久久女警| 久久se精品一区二区| 久久精品999| 国产综合色在线| 国产乱妇无码大片在线观看| 三级欧美韩日大片在线看| 亚洲宅男天堂在线观看无病毒| 一区二区三区四区国产精品| 亚洲人成精品久久久久| 亚洲人妖av一区二区| 亚洲日本一区二区三区| 一区二区三区四区不卡在线| 一区二区三区中文免费| 一区二区三区四区视频精品免费 | 韩日欧美一区二区三区| 九九视频精品免费| 国产乱码字幕精品高清av| 国产成+人+日韩+欧美+亚洲| 丰满放荡岳乱妇91ww| 本田岬高潮一区二区三区| 色视频成人在线观看免| 日韩免费福利电影在线观看| 日韩欧美综合一区| 国产亚洲精品免费| 亚洲欧洲国产专区| 一个色综合av| 麻豆精品久久久| 国产成人在线网站| 91丝袜国产在线播放| 欧美亚一区二区| 在线播放中文字幕一区| 欧美精品一区二区三区四区| 国产精品私人影院| 一区二区高清视频在线观看| 日本aⅴ精品一区二区三区| 国产一区二区福利| 95精品视频在线| 91精品国产91久久久久久最新毛片| 欧美成人综合网站| 国产精品毛片高清在线完整版| 亚洲美女屁股眼交| 蜜桃av一区二区三区| 成人免费高清视频| 欧美卡1卡2卡| 国产亚洲福利社区一区| 夜夜爽夜夜爽精品视频| 精品影视av免费| 色综合久久中文字幕| 日韩免费观看高清完整版在线观看| 国产精品免费观看视频| 日韩精品福利网| 成人午夜av电影| 91麻豆精品国产91久久久| 国产精品国产三级国产有无不卡 | 成人av网址在线| 欧美精品欧美精品系列| 国产精品毛片a∨一区二区三区| 天天综合色天天综合色h| 福利视频网站一区二区三区| 欧美日韩国产在线观看| 国产日韩v精品一区二区| 视频一区二区国产| 色婷婷一区二区| 国产欧美精品一区二区色综合| 亚洲va欧美va天堂v国产综合| 成人伦理片在线| 日韩精品一区二区三区在线观看| 悠悠色在线精品| 成人美女在线视频| 精品福利一区二区三区免费视频| 一区二区三区欧美视频| 懂色av噜噜一区二区三区av| 日韩午夜在线播放| 亚洲国产日韩综合久久精品| 成人黄页毛片网站| 久久在线观看免费| 国模冰冰炮一区二区| 6080国产精品一区二区| 亚洲最大成人网4388xx| 99久久国产综合精品色伊| 久久久国产精品不卡| 久久国产尿小便嘘嘘| 欧美精品久久一区二区三区| 一区二区三区欧美视频| 91欧美激情一区二区三区成人| 国产人妖乱国产精品人妖| 久久99蜜桃精品| 欧美成人一区二区三区在线观看| 日韩高清国产一区在线| 欧美色图天堂网| 亚洲免费av观看| 色婷婷av一区二区三区软件| 综合电影一区二区三区 | 99国产欧美久久久精品| 欧美激情在线一区二区三区| 国产麻豆一精品一av一免费| 久久久一区二区三区| 国产剧情在线观看一区二区| 精品粉嫩超白一线天av| 久久黄色级2电影| 精品处破学生在线二十三| 精品一区二区av| 久久亚洲捆绑美女| 国产剧情av麻豆香蕉精品| 久久精品视频一区| 成人一级片网址| 综合在线观看色| 在线观看不卡一区| 日韩国产在线观看一区| 日韩欧美高清dvd碟片| 精品一区二区国语对白| 国产日韩v精品一区二区| www..com久久爱| 伊人婷婷欧美激情| 欧美三级午夜理伦三级中视频| 婷婷久久综合九色综合绿巨人| 欧美日本韩国一区| 麻豆成人在线观看| 亚洲国产精品v| 91黄色免费观看| 亚洲综合在线免费观看| 666欧美在线视频| 国产精品影视天天线| 成人免费在线播放视频| 欧美日韩成人综合天天影院| 男人操女人的视频在线观看欧美 | 夜色激情一区二区| 欧美一区二区三区成人| 国产成人啪免费观看软件| 1区2区3区国产精品| 欧美日韩一区高清| 国产一区二区三区国产| 国产精品三级在线观看| 在线亚洲精品福利网址导航| 久久精品噜噜噜成人av农村| 中文成人av在线| 91黄色免费网站| 一本大道久久a久久精品综合| 亚洲一区成人在线| 日韩精品自拍偷拍| 成人晚上爱看视频| 日韩国产精品91| 国产精品青草综合久久久久99| 欧美在线免费观看亚洲| 国产精品一区二区男女羞羞无遮挡 | 不卡的av电影| 日韩精品亚洲一区二区三区免费| xnxx国产精品| 欧美亚洲国产一区二区三区| 国产在线不卡视频| 亚洲国产精品久久人人爱| 国产日产欧美精品一区二区三区| 欧美日韩在线一区二区| 顶级嫩模精品视频在线看| 五月天亚洲婷婷| 亚洲色图欧洲色图婷婷| 精品美女被调教视频大全网站| 色婷婷综合视频在线观看| 国产精品一区2区| 日韩主播视频在线| 国产精品免费久久| 26uuu精品一区二区在线观看| 欧美色图在线观看| 91无套直看片红桃| 国产福利一区在线| 蜜桃传媒麻豆第一区在线观看| 亚洲制服丝袜av| 亚洲人成人一区二区在线观看|