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

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

?? usbls120.c

?? 參考著寫其他的驅動程序就可以了。
?? 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一区二区三区免费野_久草精品视频
亚洲精品一区二区三区在线观看| 1区2区3区国产精品| 国产精品女主播av| 视频一区视频二区中文| 从欧美一区二区三区| 欧美一区二区三区色| 又紧又大又爽精品一区二区| 国产高清成人在线| 日韩欧美二区三区| 日韩成人一级大片| 欧美日韩在线播放三区四区| 亚洲欧洲日韩一区二区三区| 国产一区二区美女诱惑| 日韩欧美色综合| 日韩黄色小视频| 在线亚洲高清视频| 亚洲精品视频一区| www.欧美日韩国产在线| 国产亚洲成av人在线观看导航 | 国产一区二区三区电影在线观看 | 亚洲精品国久久99热| 国产精品一区二区在线观看不卡| 在线不卡a资源高清| 亚洲综合在线免费观看| 97国产一区二区| 国产精品美女一区二区在线观看| 狠狠色丁香婷婷综合| 日韩欧美自拍偷拍| 奇米一区二区三区| 日韩免费一区二区三区在线播放| 亚洲va韩国va欧美va| 欧美午夜电影一区| 亚洲h精品动漫在线观看| 在线日韩av片| 视频精品一区二区| 欧美一区二区三区在线视频| 午夜精品福利一区二区蜜股av| 欧美亚洲综合网| 婷婷久久综合九色综合绿巨人 | 免费亚洲电影在线| 在线免费亚洲电影| 亚洲国产一区二区三区| 欧美视频三区在线播放| 五月激情综合婷婷| 精品国产伦一区二区三区观看方式 | 精品国产乱码久久久久久闺蜜| 免费在线观看精品| 精品国产乱码久久久久久夜甘婷婷| 免费成人av在线| 久久女同互慰一区二区三区| 成人免费看视频| 夜夜揉揉日日人人青青一国产精品 | 色天天综合久久久久综合片| 亚洲乱码国产乱码精品精的特点 | 美国精品在线观看| 久久女同精品一区二区| av成人动漫在线观看| 亚洲国产精品人人做人人爽| 91精品国产综合久久久久| 国产乱色国产精品免费视频| 国产精品福利一区二区三区| 在线视频国内自拍亚洲视频| 久久电影网站中文字幕| 中文字幕成人av| 欧美日韩综合在线| 国产精品一级二级三级| 亚洲一线二线三线久久久| 欧美va天堂va视频va在线| av色综合久久天堂av综合| 亚洲国产成人av网| 精品国产精品一区二区夜夜嗨 | 国模大尺度一区二区三区| 亚洲欧洲av在线| 日韩一区二区三区高清免费看看| 国产精品18久久久久久vr| 亚洲成在人线免费| 欧美激情艳妇裸体舞| 欧美日韩精品一区二区三区四区 | 蜜桃一区二区三区在线观看| 国产精品日韩成人| 欧美一级黄色录像| 欧美中文字幕不卡| 国产传媒久久文化传媒| 日本中文字幕一区二区有限公司| 国产欧美日韩精品在线| 日韩无一区二区| 欧美视频在线不卡| 91视视频在线直接观看在线看网页在线看| 亚洲福利视频一区| 亚洲三级电影网站| 国产精品久久久久影院老司| 日韩欧美综合一区| 欧美日韩一区二区在线观看| 成人一区二区三区视频在线观看 | www日韩大片| 欧美日韩电影在线播放| 91麻豆.com| 成人午夜激情在线| 韩日精品视频一区| 日产国产高清一区二区三区| 一区二区三区四区高清精品免费观看 | 亚洲图片自拍偷拍| 国产精品欧美一级免费| 久久综合久久99| 91精品国产麻豆| 欧美日韩在线综合| 欧美天堂一区二区三区| 欧美系列一区二区| 一本久久综合亚洲鲁鲁五月天| 成人午夜在线免费| 成人精品免费看| 成人美女视频在线观看| 国产大陆精品国产| 国产99精品国产| av中文字幕不卡| 不卡高清视频专区| 99久久综合精品| 91视频xxxx| 欧美亚洲一区二区三区四区| 欧美午夜一区二区| 欧美网站大全在线观看| 777a∨成人精品桃花网| 欧美裸体bbwbbwbbw| 在线观看91精品国产麻豆| 制服丝袜中文字幕一区| 日韩欧美亚洲另类制服综合在线| 日韩一二在线观看| 久久视频一区二区| 国产欧美日韩三区| 亚洲伦理在线精品| 婷婷成人综合网| 久久av中文字幕片| 成人天堂资源www在线| 成人av电影在线| 欧美在线啊v一区| 69久久夜色精品国产69蝌蚪网| 日韩欧美一区中文| 国产欧美日韩不卡| 伊人一区二区三区| 日韩国产欧美在线观看| 国产一区二区在线视频| 成人a免费在线看| 欧美色男人天堂| 精品国产自在久精品国产| 国产精品久久久久久久久免费丝袜 | 制服丝袜亚洲精品中文字幕| 日韩一区二区电影网| 国产日韩欧美a| 亚洲免费在线播放| 奇米色777欧美一区二区| 成人国产精品免费观看视频| 日韩一级在线观看| 久久亚洲影视婷婷| 亚洲免费观看高清| 欧美日韩成人一区| 精品嫩草影院久久| 亚洲精品日韩一| 久99久精品视频免费观看| 欧美一级免费观看| 久久久午夜精品| 91视频免费播放| 亚洲视频免费在线| 97se亚洲国产综合在线| 国产精品色哟哟网站| 成人在线一区二区三区| 国产色综合久久| 国产成人夜色高潮福利影视| 久久一日本道色综合| 精品无码三级在线观看视频| 日韩欧美高清一区| 精品一区中文字幕| 久久久高清一区二区三区| 国产原创一区二区| 久久免费电影网| 成人性视频免费网站| 国产精品水嫩水嫩| 91在线观看美女| 亚洲一区二区成人在线观看| 欧美视频在线一区| 奇米精品一区二区三区四区| 日韩欧美一区二区在线视频| 韩国女主播一区二区三区| 欧美精品一区二区久久久| 国产精品影视天天线| 亚洲欧洲精品天堂一级| 色噜噜狠狠成人中文综合| 亚洲图片欧美一区| 日韩一级片网址| 岛国一区二区三区| 亚洲精品国产无天堂网2021| 欧美色爱综合网| 蜜臀av性久久久久av蜜臀妖精| 国产亚洲精品aa| 一本大道综合伊人精品热热| 婷婷国产在线综合| 国产欧美日韩中文久久| 色欧美日韩亚洲| 麻豆精品一区二区av白丝在线| 久久夜色精品国产噜噜av| 91视频免费看|