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

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

?? ezloader.c

?? EZ_LOADER驅動程序源代碼(VC工程文件)
?? C
?? 第 1 頁 / 共 2 頁
字號:
//////////////////////////////////////////////////////////////////////
//
// File:      ezloader.c
// $Archive: /USB/Drivers/ezloader/ezloader.c $
//
// Purpose:
//    driver for downloading firmware to pre-renumerated ezusb devices.
//
// Note:
//    derived from ezusbsys.c ver 15

// Environment:
//    kernel mode
//
// $Author: Mdn $
//
// $History: ezloader.c $           
//  
//  *****************  Version 2  *****************
//  User: Mdn          Date: 7/19/01    Time: 10:32a
//  Updated in $/USB/Drivers/ezloader
//  added support for FX2 - specifically, modified the 8051 reset code so
//  it will work with both EZ-USB and FX2
//  
//  *****************  Version 1  *****************
//  User: Tpm          Date: 6/09/00    Time: 6:30p
//  Created in $/USB/Drivers/ezloader
//  
//  *****************  Version 7  *****************
//  User: Markm        Date: 4/12/99    Time: 1:17p
//  Updated in $/EzUsb/Drivers/ezloader
//  
//  *****************  Version 6  *****************
//  User: Markm        Date: 4/12/99    Time: 1:16p
//  Updated in $/EzUsb/Drivers/ezloader
//  
//  *****************  Version 5  *****************
//  User: Markm        Date: 4/12/99    Time: 1:00p
//  Updated in $/EzUsb/Drivers/ezloader
//  minor changes to get rid of compiler warnings.
//  
//  *****************  Version 4  *****************
//  User: Markm        Date: 3/26/99    Time: 2:59p
//  Updated in $/EzUsb/Drivers/ezloader
//  Fixed a bug in the surprise removal code I just added.  I was returning
//  from the PnP dispatch function without unlocking the device object.
//  
//  *****************  Version 3  *****************
//  User: Markm        Date: 3/25/99    Time: 2:05p
//  Updated in $/EzUsb/Drivers/ezloader
//  Added code to allow unplugs (surprise removal) under NT5 without
//  notifying the user.
//  
//  *****************  Version 2  *****************
//  User: Markm        Date: 4/10/98    Time: 2:06p
//  Updated in $/EZUSB/ezloader
//  modified to download intel hex records and to download the loader
//  firmware for downloading to external RAM
//  
//  *****************  Version 1  *****************
//  User: Markm        Date: 2/24/98    Time: 5:26p
//  Created in $/EZUSB/ezloader
//  
//  
// Copyright (c) 1997 Anchor Chips, Inc.  May not be reproduced without
// permission.  See the license agreement for more details.
//
//////////////////////////////////////////////////////////////////////

//
// Include files needed for WDM driver support
//
#include <wdm.h>
#include "stdarg.h"
#include "stdio.h"

//
// Include files needed for USB support
//
#include "usbdi.h"
#include "usbdlib.h"

//
// Include file for the Ezusb Device
//
#include "ezloader.h"

//
// this file contains an image of the device firmware
//
extern INTEL_HEX_RECORD firmware[];
extern INTEL_HEX_RECORD loader[];

NTSTATUS
DriverEntry(
    IN PDRIVER_OBJECT DriverObject,
    IN PUNICODE_STRING RegistryPath
    )
/*++

Routine Description:
   
Arguments:
   DriverObject - pointer to the driver object
   RegistryPath - pointer to a unicode string representing the path
                  to driver-specific key in the registry

Return Value:
   STATUS_SUCCESS if successful,
   STATUS_UNSUCCESSFUL otherwise

--*/
{
   NTSTATUS ntStatus = STATUS_SUCCESS;
   PDEVICE_OBJECT deviceObject = NULL;

   Ezusb_KdPrint (("entering (Ezusb) DriverEntry (Build: %s/%s\n",__DATE__,__TIME__));

   DriverObject->DriverUnload = Ezusb_Unload;

   //
   // POWER and PNP IRPs go to the same dispatch function.  Under
   // Win95, there is just a single IRP for both, called
   // IRP_MJ_PNP_POWER.  This is assigned the same value as
   // IRP_MJ_PNP has under Win98 and NT5.  I'm only concerned
   // with basic PNP stuff, like START and REMOVE.  All other
   // PNP and POWER IRPs will simply be passed down the driver
   // stack.  This driver won't be around like enough to worry
   // about POWER IRPs.  That is, as soon as code is downloaded
   // to the device, the device will remove itself and the driver
   // will go away.
   //
   DriverObject->MajorFunction[IRP_MJ_PNP] =
   DriverObject->MajorFunction[IRP_MJ_POWER] = Ezusb_DispatchPnp;

   DriverObject->DriverExtension->AddDevice = Ezusb_PnPAddDevice;

   Ezusb_KdPrint (("exiting (Ezusb) DriverEntry (%x)\n", ntStatus));

   return ntStatus;
}

