gargantua
驱动牛犊
驱动牛犊
  • 注册日期2003-02-02
  • 最后登录2003-09-12
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1027回复:8

大侠们请进

楼主#
更多 发布于:2003-05-13 14:44
两块一样的硬件板卡插到同一台机器上,请问在驱动程序中通过什么加以区分?自己用DS编写驱动,应该怎样实现两块一样板卡的驱动?
escape
驱动老牛
驱动老牛
  • 注册日期2002-02-01
  • 最后登录2004-08-20
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2003-05-13 15:28
困惑中
yyhabc
驱动小牛
驱动小牛
  • 注册日期2003-01-06
  • 最后登录2013-03-18
  • 粉丝0
  • 关注0
  • 积分327分
  • 威望47点
  • 贡献值0点
  • 好评度21点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2003-05-13 16:23
一个驱动是可以管理多个硬件的。硬件的不同资源是在系统内存的不同地方被记录的。虽然代码相同,由于书素为之不一致,所以不会冲突。你的驱动程序入口会收到一个deviceobject指针,系统就是有这个指针区分不同设备的,建议你多看ddk,就会明白。
gargantua
驱动牛犊
驱动牛犊
  • 注册日期2003-02-02
  • 最后登录2003-09-12
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2003-05-13 16:52
那如果在上层应用层调用某个功能,是通过什么区分具体的硬件(硬件板卡一样,驱动也一样)?
arthurtu
驱动巨牛
驱动巨牛
  • 注册日期2001-11-08
  • 最后登录2020-12-19
  • 粉丝0
  • 关注0
  • 积分26分
  • 威望161点
  • 贡献值0点
  • 好评度35点
  • 原创分0分
  • 专家分0分
  • 社区居民
地下室#
发布于:2003-05-13 17:17
GUID,或硬编码。
gargantua
驱动牛犊
驱动牛犊
  • 注册日期2003-02-02
  • 最后登录2003-09-12
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2003-05-13 17:20
也就是说我自己开发驱动的话,必须给两个硬件板卡不同的GUID?
yyhabc
驱动小牛
驱动小牛
  • 注册日期2003-01-06
  • 最后登录2013-03-18
  • 粉丝0
  • 关注0
  • 积分327分
  • 威望47点
  • 贡献值0点
  • 好评度21点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2003-05-13 17:31
GUID是接口GUID,不同的设备也可以实现相同的接口。你自己编写驱动,关于设备的去跟问题不简单,但你不必为每个设备产生单独的GUID.系统区分不同设备的标示是instance ID,以下是ddk中的说明。
instance ID
A string that distinguishes a device from other devices of the same type on a machine. An instance ID is a string (without any path-separator characters) that contains serial-number information, if supported by the underlying bus, or some kind of location information. The format of the string is bus specific.
If the UniqueID device capability (see DEVICE_CAPABILITIES) is FALSE for the device, then the instance ID is unique on the device\'s bus. If the UniqueID capability is TRUE, then the concatenation of the device ID and the instance ID uniquely identifies the device across the entire system.

If the UniqueID device capability is FALSE, the PnP Manager modifies the instance ID reported by the device\'s underlying bus driver to add information about the device\'s parent and thus makes the ID unique on the machine.

An instance ID is persistent across system boots.

See also device ID, hardware ID, compatible ID, and device instance ID.

For more information, see the topic Device Identification Strings.

gargantua
驱动牛犊
驱动牛犊
  • 注册日期2003-02-02
  • 最后登录2003-09-12
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
7楼#
发布于:2003-05-13 20:00
以上说了那么多,还是有点不明白:在上层应用程序中,通过什么机制区分功能完全一样的不同板卡?
yyhabc
驱动小牛
驱动小牛
  • 注册日期2003-01-06
  • 最后登录2013-03-18
  • 粉丝0
  • 关注0
  • 积分327分
  • 威望47点
  • 贡献值0点
  • 好评度21点
  • 原创分0分
  • 专家分0分
8楼#
发布于:2003-05-14 10:04
你在调用IoCreateDevice的时候会制定一个设备名,上层就用这个设备名区分不同的设备。你的读懂如果管理多个设备,在调用IoCreateDevice时,你有责任其不同的名字。在调用IoCreateDevice时,如果名字已经存在会返回错误码0xc0000034(对象名已经存在),你可以接着式其它的名字。
游客

返回顶部