Page 1 of 1

Floppy Driver (Possibly Todo With IRQ)

Posted: Wed May 09, 2007 6:07 am
by Lprogster
Hi all again 8)

I'm OK now... I recommend the link posted by urxae. Thanks!

Lster

Re: Floppy Driver (Possibly Todo With IRQ)

Posted: Wed May 09, 2007 6:43 am
by urxae
Lprogster wrote:

Code: Select all

// Reset the floppy disk
void reset_floppy ( )
{
	// Reset the floppy
	out_port ( DOR, 0x00 );
	out_port ( DOR, 0x0C );
	out_port ( CCR, 0x00 );

	// Wait for interupt
	floppy_flag = 1;
	while ( floppy_flag == 1 )
		;
}
According to this thread, you should wait for an IRQ after the first two IO-outs, then call "floppy_check_interrupt" (code quoted below for convenience) ignoring the results, and only then send the last IO-out (to CCR). (Then he does some more stuff to set the "steprate" and "load time", followed by recalibration)
mystran wrote:

Code: Select all

unsigned char floppy_read_data(int base) {

    int i; // do timeout, 60 seconds
    for(i = 0; i < 600; i++) {
        timer_sleep(1); // sleep 10 ms
        if(0x80 & in8_p(base+FLOPPY_MSR)) {
            return in8_p(base+FLOPPY_FIFO);
        }
    }
    panic("floppy_read_data: timeout");
    return 0; // not reached
}
(Disclaimer: My own floppy driver, based on that thread, doesn't yet work on any real hardware I have available...)


Other things that could be wrong (from the obviousness department): Interrupts being disabled and/or IRQ 6 being masked...

Posted: Wed May 09, 2007 7:30 am
by Lprogster
Thank you - I'll be looking harder at that thread tommorrow - it looks good :). I'm coding rather a lot right now :twisted:.

Lster