Implement floppy disk controller driver (AI)
Add Intel 82077AA-compatible floppy disk controller driver with: - CMOS-based drive detection (register 0x10) - FDC reset with DOR toggle and SPECIFY command - Motor control with spin-up delay - ISA DMA channel 2 setup for data transfers - LBA-to-CHS conversion for 1.44MB geometry - Single-sector read/write via DMA with 7-byte result phase - Seek and recalibrate with sense interrupt verification - IRQ 6 handler (vector 38) for command completion - Devicefs integration as 'floppy' class block devices The IRQ wait function detects whether interrupts are enabled (EFLAGS IF bit) and temporarily enables them if needed, allowing the driver to work during early init before the kernel calls STI. The scheduler safely handles timer interrupts in this window since no user processes exist yet. Tested with QEMU: drive detected as 1.44M 3.5", registered as /dev/floppy1, full boot succeeds with CD+HDD+floppy attached.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "process.h"
|
||||
#include "syscall.h"
|
||||
#include "keyboard.h"
|
||||
#include "floppy.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* Forward declaration for kernel panic or similar */
|
||||
@@ -64,6 +65,9 @@ void isr_handler(registers_t *regs)
|
||||
} else if (regs->int_no == 33) {
|
||||
/* Keyboard IRQ */
|
||||
keyboard_irq(regs);
|
||||
} else if (regs->int_no == 38) {
|
||||
/* Floppy IRQ */
|
||||
floppy_irq();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user