Page 1 of 1

how can i get drive params with c?

Posted: Wed Nov 30, 2005 11:40 pm
by MANDLA
hello all
i have a question. how can i get drive params with c? i m making own OS.

Re:how can i get drive params with c?

Posted: Wed Nov 30, 2005 11:45 pm
by Cjmovie
Drive params? You mean like CD-Drive, Hard drive, floppy drive, etc.?

CD and Hard drive are on an IDE Slave/Master setup, usually with 2 channels. I don't have anything in front of me, but look back ~1/2 a month for a post, there was a good website for that stuff posted.

As for the floppy, it has its own logic - Again, nothing in front of me, but the OS-Faq has some insight.

Sorry I couldn't be more help :)

Re:how can i get drive params with c?

Posted: Thu Dec 01, 2005 1:29 am
by Solar
Your question could mean two things:

1) How could my kernel read drive geometry etc. from the BIOS and / or the controller?

Answer: Please consult the FAQ, the forum search function and the various linked and / or google-able tutorials. It is a wide subject, and very much dependent on your kernel architecture, your hardware, and your BIOS - but not at all dependent on the language.

2) Are there any standard C functions to do this?

Answer: No.

Re:how can i get drive params with c?

Posted: Thu Dec 01, 2005 1:58 am
by udarkman
The more you clearify and simplify your question, the better answers you take.

Anyway...

If you ask getting info about your fdd and hdd, you may probe their ports.

IIRC, CMOS have an information about types and existance of first and second fdd. Read 0x10 from cmos for that information.

Or (and better) probe :

0x3f0 -> First fdc
0x370 -> Second fdc

And for hdd, you may probe these base addrs.

0x1f0 -> Primary controller
0x170 -> Secondary controller
0x1e8 -> Triplicate controller
0x168 -> Quadriple controller

Each controller may have 2 drives(master/slave). I dont remember which commands to send to get info. Google it.

Thats what I understood from your question.

Re:how can i get drive params with c?

Posted: Fri Dec 02, 2005 12:58 am
by MANDLA
thanks everyone!