Please note that this post follows on from : IRQ’s and Interrupts
I/O Addresses and I/O memory relate to bi-directional Communications between (CPU/Computer to devices ) as opposed to IRQ’s/Interrupt’s which are one way (device to CPU/Computer) communications.
Communication via I/O Addresses and I/O memory also relates to more general data transfers as opposed to Interrupts using IRQ’s which tend to relate to operational signals such as “I have finished Printing your document”.
The CPU writes data or maybe control codes to a devices (I/O port , I/O memory address).
Note that unlike Interrupts, this is not a one way communication process, the CPU can also use a device’s IO port to read status information about the device.
Like interrupts, ports and addresses should not be shared!
The Following is a good example of the Linux system file /proc/ioports
I/O ports in /proc/ioports
0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-006f : keyboard
0070-0077 : rtc
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
0170-0177 : ide1
02f8-02ff : serial
The first column gives the I/O port address range reserved for the device listed in the second column.
I/O memory, /proc/iomem
System devices also need to have system memory allocated to them, devices such as the system RAM and GPIO ports .
The following is an example of the file /proc/iomem, taken from a Raspberry PI model 3
00000000-36ffffff : System RAM
00008000-007945ef : Kernel code
00804000-009497db : Kernel data
3f006000-3f006fff : dwc_otg
3f007000-3f007eff : /soc/dma@7e007000
3f00b840-3f00b84e : /soc/vchiq
3f00b880-3f00b8bf : /soc/mailbox@7e00b800
3f200000-3f2000b3 : /soc/gpio@7e200000
3f201000-3f201fff : /soc/uart@7e201000
3f201000-3f201fff : uart-pl011
3f202000-3f2020ff : /soc/sdhost@7e202000
3f215040-3f21507f : serial
3f300000-3f3000ff : /soc/mmc@7e300000
3f980000-3f98ffff : dwc_otg
The first column displays the memory used by each of the different types of registered device. The second column lists the details for the allocated memory.
This file tells the Linux Kernel system, where to find and store data that relates to the devices listed with in it.
Note : As with all Linux study, this information relates to a general perspective. You should take into account that Different versions of Linux May or May not do things in the orthodox fashion.
The Raspberry Pi using Rasbian Linux for example, does not have a /proc/ioports file available but does have the file /proc/iomem. Ubuntu Linux on a standard Intel PC has both /proc/ioports and /proc/iomem available to the system services.
You always have to dig deep when it comes to your own installation of Linux!