the floppy drive didn't receive irq signal

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
orighost
Posts: 17
Joined: Sun May 27, 2012 8:38 pm

the floppy drive didn't receive irq signal

Post by orighost »

I am developing the floppy driver. When I send read data command (in dma mode), I didn't recieve IRQ6 interrupt.

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]
        ......
}
note: when I seek track, I can receive irq signal. now when I send read comman ,it loop here.

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");
}
The bochs logs:
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
orighost
Posts: 17
Joined: Sun May 27, 2012 8:38 pm

Re: the floppy drive didn't receive irq signal

Post by orighost »

I have solved it, but I dong't know why.
just add a commond: outb(0xd4, 0x00) //set slave dma's mask registers, unmusk channel 4.
Post Reply