NTSTATUS
Ezusb_DefaultPnpHandler(
   IN PDEVICE_OBJECT fdo,
   IN PIRP Irp
   )
{
   PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;

   IoSkipCurrentIrpStackLocation(Irp);
   return IoCallDriver(pdx->StackDeviceObject, Irp);
}

///////////////////////////////////////////////////////////////////////////////
// @func Handle completion of a request by a lower-level driver
// @parm Functional device object
// @parm I/O request which has completed
// @parm Context argument supplied to IoSetCompletionRoutine, namely address of
// KEVENT object on which ForwardAndWait is waiting
// @comm This is the completion routine used for requests forwarded by ForwardAndWait. It
// sets the event object and thereby awakens ForwardAndWait.
// @comm Note that it's *not* necessary for this particular completion routine to test
// the PendingReturned flag in the IRP and then call IoMarkIrpPending. You do that in many
// completion routines because the dispatch routine can't know soon enough that the
// lower layer has returned STATUS_PENDING. In our case, we're never going to pass a
// STATUS_PENDING back up the driver chain, so we don't need to worry about this.

NTSTATUS 
OnRequestComplete(
   IN PDEVICE_OBJECT fdo,
   IN PIRP Irp,
   IN PKEVENT pev
   )
/*++

Routine Description:
   Handle completion of a request by a lower-level driver

Arguments:
   DriverObject -  Functional device object
   Irp - I/O request which has completed
   pev - Context argument supplied to IoSetCompletionRoutine, namely address of
         KEVENT object on which ForwardAndWait is waiting

Return Value:
   STATUS_MORE_PROCESSING_REQUIRED
--*/
{
   KeSetEvent(pev, 0, FALSE);
   return STATUS_MORE_PROCESSING_REQUIRED;
}

NTSTATUS
ForwardAndWait(
   IN PDEVICE_OBJECT fdo,
   IN PIRP Irp
   )
/*++
Routine Description:
   Forward request to lower level and await completion

   The only purpose of this routine in this particular driver is to pass down
   IRP_MN_START_DEVICE requests and wait for the PDO to handle them.
   
   The processor must be at PASSIVE IRQL because this function initializes
   and waits for non-zero time on a kernel event object.

Arguments:
   fdo - pointer to a device object
   Irp          - pointer to an I/O Request Packet

Return Value:
   STATUS_SUCCESS if successful,
   STATUS_UNSUCCESSFUL otherwise
--*/
{
	KEVENT event;
	PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
	NTSTATUS ntStatus;

   ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);
	
	//
   // Initialize a kernel event object to use in waiting for the lower-level
	// driver to finish processing the object. 
   //
	KeInitializeEvent(&event, NotificationEvent, FALSE);

	IoCopyCurrentIrpStackLocationToNext(Irp);
	IoSetCompletionRoutine(Irp, (PIO_COMPLETION_ROUTINE) OnRequestComplete,
		(PVOID) &event, TRUE, TRUE, TRUE);

	ntStatus = IoCallDriver(pdx->StackDeviceObject, Irp);

	if (ntStatus == STATUS_PENDING)
	{
      KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
      ntStatus = Irp->IoStatus.Status;
   }

	return ntStatus;
}

NTSTATUS
CompleteRequest(
   IN PIRP Irp,
   IN NTSTATUS status,
   IN ULONG info
   )
/*++
Routine Description:
   Mark I/O request complete

Arguments:
   Irp - I/O request in question
   status - Standard status code
   info Additional information related to status code

Return Value:
   STATUS_SUCCESS if successful,
   STATUS_UNSUCCESSFUL otherwise
--*/
{
	Irp->IoStatus.Status = status;
	Irp->IoStatus.Information = info;
	IoCompleteRequest(Irp, IO_NO_INCREMENT);

   return status;
}

NTSTATUS
Ezusb_DispatchPnp(
   IN PDEVICE_OBJECT fdo,
   IN PIRP           Irp
   )
