#include #include #include #include #include #include static void emptyIT() { return; } static void hddIT() { return; } void write_disk(uintptr_t *data) { write_sector(0, 0, data); } uintptr_t* read_disk() { struct dskinfo_t info = dskinfo(); uintptr_t *data = malloc(info.taille_sec); read_sector(0, 0, data); return data; } int main(int argc, char *argv[]) { unsigned int i; /* init hardware */ if(initHardware("hardware.ini") == 0) { fprintf(stderr, "Error in hardware initialization\n"); exit(EXIT_FAILURE); } /* Interreupt handlers */ for(i=0; i<16; i++) IRQVECTOR[i] = emptyIT; IRQVECTOR[HDA_IRQ] = hddIT; /* Allows all IT */ _mask(1); struct dskinfo_t info = dskinfo(); int entiers[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; uintptr_t *data = malloc(info.taille_sec); memset(data, 0, info.taille_sec); memcpy(data, entiers, 10*sizeof(int)); write_disk(data); int *res = (int*)read_disk(); if ( memcmp(&entiers, res, sizeof(int)*10) == 0 ) { printf("OK !\n"); int i; for(i=0;i<10;i++) printf("%d ", res[i]); printf("\n"); free(data); free(res); return EXIT_SUCCESS; } else { printf("RATAI !\n"); free(data); free(res); return EXIT_FAILURE; } }