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

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

?? liubo2004666_ezusbsys.c

?? EZ-USB 通用驅動程序源碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
   } // if ntStatus is PENDING

   goto Ezusb_Dispatch_Done;
            
Ezusb_Dispatch_Done:

   Ezusb_KdPrint (("Exit Ezusb_DispatchPower %x\n", ntStatus));
   return ntStatus;

}//Ezusb_DispatchPower


VOID
Ezusb_Unload(
    IN PDRIVER_OBJECT DriverObject
    )
/*++
Routine Description:
    Free all the allocated resources, etc.
    TODO: This is a placeholder for driver writer to add code on unload

Arguments:
    DriverObject - pointer to a driver object

Return Value:
    None
--*/
{
    Ezusb_KdPrint (("enter Ezusb_Unload\n"));
    /*
    // TODO: Free any global resources allocated in DriverEntry
    */
    Ezusb_KdPrint (("exit Ezusb_Unload\n"));
}

NTSTATUS
Ezusb_HandleRemoveDevice(
   IN PDEVICE_OBJECT fdo,
   IN PIRP Irp
   )
{
   NTSTATUS ntStatus;
   PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
   ULONG i;

   // set the removing flag to prevent any new I/O's
   pdx->removing = TRUE;

   // brute force - send an abort pipe message to all pipes to cancel any
   // pending transfers.  this should solve the problem of the driver blocking
   // on a REMOVE message because there is a pending transfer.
   for (i = 0; i < pdx->Interface->NumberOfPipes; i++)
   {
      Ezusb_AbortPipe(fdo,(USBD_PIPE_HANDLE) pdx->Interface->Pipes[i].PipeHandle);
   }

   UnlockDevice(fdo);			// once for LockDevice at start of dispatch
   UnlockDevice(fdo);			// once for initialization during AddDevice
   KeWaitForSingleObject(&pdx->evRemove, Executive, KernelMode, FALSE, NULL);

	Ezusb_RemoveDevice(fdo);

   ntStatus = Ezusb_DefaultPnpHandler(fdo, Irp);

   return ntStatus;				// lower-level completed IoStatus already

}


NTSTATUS
Ezusb_HandleStartDevice(
   IN PDEVICE_OBJECT fdo,
   IN PIRP Irp
   )
{
   NTSTATUS ntStatus;

   //
   // First let all lower-level drivers handle this request.
   //
   ntStatus = ForwardAndWait(fdo, Irp);
	if (!NT_SUCCESS(ntStatus))
		return CompleteRequest(Irp, ntStatus, Irp->IoStatus.Information);

   //
   // now do whatever we need to do to start the device
   //
   ntStatus = Ezusb_StartDevice(fdo);

	return CompleteRequest(Irp, ntStatus, 0);
}

NTSTATUS
Ezusb_StartDevice(
    IN  PDEVICE_OBJECT fdo
    )
