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

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

?? bulkusb.c

?? S3C2410X平臺下的USB驅動程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
                       FALSE,
                       NULL);

    } else {
        ioStatus.Status = ntStatus;
    }

    BULKUSB_KdPrint( DBGLVL_MAXIMUM,("BulkUsb_CallUSBD() URB status = %x status = %x irp status %x\n",
        Urb->UrbHeader.Status, status, ioStatus.Status));

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

    BULKUSB_KdPrintCond( DBGLVL_MAXIMUM, !NT_SUCCESS( ntStatus ), ("exit BulkUsb_CallUSBD FAILED (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
BulkUsb_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;

    BULKUSB_KdPrint( DBGLVL_HIGH,("enter BulkUsb_ConfigureDevice\n"));

    deviceExtension = DeviceObject->DeviceExtension;

	BULKUSB_ASSERT( deviceExtension->UsbConfigurationDescriptor == NULL );

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

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

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

	} // end, while (retry loop )

    BULKUSB_ExFreePool(urb);
	BULKUSB_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 = BulkUsb_SelectInterface(DeviceObject,
        deviceExtension->UsbConfigurationDescriptor);


    BULKUSB_KdPrint( DBGLVL_HIGH,("exit BulkUsb_ConfigureDevice (%x)\n", ntStatus));

    return ntStatus;
} 


