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

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

?? rwusb.c

?? HomePNA的Usb網卡驅動
?? C
?? 第 1 頁 / 共 5 頁
字號:
	{
        DEBUGMSG(DBG_ERR,("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
        //

        ((PUSB_INFO) device->pUsbInfo)->UsbConfigurationHandle =
            selurb->UrbSelectConfiguration.ConfigurationHandle;

        if ( NULL == ((PUSB_INFO) device->pUsbInfo)->UsbInterface ) 
		{
           ((PUSB_INFO) device->pUsbInfo)->UsbInterface = MemAlloc(Interface->Length);
        }

        if ( NULL != ((PUSB_INFO) device->pUsbInfo)->UsbInterface) {
            ULONG j;

            //
            // save a copy of the interface information returned
            //
            NdisMoveMemory(((PUSB_INFO) device->pUsbInfo)->UsbInterface, Interface, Interface->Length);

            //
            // Dump the interface to the debugger
            //
            DEBUGMSG(DBG_FUNC,("---------After Select Config \n"));
            DEBUGMSG(DBG_FUNC,("NumberOfPipes 0x%x\n", ((PUSB_INFO) device->pUsbInfo)->UsbInterface->NumberOfPipes));
            DEBUGMSG(DBG_FUNC,("Length 0x%x\n", ((PUSB_INFO) device->pUsbInfo)->UsbInterface->Length));
            DEBUGMSG(DBG_FUNC,("Alt Setting 0x%x\n", ((PUSB_INFO) device->pUsbInfo)->UsbInterface->AlternateSetting));
            DEBUGMSG(DBG_FUNC,("Interface Number 0x%x\n", ((PUSB_INFO) device->pUsbInfo)->UsbInterface->InterfaceNumber));
            DEBUGMSG(DBG_FUNC,("Class, subclass, protocol 0x%x 0x%x 0x%x\n",
                ((PUSB_INFO) device->pUsbInfo)->UsbInterface->Class,
                ((PUSB_INFO) device->pUsbInfo)->UsbInterface->SubClass,
                ((PUSB_INFO) device->pUsbInfo)->UsbInterface->Protocol));

            // Find our Bulk in and out pipes, save their handles, Dump the pipe info
            for (j=0; j<Interface->NumberOfPipes; j++) 
			{
                PUSBD_PIPE_INFORMATION pipeInformation;
                pipeInformation = &((PUSB_INFO) device->pUsbInfo)->UsbInterface->Pipes[j];

                //Find the Bulk In and Out pipes ( these are probably the only two pipes )
                if ( UsbdPipeTypeBulk == pipeInformation->PipeType )
                {
                    // endpoint address with bit 0x80 set are input pipes, else output
                    if ( USB_ENDPOINT_DIRECTION_IN( pipeInformation->EndpointAddress ) ) 
					{
                        device->BulkInPipeHandle = pipeInformation->PipeHandle;
                    }

					if ( USB_ENDPOINT_DIRECTION_OUT( pipeInformation->EndpointAddress ) ) {
                        device->BulkOutPipeHandle = pipeInformation->PipeHandle;

                    }

                }
				if ( UsbdPipeTypeInterrupt == pipeInformation->PipeType )
				{
					if ( USB_ENDPOINT_DIRECTION_IN( pipeInformation->EndpointAddress ) ) 
					{
                        device->InterruptInPipeHandle = pipeInformation->PipeHandle;
                        device->IntInternalTime =  pipeInformation->Interval;
					}

				}


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

            DEBUGMSG(DBG_FUNC,("---------\n"));
        }
    }

    //we better have found input and output bulk pipes!
    ASSERT( device->BulkInPipeHandle && device->BulkOutPipeHandle );

    if (selurb) 
	{
        // don't call the MemFree since the buffer was
        //  alloced by USBD_CreateConfigurationRequest, not MemAlloc()
        ExFreePool(selurb);
    }

    DEBUGMSG(DBG_FUNC,(" -SelectInterface (%x)\n", ntStatus));

    return ntStatus;
}



NTSTATUS
StartDevice(
    IN  PUSB_DEVICE DeviceExt
    )
/*++

Routine Description:

    Initializes a given instance of the device on the USB.
    USB client drivers such as us set up URBs (USB Request Packets) to send requests
    to the host controller driver (HCD). The URB structure defines a format for all
    possible commands that can be sent to a USB device.
    Here, we request the device descriptor and store it, and configure the device.

Return Value:

    NT status code

--*/
{
    PUSB_DEVICE device;
    NTSTATUS ntStatus;
    PUSB_DEVICE_DESCRIPTOR deviceDescriptor = NULL;
    PURB urb;
    ULONG siz;

    DEBUGMSG( DBG_FUNC, (" +StartDevice()\n"));

    device = DeviceExt;

    urb = MemAlloc(sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST));

    DEBUGCOND( DBG_ERR,!urb, ("StartDevice() FAILED MemAlloc() for URB\n"));

    if (urb) 
	{

        siz = sizeof(USB_DEVICE_DESCRIPTOR);

        deviceDescriptor = MemAlloc(siz);

        DEBUGCOND( DBG_ERR, !deviceDescriptor, ("StartDevice() FAILED MemAlloc() for deviceDescriptor\n"));

        if (deviceDescriptor) 
		{

            UsbBuildGetDescriptorRequest(urb,
                                         (USHORT) sizeof (struct _URB_CONTROL_DESCRIPTOR_REQUEST),
                                         USB_DEVICE_DESCRIPTOR_TYPE,
                                         0,
                                         0,
                                         deviceDescriptor,
                                         NULL,
                                         siz,
                                         NULL);

            
            ntStatus = CallUSBD(DeviceExt, urb); // build get descripttor req; main thread

            DEBUGCOND( DBG_ERR, !NT_SUCCESS(ntStatus), ("StartDevice() FAILED CallUSBD (DeviceExt, urb)\n"));
            
            if (NT_SUCCESS(ntStatus)) 
			{
                DEBUGMSG( DBG_FUNC,("Device Descriptor = %x, len %x\n",
                                deviceDescriptor,
                                urb->UrbControlDescriptorRequest.TransferBufferLength));

                DEBUGMSG( DBG_FUNC,("-------------------------\n"));
                DEBUGMSG( DBG_FUNC,("bLength %d\n", deviceDescriptor->bLength));
                DEBUGMSG( DBG_FUNC,("bDescriptorType 0x%x\n", deviceDescriptor->bDescriptorType));
                DEBUGMSG( DBG_FUNC,("bcdUSB 0x%x\n", deviceDescriptor->bcdUSB));
                DEBUGMSG( DBG_FUNC,("bDeviceClass 0x%x\n", deviceDescriptor->bDeviceClass));
                DEBUGMSG( DBG_FUNC,("bDeviceSubClass 0x%x\n", deviceDescriptor->bDeviceSubClass));
                DEBUGMSG( DBG_FUNC,("bDeviceProtocol 0x%x\n", deviceDescriptor->bDeviceProtocol));
                DEBUGMSG( DBG_FUNC,("bMaxPacketSize0 0x%x\n", deviceDescriptor->bMaxPacketSize0));
                DEBUGMSG( DBG_FUNC,("idVendor 0x%x\n", deviceDescriptor->idVendor));
                DEBUGMSG( DBG_FUNC,("idProduct 0x%x\n", deviceDescriptor->idProduct));
                DEBUGMSG( DBG_FUNC,("bcdDevice 0x%x\n", deviceDescriptor->bcdDevice));
                DEBUGMSG( DBG_FUNC,("iManufacturer 0x%x\n", deviceDescriptor->iManufacturer));
                DEBUGMSG( DBG_FUNC,("iProduct 0x%x\n", deviceDescriptor->iProduct));
                DEBUGMSG( DBG_FUNC,("iSerialNumber 0x%x\n", deviceDescriptor->iSerialNumber));
                DEBUGMSG( DBG_FUNC,("bNumConfigurations 0x%x\n", deviceDescriptor->bNumConfigurations));
            }
        } 
		else
		{
            // if we got here we failed to allocate deviceDescriptor
            ntStatus = STATUS_INSUFFICIENT_RESOURCES;
        }

        if (NT_SUCCESS(ntStatus))//device->deviceExt
		{
            ((PUSB_INFO) device->pUsbInfo)->UsbDeviceDescriptor = deviceDescriptor;
            device->IdVendor = ((PUSB_INFO) device->pUsbInfo)->UsbDeviceDescriptor->idVendor;
        }
          
          MemFree(urb, sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST));

    }
	else
	{
        // if we got here we failed to allocate the urb
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    if (NT_SUCCESS(ntStatus)) 
	{
        ntStatus = ConfigureDevice(DeviceExt);
        DEBUGCOND( DBG_ERR,!NT_SUCCESS(ntStatus),("StartDevice ConfigureDevice() FAILURE (%x)\n", ntStatus));
    }

    if (NT_SUCCESS(ntStatus)) {
            DeviceExt->fDeviceStarted = TRUE;
    }

    DEBUGMSG( DBG_FUNC, (" -StartDevice (%x)\n", ntStatus));
    return ntStatus;
}

NTSTATUS
StopDevice(
    IN  PUSB_DEVICE DeviceExt
    )
/*++

Routine Description:

  Stops a given instance of a 8511 device on the USB.
    We basically just tell USB this device is now 'unconfiguration'

Return Value:

    NT status code

--*/
{
    PUSB_DEVICE device;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PURB urb;
    ULONG siz;

    DEBUGMSG( DBG_FUNC,(" +StopDevice\n"));

    device = DeviceExt;

    //
    // Send the select configuration urb with a NULL pointer for the configuration
    // handle. This closes the configuration and puts the device in the 'unconfigured'
    // state.
    //

    siz = sizeof(struct _URB_SELECT_CONFIGURATION);

    urb = MemAlloc(siz);

    if (urb)
	{
        UsbBuildSelectConfigurationRequest(urb,(USHORT) siz,NULL);
        ntStatus = CallUSBD(DeviceExt, urb); // build select config req; main thread

        DEBUGCOND( DBG_ERR,!NT_SUCCESS(ntStatus),("StopDevice() FAILURE Configuration Closed status = %x usb status = %x.\n", ntStatus, urb->UrbHeader.Status));
        DEBUGCOND( DBG_WARN,NT_SUCCESS(ntStatus),("StopDevice() SUCCESS Configuration Closed status = %x usb status = %x.\n", ntStatus, urb->UrbHeader.Status));

        MemFree(urb, sizeof(struct _URB_SELECT_CONFIGURATION));
    }
	else
	{
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    DEBUGMSG( DBG_FUNC,(" -StopDevice  (%x) \n ", ntStatus));

    return ntStatus;
}

VOID
ResetPipeCallback (
    IN PUSB_WORK_ITEM   pWorkItem
    )
{
    PUSB_DEVICE device;
    HANDLE Pipe;
    NTSTATUS ntStatus;

    device = (PUSB_DEVICE) pWorkItem->pDevice;
    Pipe = ( HANDLE ) pWorkItem->InfoBuf;

    if( Pipe == device->BulkInPipeHandle ) 
	{
        ASSERT( TRUE == device->fPendingReadClearStall );
        
        ResetPipe( device, Pipe );
        CancelPendingReadIo(device, TRUE );


        //StopDevice( device ); // select the NULL interface

        //ntStatus = SelectInterface( device, // re-select our real interface
        //    ((PUSB_INFO) device->pUsbInfo)->UsbConfigurationDescriptor);

        InterlockedExchange( &device->fPendingReadClearStall, FALSE );


    } 
	else  if( Pipe == device->BulkOutPipeHandle ) 
	{
        ASSERT( TRUE == device->fPendingWriteClearStall );

        ResetPipe( device, Pipe );
        CancelPendingWriteIo( device );

        //ResetPipe( device, Pipe );

        //StopDevice( device ); // select the NULL interface

        //ntStatus = SelectInterface( device, // re-select our real interface
        //    ((PUSB_INFO) device->pUsbInfo)->UsbConfigurationDescriptor);

        InterlockedExchange( &device->fPendingWriteClearStall, FALSE );
    }
    else
	{
        ASSERT( 0 );
    }

    FreeWorkItem( pWorkItem );

}

VOID
FreeWorkItem(
            PUSB_WORK_ITEM pItem
            )
{
    InterlockedExchange( (PLONG) &pItem->fInUse, FALSE );
}

BOOLEAN
CancelPendingIo(
    IN PUSB_DEVICE Device
    )
/*++



Return Value:

    TRUE if cancelled any, else FALSE

--*/
{
    BOOLEAN cRes = TRUE;

    DEBUGMSG( DBG_FUNC, ("  +CancelPendingIo(), fDeviceStarted =%d\n", Device->fDeviceStarted)); // chag to FUNC later?

    ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);

    if ( Device->fDeviceStarted ){

        CancelPendingReadIo(Device, TRUE);

        CancelPendingWriteIo(Device);
    }


    DEBUGMSG( DBG_FUNC, ("  -CancelPendingIo()\n")); // chag to FUNC later?

    return (BOOLEAN) cRes;

}


BOOLEAN
CancelPendingReadIo(
    IN PUSB_DEVICE DeviceExt,
    BOOLEAN fWaitCancelComplete
    )
/*++

Return Value:

    TRUE if cancelled any, else FALSE

--*/
{
    PUSB_DEVICE device = DeviceExt;
    BOOLEAN cRes = FALSE;
    NTSTATUS timeStat;
    int i;

    DEBUGMSG( DBG_FUNC, ("  +CancelPendingReadIo()\n"));

    ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);

    
    for (i = 0; i < NUM_RCV_BUFS; i++)
    {
        PRCV_BUFFER  pRcvBuf = &device->rcvBufs[i];

        if ( ( STATE_PENDING == pRcvBuf->state ) &&
             ( NULL != pRcvBuf->Irp ) )
        {

            PIRP pIrp = (PIRP) pRcvBuf->Irp;

            // Since IoCallDriver has been called on this request, we call IoCancelIrp
            //  and let our completion routine handle it
            //
            DEBUGMSG( DBG_FUNC, ("  CancelPendingReadIo() about to CANCEL a read IRP!\n"));

            KeClearEvent( &pRcvBuf->Event );

            cRes = IoCancelIrp( (PIRP) pRcvBuf->Irp );  //CancelPendingReadIo()

            DEBUGCOND( DBG_ERR, !cRes, ("  CancelPendingReadIo() COULDN'T CANCEL IRP!\n"));
            DEBUGCOND( DBG_FUNC, cRes, ("  CancelPendingReadIo() CANCELLED IRP SUCCESS!\n"));

            if ( cRes  && fWaitCancelComplete ) 
			{
                timeStat = MyKeWaitForSingleObject(
                           device,
                           &pRcvBuf->Event,
                           NULL,  // irp to cancel; we did it above already, so pass NULL

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品在线观看入口| 亚洲成人一区在线| 久久精品国产亚洲高清剧情介绍| 欧美日本高清视频在线观看| 五月综合激情婷婷六月色窝| 日韩欧美一区在线观看| 国产专区欧美精品| 中文字幕在线播放不卡一区| 92精品国产成人观看免费| 亚洲国产aⅴ天堂久久| 538在线一区二区精品国产| 免费高清不卡av| 欧美国产精品一区二区| 91极品美女在线| 蜜臀va亚洲va欧美va天堂| 国产亚洲综合av| 在线精品视频一区二区| 久久黄色级2电影| 国产精品国产精品国产专区不片| 欧洲精品中文字幕| 激情综合亚洲精品| 亚洲精选一二三| 精品久久久久一区二区国产| 99riav一区二区三区| 免费成人av在线播放| 国产精品剧情在线亚洲| 欧美日韩黄色影视| 波多野结衣中文字幕一区| 五月天激情小说综合| 日本一区二区三区高清不卡 | 精品剧情在线观看| 91麻豆福利精品推荐| 美脚の诱脚舐め脚责91| 亚洲欧美视频在线观看| 精品伦理精品一区| 欧美午夜免费电影| 成人午夜av影视| 精品一区二区三区视频在线观看 | 日韩一区二区免费高清| av亚洲精华国产精华| 美女尤物国产一区| 一区二区在线观看免费| 国产日韩精品久久久| 日韩一区二区在线看片| 91国产丝袜在线播放| 欧美一级生活片| 91色.com| 成人av电影在线网| 国产精品一区2区| 免费高清成人在线| 亚洲国产精品欧美一二99| 亚洲欧洲日韩在线| 久久久久久久综合色一本| 欧美一区三区二区| 欧美亚洲禁片免费| 91免费国产在线| 成人午夜激情视频| 国产盗摄一区二区三区| 麻豆视频观看网址久久| 视频一区二区欧美| 亚洲国产精品久久艾草纯爱| 亚洲免费高清视频在线| 亚洲欧洲av在线| 国产精品美女久久久久久久| 久久久久久久久岛国免费| 久久影院午夜片一区| 日韩视频中午一区| 欧美一区二区三区爱爱| 91精品国产入口| 日韩欧美色综合| 精品剧情在线观看| 久久一日本道色综合| 国产偷v国产偷v亚洲高清| 国产午夜亚洲精品不卡| 国产精品视频线看| 国产精品高潮呻吟| 一区二区三区四区在线免费观看| 亚洲欧美日韩在线| 亚洲香肠在线观看| 日韩av中文在线观看| 久久精品999| 国产精品中文欧美| 成+人+亚洲+综合天堂| gogo大胆日本视频一区| 在线观看91视频| 9191国产精品| 国产亚洲人成网站| 亚洲天堂成人网| 天天av天天翘天天综合网| 男男视频亚洲欧美| 国产一区二区三区在线观看精品 | 中文字幕一区二区三区四区不卡| 中文字幕一区二区三区乱码在线| 亚洲色图制服丝袜| 男女男精品视频网| 国产91精品在线观看| 色综合夜色一区| 91精品免费观看| 国产网站一区二区三区| 136国产福利精品导航| 亚洲一级二级三级| 国产一区二区在线观看免费| av资源网一区| 日韩欧美在线123| 国产精品日产欧美久久久久| 性做久久久久久| 国产一区二区视频在线| 91亚洲资源网| 精品欧美一区二区久久| 亚洲欧美aⅴ...| 欧美三级中文字幕| 欧美不卡在线视频| 国产精品免费久久久久| 天天综合色天天综合| 国产成人av一区二区三区在线 | 国产人成一区二区三区影院| 亚洲综合清纯丝袜自拍| 国产伦精品一区二区三区免费迷| 成人午夜视频福利| 欧美一区二区在线看| 亚洲欧美日韩小说| 国产一区二区导航在线播放| 色狠狠色噜噜噜综合网| 亚洲第一在线综合网站| 久久91精品久久久久久秒播| 91丝袜呻吟高潮美腿白嫩在线观看| 91.麻豆视频| 亚洲欧美成aⅴ人在线观看| 亚洲精品国产视频| 美女在线观看视频一区二区| 91麻豆swag| 国产偷国产偷亚洲高清人白洁| 一区二区三区精品久久久| 国产成人一区在线| 日韩三级在线免费观看| 亚洲精品日产精品乱码不卡| 国产成人免费在线| 精品久久久久久亚洲综合网| 天堂影院一区二区| 日本丶国产丶欧美色综合| 久久久久久久综合日本| 日韩精品国产精品| 欧美亚洲免费在线一区| 日韩理论电影院| 成人精品免费网站| 中文字幕国产一区| 国产精品一区久久久久| 日韩欧美中文一区| 天堂午夜影视日韩欧美一区二区| 日本韩国一区二区三区视频| 国产精品二三区| 粉嫩一区二区三区性色av| 久久综合999| 久久99久久精品| 制服丝袜一区二区三区| 午夜精品爽啪视频| 欧美午夜精品一区| 亚洲高清三级视频| 欧美亚洲图片小说| 亚洲国产精品久久久久婷婷884| 色偷偷成人一区二区三区91| 国产精品久久夜| 成+人+亚洲+综合天堂| 国产精品妹子av| 97久久超碰精品国产| 中文字幕亚洲区| 91网站最新网址| 亚洲精品国产一区二区三区四区在线| 99re在线精品| 一区二区三区精品视频| 欧美日韩成人一区二区| 午夜精品一区二区三区免费视频 | 麻豆国产欧美日韩综合精品二区| 欧美精品v日韩精品v韩国精品v| 午夜精品一区二区三区三上悠亚| 欧美日韩在线观看一区二区| 香蕉久久夜色精品国产使用方法| 欧美精品精品一区| 精品一区二区三区香蕉蜜桃| 国产亚洲女人久久久久毛片| 成人精品免费视频| 一区二区三区四区高清精品免费观看 | 亚洲不卡一区二区三区| 69av一区二区三区| 黄页视频在线91| 国产精品你懂的| 欧美系列在线观看| 青青草国产成人av片免费 | 国产精品网站一区| 色婷婷av一区二区三区大白胸| 午夜影院在线观看欧美| 日韩美女一区二区三区| 国产成人午夜精品影院观看视频 | 中文文精品字幕一区二区| 91在线视频免费91| 日韩av一级片| 国产精品毛片久久久久久| 欧美性大战久久久久久久| 韩国午夜理伦三级不卡影院| 亚洲欧洲色图综合|