how can i get drive params with c?

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
MANDLA

how can i get drive params with c?

Post by MANDLA »

hello all
i have a question. how can i get drive params with c? i m making own OS.
Cjmovie

Re:how can i get drive params with c?

Post 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 :)
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:how can i get drive params with c?

Post 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.
Every good solution is obvious once you've found it.
udarkman

Re:how can i get drive params with c?

Post 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.
MANDLA

Re:how can i get drive params with c?

Post by MANDLA »

thanks everyone!
Post Reply