NTSTATUS
BulkUsb_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;

    BULKUSB_KdPrint( DBGLVL_MEDIUM,("enter BulkUsb_SelectInterface\n"));

    deviceExtension = DeviceObject->DeviceExtension;


    BULKUSB_KdPrint( DBGLVL_HIGH,("BulkUsb_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 ) {

			BULKUSB_KdPrint( DBGLVL_HIGH,("BulkUsb_SelectInterface() ParseConfigurationDescriptorEx() failed\n  returning STATUS_INSUFFICIENT_RESOURCES\n"));
			BULKUSB_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 = BULKUSB_ExAllocatePool(
            NonPagedPool, 
            Interface->NumberOfPipes * sizeof ( BULKUSB_PIPEINFO ) );
    
        if ( !deviceExtension->PipeInfo ) {
		    return STATUS_INSUFFICIENT_RESOURCES;
        }

        RtlZeroMemory(deviceExtension->PipeInfo,
            Interface->NumberOfPipes * sizeof ( BULKUSB_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;
            ( (PBULKUSB_PIPEINFO) pInf)->fPipeOpened = FALSE;
            pInf += sizeof ( BULKUSB_PIPEINFO );
        }

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


        ntStatus = BulkUsb_CallUSBD(DeviceObject, urb);

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

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

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

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

    if (urb) {
		// don't call the BULKUSB_ExFreePool since the buffer was 
		//  alloced by USBD_CreateConfigurationRequest, not BULKUSB_ExAllocatePool()
        ExFreePool(urb);
    }
    BULKUSB_KdPrint( DBGLVL_HIGH,("exit BulkUsb_SelectInterface (%x)\n", ntStatus));

    return ntStatus; 
}



NTSTATUS
BulkUsb_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;

    BULKUSB_KdPrint( DBGLVL_DEFAULT,("BulkUsb_ResetPipe() Reset Pipe %x\n", PipeInfo));

    urb = BULKUSB_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 = BulkUsb_CallUSBD(DeviceObject, urb);

        BULKUSB_ExFreePool(urb);

    } else {
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    if (!(NT_SUCCESS(ntStatus))) {
#if DBG
		if ( gpDbg )
			gpDbg->PipeErrorCount++;
#endif

        BULKUSB_KdPrint( DBGLVL_DEFAULT,("BulkUsb_ResetPipe() FAILED, ntStatus =0x%x\n", ntStatus ));
    }
    else {
#if DBG
		if ( gpDbg )
			gpDbg->ResetPipeCount++;
#endif

        BULKUSB_KdPrint( DBGLVL_DEFAULT,("BulkUsb_ResetPipe() SUCCESS, ntStatus =0x%x\n", ntStatus ));
    }

    return ntStatus;
}




LONG
BulkUsb_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


    BULKUSB_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);

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


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

    BULKUSB_KdPrint( DBGLVL_MAXIMUM,("Enter BulkUsb_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);

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


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲va欧美va人人爽午夜| 蜜臀av亚洲一区中文字幕| 国产婷婷色一区二区三区| 91麻豆精品国产| 欧美嫩在线观看| 91极品视觉盛宴| 色偷偷久久一区二区三区| 成人av高清在线| 99久久综合狠狠综合久久| 成人av午夜电影| 色偷偷成人一区二区三区91| 色噜噜偷拍精品综合在线| 日韩亚洲欧美中文三级| 欧美日本在线观看| 欧美一级片免费看| 久久综合网色—综合色88| 亚洲精品在线电影| 中文字幕av资源一区| 国产精品色噜噜| 亚洲欧美在线观看| 亚洲第一搞黄网站| 蜜臀久久99精品久久久画质超高清| 久久精品国产免费看久久精品| 精品一区二区在线免费观看| 国产成人丝袜美腿| 91丨九色丨黑人外教| 972aa.com艺术欧美| 色国产综合视频| 欧美人牲a欧美精品| 日韩午夜在线观看视频| 国产女主播一区| 亚洲狠狠丁香婷婷综合久久久| 日韩精品午夜视频| 国产福利一区在线| 欧美婷婷六月丁香综合色| 91精品国产综合久久小美女| 久久精品一区二区| 伊人开心综合网| 麻豆91在线看| 成人午夜电影网站| 欧美视频三区在线播放| 欧美成人综合网站| 亚洲国产精品99久久久久久久久| 夜夜嗨av一区二区三区网页| 免费看日韩a级影片| 成人动漫视频在线| 宅男在线国产精品| 国产精品欧美综合在线| 日韩成人精品在线观看| 国产91在线观看| 欧美人伦禁忌dvd放荡欲情| 国产婷婷色一区二区三区| 亚洲一区二区三区四区在线免费观看| 久久99精品久久久久婷婷| av影院午夜一区| 日韩欧美一区二区不卡| 中文字幕在线一区| 日本一道高清亚洲日美韩| 国产91在线观看丝袜| 91精品国产一区二区三区香蕉| 国产丝袜欧美中文另类| 亚洲大片在线观看| 波多野结衣中文字幕一区| 日韩一区二区高清| 亚洲综合清纯丝袜自拍| 国产老肥熟一区二区三区| 欧美精品欧美精品系列| 国产精品成人午夜| 国产精品小仙女| 91精品国产一区二区三区蜜臀| 亚洲另类在线一区| 福利电影一区二区| 欧美xxxx在线观看| 日本系列欧美系列| 久久网站热最新地址| 日韩中文字幕亚洲一区二区va在线| 成人精品鲁一区一区二区| 日韩欧美另类在线| 天天操天天色综合| 欧洲国产伦久久久久久久| 国产精品电影院| 国产成+人+日韩+欧美+亚洲| 日韩欧美一二三| 日韩影院在线观看| 欧美日韩在线播放| 一区二区三区欧美视频| 白白色亚洲国产精品| 久久精品水蜜桃av综合天堂| 老司机精品视频导航| 7777精品伊人久久久大香线蕉经典版下载| 亚洲区小说区图片区qvod| 粉嫩嫩av羞羞动漫久久久| 久久天天做天天爱综合色| 伦理电影国产精品| 欧美一区二区免费| 日本va欧美va精品发布| 欧美日韩黄色一区二区| 亚洲国产日产av| 在线视频国内一区二区| 一区二区三区中文在线观看| 91蜜桃网址入口| 亚洲女性喷水在线观看一区| 91在线高清观看| 亚洲精品综合在线| 欧美午夜在线观看| 亚洲mv在线观看| 欧美高清视频一二三区 | 欧美色老头old∨ideo| 一区二区日韩电影| 欧美日韩国产在线观看| 亚洲成人综合在线| 91精品国产日韩91久久久久久| 日本最新不卡在线| 精品精品国产高清一毛片一天堂| 久久99热这里只有精品| 久久精品欧美日韩精品| 成人高清免费观看| 伊人性伊人情综合网| 欧美日韩aaa| 狠狠色丁香久久婷婷综| 久久精品视频免费观看| gogo大胆日本视频一区| 亚洲图片你懂的| 欧美日韩色一区| 麻豆精品新av中文字幕| 欧美极品另类videosde| 99re热这里只有精品免费视频| 一区2区3区在线看| 日韩一区二区影院| 丁香婷婷综合五月| 亚洲精品视频自拍| 91精品国产91综合久久蜜臀| 精品一区二区免费| 国产精品毛片久久久久久久| 91在线一区二区三区| 性久久久久久久久| 亚洲精品中文在线影院| 欧美日韩国产欧美日美国产精品| 日韩精品亚洲一区二区三区免费| www亚洲一区| aaa亚洲精品| 日本人妖一区二区| 国产精品激情偷乱一区二区∴| 在线视频你懂得一区| 麻豆成人综合网| 成人免费一区二区三区视频| 在线播放中文一区| 成人综合婷婷国产精品久久免费| 亚洲激情欧美激情| 26uuu精品一区二区三区四区在线| 不卡一区二区三区四区| 爽好多水快深点欧美视频| 久久精品欧美一区二区三区不卡| 欧美午夜影院一区| 国产凹凸在线观看一区二区| 亚洲一区免费观看| 久久精品亚洲精品国产欧美kt∨| 欧美最新大片在线看| 国产麻豆午夜三级精品| 一区二区三区国产豹纹内裤在线| 久久一区二区三区国产精品| 日本韩国精品一区二区在线观看| 久久se精品一区二区| 亚洲一区二区视频在线观看| 久久久久亚洲蜜桃| 777精品伊人久久久久大香线蕉| 成人精品视频.| 久久激情综合网| 亚洲一区二区三区四区在线观看| 国产日产亚洲精品系列| 91精品国产综合久久精品图片| 99re亚洲国产精品| 国产成人综合在线播放| 日韩极品在线观看| 一区二区三区在线不卡| 国产日产欧美一区二区视频| 日韩女同互慰一区二区| 欧美中文字幕亚洲一区二区va在线| 国产99久久久国产精品免费看| 久久er99热精品一区二区| 亚洲va韩国va欧美va精品 | 高清视频一区二区| 日本亚洲电影天堂| 香蕉乱码成人久久天堂爱免费| 日韩理论片网站| 中文字幕一区二区三区四区不卡| 久久影院午夜论| 精品国产在天天线2019| 日韩一区二区精品在线观看| 欧美精品日韩综合在线| 欧美色偷偷大香| 欧美色图免费看| 欧美日韩中字一区| 91丨九色丨黑人外教| 成人动漫一区二区| gogogo免费视频观看亚洲一| 成人国产精品免费观看视频| 国产99精品视频| av亚洲精华国产精华精华| 丁香激情综合国产|