#include #include #include #include #include "hardware.h" #include "hdd.h" struct dskinfo_t { uint16_t nb_sec; uint16_t nb_cyl; uint16_t taille_sec; }; static void emptyIT() { return; } static void hddIT() { printf("IT!\n"); return; } struct dskinfo_t dskinfo() { struct dskinfo_t info; _out(HDA_CMDREG, CMD_DSKINFO); info.nb_cyl = _in(HDA_DATAREGS) << 8; info.nb_cyl |= _in(HDA_DATAREGS+1); info.nb_sec = _in(HDA_DATAREGS+2) << 8; info.nb_sec |= _in(HDA_DATAREGS+3); info.taille_sec = _in(HDA_DATAREGS+4) << 8; info.taille_sec |= _in(HDA_DATAREGS+5); return info; } void seek(uint16_t piste, uint16_t secteur) { printf("SEEK : %d, %d\n", piste, secteur); _out(HDA_DATAREGS, (piste >> 8) & 0xFF); _out(HDA_DATAREGS+1, piste & 0xFF); _out(HDA_DATAREGS+2, (secteur >> 8) & 0xFF); _out(HDA_DATAREGS+3, secteur & 0xFF); _out(HDA_CMDREG, CMD_SEEK); _sleep(HDA_IRQ); } void frmt() { int i,j; struct dskinfo_t info = dskinfo(); printf("%d, %d, %d\n", info.nb_cyl, info.nb_sec, info.taille_sec); printf("Formattage !\n"); for(i=0;i> 8) & 0xFF); _out(HDA_DATAREGS+1, (info.nb_sec) & 0xFF); _out(HDA_DATAREGS+2, 0); _out(HDA_DATAREGS+3, 0); _out(HDA_DATAREGS+4, 0); _out(HDA_DATAREGS+5, 0); _out(HDA_CMDREG, CMD_FORMAT); for(j=0;j