Pls explain the difference between memory mapped IO and IO mapped IO
-
1This seems more like a machine architecture question than a programming question.– PointyCommented Oct 8, 2010 at 12:35
-
Try asking your question at ServerFault.com– DOKCommented Oct 8, 2010 at 12:38
-
1@DOK: How in the world do you figure this is a SF question?– dmckee --- ex-moderator kittenCommented Oct 10, 2010 at 12:03
-
@Pointy: At the very least it's a concern when writing drivers. It's not clear that kabhay is working at that level, but...– dmckee --- ex-moderator kittenCommented Oct 10, 2010 at 12:05
-
This answer to this question is of huge import to anyone who's building drivers for x86. As such, i'd say it belongs here.– cHaoCommented Apr 17, 2011 at 16:33
5 Answers
On x86 there are two different address spaces, one for memory, and another one for I/O ports.
The port address space is limited to 65536 ports, and is accessed using the IN/OUT instructions.
As an example, a video card's VGA functionality can be accessed using some I/O ports, but the framebuffer is memory-mapped.
Other CPU architectures only have one address space. In those architectures, all devices are memory-mapped.
Uhm,... unless I misunderstood, you're talking about two completely different things. I'll give you two very short explanations so you can google up what you need to now.
Memory-mapped I/O means mapping I/O hardware devices' memory into the main memory map. That is, there will be addresses in the computer's memory that won't actually correspond to your RAM, but to internal registers and memory of peripheral devices. This is the machine architecture Pointy was talking about.
There's also mapped I/O, which means taking (say) a file, and having the OS load portions of it in memory for faster access later on. In Unix, this can be accomplished through mmap()
.
I hope this helped.
-
1Your answer is informative but you have not explained IO mapped IO.– JagdishCommented Dec 19, 2015 at 14:32
-
"there will be addresses in the computer's memory that won't actually correspond to your RAM, but to internal registers and memory of peripheral devices." Does each device have its own internal registers and memory that they map to RAM (for example: can a printer have 4 registers while a webcam have 7 registers), or is there a standard number of registers and memory that all devices must implement?– JohnCommented May 29, 2017 at 13:04
-
1Each device is different, both internally and interface-wise. Memory mappings can be used, or not. It's highly device-dependent– salezicaCommented May 29, 2017 at 17:35
Memory mapped I/O is mapped into the same address space as program memory and/or user memory, and is accessed in the same way.
Port mapped I/O uses a separate, dedicated address space and is accessed via a dedicated set of microprocessor instructions.
As 16-bit processors will slowly become obsolete and replaced with 32-bit and 64-bit in general use, reserving ranges of memory address space for I/O is less of a problem, as the memory address space of the processor is usually much larger than the required space for all memory and I/O devices in a system.
Therefore, it has become more frequently practical to take advantage of the benefits of memory-mapped I/O.
The disadvantage to this method is that the entire address bus must be fully decoded for every device. For example, a machine with a 32-bit address bus would require logic gates to resolve the state of all 32 address lines to properly decode the specific address of any device. This increases the cost of adding hardware to the machine.
The advantage of IO Mapped IO system is that less logic is needed to decode a discrete address and therefore less cost to add hardware devices to a machine. However more instructions could be needed.
Ref:- Check This link
I have one more clear difference between the two. The memory mapped I/O device is that I/O device which respond when IO/M is low. While a I/O (or peripheral) mapped I/O device is that which respond when IO/M is high.
Memory mapped I/O is mapped into the same address space as program memory and/or user memory, and is accessed in the same way.
I/O mapped I/O uses a separate, dedicated address space and is accessed via a dedicated set of microprocessor instructions.
The difference between the two schemes occurs within the Micro processor’s / Micro controller’s. Intel has, for the most part, used the I/O mapped scheme for their microprocessors and Motorola has used the memory mapped scheme.
https://techdhaba.com/2018/06/16/memory-mapped-i-o-vs-i-o-mapped-i-o/
-
For 8-bit retro types, 6502 used memory mapped and Z80 used IO mapped. Commented Apr 15, 2020 at 1:41