/*++
Routine Description:
   Process Plug and Play IRPs sent to this device.

Arguments:
   fdo - pointer to a device object
   Irp          - pointer to an I/O Request Packet

Return Value:
   NTSTATUS
--*/
{
   PIO_STACK_LOCATION irpStack;
   PDEVICE_EXTENSION pdx = fdo->DeviceExtension;
   ULONG fcn;
   NTSTATUS ntStatus;

   Ezusb_KdPrint (("Enter Ezusb_DispatchPnp\n"));

   if (!LockDevice(fdo))
		return CompleteRequest(Irp, STATUS_DELETE_PENDING, 0);

   //
   // Get a pointer to the current location in the Irp. This is where
   //     the function codes and parameters are located.
   //
   irpStack = IoGetCurrentIrpStackLocation (Irp);

   ASSERT(irpStack->MajorFunction == IRP_MJ_PNP);

   fcn = irpStack->MinorFunction;

   switch (fcn)
   {
      case IRP_MN_START_DEVICE:

         Ezusb_KdPrint (("IRP_MN_START_DEVICE\n"));

         ntStatus = Ezusb_HandleStartDevice(fdo,Irp);

         break; //IRP_MN_START_DEVICE

      case IRP_MN_REMOVE_DEVICE:

         Ezusb_KdPrint (("IRP_MN_REMOVE_DEVICE\n"))

         ntStatus = Ezusb_HandleRemoveDevice(fdo,Irp);

         break; //IRP_MN_REMOVE_DEVICE

      case IRP_MN_QUERY_CAPABILITIES:
      {
         //
         // This code swiped from Walter Oney.  Please buy his book!!
         //

      	PDEVICE_CAPABILITIES pdc = irpStack->Parameters.DeviceCapabilities.Capabilities;

         Ezusb_KdPrint (("IRP_MN_QUERY_CAPABILITIES\n"))

         // Check to besure we know how to handle this version of the capabilities structure

	      if (pdc->Version < 1)
         {
		      ntStatus = Ezusb_DefaultPnpHandler(fdo, Irp);
            break;
         }

         ntStatus = ForwardAndWait(fdo, Irp);
	      if (NT_SUCCESS(ntStatus))
   		{						// IRP succeeded
      		pdc = irpStack->Parameters.DeviceCapabilities.Capabilities;
            // setting this field prevents NT5 from notifying the user when the
            // device is removed.
		      pdc->SurpriseRemovalOK = TRUE;
   		}						// IRP succeeded

	      ntStatus = CompleteRequest(Irp, ntStatus, Irp->IoStatus.Information);
      }
         break; //IRP_MN_QUERY_CAPABILITIES


      //
      // All other PNP IRP's are just passed down the stack by the default handler
      //
      default:
        Ezusb_KdPrint (("Passing down unhandled PnP IOCTL MJ=0x%x MN=0x%x\n",
           irpStack->MajorFunction, irpStack->MinorFunction));
        ntStatus = Ezusb_DefaultPnpHandler(fdo, Irp);

   } // switch MinorFunction

	if (fcn != IRP_MN_REMOVE_DEVICE)
      UnlockDevice(fdo);

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

}//Ezusb_Dispatch


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;
	pdx->removing = TRUE;
	UnlockDevice(fdo);			// once for LockDevice at start of dispatch
	UnlockDevice(fdo);			// once for initialization during AddDevice
	KeWaitForSingleObject(&pdx->evRemove, Executive, KernelMode, FALSE, NULL);

	// Let lower-level drivers handle this request. Ignore whatever
	// result eventuates.

//   ntStatus = Ezusb_DefaultPnpHandler(fdo, Irp);

//   Ezusb_Cleanup(fdo);

   // Remove the device object

	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
