// I2cAnalyzerDevice.cpp
//
// Generated by DriverWizard 3.2.0 (Build 2485)
// Requires DDK and DriverWorks
// File created on 7/27/2009
//
// This source file contains the implementation of a subclass of KDevice.
// WDM drivers implement a subclass of KPnpDevice and override member
// functions to handle requests (IRPs) from the system.
//
#include <vdw.h>
#include <kusb.h>
#include <kusbbusintf.h>
#include "I2cAnalyzerDriver.h"
#include "I2cAnalyzerDevice.h"
#include "..\\intrface.h"
#pragma hdrstop("I2cAnalyzer.pch")
// Global driver trace object
// TODO: Use KDebugOnlyTrace if you want trace messages
// to appear only in checked builds. Use KTrace if
// you want trace messages to always appear. Call
// method SetOutputLevel to set the output threshold.
extern KDebugOnlyTrace T;
///////////////////////////////////////////////////////////////////////////////////////////////////
// I2cAnalyzerDevice::I2cAnalyzerDevice
// This is the constructor for the class representing the Functional
// Device Object, or FDO. It is derived from KPnpDevice, which builds
// in automatic dispatching of subfunctions of IRP_MJ_POWER and IRP_MJ_PNP
// to virtual member functions.
// The object being constructed contains a data member (m_Lower) of type
// KPnpLowerDevice. By initializing it, the driver binds the FDO to the
// PDO and creates an interface to the upper edge of the system class driver.
//
// Arguments:
// IN Pdo
// Physical Device Object. This is a pointer to a system
// device object that represents the physical device.
//
// IN Unit
// Unit number to append to the device's base device name
// to distinguish multiple units of this device type.
//
// Return Value:
// none
//
I2cAnalyzerDevice::I2cAnalyzerDevice(PDEVICE_OBJECT Pdo, ULONG Unit) :
KPnpDevice(Pdo, &GUID_DEVINTERFACE_I2CANALYZER)
{
if (!NT_SUCCESS(m_ConstructorStatus))
{
T.Trace(TraceError, __FUNCTION__": Failed to create device I2cAnalyzerDevice"
" unit number %d status %x\n", Unit, m_ConstructorStatus);
ASSERT(FALSE);
return;
}
// Initialize the lower device
m_Lower.Initialize(this, Pdo);
// Initialize the interface object. The wizard generates code
// to support a single interface. You may create and add additional
// interfaces. By default, the wizard uses InterfaceNumber 0 (the
// first interface descriptor), ConfigurationValue 1 (the first
// configuration descriptor), and initial interface alternate
// setting of 0. If your device has multiple interfaces or alternate
// settings for an interface, you can add additional KUsbInterface
// objects or adjust the parameters passed to this function.
m_Interface.Initialize(
m_Lower, //KUsbLowerDevice
0, //InterfaceNumber
1, //ConfigurationValue
0 //Initial Interface Alternate Setting
);
// Initialize each Pipe object
Ep1In.Initialize(m_Lower, 0x81); //16);
Ep1Out.Initialize(m_Lower, 0x01); // 16);
Ep2In.Initialize(m_Lower, 0x82); //, 4096); //64);
Ep3Out.Initialize(m_Lower, 0x03); //, 4096); //64);
#if (_WDM_ && (WDM_MAJORVERSION > 1 ||((WDM_MAJORVERSION == 1) && (WDM_MINORVERSION >= 0x20))))
// Initialize USB direct client access interface
if (STATUS_SUCCESS == m_BusIntf.Initialize(m_Lower.TopOfStack()))
m_fBusIntfAvailable = TRUE;
else
m_fBusIntfAvailable = FALSE;
#endif
// Inform the base class of the lower edge device object
SetLowerDevice(&m_Lower);
// Initialize the PnP Policy settings to the "standard" policy
SetPnpPolicy();
// TODO: Customize the PnP Policy for this device by setting
// flags in m_Policies.
// Initialize the Power Policy settings to the "standard" policy
SetPowerPolicy();
// TODO: Customize the Power Policy for this device by setting
// flags in m_PowerPolicies.
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// I2cAnalyzerDevice::~I2cAnalyzerDevice
// This is the destructor for the class.
//
// Arguments:
// none
//
// Return Value:
// none
//
I2cAnalyzerDevice::~I2cAnalyzerDevice()
{
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// I2cAnalyzerDevice::DefaultPnp
// Default handler for IRP_MJ_PNP.
// This routine just passes the IRP through to the lower device. IRPs
// that correspond to any virtual members of KpnpDevice that handle
// minor functions of IRP_MJ_PNP and that are not overridden get
// passed to this routine.
//
// Arguments:
// IN I
// the plug and play IRP
//
// Return Value:
// NTSTATUS
// Result returned from lower device
//
NTSTATUS I2cAnalyzerDevice::DefaultPnp(KIrp I)
{
T.Trace(TraceInfo, __FUNCTION__"++. IRP %p\n", I);
T << I;
I.ForceReuseOfCurrentStackLocationInCalldown();
NTSTATUS status = m_Lower.PnpCall(this, I);
T.Trace(TraceInfo, __FUNCTION__"--. IRP %p, STATUS %x\n", I, status);
return status;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// I2cAnalyzerDevice::DefaultPower
// Default handler for IRP_MJ_POWER.
// This routine just passes the IRP through to the lower device. IRPs
// that correspond to any virtual members of KpnpDevice that handle
// minor functions of IRP_MJ_POWER and that are not overridden get
// passed to this routine.
//
// Arguments:
// IN I
// the power IRP
//
// Return Value:
// NTSTATUS
// Result returned from lower device
//
NTSTATUS I2cAnalyzerDevice::DefaultPower(KIrp I)
{
T.Trace(TraceInfo, __FUNCTION__"++. IRP %p\n", I);
T << I;
I.IndicatePowerIrpProcessed();
I.CopyParametersDown();
NTSTATUS status = m_Lower.PnpPowerCall(this, I);
T.Trace(TraceInfo, __FUNCTION__"--. IRP %p, STATUS %x\n", I, status);
return status;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// I2cAnalyzerDevice::SystemControl
// Default handler for IRP_MJ_SYSTEM_CONTROL.
// This routine just passes the IRP through to the next device since
// this driver is not a WMI provider.
//
// Arguments:
// IN I
// the system control (WMI) IRP
//
// Return Value:
// NTSTATUS
// Result returned from lower device
//
NTSTATUS I2cAnalyzerDevice::SystemControl(KIrp I)
{
T.Trace(TraceInfo, __FUNCTION__"++. IRP %p\n", I);
T << I;
NTSTATUS status = STATUS_SUCCESS;
I.ForceReuseOfCurrentStackLocationInCalldown();
status = m_Lower.PnpCall(this, I);
T.Trace(TraceInfo, __FUNCTION__"--. IRP %p, STATUS %x\n", I, status);
return status;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// I2cAnalyzerDevice::OnStartDevice
// Handler for IRP_MJ_PNP subfcn IRP_MN_START_DEVICE.
// Initialize the hardware device. Typically, the driver initializes
// physical resources here. Call I.AllocatedResources() for a list
// of the raw resources that the system has assigned to the device,
// or I.TranslatedResources() for the translated resource list.
//
// Arguments:
// IN I
// the start device IRP
//
// Return Value:
// NTSTATUS
//
NTSTATUS I2cAnalyzerDevice::OnStartDevice(KIrp I)
{
T.Trace(TraceInfo, __FUNCTION__"++. IRP %p\n", I);
NTSTATUS status = STATUS_SUCCESS;
I.Information() = 0;
status = STATUS_UNSUCCESSFUL;
AC_STATUS acStatus = AC_SUCCESS;
// By default, the wizard passes a ConfigurationValue of 1 to
// ActivateConfiguration(). This corresponds to the first configuration
// that the device reports in its configuration descriptor. If the device
// supports multiple configurations, pass the appropriate
// ConfigurationValue of the configuration to activate here.
acStatus = m_Lower.ActivateConfiguration(
1 // ConfigurationValue 1 (the first configuration)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
前些时间玩了把STM32,原来想做一个USB接口的单片机,FLASH编程器,感觉不错,但这段时间停了,特发上来和大家分享 代码涉及USB上位机(VC++源码),动态库(VC++源码),STM32下位机, 如果正在学习USB相关的可以参考,上位机提供了动态库及源码,如果写应用界面可直接调用动态库即可,无须对底层做过多了解,但这些也只属于一个初始框架,希望哪位有VC++经验而且有兴趣的,可以细化并提供出一个更好的供广大爱好者使用。 STM32 USB驱动原码
资源推荐
资源详情
资源评论
收起资源包目录
驱动程序原代码_Driver.rar (54个子文件)
Driver
I2cAnalyzerDrv
I2cAnalyzer.IMD 368B
I2cAnalyzer.WK3 24KB
I2cAnalyzer.PO 776B
I2cAnalyzer.dsw 761B
I2cAnalyzer.CF3 129KB
driver
I2cAnalyzerDevice.h 3KB
I2cAnalyzerDriver.cpp 5KB
function.h 725B
objfre_wxp_x86
_objects.mac 838B
i386
I2cAnalyzer.sys 32KB
I2cAnalyzerDriver.h 717B
I2cAnalyzer.sys 29KB
objchk
i386
I2cAnalyzer.sys 81KB
I2cAnalyzer.inf 4KB
I2cAnalyzer.cat 172B
makefile 267B
I2cAnalyzerDevice.cpp 40KB
I2cAnalyzer.plg 255B
buildfre_wxp_x86.log 4KB
I2cAnalyzer.dsp 21KB
objfre
i386
I2cAnalyzer.sys 29KB
I2cAnalyzer.rc 1KB
sources 2KB
I2cAnalyzer.PFI 24B
I2cAnalyzer.IMB 4KB
I2cAnalyzer.sys 29KB
intrface.h 2KB
I2cAnalyzerVars.xml 8KB
I2cAnalyzer.inf.bak 4KB
I2cAnalyzer.PS 35KB
app
I2cAnalyzerIorw.cpp 19KB
I2cAnalyzerApp.dsp 5KB
I2cAnalyzerApp.plg 69B
I2cAnalyzerApp.h 1KB
makefile 267B
buildfre_wxp_x86.log 6KB
resource.h 1KB
I2cAnalyzerApp.rc 2KB
buildfre_wxp_x86.err 159B
I2cAnalyzerApp.cpp 19KB
sources 629B
I2cAnalyzer.inf 4KB
I2cAnalyzer.cat 172B
I2cAnalyzer.SearchResults 39B
dirs 35B
I2cAnalyzer.ncb 73KB
I2cAnalyzer.PRI 12KB
I2cAnalyzer.bbs 139B
I2cAnalyzer.PR 2KB
Backup of I2cAnalyzer.CF3 129KB
ReadMe.htm 12KB
I2cAnalyzer.IAB 8KB
I2cAnalyzer.opt 86KB
I2cAnalyzer.IAD 408B
共 54 条
- 1
资源评论
- zxzxzzxz2012-12-15东西不能正常工作呀!
- shuizhonglinsname2012-10-09没能用上啊
- 落尘致远2012-05-10还可以,但是由于STM32本身只支持USB全速,不如直接采用USBCDC了,省的写驱动了
- 磁动力电子_明浩2013-06-24STMUSB库中的例子全是免驱的,楼主的例子能达多少M的速率?
- bone_love2013-02-05没调通,没调通。
huxiaoping123
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 软件工程项目验收系列文档.doc
- content_1713513663833.xmind
- 数据流图(Data Flow Diagram,简称DFD).md
- 基于Mybatis-Plus的Maven代码生成插件设计源码
- 67e1bc92-b0ee-45c1-b46f-9d519bbd6925.ofd
- npcsvpwm.v
- Java项目:基于Springboot+vue实现的校园志愿者管理系统(源码+数据库+环境配置和运行指导视频+系统讲解视频)
- 驱动开发,驱动加载工具,支持安装、启动、停止、卸载、关闭功能
- UTS 32146 Data Visualisation and Visual Analytics A1
- 西门子1200PLC 六部十层电梯程序案例,WINCC RT Advanced界面,博图
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功