Code: Select all
void fd_init()
{
fd_get_info();
fd_cur_track = -1;
register_interrupt_handler(0x26, &fd_handler);
enable_irq(0x06);
init_dma();
outb(FD_DOR,0x0C); //emable dma, select drive A, off motor.
outb(FD_DCR, 0); //speed
/*set floppy mode*/
fd_delay(6);
fd_outb(FD_SPECIFY);
fd_outb(0xC1);
fd_outb(0x10);
fd_delay(2);
}
Code: Select all
static void fd_read(uint8_t sector,uint8_t track,uint8_t head) {
fd_motor_on();
fd_delay(2);
fd_seek(track, head); // I have tested, it worked well.
set_fd_dma_read();
irq_stat = 0;
fd_outb(FD_READ);
fd_outb((head & 1) << 2);
fd_outb(track);
fd_outb(head);
fd_outb(sector);
fd_outb(0x02);
fd_outb(0x12);
fd_outb(0x1B);
fd_outb(0xFF);
fd_wait_int(); //[color=#FF0000]---------??? loop------------------[/color]
......
}
Code: Select all
static void set_fd_dma_read() {
dma_disable(2);
dma_set_mode(2, DMA_MODE_READ);
dma_clear_ff(2);
dma_set_addr(2, (unsigned int)DMA_BUFFER);
dma_set_count(2, 0xFF);
dma_enable(2);
}
Code: Select all
void fd_motor_on()
{
//disable interrupt
asm volatile("cli");
outb(FD_DOR,0x1C);
fd_motor = 1;
asm volatile("sti");
}
int13_harddisk: function 08, unmapped device for ELDL=80
*** int 15h function AX=00c0, BX=0000 not yet supported!
io_write: config control register: 0x00