ATA PIO vs ATAPI - Which one should I start?

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
dlarudgus20
Member
Member
Posts: 36
Joined: Sat Oct 26, 2013 4:14 am

ATA PIO vs ATAPI - Which one should I start?

Post by dlarudgus20 »

Recently, I've finished writing multitasking and memory management on my OS (although there are many lack of completeness), and I'm pleased to make my first release on github(https://github.com/dlarudgus20/Clubcos) and go to the next chapter - supporting for hard disk/floppy disk.

I decide to start by hard disk. I search wiki and notice that there are two ones: obsolete ATA PIO Mode, and ATAPI. ATAPI is more preferable, but it seems that PIO mode is recommended for beginners because of its ease.

However, PIO doesn't look so simple, and I should do a lot of things whatever I choose. I don't hate doing a lot of effort, but I wonder if this obsolete one is really worth trying for just studying and getting ready for ATAPI (I think I should go to ATAPI at last although I choose PIO at first time)

Can you give me some advices?
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: ATA PIO vs ATAPI - Which one should I start?

Post by thepowersgang »

Actually, ATAPI is just for CD drives, the actual descision is between PIO and DMA.

DMA is better to use in most cases, but you'll probably want to also support PIO mode either as a fallback, or just for early init (Iirc, my driver uses PIO to send ATA IDENTIFY, can't remember why it doesn't use DMA for that).
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
YaYo
Posts: 6
Joined: Fri Dec 06, 2013 1:49 pm

Re: ATA PIO vs ATAPI - Which one should I start?

Post by YaYo »

thepowersgang wrote:Actually, ATAPI is just for CD drives, the actual descision is between PIO and DMA.

DMA is better to use in most cases, but you'll probably want to also support PIO mode either as a fallback, or just for early init (Iirc, my driver uses PIO to send ATA IDENTIFY, can't remember why it doesn't use DMA for that).
i believe that starting with PIO would be better and easier, but later you may use DMA mode. especially that it's more practical and more effective for performance issues especially when you activate multitasking, but at boot time it's preferable to use PIO mode to load boot files (it's faster).
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: ATA PIO vs ATAPI - Which one should I start?

Post by SpyderTL »

ATA (Reading from and writing to a hard drive) is easier than ATAPI (Reading from a CD-ROM).

PIO (Reading one byte at a time) is easier than DMA (Programming the DMA controller to copy a block of data in the background).

So, I would start with reading a single block from a hard drive using ATA and PIO, and once you have that working, write a completely new function to do the same thing using DMA, and then another pair of functions to do the same functionality for CD-ROM.

Just a suggestion.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
dlarudgus20
Member
Member
Posts: 36
Joined: Sat Oct 26, 2013 4:14 am

Re: ATA PIO vs ATAPI - Which one should I start?

Post by dlarudgus20 »

Thanks all of you! then I'd rather start by pio
Post Reply