Decision of Which I/O Model To Use

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Malfunction
Posts: 9
Joined: Sun Jun 16, 2019 11:32 am

Decision of Which I/O Model To Use

Post by Malfunction »

In x86 architecture we use I/O instructions like IN and OUT for I/O mapped I/O. We use memory instructions like MOV in memory mapped I/O as far as I know. This is all nice but who decides which I/O method will be used? If I want to build my own device (a peripheral) can I choose freely whether I use I/O mapped or memory mapped I/O to communicate with PC? Or all devices must support the both?

Can't understand who makes the decision on I/O method used to communicate with a device.
User avatar
~
Member
Member
Posts: 1228
Joined: Tue Mar 06, 2007 11:17 am
Libera.chat IRC: ArcheFire

Re: Decision of Which I/O Model To Use

Post by ~ »

The hardware makes the decision.

Then the drivers must follow the specifications of a specific device model.

Whether you write your own drivers or write driver subsystems for DOS/Win3x,Win9x,WinNT,Linux so you can load existing drivers after reimplementing the existing driver model subsystems.
-----------------------------------------------------------------

For my OS, I have designed a lot of command line built-in commands in the kernel console, so I can invoke a command and it accesses the corresponding devices from a directory-like hierarchy for a raw standard PC with ISA, PCI, USB, IDE, serial/parallel, PS/2, VGA, etc...

I categorize devices internally among other direct ways, like directory paths that must be traversed functionally to actually reach/configure them in the actual physical path, and which only those special functions understand, so that they don't interfere with normal files that may have the same name and that would be accessed by real filesystem functions.

With those commands, I can command them to different degrees, but the complexity of the command also increases to handle things that cannot be done reliably step by step at human speed.
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: Decision of Which I/O Model To Use

Post by Korona »

You can more-or-less choose what to use. You need to follow the PCI specification if you want to make your device accessible on the system bus (i.e., either as I/O or as memory).
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
Post Reply