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

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

?? usbls120.c

?? 來自微軟的usb2.0開發包,加速USB驅動開發
?? C
?? 第 1 頁 / 共 2 頁
字號:
    DeviceObject - pointer to the physical device object for this instance of the 82930
                   device.


Return Value:

    NT status code

--*/
{
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus;
    PURB urb;
    ULONG siz;

    USBLS120_KdPrint( DBGLVL_HIGH,("enter USBLS120_ConfigureDevice\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    USBLS120_ASSERT( deviceExtension->UsbConfigurationDescriptor == NULL );

    urb = USBLS120_ExAllocatePool(NonPagedPool,
			 sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST));
    if ( !urb )
        return STATUS_INSUFFICIENT_RESOURCES;

    // When USB_CONFIGURATION_DESCRIPTOR_TYPE is specified for DescriptorType
    // in a call to UsbBuildGetDescriptorRequest(),
    // all interface, endpoint, class-specific, and vendor-specific descriptors 
    // for the configuration also are retrieved. 
    // The caller must allocate a buffer large enough to hold all of this 
    // information or the data is truncated without error.
    // Therefore the 'siz' set below is just a 'good guess', and we may have to retry

    siz = sizeof(USB_CONFIGURATION_DESCRIPTOR) + 512;  

    // We will break out of this 'retry loop' when UsbBuildGetDescriptorRequest()
    // has a big enough deviceExtension->UsbConfigurationDescriptor buffer not to truncate
    while( 1 ) {

        deviceExtension->UsbConfigurationDescriptor = USBLS120_ExAllocatePool(NonPagedPool, siz);

        if ( !deviceExtension->UsbConfigurationDescriptor ) {
            USBLS120_ExFreePool(urb);
            return STATUS_INSUFFICIENT_RESOURCES;
        }

        UsbBuildGetDescriptorRequest(
            urb,
            (USHORT) sizeof (struct _URB_CONTROL_DESCRIPTOR_REQUEST),
            USB_CONFIGURATION_DESCRIPTOR_TYPE,
            0,
            0,
            deviceExtension->UsbConfigurationDescriptor,
            NULL,
            siz,
            NULL
            );

        ntStatus = USBLS120_CallUSBD(DeviceObject, urb);

        USBLS120_KdPrint( DBGLVL_HIGH,("USBLS120_CallUSBD() Configuration Descriptor = %x, len %x\n",
                                       deviceExtension->UsbConfigurationDescriptor,
                                       urb->UrbControlDescriptorRequest.TransferBufferLength));
        //
        // if we got some data see if it was enough.
        // NOTE: we may get an error in URB because of buffer overrun
        if (urb->UrbControlDescriptorRequest.TransferBufferLength>0 &&
            deviceExtension->UsbConfigurationDescriptor->wTotalLength > siz) {

            siz = deviceExtension->UsbConfigurationDescriptor->wTotalLength;
            USBLS120_ExFreePool(deviceExtension->UsbConfigurationDescriptor);
            deviceExtension->UsbConfigurationDescriptor = NULL;
        } else {
            break;  // we got it on the first try
        }

    } // end, while (retry loop )

    USBLS120_ExFreePool(urb);
    USBLS120_ASSERT( deviceExtension->UsbConfigurationDescriptor );

    //
    // We have the configuration descriptor for the configuration we want.
    // Now we issue the select configuration command to get
    // the  pipes associated with this configuration.
    //

    ntStatus = USBLS120_SelectInterface(
                   DeviceObject,
                   deviceExtension->UsbConfigurationDescriptor
                   );


    USBLS120_KdPrint( DBGLVL_HIGH,("exit USBLS120_ConfigureDevice (%x)\n", ntStatus));

    return ntStatus;
} 


NTSTATUS
USBLS120_SelectInterface(
    IN PDEVICE_OBJECT DeviceObject,
    IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor
    )
/*++

Routine Description:

    Initializes an 82930 with (possibly) multiple interfaces;
    This minidriver only supports one interface (with multiple endpoints).

Arguments:

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

    ConfigurationDescriptor - pointer to the USB configuration
                   descriptor containing the interface and endpoint
                   descriptors.

Return Value:

    NT status code

--*/
{
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus;
    PURB urb = NULL;
    ULONG i;
    PUSB_INTERFACE_DESCRIPTOR interfaceDescriptor = NULL;
    PUSBD_INTERFACE_INFORMATION Interface = NULL;
    USHORT siz;

    USBLS120_KdPrint( DBGLVL_MEDIUM,("enter USBLS120_SelectInterface\n"));

    deviceExtension = DeviceObject->DeviceExtension;


    USBLS120_KdPrint( DBGLVL_HIGH,("USBLS120_SelectInterface() called with NULL Interface\n"));

    //
    // BulkUsb driver only supports one interface, we must parse
    // the configuration descriptor for the interface 
    // and remember the pipes.
    //
    urb = USBD_CreateConfigurationRequest(ConfigurationDescriptor, &siz);

    if (urb) 
    {

        //
        // USBD_ParseConfigurationDescriptorEx searches a given configuration
        // descriptor and returns a pointer to an interface that matches the 
        //  given search criteria. We only support one interface on this device
        //
	interfaceDescriptor = USBD_ParseConfigurationDescriptorEx(
                                  ConfigurationDescriptor,
                                  ConfigurationDescriptor, //search from start of config  descriptro
                                  -1,   // interface number not a criteria; we only support one interface
                                  -1,   // not interested in alternate setting here either
                                  -1,   // interface class not a criteria
                                  -1,   // interface subclass not a criteria
                                  -1    // interface protocol not a criteria
                                  );

        if ( !interfaceDescriptor ) {

            USBLS120_KdPrint( DBGLVL_HIGH,("USBLS120_SelectInterface() ParseConfigurationDescriptorEx() failed\n  returning STATUS_INSUFFICIENT_RESOURCES\n"));
            USBLS120_ExFreePool(urb);
            return STATUS_INSUFFICIENT_RESOURCES;
        }

	Interface = &urb->UrbSelectConfiguration.Interface;

        for (i=0; i< Interface->NumberOfPipes; i++) {
	    //
	    // perform any pipe initialization here
	    //
	    Interface->Pipes[i].MaximumTransferSize = deviceExtension->MaximumTransferSize;
	    Interface->Pipes[i].PipeFlags = 0;
	}

	UsbBuildSelectConfigurationRequest(
            urb,
            (USHORT) siz,
            ConfigurationDescriptor);

        ntStatus = USBLS120_CallUSBD(DeviceObject, urb);

	deviceExtension->UsbConfigurationHandle =
	    urb->UrbSelectConfiguration.ConfigurationHandle;

    } else {
        USBLS120_KdPrint( DBGLVL_HIGH,("USBLS120_SelectInterface() USBD_CreateConfigurationRequest() failed\n  returning STATUS_INSUFFICIENT_RESOURCES\n"));
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    if (NT_SUCCESS(ntStatus)) {

	//
	// Save the configuration handle for this device
	//

	deviceExtension->UsbConfigurationHandle =
	    urb->UrbSelectConfiguration.ConfigurationHandle;

        deviceExtension->UsbInterface = USBLS120_ExAllocatePool(
                                            NonPagedPool,
                                            Interface->Length
                                            );

        if (deviceExtension->UsbInterface) {

            ULONG j;

            //
            // save a copy of the interface information returned
            //
            RtlCopyMemory(deviceExtension->UsbInterface, Interface, Interface->Length);

            //
            // Dump the interface to the debugger
            //
            USBLS120_KdPrint( 1,("---------\n"));
            USBLS120_KdPrint( 1,("NumberOfPipes 0x%x\n", deviceExtension->UsbInterface->NumberOfPipes));
            USBLS120_KdPrint( 1,("Length 0x%x\n", deviceExtension->UsbInterface->Length));
            USBLS120_KdPrint( 1,("Alt Setting 0x%x\n", deviceExtension->UsbInterface->AlternateSetting));
            USBLS120_KdPrint( 1,("Interface Number 0x%x\n", deviceExtension->UsbInterface->InterfaceNumber));
            USBLS120_KdPrint( 1,("Class, subclass, protocol 0x%x 0x%x 0x%x\n",
                deviceExtension->UsbInterface->Class,
                deviceExtension->UsbInterface->SubClass,
                deviceExtension->UsbInterface->Protocol));

            // Dump the pipe info

            for (j=0; j<Interface->NumberOfPipes; j++) {
                PUSBD_PIPE_INFORMATION pipeInformation;

                pipeInformation = &deviceExtension->UsbInterface->Pipes[j];

                USBLS120_KdPrint( 1,("---------\n"));
                USBLS120_KdPrint( 1,("PipeType 0x%x\n", pipeInformation->PipeType));
                USBLS120_KdPrint( 1,("EndpointAddress 0x%x\n", pipeInformation->EndpointAddress));
                USBLS120_KdPrint( 1,("MaxPacketSize 0x%x\n", pipeInformation->MaximumPacketSize));
                USBLS120_KdPrint( 1,("Interval 0x%x\n", pipeInformation->Interval));
                USBLS120_KdPrint( 1,("Handle 0x%x\n", pipeInformation->PipeHandle));
                USBLS120_KdPrint( 1,("MaximumTransferSize 0x%x\n", pipeInformation->MaximumTransferSize));

                switch (pipeInformation->PipeType) {       

                     case UsbdPipeTypeBulk:
                         if (USBD_PIPE_DIRECTION_IN(pipeInformation)) {
                             USBLS120_KdPrint( 1,("DataInPipe 0x%x\n", j));
                             deviceExtension->DataInPipe = j;
                         } else {
                             USBLS120_KdPrint( 1,("DataOutPipe 0x%x\n", j));
                             deviceExtension->DataOutPipe = j;
                         }
                         break;
			

                     case UsbdPipeTypeInterrupt:
                         USBLS120_KdPrint( 1,("StatusPipe 0x%x\n", j));
                         deviceExtension->StatusPipe = j;
                         break;


                     default:
                         USBLS120_KdPrint( 1,("Unknown pipe 0x%x\n", j));
                         break;
                }
            }
        }
        USBLS120_KdPrint( DBGLVL_MEDIUM,("---------\n"));
    }

    if (urb) {
        // don't call the USBLS120_ExFreePool since the buffer was 
        //  alloced by USBD_CreateConfigurationRequest, not USBLS120_ExAllocatePool()
        ExFreePool(urb);
    }
    USBLS120_KdPrint( DBGLVL_HIGH,("exit USBLS120_SelectInterface (%x)\n", ntStatus));

    return ntStatus; 
}



NTSTATUS
USBLS120_ResetPipe(
    IN PDEVICE_OBJECT DeviceObject,
    IN PUSBD_PIPE_INFORMATION PipeInfo
    )
/*++

Routine Description:

    Reset a given USB pipe.

    NOTES:

    This will reset the host to Data0 and should also reset the device to Data0 

Arguments:

    Ptrs to our FDO and a USBD_PIPE_INFORMATION struct

Return Value:

    NT status code

--*/
{
    NTSTATUS ntStatus;
    PURB urb;
    PDEVICE_EXTENSION deviceExtension;

    deviceExtension = DeviceObject->DeviceExtension;

    USBLS120_KdPrint( DBGLVL_DEFAULT,("USBLS120_ResetPipe() Reset Pipe %x\n", PipeInfo));

    urb = USBLS120_ExAllocatePool(NonPagedPool, sizeof(struct _URB_PIPE_REQUEST));

    if (urb) {

	urb->UrbHeader.Length = (USHORT) sizeof (struct _URB_PIPE_REQUEST);
	urb->UrbHeader.Function = URB_FUNCTION_RESET_PIPE;
        urb->UrbPipeRequest.PipeHandle = PipeInfo->PipeHandle;

        ntStatus = USBLS120_CallUSBD(DeviceObject, urb);

        USBLS120_ExFreePool(urb);

    } else {
	ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    if (!(NT_SUCCESS(ntStatus))) {

#if DBG
        if ( gpDbg )
            gpDbg->PipeErrorCount++;
#endif
        USBLS120_KdPrint( DBGLVL_DEFAULT,("USBLS120_ResetPipe() FAILED, ntStatus =0x%x\n", ntStatus ));

    } else {

#if DBG
        if ( gpDbg )
            gpDbg->ResetPipeCount++;
#endif
    USBLS120_KdPrint( DBGLVL_DEFAULT,("USBLS120_ResetPipe() SUCCESS, ntStatus =0x%x\n", ntStatus ));

    }

    return ntStatus;
}




LONG
USBLS120_DecrementIoCount(
    IN PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    We keep a pending IO count ( extension->PendingIoCount )  in the device extension.
    The first increment of this count is done on adding the device.
    Subsequently, the count is incremented for each new IRP received and
    decremented when each IRP is completed or passed on.

    Transition to 'one' therefore indicates no IO is pending and signals
    deviceExtension->NoPendingIoEvent. This is needed for processing
    IRP_MN_QUERY_REMOVE_DEVICE

    Transition to 'zero' signals an event ( deviceExtension->RemoveEvent )
    to enable device removal. This is used in processing for IRP_MN_REMOVE_DEVICE
 
Arguments:

    DeviceObject -- ptr to our FDO

Return Value:

    deviceExtension->PendingIoCount


--*/

{
    PDEVICE_EXTENSION deviceExtension;
    LONG ioCount;
    KIRQL oldIrql;

    deviceExtension = DeviceObject->DeviceExtension;
    KeAcquireSpinLock (&deviceExtension->IoCountSpinLock, &oldIrql);

    ioCount = InterlockedDecrement(&deviceExtension->PendingIoCount);

#if DBG
    InterlockedDecrement(&gpDbg->PendingIoCount);
#endif

    USBLS120_TrapCond( DBGLVL_HIGH,( 0 > ioCount ) );

    if (ioCount==1) {

	// trigger no pending io
	KeSetEvent(
            &deviceExtension->NoPendingIoEvent,
            1,
            FALSE
            );
    }

    if (ioCount==0) {

	// trigger remove-device event
	KeSetEvent(
            &deviceExtension->RemoveEvent,
            1,
            FALSE
            );
    }

    KeReleaseSpinLock (&deviceExtension->IoCountSpinLock, oldIrql);

    USBLS120_KdPrint( DBGLVL_HIGH,("Exit USBLS120_DecrementIoCount() Pending io count = %x\n", ioCount));
    return ioCount;
}


VOID
USBLS120_IncrementIoCount(
    IN PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    We keep a pending IO count ( extension->PendingIoCount )  in the device extension.
    The first increment of this count is done on adding the device.
    Subsequently, the count is incremented for each new IRP received and
    decremented when each IRP is completed or passed on.

 
Arguments:

    DeviceObject -- ptr to our FDO

Return Value:

    None

--*/
{
    PDEVICE_EXTENSION deviceExtension;
    KIRQL oldIrql;

    deviceExtension = DeviceObject->DeviceExtension;

    USBLS120_KdPrint( DBGLVL_HIGH,("Enter USBLS120_IncrementIoCount() Pending io count = %x\n", deviceExtension->PendingIoCount));

    KeAcquireSpinLock (&deviceExtension->IoCountSpinLock, &oldIrql);

    InterlockedIncrement(&deviceExtension->PendingIoCount);
#if DBG
    InterlockedIncrement(&gpDbg->PendingIoCount);
#endif
    KeReleaseSpinLock (&deviceExtension->IoCountSpinLock, oldIrql);

    USBLS120_KdPrint( DBGLVL_HIGH,("Exit USBLS120_IncrementIoCount() Pending io count = %x\n", deviceExtension->PendingIoCount));
}



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品久久一区| 本田岬高潮一区二区三区| 欧美日韩在线免费视频| 亚洲综合视频在线| 欧美日韩在线免费视频| 蜜桃精品视频在线| 久久午夜老司机| 99re这里只有精品6| 亚洲精品一卡二卡| 欧美日韩不卡一区| 韩国在线一区二区| 成人欧美一区二区三区小说| 欧美丝袜自拍制服另类| 免费高清视频精品| 中文字幕第一页久久| 色香蕉成人二区免费| 亚洲成人福利片| 精品国产三级a在线观看| 国产高清亚洲一区| 亚洲国产一区视频| 精品久久国产字幕高潮| 91在线视频观看| 日韩影院精彩在线| 国产精品视频你懂的| 欧美日韩在线不卡| 国产成人精品www牛牛影视| 夜夜嗨av一区二区三区四季av| 在线播放中文一区| 成人av电影免费观看| 亚洲成av人片在线观看| 2020国产精品久久精品美国| 色呦呦网站一区| 国产精品一区免费视频| 亚洲国产精品尤物yw在线观看| 久久色中文字幕| 欧美日韩免费观看一区三区| 丁香天五香天堂综合| 婷婷久久综合九色综合绿巨人 | 91久久精品一区二区二区| 奇米色一区二区| 亚洲免费观看在线视频| 国产清纯美女被跳蛋高潮一区二区久久w | 日韩成人一区二区三区在线观看| 久久精品视频在线看| 91麻豆精品国产自产在线| 本田岬高潮一区二区三区| 国产曰批免费观看久久久| 亚洲妇女屁股眼交7| 亚洲欧洲精品成人久久奇米网| 日韩欧美在线一区二区三区| 欧美日韩一区二区三区在线看| 国产麻豆成人传媒免费观看| 日韩国产欧美在线播放| 亚洲综合在线五月| 亚洲视频资源在线| 欧美激情一区二区在线| 精品国产乱码久久久久久久久| 久久青草国产手机看片福利盒子 | 欧美大片在线观看一区二区| 欧美日韩亚洲综合在线 | 最新久久zyz资源站| www国产成人免费观看视频 深夜成人网| 欧美性一二三区| 色综合天天天天做夜夜夜夜做| 国产91对白在线观看九色| 精彩视频一区二区| 激情深爱一区二区| 美日韩一区二区三区| 美女视频黄免费的久久| 五月激情丁香一区二区三区| 亚洲国产婷婷综合在线精品| 亚洲一区在线视频| 亚洲一区在线观看免费 | 青青草国产成人99久久| 三级成人在线视频| 日韩1区2区3区| 日韩黄色在线观看| 丝袜亚洲另类欧美综合| 日韩福利视频网| 麻豆91免费看| 国内精品免费在线观看| 国产在线播放一区三区四| 国产乱国产乱300精品| 丰满放荡岳乱妇91ww| av一区二区三区在线| 91在线精品一区二区三区| 色综合久久中文综合久久97| 一本到不卡免费一区二区| 在线观看日产精品| 欧美日韩美女一区二区| 日韩精品最新网址| 久久久久久久久岛国免费| 国产精品久久久久婷婷二区次| 中文字幕一区二区在线观看| 夜夜揉揉日日人人青青一国产精品| 亚洲综合成人在线视频| 日本aⅴ亚洲精品中文乱码| 久久精品国产一区二区| 国产99精品国产| 色婷婷综合久久| 日韩欧美国产三级电影视频| 国产日韩欧美激情| 亚洲一二三四久久| 久久疯狂做爰流白浆xx| 99视频超级精品| 制服丝袜一区二区三区| 久久九九99视频| 亚洲综合免费观看高清完整版| 久久99久久精品欧美| www.欧美.com| 欧美一区二区视频网站| 国产欧美精品一区二区色综合朱莉 | 99久久精品免费精品国产| 欧美日韩免费一区二区三区视频| 久久一二三国产| 樱桃视频在线观看一区| 精品一区二区三区免费视频| 欧美一二三四区在线| 久久精品男人的天堂| 亚洲国产wwwccc36天堂| 国产成人av福利| 欧美精品vⅰdeose4hd| 国产精品日产欧美久久久久| 午夜激情综合网| av影院午夜一区| 26uuuu精品一区二区| 亚洲一级二级在线| av不卡在线播放| 精品国产凹凸成av人导航| 亚洲一区视频在线| 成人av免费网站| 精品999久久久| 天天免费综合色| av资源网一区| 久久一区二区视频| 日本欧美肥老太交大片| 色婷婷综合久久久中文一区二区| 久久―日本道色综合久久| 青青草国产精品97视觉盛宴| 在线观看亚洲精品视频| 国产精品久久久久久久久免费丝袜 | 一区二区三区国产精品| 国产精品一区二区男女羞羞无遮挡 | 日韩一区在线播放| 国产剧情一区二区| 日韩一级成人av| 亚洲成a人片在线不卡一二三区| 成人激情免费电影网址| 久久综合九色综合欧美98| 美女在线一区二区| 7777精品伊人久久久大香线蕉完整版 | 激情图区综合网| 日韩视频一区二区三区| 亚洲一区二区av在线| 一本一本久久a久久精品综合麻豆| 久久久久久久久久美女| 国产在线视视频有精品| 精品三级av在线| 精品一区二区三区在线播放视频| 777奇米四色成人影色区| 午夜精品久久久久久久99樱桃| 日本道精品一区二区三区| 一区二区三区色| 欧美色综合天天久久综合精品| 亚洲三级免费观看| 一本久久精品一区二区| 亚洲精选在线视频| 日本伦理一区二区| 亚洲成人第一页| 欧美性感一区二区三区| 亚洲亚洲人成综合网络| 欧美精品18+| 美女网站色91| 久久网站最新地址| 成人精品视频一区二区三区 | 欧美va亚洲va| 久久99久久99小草精品免视看| 精品第一国产综合精品aⅴ| 国产精品自在在线| 最新成人av在线| 色先锋aa成人| 成人av在线播放网站| 亚洲精品久久久蜜桃| 欧美三级电影一区| 另类小说图片综合网| 国产丝袜欧美中文另类| 99久久综合色| 亚洲成人中文在线| 日韩你懂的电影在线观看| 国产乱理伦片在线观看夜一区| 中文字幕va一区二区三区| 色女孩综合影院| 青椒成人免费视频| 国产欧美日产一区| 在线观看亚洲专区| 国内不卡的二区三区中文字幕| 国产精品成人网| 91精品国产麻豆| eeuss鲁片一区二区三区| 水野朝阳av一区二区三区|