Port I/O maps device registers to a separate address space and uses special I/O instructions to read and write registers. Memory mapped I/O maps device registers into the regular memory address space and uses regular memory instructions, allowing code reuse and flexibility while protecting device registers. Reading and writing MMIO registers can trigger hardware operations, unlike reading and writing normal memory.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
24 views5 pages
Mcu 4
Port I/O maps device registers to a separate address space and uses special I/O instructions to read and write registers. Memory mapped I/O maps device registers into the regular memory address space and uses regular memory instructions, allowing code reuse and flexibility while protecting device registers. Reading and writing MMIO registers can trigger hardware operations, unlike reading and writing normal memory.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5
Port I/O
Port I /O • Devices registers mapped onto “ports”; a • Devices registers mapped onto “ports”; separate address a separate addressspace space memory I/O ports
• Use special I/O instructions to read/write ports
• Use special I/O instructions to read/write ports • Protected by making I/O instructions available only in kernel/supervisor • Protected mode by making I/O instructions available only in kernel/supervisor • Used for example bymode IBM 360 and successors
• Used for example by IBM 360 and successors
How can we imagine providing an interface to hardware from software? 1. Specialized CPU instructions (x86 in/out) 2. Treating devices like they are memory (MMIO) Memory Mapped IO Memory Mapped I/ O • Device registers mapped into regular address space • Device registers mapped into regular address space memory memory mapped I/O
• Use regular move (assignment) instructions to
• Use regular move (assignment) instructions to read/ write registers read/ write a device’s hardware “registers” • Use • Usememory memoryprotection mechanismtoto protection mechanism protect protect device registers device registers
• Used for example by PDP-11
MMIO is used for embedded systems • Why not Ports I/O? – special I/O instructions would be instruction set dependent (x86, ARM Thumb, MIPS) • Bad if there are many different instruction sets out there – Need special hardware to execute and protect instructions
• Memory mapped I/O:
– Can use all existing memory reference instructions for I/O • Can reuse code for reading and writing (e.g., memcpy) – Memory protection mechanism allows greater flexibility than protected instructions (protect specific registers) – Can reuse memory management / protection hardware to interface with hardware (saves space and power) Reading and writing with MMIO is not like talking to RAM • MMIO reads and writes hardware device registers • Reads and write to registers can cause peripherals to begin or end an operation • By reading data, it may cause the hardware to do something!!! – E.g., Clear an interrupt flag, get the next byte on a bus • By writing data, it may cause the hardware to do something with it – E.g., Send this data over the UART bus