--*/
{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩成人综合| 亚洲同性gay激情无套| 欧美韩国日本一区| 午夜精品久久久久久不卡8050| 免费在线观看精品| 欧美午夜精品久久久久久孕妇| 久久亚洲一区二区三区四区| 亚洲va韩国va欧美va| www..com久久爱| 精品美女一区二区三区| 亚洲第一激情av| 91麻豆成人久久精品二区三区| 久久综合九色综合欧美就去吻| 天天色综合成人网| 91美女片黄在线观看91美女| 久久精品人人做人人综合| 日本91福利区| 6080亚洲精品一区二区| 一区二区三区四区精品在线视频| 久久99精品久久久久久动态图| 欧美乱熟臀69xxxxxx| 中文字幕免费不卡在线| 精品一区二区av| 日韩网站在线看片你懂的| 天天影视涩香欲综合网| 欧美日韩中文精品| 亚洲香蕉伊在人在线观| 日本精品一级二级| 亚洲欧美精品午睡沙发| 国产成都精品91一区二区三| 久久久三级国产网站| 美女在线视频一区| 日韩欧美不卡在线观看视频| 蜜桃精品视频在线观看| 欧美高清精品3d| 视频一区欧美日韩| 欧美日韩二区三区| 日韩专区中文字幕一区二区| 欧美人伦禁忌dvd放荡欲情| 午夜伊人狠狠久久| 欧美一级在线免费| 久久91精品久久久久久秒播| 日韩一级欧美一级| 久久精品久久99精品久久| 日韩精品一区二区三区在线| 国内精品伊人久久久久av影院 | 亚洲va天堂va国产va久| 在线播放日韩导航| 久久99精品国产.久久久久久| 久久综合资源网| 成人高清视频在线| 一区二区三区电影在线播| 欧美老人xxxx18| 色激情天天射综合网| 国产视频在线观看一区二区三区| 国产精品1区2区3区在线观看| 国产精品天干天干在观线| 一本大道综合伊人精品热热 | 国产三级精品在线| 91麻豆精东视频| 三级欧美韩日大片在线看| 精品区一区二区| 不卡一区二区中文字幕| 亚洲高清中文字幕| 久久午夜老司机| 一本一道久久a久久精品 | 亚洲国产精品自拍| 精品美女一区二区| 91国在线观看| 国内外成人在线| 亚洲超碰精品一区二区| 久久夜色精品国产噜噜av| 在线视频国内一区二区| 激情五月激情综合网| 一区av在线播放| 国产欧美日韩综合| 欧美一区二区三区在线| 99精品视频在线播放观看| 奇米在线7777在线精品| 国产精品电影一区二区三区| 欧美不卡一区二区三区| 色天使久久综合网天天| 国产xxx精品视频大全| 午夜欧美大尺度福利影院在线看| 国产精品全国免费观看高清 | 精品视频一区二区三区免费| 国产精品一色哟哟哟| 日韩二区三区四区| 亚洲免费观看高清完整版在线观看 | 日韩一区二区三区三四区视频在线观看| 国产高清亚洲一区| 免费成人在线影院| 亚洲一区二区三区四区五区黄| 欧美国产1区2区| 亚洲精品一区在线观看| 欧美日韩精品欧美日韩精品| aaa欧美大片| 久久99国产精品久久| 天堂一区二区在线免费观看| 亚洲精品中文字幕在线观看| 久久久久久久网| 精品处破学生在线二十三| 91精品婷婷国产综合久久性色| 色哟哟亚洲精品| 91色.com| av一区二区三区在线| 成人少妇影院yyyy| 国产不卡视频在线播放| 国产一区二区三区在线观看精品 | 91在线国产观看| 成人黄色片在线观看| 国产99精品国产| 处破女av一区二区| 高清不卡一区二区在线| 国产成人亚洲综合a∨婷婷| 韩国欧美一区二区| 国产一区在线不卡| 国产精品一区在线观看你懂的| 国产一区二区精品久久91| 久久99国产精品尤物| 国产精品一区二区在线播放| 国产精品一级片| voyeur盗摄精品| 欧美中文字幕亚洲一区二区va在线 | 精品中文字幕一区二区| 国产一区视频在线看| 成人午夜在线免费| 91视频.com| 欧美日韩电影一区| 精品国产露脸精彩对白 | 亚洲精品一区二区三区四区高清| 日韩视频免费观看高清在线视频| 日韩欧美激情一区| 国产欧美一区二区三区沐欲| 中文字幕av不卡| 亚洲老司机在线| 三级久久三级久久久| 国产乱码精品一区二区三区av| 国产成人精品免费一区二区| 一本大道久久a久久精品综合| 欧美色男人天堂| 欧美精品一区二区久久久| 欧美国产日韩a欧美在线观看| 亚洲色图视频网| 日韩av网站在线观看| 国产精品996| 在线观看日韩电影| 日韩欧美区一区二| 日韩毛片视频在线看| 日韩精品亚洲一区二区三区免费| 精品一区二区三区免费播放 | 久久久精品人体av艺术| 亚洲视频一区二区在线| 天天色天天爱天天射综合| 国产精品一区一区| 欧美日韩一区二区欧美激情| 久久亚洲一区二区三区四区| 亚洲一线二线三线久久久| 久久精品99国产精品| 91美女精品福利| 久久众筹精品私拍模特| 亚洲一区二区影院| 国产v综合v亚洲欧| 日韩丝袜情趣美女图片| 亚洲美女精品一区| 国产一区二区在线观看免费| 欧美亚洲图片小说| 欧美高清在线精品一区| 日韩精品五月天| 色素色在线综合| 国产精品蜜臀av| 国内精品视频一区二区三区八戒| 欧美最猛性xxxxx直播| 国产欧美一区二区精品性色超碰| 日韩成人精品在线观看| 欧洲精品在线观看| 国产精品久久久久久久久久久免费看 | 久久综合国产精品| 青椒成人免费视频| 欧美日韩综合不卡| 亚洲制服丝袜一区| 色偷偷一区二区三区| 国产日韩欧美精品一区| 国产一区二区三区观看| 欧美一级爆毛片| 秋霞电影一区二区| 884aa四虎影成人精品一区| 亚洲一区在线观看视频| 99精品久久99久久久久| 国产欧美日韩三级| 国产福利电影一区二区三区| 日韩一区二区三区四区| 日产精品久久久久久久性色| 在线播放中文一区| 日韩国产欧美在线视频| 7777精品伊人久久久大香线蕉完整版 | 九九**精品视频免费播放| 欧美一卡二卡在线观看| 美女免费视频一区| 欧美成人aa大片|