Update The Floppy Driver
This commit is contained in:
parent
e73fb1f303
commit
b0b2b4e9e5
11
Makefile
11
Makefile
@ -5,7 +5,10 @@ include build_scripts/config.mk
|
||||
all: floppy_image tools_fat
|
||||
|
||||
include build_scripts/toolchain.mk
|
||||
|
||||
# oldnum = cat version
|
||||
# newnum = expr $(oldnum) + 1
|
||||
# export oldnum
|
||||
# export newnum
|
||||
|
||||
#
|
||||
# Floppy image
|
||||
@ -58,8 +61,12 @@ $(BUILD_DIR)/tools/fat: always tools/fat/fat.c
|
||||
#
|
||||
# Always
|
||||
#
|
||||
always:
|
||||
always:
|
||||
mkdir -p $(BUILD_DIR)
|
||||
# echo Version $(oldnum)
|
||||
# sed -i '9i s/#define VERSION "RD-//#define VERSION "RD-$(newnum)/"' src/libs/version.h
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Clean
|
||||
|
||||
@ -6,16 +6,33 @@
|
||||
#include "floppy.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <util/binary.h>
|
||||
#include <arch/i686/io.h>
|
||||
#include <arch/i686/irq.h>
|
||||
|
||||
#define PORT_FLOPPY_TYPE 0x10
|
||||
|
||||
void Floppy_Handler()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// I cannot get this to work for the life of me,
|
||||
// OSDEV Wiki says its meant to be CMOS Register 0x10, which seems to be 0xFF for me...
|
||||
// 0xFF, is NOT a vaild value at all...
|
||||
// Basically Gonna hard-code the driver for 1.44MB Drives
|
||||
// Since Nanite is only capable of running off one without modifications to the bootloader,
|
||||
// this is not an issue... but its sure as shit annoying
|
||||
int Master_FDD_Detect()
|
||||
{
|
||||
int Buffer;
|
||||
uint8_t Buffer;
|
||||
int FDDType;
|
||||
int bit1, bit2, bit3, bit4;
|
||||
/* FDD Drive Values
|
||||
Value: Drive Type:
|
||||
00h no drive
|
||||
@ -26,13 +43,21 @@ int Master_FDD_Detect()
|
||||
05h 2.88 MB 3.5 drive*/
|
||||
Buffer = i686_inb(PORT_FLOPPY_TYPE);
|
||||
|
||||
int bit = Byte_Parse(Buffer, 0);
|
||||
int i = 1;
|
||||
while(i < 4) {
|
||||
FDDType = bit & bit;
|
||||
bit = Byte_Parse(Buffer, i);
|
||||
i++;
|
||||
}
|
||||
// bit1 = Byte_Parse(Buffer, 0);
|
||||
// bit2 = Byte_Parse(Buffer, 1);
|
||||
// bit3 = Byte_Parse(Buffer, 2);
|
||||
// bit4 = Byte_Parse(Buffer, 3);
|
||||
// printf("Bits: %d, %d, %d, %d\n", bit1, bit2, bit3, bit4);
|
||||
printf("Buffer: %s", Buffer);
|
||||
// int bit = Byte_Parse(Buffer, 0);
|
||||
// int i = 1;
|
||||
// while(i < 4) {
|
||||
// FDDType = bit & bit;
|
||||
// bit = Byte_Parse(Buffer, i);
|
||||
// i++;
|
||||
// printf("MFDD Bit %d: %d\n", i, bit);
|
||||
// }
|
||||
FDDType = bit1 & bit2 & bit3 & bit4;
|
||||
return FDDType;
|
||||
}
|
||||
|
||||
@ -50,12 +75,13 @@ int Slave_FDD_Detect()
|
||||
05h 2.88 MB 3.5 drive*/
|
||||
Buffer = i686_inb(PORT_FLOPPY_TYPE);
|
||||
|
||||
int bit = Byte_Parse(Buffer, 4);
|
||||
int i = 5;
|
||||
int bit = Byte_Parse(Buffer, 3);
|
||||
int i = 4;
|
||||
while(i < 8) {
|
||||
FDDType = bit & bit;
|
||||
bit = Byte_Parse(Buffer, i);
|
||||
i++;
|
||||
printf("SFDD Bit %d: %d\n", i, bit);
|
||||
}
|
||||
return FDDType;
|
||||
}
|
||||
@ -5,5 +5,29 @@
|
||||
\*----------------*/
|
||||
#pragma once
|
||||
|
||||
int Master_FDD_Detect();
|
||||
int Slave_FDD_Detect();
|
||||
void Floppy_Handler();
|
||||
|
||||
enum FloppyCommands
|
||||
{
|
||||
READ_TRACK = 2, // generates IRQ6
|
||||
SPECIFY = 3, // * set drive parameters
|
||||
SENSE_DRIVE_STATUS = 4,
|
||||
WRITE_DATA = 5, // * write to the disk
|
||||
READ_DATA = 6, // * read from the disk
|
||||
RECALIBRATE = 7, // * seek to cylinder 0
|
||||
SENSE_INTERRUPT = 8, // * ack IRQ6, get status of last command
|
||||
WRITE_DELETED_DATA = 9,
|
||||
READ_ID = 10, // generates IRQ6
|
||||
READ_DELETED_DATA = 12,
|
||||
FORMAT_TRACK = 13, // *
|
||||
DUMPREG = 14,
|
||||
SEEK = 15, // * seek both heads to cylinder X
|
||||
VERSION = 16, // * used during initialization, once
|
||||
SCAN_EQUAL = 17,
|
||||
PERPENDICULAR_MODE = 18, // * used during initialization, once, maybe
|
||||
CONFIGURE = 19, // * set controller parameters
|
||||
LOCK = 20, // * protect controller params from a reset
|
||||
VERIFY = 22,
|
||||
SCAN_LOW_OR_EQUAL = 25,
|
||||
SCAN_HIGH_OR_EQUAL = 29
|
||||
};
|
||||
@ -16,6 +16,7 @@
|
||||
#include <dri/disk/floppy.h>
|
||||
#include <dri/disk/ata.h>
|
||||
#include <util/param.h>
|
||||
#include <util/util.h>
|
||||
#include "../libs/version.h"
|
||||
#include "../libs/boot/bootparams.h"
|
||||
|
||||
@ -65,18 +66,10 @@ void __attribute__((section(".entry"))) start(BootParams* bootParams) {
|
||||
printf("Done!\n");
|
||||
|
||||
printf("Load Basic Storage Drivers...");
|
||||
masterFDDType = Master_FDD_Detect();
|
||||
slaveFDDType = Slave_FDD_Detect();
|
||||
i686_IRQ_RegisterHandler(6, Floppy_Handler);
|
||||
printf("Done!\n");
|
||||
// Nightmare to print the Storage Types.
|
||||
// Im gonna Make a Full Function For Showing ATA and FDD Types in Util.h later on,
|
||||
// this IS temporary.
|
||||
if (masterFDDType == 0) printf("No Master Floppy Drive Detected!\n");
|
||||
if (masterFDDType == 1) printf("Master Floppy Drive Detected!\nType: 360 KB 5.25 Inch Drive\n");
|
||||
if (masterFDDType == 2) printf("Master Floppy Drive Detected!\nType: 1.2 MB 5.25 Inch Drive\n");
|
||||
if (masterFDDType == 3) printf("Master Floppy Drive Detected!\nType: 720 KB 3.5 Inch Drive\n");
|
||||
if (masterFDDType == 4) printf("Master Floppy Drive Detected!\nType: 1.44 MB 3.5 Inch Drive\n");
|
||||
if (masterFDDType == 5) printf("Master Floppy Drive Detected!\nType: 2.88 MB 3.5 Inch Drive\n");
|
||||
|
||||
|
||||
|
||||
|
||||
// Debug Info for Memory :3 i REALLY need to make a like serial debug output thingy
|
||||
|
||||
@ -3,9 +3,10 @@
|
||||
|Copyright (C) 2024|
|
||||
|Tyler McGurrin |
|
||||
\*----------------*/
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int string_length(char s[]) {
|
||||
int i = 0;
|
||||
while (s[i] != '\0') {
|
||||
@ -20,3 +21,20 @@ void append(char s[], char n) {
|
||||
s[len + 1] = '\0';
|
||||
}
|
||||
|
||||
void Print_Storage_Types(int masterFDDType, int slaveFDDType)
|
||||
{
|
||||
// Master FDD
|
||||
if (masterFDDType == 0) printf("No Master Floppy Drive Detected!\n");
|
||||
if (masterFDDType == 1) printf("Master Floppy Drive Detected!\nType: 360 KB 5.25 Inch Drive\n");
|
||||
if (masterFDDType == 2) printf("Master Floppy Drive Detected!\nType: 1.2 MB 5.25 Inch Drive\n");
|
||||
if (masterFDDType == 3) printf("Master Floppy Drive Detected!\nType: 720 KB 3.5 Inch Drive\n");
|
||||
if (masterFDDType == 4) printf("Master Floppy Drive Detected!\nType: 1.44 MB 3.5 Inch Drive\n");
|
||||
if (masterFDDType == 5) printf("Master Floppy Drive Detected!\nType: 2.88 MB 3.5 Inch Drive\n");
|
||||
// Slave FDD
|
||||
if (slaveFDDType == 0) printf("No Slave Floppy Drive Detected!\n");
|
||||
if (slaveFDDType == 1) printf("Slave Floppy Drive Detected!\nType: 360 KB 5.25 Inch Drive\n");
|
||||
if (slaveFDDType == 2) printf("Slave Floppy Drive Detected!\nType: 1.2 MB 5.25 Inch Drive\n");
|
||||
if (slaveFDDType == 3) printf("Slave Floppy Drive Detected!\nType: 720 KB 3.5 Inch Drive\n");
|
||||
if (slaveFDDType == 4) printf("Slave Floppy Drive Detected!\nType: 1.44 MB 3.5 Inch Drive\n");
|
||||
if (slaveFDDType == 5) printf("Slave Floppy Drive Detected!\nType: 2.88 MB 3.5 Inch Drive\n");
|
||||
}
|
||||
@ -4,4 +4,5 @@
|
||||
|Tyler McGurrin |
|
||||
\*----------------*/
|
||||
int string_length(char s[]);
|
||||
void append(char s[], char n);
|
||||
void append(char s[], char n);
|
||||
void Print_Storage_Types(int masterFDDType, int slaveFDDType);
|
||||
@ -4,7 +4,7 @@
|
||||
|Tyler McGurrin |
|
||||
\*----------------*/
|
||||
#pragma once
|
||||
// Version Info MUST stay on line 9! (it gets incremented on build!)
|
||||
|
||||
#define LOGO " _ _____ _ __________________\n / | / / | / | / / _/_ __/ ____/\n / |/ / /| | / |/ // / / / / __/ \n / /| / ___ |/ /| // / / / / /___ \n/_/ |_/_/ |_/_/ |_/___/ /_/ /_____/ \n"
|
||||
#define VERSION "RD-00010"
|
||||
#define VERSION "RD-00012"
|
||||
#define BOOTLOGO " _ ______ ____ ____ ______\n / | / / __ )/ __ \\/ __ /_ __/\n / |/ / __ / / / / / / // / \n / /| / /_/ / /_/ / /_/ // / \n/_/ |_/_____/\\____/\\____//_/ \n"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user