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

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

?? ezusbsys.c

?? EZ Usb system driver written in C.. a useful USB driver..
?? C
?? 第 1 頁 / 共 5 頁
字號:
   {
      Ezusb_KdPrint (("Power Irp came back, status = %x\n", ntStatus));
   } // 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.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线free| 不卡的av网站| 欧美精品久久99久久在免费线 | 成人免费黄色在线| 国产精品伦一区| 一本色道亚洲精品aⅴ| 偷偷要91色婷婷| www亚洲一区| 91丨porny丨首页| 亚洲二区在线观看| 精品国产污污免费网站入口| 国产美女视频91| 亚洲欧美日韩电影| 欧美一区二视频| 成人免费看片app下载| 亚洲一区二区高清| 精品国产一区二区三区忘忧草| 国产麻豆一精品一av一免费| 亚洲日本va午夜在线影院| 欧美日韩国产大片| 国产精品原创巨作av| 国产精品国产三级国产普通话蜜臀 | 久久久久九九视频| bt7086福利一区国产| 亚洲第一狼人社区| 国产日韩欧美麻豆| 欧美日韩和欧美的一区二区| 国产麻豆91精品| 亚洲一区二区影院| 日本一区二区综合亚洲| 欧美日韩视频第一区| 国产激情视频一区二区在线观看 | av在线播放不卡| 日韩精品一二区| 国产精品乱子久久久久| 欧美一区二区视频免费观看| 不卡一区二区中文字幕| 天堂精品中文字幕在线| 综合亚洲深深色噜噜狠狠网站| 欧美一级专区免费大片| 成人福利视频在线看| 日本不卡免费在线视频| 亚洲免费av在线| 久久久久久久久99精品| 欧美日韩黄色一区二区| 日本精品一区二区三区高清 | 欧美一级久久久| 日本久久精品电影| av爱爱亚洲一区| 国产成人综合亚洲网站| 另类小说综合欧美亚洲| 亚洲永久免费视频| 亚洲欧美电影院| 国产精品视频免费看| 26uuu精品一区二区| 欧美二区乱c少妇| 日本伦理一区二区| 99国产精品久久久久久久久久| 国产一区二区三区四区五区美女| 免费成人在线视频观看| 亚洲成av人影院在线观看网| 亚洲欧美日韩在线不卡| 综合久久久久久| 最近中文字幕一区二区三区| 国产精品麻豆网站| 最新热久久免费视频| 中文字幕国产一区| 国产精品国产三级国产三级人妇| 欧美经典一区二区| 国产精品三级久久久久三级| 欧美激情在线免费观看| 国产欧美综合色| 中文字幕的久久| 欧美国产成人精品| 日韩一区欧美小说| 一区二区三区四区亚洲| 一区av在线播放| 亚洲午夜电影网| 丝袜亚洲另类欧美综合| 日韩电影在线免费看| 美日韩一区二区三区| 久久成人久久爱| 国产精品影视网| 波多野结衣视频一区| 一本大道久久a久久精二百| 91精品1区2区| 欧美理论片在线| 日韩欧美高清在线| 久久久99精品免费观看不卡| 国产午夜久久久久| 日韩毛片视频在线看| 一区二区三区四区av| 日韩精品欧美精品| 精品亚洲成av人在线观看| 国产精品一区二区不卡| av亚洲精华国产精华| 欧美日韩一区二区三区四区五区| 9191精品国产综合久久久久久| 日韩欧美综合一区| 中文字幕av一区二区三区免费看| 亚洲色图视频网| 日韩中文字幕不卡| 国产福利视频一区二区三区| 91亚洲精品久久久蜜桃网站| 欧美色图片你懂的| 欧美大白屁股肥臀xxxxxx| 中文字幕精品三区| 亚洲国产成人av网| 国产黄色精品网站| 欧美色中文字幕| 欧美国产97人人爽人人喊| 亚洲成人av资源| 国产在线视频不卡二| 色综合久久中文综合久久牛| 日韩视频免费直播| 亚洲精品一二三| 麻豆91精品91久久久的内涵| 成人av在线播放网站| 4438亚洲最大| 综合av第一页| 国产制服丝袜一区| 欧美日韩电影在线播放| 中文字幕av一区 二区| 男男gaygay亚洲| 色悠悠久久综合| 久久精品视频在线看| 性做久久久久久免费观看欧美| 国产麻豆精品在线| 337p亚洲精品色噜噜噜| 亚洲人成人一区二区在线观看 | 夜夜嗨av一区二区三区四季av | 成人欧美一区二区三区| 日韩av电影免费观看高清完整版 | 日韩精彩视频在线观看| av亚洲精华国产精华精华| 日韩一级二级三级精品视频| 一区二区三区中文免费| 成人天堂资源www在线| 日韩一区二区影院| 午夜国产精品一区| 91色在线porny| 国产精品久久毛片| 国精产品一区一区三区mba桃花 | 91精品国产一区二区三区香蕉| 日韩理论片中文av| eeuss鲁片一区二区三区| 久久精品在线观看| 黄色日韩网站视频| 欧美成人国产一区二区| 日本vs亚洲vs韩国一区三区二区 | 91天堂素人约啪| 国产日韩亚洲欧美综合| 久久电影国产免费久久电影| 制服丝袜在线91| 亚洲午夜久久久久中文字幕久| 91老司机福利 在线| 亚洲视频一区在线观看| 波多野结衣中文字幕一区 | 婷婷综合另类小说色区| 91高清视频在线| 亚洲精品视频一区| 99国产精品国产精品久久| 国产精品二三区| 99精品视频一区二区三区| 国产精品国产三级国产有无不卡 | 欧美日韩亚洲高清一区二区| 亚洲最色的网站| 欧美午夜电影网| 午夜一区二区三区视频| 欧美日韩一区视频| 日本在线不卡视频一二三区| 日韩一区二区影院| 国产一区二区在线看| 久久精品一二三| 成人av中文字幕| 亚洲免费在线电影| 欧美日韩一级二级三级| 日本女人一区二区三区| 日韩精品一区二区三区视频播放 | 日韩黄色免费网站| 精品日韩欧美在线| 处破女av一区二区| 亚洲欧美国产77777| 在线不卡一区二区| 韩国毛片一区二区三区| 欧美高清在线视频| 欧美四级电影网| 狠狠色狠狠色综合| 国产精品久久久99| 欧洲亚洲精品在线| 看电影不卡的网站| 国产精品乱码久久久久久| 欧美最新大片在线看| 蜜桃av一区二区| 欧美激情一区二区三区| 欧美亚洲高清一区| 国产一区三区三区| 亚洲色图欧洲色图婷婷| 日韩欧美美女一区二区三区| 成人av网站免费观看|