Memory mapped I/O vs Port mapped I/O [closed]

2019-04-26 17:16发布

问题:

Memory mapped I/O is a technique which allows the use of central memory (RAM) to communicate with peripherals. Port mapped I/O uses ports (with special assembly instructions) to communicate over digital ports.

What are the advantages of one method with respect to another?

回答1:

As Cthulhu said,

  • memory mapped I/O allows writing/reading to I/O device ports the same as reading/writing to normal memory (using the same machine code/asm)

but there is a disadvantage:

  • you use up physical memory address space for your memory mapped I/O devices (think of 32 bit Windows not being able to access all 4G of RAM on a PC)

So an advantage of using the port mapped I/O method is that you have a separate address space for your I/O devices and you can use the whole memory addressing range to access memory.

EDIT: Here is a more complete answer to your question: hardware ports to memory addresses