Floppy Driver (Possibly Todo With IRQ)

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
Lprogster
Member
Member
Posts: 174
Joined: Tue Nov 14, 2006 11:59 am

Floppy Driver (Possibly Todo With IRQ)

Post by Lprogster »

Hi all again 8)

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

Lster
Last edited by Lprogster on Wed May 09, 2007 10:40 am, edited 1 time in total.
urxae
Member
Member
Posts: 149
Joined: Sun Jul 30, 2006 8:16 am
Location: The Netherlands

Re: Floppy Driver (Possibly Todo With IRQ)

Post 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...
Lprogster
Member
Member
Posts: 174
Joined: Tue Nov 14, 2006 11:59 am

Post 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
Post Reply