我正在阅读 Linux 设备驱动程序,并从并行端口进行读写。我读到了一些内容
ioperm(from, num, turn_on) , where:
from is the first port number to give access to
num the number of consecutive ports to give access to
turn_on is a boolean value.
Example: ioperm(0x300, 5, 1) would give access to ports 0x300 through 0x304 (a total of 5 ports). The last argument is a Boolean value specifying whether to give access to the program to the ports (true (1)) or to remove access (false (0)). You can call ioperm() multiple times to enable multiple non-consecutive ports.
ioperm() can only give access to ports 0x000 through 0x3ff;
对于上段的最后一行,我不清楚我的电脑中的哪些端口映射到 0x000 或 0x300。据我了解,LPT1 映射到 0x378,LPT2 映射到 0X278。
答案1
这些都不能告诉你映射了什么,只是为了允许访问端口。如果你想知道实际映射了什么,那么请/proc/ioports
以 root 身份检查内容。