mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 05:32:13 +00:00
Kernel: Initial FDC Device Driver (#315)
A basic Floppy Disk Controller device driver for any system later than (and including) the IBM AT. The driver is based on the documentation supplied by QEMU, which is the datasheet for the Intel 82078 Floppy Disk controller (found here: 29047403
.pdf)
Naturally, floppy disks are a _very_ outdated storage medium, however, as Serenity is a throwback to aesthetic 90s computing, it's a definite must have. Not to mention that there are still a lot of floppy disks around, with countless petabytes of software on them, so it would be nice if people could create images of said disks with serenity.
The code for this is mostly clean. however there are a LOT of values specified in the datasheet, so some of them might be wrong, not to mention that the actual specification itself is rather dirt and seemingly hacked together.
I'm also only supporting 3.5" floppy disks, without PIO polling (DMA only), so if you want anything more/less than 1.44MB HD Floppys, you'll have to do it yourself.
This commit is contained in:
parent
4f94fbc9e1
commit
10ffaf019f
4 changed files with 731 additions and 0 deletions
|
@ -7,9 +7,11 @@
|
|||
#include <Kernel/Arch/i386/CPU.h>
|
||||
#include <Kernel/Arch/i386/PIC.h>
|
||||
#include <Kernel/Arch/i386/PIT.h>
|
||||
#include <Kernel/CMOS.h>
|
||||
#include <Kernel/Devices/BXVGADevice.h>
|
||||
#include <Kernel/Devices/DebugLogDevice.h>
|
||||
#include <Kernel/Devices/DiskPartition.h>
|
||||
#include <Kernel/Devices/FloppyDiskDevice.h>
|
||||
#include <Kernel/Devices/FullDevice.h>
|
||||
#include <Kernel/Devices/IDEDiskDevice.h>
|
||||
#include <Kernel/Devices/KeyboardDevice.h>
|
||||
|
@ -136,6 +138,24 @@ VFS* vfs;
|
|||
vfs->mount(ProcFS::the(), "/proc");
|
||||
vfs->mount(DevPtsFS::the(), "/dev/pts");
|
||||
|
||||
// Now, detect whether or not there are actually any floppy disks attached to the system
|
||||
u8 detect = CMOS::read(0x10);
|
||||
RefPtr<FloppyDiskDevice> fd0;
|
||||
RefPtr<FloppyDiskDevice> fd1;
|
||||
if ((detect >> 4) & 0x4) {
|
||||
fd0 = FloppyDiskDevice::create(FloppyDiskDevice::DriveType::Master);
|
||||
kprintf("fd0 is 1.44MB floppy drive\n");
|
||||
} else {
|
||||
kprintf("fd0 type unsupported! Type == 0x%x\n", detect >> 4);
|
||||
}
|
||||
|
||||
if (detect & 0x0f) {
|
||||
fd0 = FloppyDiskDevice::create(FloppyDiskDevice::DriveType::Slave);
|
||||
kprintf("fd1 is 1.44MB floppy drive");
|
||||
} else {
|
||||
kprintf("fd1 type unsupported! Type == 0x%x\n", detect & 0x0f);
|
||||
}
|
||||
|
||||
int error;
|
||||
|
||||
auto* system_server_process = Process::create_user_process("/bin/SystemServer", (uid_t)100, (gid_t)100, (pid_t)0, error, {}, {}, tty0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue