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

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

?? isousb.c

?? ARM2410的USB的源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
        Urb->UrbHeader.Status, status, ioStatus.Status));

    //
    // USBD maps the error code for us
    //
    ntStatus = ioStatus.Status;

    ISOUSB_KdPrintCond( DBGLVL_MAXIMUM, !NT_SUCCESS( ntStatus ), ("exit IsoUsb_CallUSBD FAILED (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
IsoUsb_ConfigureDevice(
    IN  PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    Initializes a given instance of the device on the USB and
	selects and saves the configuration.

Arguments:

    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;

    ISOUSB_KdPrint( DBGLVL_HIGH,("enter IsoUsb_ConfigureDevice\n"));

    deviceExtension = DeviceObject->DeviceExtension;

	ISOUSB_ASSERT( deviceExtension->UsbConfigurationDescriptor == NULL );

    urb = 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 = ExAllocatePool(NonPagedPool, siz);

		if ( !deviceExtension->UsbConfigurationDescriptor ) {
		    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 = IsoUsb_CallUSBD(DeviceObject, urb);

		ISOUSB_KdPrint( DBGLVL_HIGH,("IsoUsb_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;
			ExFreePool(deviceExtension->UsbConfigurationDescriptor);
			deviceExtension->UsbConfigurationDescriptor = NULL;
		} else {
			break;  // we got it on the first try
		}

	} // end, while (retry loop )

    ExFreePool(urb);
	ISOUSB_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 = IsoUsb_SelectInterface(DeviceObject,
        deviceExtension->UsbConfigurationDescriptor);


    ISOUSB_KdPrint( DBGLVL_HIGH,("exit IsoUsb_ConfigureDevice (%x)\n", ntStatus));

    return ntStatus;
} 


NTSTATUS
IsoUsb_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;
    PUCHAR pInf;

    ISOUSB_KdPrint( DBGLVL_MEDIUM,("enter IsoUsb_SelectInterface\n"));

    deviceExtension = DeviceObject->DeviceExtension;


    ISOUSB_KdPrint( DBGLVL_HIGH,("IsoUsb_SelectInterface() called with NULL Interface\n"));
    //
    // IsoUsb 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 ) {

			ISOUSB_KdPrint( DBGLVL_HIGH,("IsoUsb_SelectInterface() ParseConfigurationDescriptorEx() failed\n  returning STATUS_INSUFFICIENT_RESOURCES\n"));
			ExFreePool(urb);
			return STATUS_INSUFFICIENT_RESOURCES;
		}

        Interface = &urb->UrbSelectConfiguration.Interface;


        // allocate space for an array of pipe information structs;
        //  in this basic sample, just used to track if opened/closed
        deviceExtension->PipeInfo = ExAllocatePool(
            NonPagedPool, 
            Interface->NumberOfPipes * sizeof ( ISOUSB_PIPEINFO ) );
    
        if ( !deviceExtension->PipeInfo ) {
		    return STATUS_INSUFFICIENT_RESOURCES;
        }

        RtlZeroMemory(deviceExtension->PipeInfo,
            Interface->NumberOfPipes * sizeof ( ISOUSB_PIPEINFO ) );

        pInf = (PUCHAR ) deviceExtension->PipeInfo;

        for (i=0; i< Interface->NumberOfPipes; i++) {
            //
            // Perform any pipe initialization here;
			// We set the max transfer size and any Pipe flags we use; USBD sets the rest
			// of the Interface struct members
            //
            Interface->Pipes[i].MaximumTransferSize = deviceExtension->MaximumTransferSize;
            ( (PISOUSB_PIPEINFO) pInf)->fPipeOpened = FALSE;
            pInf += sizeof ( ISOUSB_PIPEINFO );
        }

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


        ntStatus = IsoUsb_CallUSBD(DeviceObject, urb);

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

    } else {
        ISOUSB_KdPrint( DBGLVL_HIGH,("IsoUsb_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 = 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
            //
            ISOUSB_KdPrint( DBGLVL_MEDIUM,("---------\n"));
            ISOUSB_KdPrint( DBGLVL_MEDIUM,("NumberOfPipes 0x%x\n", deviceExtension->UsbInterface->NumberOfPipes));
            ISOUSB_KdPrint( DBGLVL_MEDIUM,("Length 0x%x\n", deviceExtension->UsbInterface->Length));
            ISOUSB_KdPrint( DBGLVL_MEDIUM,("Alt Setting 0x%x\n", deviceExtension->UsbInterface->AlternateSetting));
            ISOUSB_KdPrint( DBGLVL_MEDIUM,("Interface Number 0x%x\n", deviceExtension->UsbInterface->InterfaceNumber));
            ISOUSB_KdPrint( DBGLVL_MEDIUM,("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];

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

            ISOUSB_KdPrint( DBGLVL_MEDIUM,("---------\n"));
        }
    }

    if (urb) {
		// don't call the ISOUSB_ExFreePool since the buffer was 
		//  alloced by USBD_CreateConfigurationRequest, not ISOUSB_ExAllocatePool()
        ExFreePool(urb);
    }
    ISOUSB_KdPrint( DBGLVL_HIGH,("exit IsoUsb_SelectInterface (%x)\n", ntStatus));

    return ntStatus; 
}


NTSTATUS
IsoUsb_ResetPipe(
    IN PDEVICE_OBJECT DeviceObject,
    IN PUSBD_PIPE_INFORMATION Pipe,
    IN BOOLEAN IsoClearStall
    )
/*++

Routine Description:

    Reset a given USB pipe.
    
    NOTES:

    This will reset the host to Data0 and should also reset the device
    to Data0 for Bulk and Interrupt pipes.

    For Iso pipes this will set the virgin state of pipe so that ASAP
    transfers begin with the current bus frame instead of the next frame
    after the last transfer occurred.

Arguments:

Return Value:


--*/
{
    NTSTATUS ntStatus;
    PURB urb;

    ISOUSB_KdPrint ( DBGLVL_MEDIUM, (" Reset Pipe %x\n", Pipe));

    urb = 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 =
            Pipe->PipeHandle;

        ntStatus = IsoUsb_CallUSBD(DeviceObject, urb);

        ExFreePool(urb);

    } else {
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    //
    // Memphis RESET_PIPE will send a Clear-Feature Endpoint Stall to
    // reset the data toggle of non-Iso pipes as part of a RESET_PIPE
    // request.  It does not do this for Iso pipes as Iso pipes do not use
    // the data toggle (all Iso packets are Data0).  However, we also use
    // the Clear-Feature Endpoint Stall request in our device firmware to
    // reset data buffer points inside the device so we explicitly send
    // this request to the device for Iso pipes if desired.
    //
    if (NT_SUCCESS(ntStatus) && IsoClearStall &&
        (Pipe->PipeType == UsbdPipeTypeIsochronous)) {
        
        urb = ExAllocatePool(NonPagedPool,
                             sizeof(struct _URB_CONTROL_FEATURE_REQUEST));

        if (urb) {

            UsbBuildFeatureRequest(urb,
                                   URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT,
                                   USB_FEATURE_ENDPOINT_STALL,
                                   Pipe->EndpointAddress,
                                   NULL);

            ntStatus = IsoUsb_CallUSBD(DeviceObject, urb);

            ExFreePool(urb);
        } else {
            ntStatus = STATUS_INSUFFICIENT_RESOURCES;
        }
    }

    return ntStatus;
}




LONG
IsoUsb_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;

    deviceExtension = DeviceObject->DeviceExtension;

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


    ISOUSB_KdPrint( DBGLVL_MAXIMUM,("IsoUsb_DecrementIoCount() Pending io count = %x\n", ioCount));
    ISOUSB_TrapCond( DBGLVL_HIGH,( 0 > ioCount ) );

    if (ioCount==1) {
        // trigger no pending io
        ISOUSB_KdPrint( DBGLVL_MAXIMUM,("IsoUsb_DecrementIoCount() setting NoPendingIoEvent\n"));

        KeSetEvent(&deviceExtension->NoPendingIoEvent,
                   1,
                   FALSE);
    }

    if (ioCount==0) {
        // trigger remove-device event
        ISOUSB_KdPrint( DBGLVL_HIGH,("IsoUsb_DecrementIoCount() setting RemoveEvent\n"));

        KeSetEvent(&deviceExtension->RemoveEvent,
                   1,
                   FALSE);
    }

    return ioCount;
}


VOID
IsoUsb_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;

    deviceExtension = DeviceObject->DeviceExtension;

    InterlockedIncrement(&deviceExtension->PendingIoCount);
#if DBG
    InterlockedIncrement(&gpDbg->PendingIoCount);
#endif
    ISOUSB_KdPrint( DBGLVL_MAXIMUM,("Exit IsoUsb_IncrementIoCount() Pending io count = %x\n", deviceExtension->PendingIoCount));
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区香蕉| 最新国产の精品合集bt伙计| 久久奇米777| 中文字幕电影一区| 亚洲精品福利视频网站| 奇米亚洲午夜久久精品| 国产大陆亚洲精品国产| 91高清视频在线| 欧美一级理论片| 亚洲欧洲av在线| 日本免费新一区视频| 国产盗摄一区二区三区| 欧美日韩亚洲高清一区二区| 精品国产在天天线2019| 亚洲精品v日韩精品| 精品一区在线看| 一本色道a无线码一区v| 日韩三级视频在线观看| 亚洲色图在线看| 狠狠色综合日日| 欧美日韩一区二区三区视频| 国产视频一区在线观看| 亚洲va欧美va人人爽| 丁香亚洲综合激情啪啪综合| 欧美日韩国产一区二区三区地区| 国产午夜久久久久| 丝袜诱惑亚洲看片 | 欧美本精品男人aⅴ天堂| 国产精品色眯眯| 蜜桃视频一区二区| 一本色道a无线码一区v| 国产偷国产偷精品高清尤物| 日韩高清在线电影| 色综合久久88色综合天天免费| 精品国产污污免费网站入口| 亚洲一区在线观看免费观看电影高清| 国产一区二区三区观看| 欧美精品乱码久久久久久| 中文字幕一区视频| 国内精品在线播放| 欧美高清一级片在线| 亚洲欧美日韩久久| 懂色av一区二区三区免费看| 日韩欧美精品三级| 污片在线观看一区二区| 色噜噜狠狠色综合中国| 国产精品久久久久久亚洲毛片| 久久99精品一区二区三区| 91精品国产91综合久久蜜臀| 亚洲最大成人网4388xx| 91在线精品秘密一区二区| 国产日产欧美一区二区视频| 久久99精品久久久久婷婷| 91精品久久久久久久91蜜桃| 亚洲精品国产一区二区精华液| 高清免费成人av| 久久久影视传媒| 久久99精品国产麻豆婷婷| 91精品国产一区二区三区蜜臀| 亚洲成人激情自拍| 欧美视频精品在线观看| 一区二区在线观看av| 91免费版pro下载短视频| 一区二区中文字幕在线| 成人v精品蜜桃久久一区| 国产精品免费观看视频| 国产69精品久久久久毛片 | 国产ts人妖一区二区| 久久亚洲私人国产精品va媚药| 免费观看一级欧美片| 欧美一区二区私人影院日本| 青青国产91久久久久久| 日韩三级视频在线看| 极品少妇xxxx偷拍精品少妇| 欧美成人在线直播| 韩国女主播一区| 欧美成人vps| 国产曰批免费观看久久久| 久久久久久久久久久久久女国产乱 | 国产麻豆视频一区| 久久免费偷拍视频| 懂色av中文字幕一区二区三区| 国产欧美精品一区二区三区四区| 成人一区二区视频| 日韩伦理免费电影| 91福利国产成人精品照片| 亚洲国产精品久久不卡毛片 | 香蕉久久夜色精品国产使用方法| 欧美私人免费视频| 日本欧美一区二区在线观看| 精品国产青草久久久久福利| 国产老肥熟一区二区三区| 国产色产综合产在线视频| 成+人+亚洲+综合天堂| 亚洲美女在线一区| 欧美日产在线观看| 精品在线视频一区| 欧美国产激情一区二区三区蜜月| 97成人超碰视| 丝袜美腿亚洲综合| xfplay精品久久| 成人av电影观看| 亚洲 欧美综合在线网络| 欧美成人伊人久久综合网| 成人午夜免费视频| 一区二区三区美女视频| 日韩欧美一区在线观看| 国产一区视频在线看| 亚洲人成网站影音先锋播放| 欧美蜜桃一区二区三区| 国产在线播精品第三| 亚洲精品视频在线看| 91精品午夜视频| 成人教育av在线| 日韩影院精彩在线| 国产喷白浆一区二区三区| 欧美日韩亚洲不卡| 国产精品一区二区三区99| 亚洲精品高清视频在线观看| 欧美变态tickle挠乳网站| 色婷婷精品大在线视频 | 国产日韩欧美不卡| 欧美四级电影网| 国产91对白在线观看九色| 首页亚洲欧美制服丝腿| 亚洲国产精品精华液ab| 欧美理论在线播放| www.日本不卡| 麻豆精品在线视频| 亚洲免费观看高清在线观看| 精品少妇一区二区三区免费观看 | 亚洲一二三四区不卡| 久久影视一区二区| 欧美日韩综合在线免费观看| 国产精品自拍网站| 一区二区三区国产豹纹内裤在线| 精品91自产拍在线观看一区| 欧美中文字幕一区二区三区| 国产成人在线电影| 蜜臀av性久久久久蜜臀av麻豆| 日韩一区在线看| 久久久影视传媒| 日韩一区二区三区在线| 91黄色免费版| 丁香天五香天堂综合| 免费成人美女在线观看| 午夜精品免费在线| 亚洲青青青在线视频| 久久精品综合网| 精品国产一区二区三区av性色| 欧美日韩在线播放| 色综合久久久久综合| 成人动漫一区二区| 国产精品1024| 精品一区二区三区免费| 亚洲v中文字幕| 亚洲国产精品久久久久秋霞影院| 亚洲人成亚洲人成在线观看图片| 国产精品人成在线观看免费| 精品国产免费一区二区三区四区 | 蜜臀a∨国产成人精品| 亚洲图片一区二区| 亚洲综合成人在线| 一区二区三区在线观看国产| 国产精品久久久久久久久动漫| 国产丝袜美腿一区二区三区| 久久影音资源网| www久久久久| 久久久久久免费网| 精品电影一区二区| 精品毛片乱码1区2区3区| 欧美一区2区视频在线观看| 欧美久久一区二区| 欧美中文字幕一区二区三区 | 视频在线在亚洲| 亚洲成人福利片| 午夜影视日本亚洲欧洲精品| 亚洲一卡二卡三卡四卡| 亚洲精品国产一区二区三区四区在线| 亚洲欧洲av在线| 亚洲欧美日韩人成在线播放| 亚洲美女在线国产| 亚洲一区二区三区爽爽爽爽爽| 亚洲一区二区成人在线观看| 亚洲成人一区二区在线观看| 首页综合国产亚洲丝袜| 蜜臂av日日欢夜夜爽一区| 老司机午夜精品| 国产一区二区三区蝌蚪| 国产精品一区二区在线看| 高清不卡在线观看| 不卡一区二区三区四区| 日本福利一区二区| 欧美亚洲国产一区在线观看网站| 欧美午夜精品理论片a级按摩| 欧美天天综合网| 欧美一区二区在线视频| 亚洲精品一区二区三区福利| 国产欧美一区二区三区在线老狼| 亚洲欧洲日本在线|