Page 1 of 1

ATA PIO vs ATAPI - Which one should I start?

Posted: Tue Jul 29, 2014 9:48 pm
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?

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

Posted: Tue Jul 29, 2014 9:50 pm
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).

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

Posted: Tue Jul 29, 2014 10:05 pm
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).

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

Posted: Wed Jul 30, 2014 11:54 am
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.

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

Posted: Wed Jul 30, 2014 7:52 pm
by dlarudgus20
Thanks all of you! then I'd rather start by pio