/*++

Routine Description:
   Initializes a given instance of the Ezusb Device on the USB.

   Arguments:
      fdo - pointer to the device object for this instance of a
                      Ezusb Device

Return Value:
   NT status code
--*/
{
    PDEVICE_EXTENSION pdx;
    NTSTATUS ntStatus;
    PUSB_DEVICE_DESCRIPTOR deviceDescriptor = NULL;
    PURB urb;
    ULONG siz;

    Ezusb_KdPrint (("enter Ezusb_StartDevice\n"));

    pdx = fdo->DeviceExtension;
    pdx->NeedCleanup = TRUE;

    /*
    // Get some memory from then non paged pool (fixed, locked system memory)
    // for use by the USB Request Block (urb) for the specific USB Request we
    // will be performing below (a USB device request).
    */
    urb = ExAllocatePool( NonPagedPool,
                          sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST));

    if (urb) {

        siz = sizeof(USB_DEVICE_DESCRIPTOR);

        // Get some non paged memory for the device descriptor contents
        deviceDescriptor = ExAllocatePool(NonPagedPool,
                                          siz);

        if (deviceDescriptor) {

            // Use a macro in the standard USB header files to build the URB
            UsbBuildGetDescriptorRequest(urb,
                                         (USHORT) sizeof (struct _URB_CONTROL_DESCRIPTOR_REQUEST),
                                         USB_DEVICE_DESCRIPTOR_TYPE,
                                         0,
                                         0,
                                         deviceDescriptor,
                                         NULL,
                                         siz,
                                         NULL);

            // Get the device descriptor
            ntStatus = Ezusb_CallUSBD(fdo, urb);

            // Dump out the descriptor info to the debugger
            if (NT_SUCCESS(ntStatus)) {
                Ezusb_KdPrint (("Device Descriptor = %x, len %x\n",
                                deviceDescriptor,
                                urb->UrbControlDescriptorRequest.TransferBufferLength));

                Ezusb_KdPrint (("Ezusb Device Descriptor:\n"));
                Ezusb_KdPrint (("-------------------------\n"));
                Ezusb_KdPrint (("bLength %d\n", deviceDescriptor->bLength));
                Ezusb_KdPrint (("bDescriptorType 0x%x\n", deviceDescriptor->bDescriptorType));
                Ezusb_KdPrint (("bcdUSB 0x%x\n", deviceDescriptor->bcdUSB));
                Ezusb_KdPrint (("bDeviceClass 0x%x\n", deviceDescriptor->bDeviceClass));
                Ezusb_KdPrint (("bDeviceSubClass 0x%x\n", deviceDescriptor->bDeviceSubClass));
                Ezusb_KdPrint (("bDeviceProtocol 0x%x\n", deviceDescriptor->bDeviceProtocol));
                Ezusb_KdPrint (("bMaxPacketSize0 0x%x\n", deviceDescriptor->bMaxPacketSize0));
                Ezusb_KdPrint (("idVendor 0x%x\n", deviceDescriptor->idVendor));
                Ezusb_KdPrint (("idProduct 0x%x\n", deviceDescriptor->idProduct));
                Ezusb_KdPrint (("bcdDevice 0x%x\n", deviceDescriptor->bcdDevice));
                Ezusb_KdPrint (("iManufacturer 0x%x\n", deviceDescriptor->iManufacturer));
                Ezusb_KdPrint (("iProduct 0x%x\n", deviceDescriptor->iProduct));
                Ezusb_KdPrint (("iSerialNumber 0x%x\n", deviceDescriptor->iSerialNumber));
                Ezusb_KdPrint (("bNumConfigurations 0x%x\n", deviceDescriptor->bNumConfigurations));
            }
        } else {
            ntStatus = STATUS_NO_MEMORY;
        }

        if (NT_SUCCESS(ntStatus)) {
            /*
            // Put a ptr to the device descriptor in the device extension for easy
            // access (like a "cached" copy).  We will free this memory when the
            // device is removed.  See the "Ezusb_RemoveDevice" code.
            */
            pdx->DeviceDescriptor = deviceDescriptor;
            pdx->Stopped = FALSE;
        } else if (deviceDescriptor) {
            /*
            // If the bus transaction failed, then free up the memory created to hold
            // the device descriptor, since the device is probably non-functional
            */
            ExFreePool(deviceDescriptor);
            pdx->DeviceDescriptor = NULL;
        }

        ExFreePool(urb);

    } else {
        // Failed getting memory for the Urb 
        ntStatus = STATUS_NO_MEMORY;
    }

    // If the Get_Descriptor call was successful, then configure the device.
    if (NT_SUCCESS(ntStatus)) {
        ntStatus = Ezusb_ConfigureDevice(fdo);
    }

#ifdef DOWNLOAD_KEIL_MONITOR
   //
   // download the Keil monitor
   //

   //
   // First download loader firmware.  The loader firmware implements a vendor
   // specific command that will allow us to anchor load to external ram
   //
   Ezusb_8051Reset(fdo,1);
   Ezusb_DownloadIntelHex(fdo,loader);
   Ezusb_8051Reset(fdo,0);

   //
   // Now download the Keil Monitor
   //
   if (IsFx2(fdo))
   {
      Ezusb_KdPrint (("**** Downloading FX2 monitor\n"));
      Ezusb_DownloadIntelHex(fdo,mon_ext_sio1_fx2);
   }
   else
   {
      Ezusb_KdPrint (("**** Downloading EZ-USB monitor\n"));
      Ezusb_DownloadIntelHex(fdo,mon_ext_sio1_ezusb);
   }

   Ezusb_8051Reset(fdo,1);
   Ezusb_8051Reset(fdo,0);

