Think about this for a moment: even if you know which API(s) to use to map or work upon I/O memory in some manner, first, you need to request permission from the OS. After all, the OS is the system's overall resource manager and you must ask it nicely before using its resources. Well, there's more to this, of course – when you ask it, what you're really doing is asking it to set up some internal data structures that allow the kernel to understand which driver or subsystem is using what I/O memory region or port.
Before performing any peripheral I/O, you are expected to ask the kernel for permission to do so, and assuming you get it, you perform the I/O. After this, you are expected to release the I/O region back to the kernel. The following steps are involved in this process:
- Before I/O: Request access to the memory or port region.
- Having received the green light from the kernel core, perform the actual I/O: You use...