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

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

?? d12.c

?? C51 USB1.1開發源碼及相關開發工具和文檔
?? C
?? 第 1 頁 / 共 4 頁
字號:
        // 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 = D12_SelectInterface(DeviceObject,
            configurationDescriptor, NULL);

        ExFreePool(configurationDescriptor);

    }



    D12_KdPrint (("D12TEST.SYS: exit D12_ConfigureDevice (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
D12_SelectInterface(
    IN PDEVICE_OBJECT DeviceObject,
    IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
    PUSBD_INTERFACE_INFORMATION Interface
    )
/*++

Routine Description:

    Initializes an 82930 with multiple interfaces

Arguments:

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

    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;
    UCHAR alternateSetting, interfaceNumber;
    PUSB_INTERFACE_DESCRIPTOR interfaceDescriptor = NULL;
    USHORT siz;

    D12_KdPrint (("D12TEST.SYS: enter D12_SelectInterface\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    if (Interface == NULL) {

        //
        // D12 driver only supports one interface, we must search
        // the configuration descriptor for the interface we want
        // and remember the pipes.
        //

        urb = USBD_CreateConfigurationRequest(ConfigurationDescriptor, &siz);

        if (urb) {

            //
            // search thru all the interfaces
            // and find any we are interested in
            //

            interfaceNumber = 0;
            alternateSetting = 0;
//            alternateSetting = 3;

            interfaceDescriptor =
                USBD_ParseConfigurationDescriptor(ConfigurationDescriptor,
                                                  interfaceNumber,
                                                  alternateSetting);

            Interface = &urb->UrbSelectConfiguration.Interface;
            
            for (i=0; i< Interface->NumberOfPipes; i++) {
                //
                // perform any pipe initialization here
                //
                Interface->Pipes[i].MaximumTransferSize = 64*1024-1;
            }

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

//            Interface->AlternateSetting = 3;
            
            ntStatus = D12_CallUSBD(DeviceObject, urb);

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

        } else {
            ntStatus = STATUS_INSUFFICIENT_RESOURCES;
        }

    } else {
        //
        // we were give an interface already set up
        //
        // do a selectinterface here if we want to change any of the
        // pipe parameters.
        //

        TRAP();

    }

    ASSERT(Interface != NULL);

    if (NT_SUCCESS(ntStatus)) {

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

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

        deviceExtension->Interface = ExAllocatePool(NonPagedPool,
                                                    Interface->Length);

        if (deviceExtension->Interface) {
            ULONG j;

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

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

            // Dump the pipe info

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

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

                D12_KdPrint (("D12TEST.SYS: ---------\n"));
                D12_KdPrint (("D12TEST.SYS: PipeType 0x%x\n", pipeInformation->PipeType));
                D12_KdPrint (("D12TEST.SYS: EndpointAddress 0x%x\n", pipeInformation->EndpointAddress));
                D12_KdPrint (("D12TEST.SYS: MaxPacketSize 0x%x\n", pipeInformation->MaximumPacketSize));
                D12_KdPrint (("D12TEST.SYS: Interval 0x%x\n", pipeInformation->Interval));
                D12_KdPrint (("D12TEST.SYS: Handle 0x%x\n", pipeInformation->PipeHandle));
                D12_KdPrint (("D12TEST.SYS: MaximumTransferSize 0x%x\n", pipeInformation->MaximumTransferSize));
            }

            D12_KdPrint (("D12TEST.SYS: ---------\n"));
        }
    }

    if (urb) {
        ExFreePool(urb);
        urb = NULL;
    }

    // Retrieve the selected Configuration and Interface setting from the
    // device.  (The only purpose of doing this here is to exercise the
    // URB_FUNCTION_GET_CONFIGURATION and URB_FUNCTION_GET_INTERFACE
    // requests).
    //
    if (NT_SUCCESS(ntStatus)) {

        urb = ExAllocatePool(
                  NonPagedPool,
                  sizeof(struct _URB_CONTROL_GET_CONFIGURATION_REQUEST) + 1);

        if (urb)
        {
            PUCHAR configuration;

            configuration = (PUCHAR)urb + sizeof(struct _URB_CONTROL_GET_CONFIGURATION_REQUEST);
            *configuration = 0xFF;

            urb->UrbHeader.Function = URB_FUNCTION_GET_CONFIGURATION;
            urb->UrbHeader.Length = sizeof(struct _URB_CONTROL_GET_CONFIGURATION_REQUEST);
            urb->UrbControlGetConfigurationRequest.TransferBufferLength = 1;
            urb->UrbControlGetConfigurationRequest.TransferBuffer = configuration;
            urb->UrbControlGetConfigurationRequest.TransferBufferMDL = NULL;
            urb->UrbControlGetConfigurationRequest.UrbLink = NULL;

            ntStatus = D12_CallUSBD(DeviceObject, urb);

            D12_KdPrint (("D12TEST.SYS: Configuration %d (%x)\n",
                             *configuration, ntStatus));

            ExFreePool(urb);
            urb = NULL;
        }

        urb = ExAllocatePool(
                  NonPagedPool,
                  sizeof(struct _URB_CONTROL_GET_INTERFACE_REQUEST) + 1);

        if (urb)
        {
            PUCHAR interface;

            interface = (PUCHAR)urb + sizeof(struct _URB_CONTROL_GET_INTERFACE_REQUEST);
            *interface = 0xFF;

            urb->UrbHeader.Function = URB_FUNCTION_GET_INTERFACE;
            urb->UrbHeader.Length = sizeof(struct _URB_CONTROL_GET_INTERFACE_REQUEST);
            urb->UrbControlGetInterfaceRequest.TransferBufferLength = 1;
            urb->UrbControlGetInterfaceRequest.TransferBuffer = interface;
            urb->UrbControlGetInterfaceRequest.TransferBufferMDL = NULL;
            urb->UrbControlGetInterfaceRequest.UrbLink = NULL;
            urb->UrbControlGetInterfaceRequest.Interface =
                deviceExtension->Interface->InterfaceNumber;

            ntStatus = D12_CallUSBD(DeviceObject, urb);

            D12_KdPrint (("D12TEST.SYS: Interface %d (%x)\n",
                             *interface, ntStatus));

            ExFreePool(urb);
            urb = NULL;
        }
    }

    D12_KdPrint (("D12TEST.SYS: exit D12_SelectInterface (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
D12_BuildPipeList(
    IN  PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

Arguments:

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


Return Value:

    NT status code

--*/
{
    PDEVICE_EXTENSION deviceExtension;
    ULONG i;
    WCHAR Name[] = L"\\PIPE00";
    PUSBD_INTERFACE_INFORMATION interface;

    deviceExtension = DeviceObject->DeviceExtension;
    interface = deviceExtension->Interface;

    D12_KdPrint (("D12TEST.SYS: enter D12_BuildPipeList\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    for (i=0; i<D12_MAX_PIPES; i++) {

        Name[6] = 'X';
        RtlCopyMemory(deviceExtension->PipeList[i].Name,
                      Name,
                      sizeof(Name));

    }

    //
    // build a list of pipe names based on the interface
    //

    for (i=0; i<interface->NumberOfPipes; i++) {

        Name[6] = '0' + (USHORT) i;
        RtlCopyMemory(deviceExtension->PipeList[i].Name,
                      Name,
                      sizeof(Name));

        deviceExtension->PipeList[i].PipeInfo =
            &interface->Pipes[i];

        deviceExtension->PipeList[i].Opened = FALSE;
    }

    return STATUS_SUCCESS;
}


NTSTATUS
D12_ResetPipe(
    IN PDEVICE_OBJECT DeviceObject,
    IN PD12_PIPE 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;

    D12_KdPrint (("D12TEST.SYS: 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->PipeInfo->PipeHandle;

        ntStatus = D12_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->PipeInfo->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->PipeInfo->EndpointAddress,
                                   NULL);

            ntStatus = D12_CallUSBD(DeviceObject, urb);

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

    return ntStatus;
}


LONG
D12_DecrementIoCount(
    IN PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

Arguments:

Return Value:


--*/
{
    PDEVICE_EXTENSION deviceExtension;
    LONG ioCount;

    deviceExtension = DeviceObject->DeviceExtension;

    ioCount = InterlockedDecrement(&deviceExtension->PendingIoCount);

    D12_KdPrint (("D12TEST.SYS: Pending io count = %x\n", ioCount));

    if (ioCount==0) {
        KeSetEvent(&deviceExtension->RemoveEvent,
                   1,
                   FALSE);
    }

    return ioCount;
}


VOID
D12_IncrementIoCount(
    IN PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

Arguments:

Return Value:


--*/
{
    PDEVICE_EXTENSION deviceExtension;

    deviceExtension = DeviceObject->DeviceExtension;

    InterlockedIncrement(&deviceExtension->PendingIoCount);
}


NTSTATUS
D12_ReconfigureDevice(
    IN  PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

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

Arguments:

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


Return Value:

    NT status code

--*/
{
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PUSBD_INTERFACE_INFORMATION interface;
    ULONG i;

    D12_KdPrint (("D12TEST.SYS: enter D12_ReconfigureDevice\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    if (NT_SUCCESS(ntStatus)) {
        ntStatus = D12_ConfigureDevice(DeviceObject);
    }

    //
    // new interface structure is now set up
    //

    interface = deviceExtension->Interface;

    //
    // set up the pipe handles again
    //

    for (i=0; i<interface->NumberOfPipes; i++) {

        D12_KdPrint (("D12TEST.SYS: pipe list = %x\n", &deviceExtension->PipeList[i]));

        deviceExtension->PipeList[i].PipeInfo =
            &interface->Pipes[i];

        //deviceExtension->PipeList[i].Opened = FALSE;
    }

    return ntStatus;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久99精品国产片| 国产精品女同一区二区三区| 国产精品夜夜嗨| 麻豆专区一区二区三区四区五区| 一区二区三区四区视频精品免费 | 亚洲人亚洲人成电影网站色| 精品国精品自拍自在线| 久久精品国产澳门| www.色综合.com| 国产拍揄自揄精品视频麻豆| 日韩午夜在线观看视频| 欧美一卡二卡在线| 日韩欧美在线影院| 久久婷婷久久一区二区三区| 日韩美一区二区三区| 91精品国产91久久综合桃花 | 亚洲图片欧美一区| 一区二区三区在线视频免费观看| 一区二区三区四区激情| 五月天婷婷综合| 精品无人码麻豆乱码1区2区| 国产精品18久久久久久久网站| 成人小视频免费在线观看| av中文一区二区三区| 欧美午夜在线一二页| 日韩美女视频一区二区在线观看| 久久久99精品免费观看不卡| 亚洲视频一区在线| 天天操天天干天天综合网| 蜜臀a∨国产成人精品| 国产成人综合在线观看| 色婷婷一区二区| 日韩精品资源二区在线| 国产精品久久久久一区二区三区| 亚洲另类一区二区| 美女视频黄免费的久久| 91在线视频官网| 91精品中文字幕一区二区三区| 久久亚洲综合色| 一区二区三区在线影院| 国产在线日韩欧美| 在线亚洲一区观看| 久久久综合视频| 亚洲国产日韩一级| 懂色av一区二区三区蜜臀| 欧美人体做爰大胆视频| 国产精品五月天| 视频一区视频二区中文| 成人av手机在线观看| 日韩欧美一区二区视频| 亚洲午夜av在线| 成人激情av网| 久久新电视剧免费观看| 日韩avvvv在线播放| 日本高清不卡一区| 久久久久国色av免费看影院| 午夜欧美大尺度福利影院在线看| 不卡的av电影在线观看| 精品日韩在线观看| 日韩电影网1区2区| 欧美日韩在线直播| 一区二区三区在线不卡| 不卡av免费在线观看| 国产亲近乱来精品视频| 精品无人区卡一卡二卡三乱码免费卡 | 国产精品美女www爽爽爽| 奇米影视在线99精品| 欧亚一区二区三区| 欧美视频一区二区三区四区| 美女脱光内衣内裤视频久久网站| ㊣最新国产の精品bt伙计久久| 中文字幕一区二区三| 国产传媒久久文化传媒| 久久综合国产精品| 国内精品久久久久影院薰衣草 | 麻豆精品国产传媒mv男同| 在线看国产一区二区| 久久久九九九九| 91麻豆精品国产91| 国产网站一区二区| 国产精品国产精品国产专区不片| 国内精品伊人久久久久影院对白| 欧美一区二区三区影视| 天天av天天翘天天综合网| 不卡在线观看av| 成人激情小说网站| 中文字幕亚洲一区二区av在线| 国产成人三级在线观看| 国产精品免费人成网站| www.欧美精品一二区| 中文字幕字幕中文在线中不卡视频| 成人性视频网站| 一区视频在线播放| 欧美日韩日日夜夜| 久草这里只有精品视频| 久久久午夜精品| 99久久精品99国产精品 | 大陆成人av片| 中文字幕欧美一| 欧美日韩亚洲高清一区二区| 日本sm残虐另类| 久久久久久综合| 91视频.com| 日本一道高清亚洲日美韩| 久久久美女毛片| 色婷婷综合激情| 经典三级视频一区| 亚洲视频在线一区| 欧美电视剧在线看免费| 波多野结衣在线一区| 亚洲国产精品久久久男人的天堂| 日韩欧美成人一区| 91在线看国产| 蜜臀av在线播放一区二区三区| 久久久精品人体av艺术| 欧美性感一类影片在线播放| 久久精品国产一区二区三区免费看 | 中文字幕一区二区三区在线不卡| 在线看国产一区二区| 国内精品国产成人国产三级粉色 | 色综合视频一区二区三区高清| 五月天国产精品| 国产精品美女一区二区| 欧美一区二区高清| 色94色欧美sute亚洲13| 国产欧美一区二区三区鸳鸯浴| 在线成人免费观看| 午夜国产精品一区| 欧美成人一区二区三区| 亚洲影院理伦片| 国产aⅴ综合色| 亚洲va欧美va人人爽| 国产精品入口麻豆九色| 欧美一区二区日韩一区二区| www.日韩精品| 国产精品综合一区二区| 水蜜桃久久夜色精品一区的特点| 日本一区二区电影| 久久亚洲免费视频| 欧美一区二区三区公司| 在线观看免费视频综合| av动漫一区二区| 国产suv一区二区三区88区| 免费高清不卡av| 日本美女一区二区| 亚洲成人高清在线| 一卡二卡欧美日韩| 亚洲欧美激情插| 日韩视频免费观看高清完整版 | 国产乱码一区二区三区| 日日骚欧美日韩| 亚洲一区二区三区四区中文字幕| 日本一区二区三区dvd视频在线| 日韩视频一区二区三区| 91精品欧美综合在线观看最新| 欧美色图一区二区三区| 欧美午夜精品理论片a级按摩| 一本在线高清不卡dvd| av不卡在线观看| 99久久99久久精品免费看蜜桃| av在线不卡网| 色综合色狠狠综合色| 欧美性做爰猛烈叫床潮| 欧美亚洲动漫精品| 欧美福利一区二区| 欧美成人乱码一区二区三区| 精品第一国产综合精品aⅴ| 欧美精品一区二区久久婷婷| 精品对白一区国产伦| 中文字幕精品一区二区三区精品| 久久久高清一区二区三区| 国产蜜臀av在线一区二区三区| 欧美高清一级片在线观看| 国产精品久久久久aaaa| 亚洲欧美一区二区不卡| 亚洲va在线va天堂| 久久国产生活片100| 豆国产96在线|亚洲| 色综合久久久久综合体| 欧美日韩国产免费一区二区 | 亚洲午夜在线视频| 强制捆绑调教一区二区| 国产精品亚洲一区二区三区在线| 成人中文字幕电影| 欧美三级乱人伦电影| 精品噜噜噜噜久久久久久久久试看 | 色婷婷综合久久久中文字幕| 欧美私人免费视频| 精品三级在线观看| 《视频一区视频二区| 亚洲福利国产精品| 国产一区二区三区免费观看| 色av综合在线| 日韩精品一区二区三区老鸭窝| 国产精品久久久久影院老司| 亚洲成人av一区二区| 成人一区二区在线观看| 欧美丰满一区二区免费视频| 国产精品麻豆一区二区| 婷婷综合另类小说色区|