#endif // if DOWNLOAD_KEIL_MONITOR

    Ezusb_KdPrint (("exit Ezusb_StartDevice (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
Ezusb_RemoveDevice(
    IN  PDEVICE_OBJECT fdo
    )
/*++

Routine Description:
    Removes a given instance of a Ezusb Device device on the USB.

Arguments:
    fdo - pointer to the device object for this instance of a Ezusb Device

Return Value:
    NT status code

--*/
{
   PDEVICE_EXTENSION pdx;
   NTSTATUS ntStatus = STATUS_SUCCESS;

   Ezusb_KdPrint (("enter Ezusb_RemoveDevice\n"));

   pdx = fdo->DeviceExtension;

   if (pdx->DeviceDescriptor)
   {
      ExFreePool(pdx->DeviceDescriptor);
   }

   //
   // Free up any interface structures in our device extension
   //
   if (pdx->Interface != NULL)
   {
      ExFreePool(pdx->Interface);
   }

   //
   // remove the device object's symbolic link
   //
   if (pdx->NeedCleanup)
   {
      UNICODE_STRING deviceLinkUnicodeString;

      pdx->NeedCleanup = FALSE;

      RtlInitUnicodeString (&deviceLinkUnicodeString,
                           pdx->DeviceLinkNameBuffer);

      IoDeleteSymbolicLink(&deviceLinkUnicodeString);
    }

   IoDetachDevice(pdx->StackDeviceObject);

   IoDeleteDevice (fdo);

   Ezusb_KdPrint (("exit Ezusb_RemoveDevice (%x)\n", ntStatus));

   return ntStatus;
}


NTSTATUS
Ezusb_StopDevice(
   IN  PDEVICE_OBJECT fdo
   )
/*++
Routine Description:
   Stops a given instance of a Ezusb Device device on USB.

Arguments:
   fdo - pointer to the device object for this instance of a Ezusb Device

Return Value:
   NT status code

  --*/
{
   PDEVICE_EXTENSION pdx;
   NTSTATUS ntStatus = STATUS_SUCCESS;
   PURB urb;
   ULONG siz;

   Ezusb_KdPrint (("enter Ezusb_StopDevice\n"));

   pdx = fdo->DeviceExtension;

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

   if (urb)
   {
      NTSTATUS status;

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

      status = Ezusb_CallUSBD(fdo, urb);

      Ezusb_KdPrint (("Device Configuration Closed status = %x usb status = %x.\n",
                     status, urb->UrbHeader.Status));

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

   Ezusb_KdPrint (("exit Ezusb_StopDevice (%x)\n", ntStatus));

   return ntStatus;
}

NTSTATUS
Ezusb_PnPAddDevice(
    IN PDRIVER_OBJECT DriverObject,
    IN PDEVICE_OBJECT PhysicalDeviceObject
    )
/*++
Routine Description:
    This routine is called to create a new instance of the device

Arguments:
    DriverObject - pointer to the driver object for this instance of Ezusb
    PhysicalDeviceObject - pointer to a device object created by the bus

Return Value:
    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
   NTSTATUS                ntStatus = STATUS_SUCCESS;
   PDEVICE_OBJECT          deviceObject = NULL;
   PDEVICE_EXTENSION       pdx;
   int instance;

   Ezusb_KdPrint(("enter Ezusb_PnPAddDevice\n"));

#define MAX_EZUSB_DEVICES 8

   //
   // create our functional device object (FDO).  This driver supports multiple ezusb devices.
   // This loop will look for an available instance number.  Keep incrementing the instance
   // until a call to Ezusb_CreateDeviceObject succeeds.
   //
   instance = 0;
   do

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产91富婆露脸刺激对白| 色香蕉成人二区免费| 综合久久一区二区三区| 91精品国产乱码| 日本道精品一区二区三区| 经典三级在线一区| 一区二区三区四区亚洲| 久久久久久久综合色一本| 色欧美88888久久久久久影院| 国产真实乱子伦精品视频| 亚洲国产毛片aaaaa无费看| 欧美国产日韩在线观看| 日韩欧美国产精品一区| 欧美三级电影在线看| 色综合久久综合网欧美综合网| 国产精品996| 九九国产精品视频| 免费一区二区视频| 婷婷中文字幕综合| 亚洲一区二区三区不卡国产欧美| 国产亚洲成aⅴ人片在线观看| 欧美一区二区三区在线观看| 精品视频一区二区不卡| 99国产欧美久久久精品| 国产不卡免费视频| 国产一区二区三区四| 日韩黄色免费电影| 日韩综合一区二区| 午夜久久久久久| 午夜成人免费电影| 首页国产丝袜综合| 天堂蜜桃91精品| 日本vs亚洲vs韩国一区三区二区 | 蜜臀av亚洲一区中文字幕| 亚洲综合网站在线观看| 一区二区三区欧美日| 一区二区三区成人在线视频| 亚洲精品国产成人久久av盗摄| 亚洲免费观看高清完整版在线观看熊| 欧美国产精品一区| 中文字幕一区二区5566日韩| 1024成人网| 亚洲综合男人的天堂| 亚洲国产精品久久不卡毛片 | 中文在线免费一区三区高中清不卡| 精品日韩欧美一区二区| 久久久不卡网国产精品二区| 久久久久久久久久久久电影| 久久久久久久av麻豆果冻| 国产精品美女久久久久久久久久久 | 国产不卡高清在线观看视频| 国产成人啪免费观看软件 | 日韩美女在线视频| 欧美一级日韩一级| 亚洲精品在线一区二区| 国产精品五月天| 亚洲精品视频一区二区| 午夜电影一区二区| 国模套图日韩精品一区二区| 粗大黑人巨茎大战欧美成人| 99精品国产一区二区三区不卡| 色88888久久久久久影院野外| 欧美乱妇15p| 久久综合九色综合久久久精品综合| 国产亚洲综合在线| 一区二区三区日韩欧美| 久久精品免费观看| 成人av片在线观看| 欧美另类一区二区三区| 国产午夜精品福利| 伊人色综合久久天天| 全国精品久久少妇| 风间由美一区二区av101| 色综合天天综合狠狠| 欧美女孩性生活视频| 国产午夜精品理论片a级大结局 | 伦理电影国产精品| 99久久99久久综合| 91精品国产综合久久国产大片| 欧美极品xxx| 日韩成人午夜精品| 成人晚上爱看视频| 正在播放一区二区| 国产精品久久一卡二卡| 人人狠狠综合久久亚洲| 91亚洲精华国产精华精华液| 91麻豆精品国产91久久久 | 不卡欧美aaaaa| 日韩午夜精品视频| 亚洲另类中文字| 精彩视频一区二区| 欧美猛男gaygay网站| 国产精品久久久一本精品| 日韩激情在线观看| 91免费看视频| 久久品道一品道久久精品| 一二三四区精品视频| 国产精品12区| 日韩亚洲欧美综合| 亚洲丝袜另类动漫二区| 久久丁香综合五月国产三级网站| 一本色道久久加勒比精品| 国产欧美精品一区二区色综合 | 国产一区福利在线| 欧美日韩国产免费一区二区| 亚洲欧美在线另类| 国产精品18久久久久久vr| 日韩一区二区三区高清免费看看| 亚洲精品高清在线观看| 波多野结衣精品在线| 国产网站一区二区| 国产一区二区三区黄视频| 欧美一区二区成人6969| 亚洲国产精品自拍| 欧美性生活大片视频| 亚洲欧美日韩成人高清在线一区| 国产精品18久久久久久久久久久久| 8v天堂国产在线一区二区| 亚洲三级在线看| av电影天堂一区二区在线| 久久久亚洲欧洲日产国码αv| 秋霞午夜av一区二区三区| 欧美日韩你懂得| 亚洲国产日韩av| 欧美日韩情趣电影| 香蕉成人伊视频在线观看| 欧美色图免费看| 亚洲夂夂婷婷色拍ww47| 欧洲生活片亚洲生活在线观看| 亚洲欧美福利一区二区| 99久久er热在这里只有精品15| 中文字幕中文乱码欧美一区二区| 97se狠狠狠综合亚洲狠狠| 中文字幕一区二区三| 91免费观看视频| 亚洲小少妇裸体bbw| 欧美日韩一区在线观看| 亚洲成人自拍偷拍| 欧美一区二区三区视频免费播放| 日韩精品电影一区亚洲| 欧美一级电影网站| 韩国一区二区三区| 亚洲国产成人私人影院tom| 成人av电影在线网| 亚洲精品日韩一| 欧美色爱综合网| 久久成人麻豆午夜电影| 久久色在线视频| 国产91丝袜在线18| 亚洲欧美综合色| 欧美日韩成人综合天天影院| 日本在线不卡一区| 欧美videos大乳护士334| 国产成人在线免费观看| 日韩伦理电影网| 欧美欧美欧美欧美| 国产麻豆成人精品| 亚洲欧美乱综合| 欧美一区二区三区四区在线观看| 久久99在线观看| 日韩一区在线播放| 欧美视频第二页| 另类中文字幕网| 国产精品欧美一区喷水| 欧美日韩一区成人| 国产一区二区三区在线观看精品| 中文字幕在线免费不卡| 欧美午夜片在线看| 国产一区久久久| 亚洲自拍偷拍综合| 久久亚洲一级片| 日本精品视频一区二区| 理论片日本一区| 亚洲欧美国产高清| 精品国产91久久久久久久妲己| 粉嫩av一区二区三区粉嫩| 亚洲一区在线视频| 久久女同互慰一区二区三区| 色欧美88888久久久久久影院| 美女高潮久久久| 亚洲人成电影网站色mp4| 欧美一区二区三区四区高清| 成人av网站免费| 免费在线一区观看| 综合激情成人伊人| ww久久中文字幕| 欧美日韩午夜精品| 成人少妇影院yyyy| 免费人成网站在线观看欧美高清| 中文字幕一区二区视频| 日韩欧美综合在线| 欧美综合一区二区| 成人午夜激情在线| 蜜臀91精品一区二区三区| 亚洲欧美偷拍另类a∨色屁股| 亚洲精品一区二区三区在线观看 | 99re6这里只有精品视频在线观看| 日韩精品亚洲一区二区三区免费| 国产精品不卡视频| 国产欧美一区二区三区鸳鸯浴|