0

I am writing a serial driver for UART in windows just for learning purpose. More specifically in WDM. I will write both the bus driver and function driver.

Currently i am writing the bus driver. So my question is from where i can come to know in my driver that how many serial ports i have in my system, so that i can expose that number of PDO's from my bus driver?? And resources allocated to each port. Do i have to check some kind of registry or windows will provide some kind of structure.

Please help me!! Thanks in advance

4

1 回答 1

1

假设您的 UART 是 PC 的一部分,那么已经有一个总线驱动程序可以枚举它们。ACPI.SYS 从平台 BIOS 获取信息,其中包括 UART 等内置组件的数量和资源分配。

如果您正在为附加的多端口串行板编写驱动程序,那么您需要查看板的文档以确定如何找到 UART 的数量。这可能就像查看 PCI 产品 ID 并为您拥有的主板类型进行硬编码计数一样简单。

当 ACPI 枚举设备时,您的驱动程序的 AddDevice 例程将被调用以加载它,并且您将在处理 PNP START 消息时收到分配的资源。

于 2014-03-17T23:19:18.667 回答