luxos/Kernel/drivers/floppy/floppy.h
Tiberiu Chibici caa7718af9 [GOOD] BUILD 0.1.0.551 DATE 9/03/2011 AT 9:25 AM
====================================================
Mainly changed: HAL.FSs
+ Updated 'mount' call in floppy driver, now done after controller is
initialized
+ Added 'detect' function for FAT file systems
+ Implemented 'initdr' driver, however still bugged
+ Improved logger
2021-09-14 18:51:43 +03:00

93 lines
3.2 KiB
C

/*
* floppy.h
*
* Created on: Aug 20, 2011
* Author: Tiberiu
*/
#ifndef FLOPPY_H_
#define FLOPPY_H_
#include <types.h>
enum FloppyRegisters
{
FloppyRegisterStatusA = 0x3F0, // read-only
FloppyRegisterStatusB = 0x3F1, // read-only
FloppyRegisterDigitalOutput = 0x3F2,
FloppyRegisterTapeDrive = 0x3F3,
FloppyRegisterMainStatus = 0x3F4, // read-only
FloppyRegisterDatarateSelect = 0x3F4, // write-only
FloppyRegisterFIFO = 0x3F5,
FloppyRegisterDigitalInput = 0x3F7, // read-only
FloppyRegisterConfigurationControl = 0x3F7 // write-only
};
enum FloppyCommands
{
FloppyCommandReadTrack = 2, // generates IRQ6
FloppyCommandSpecify = 3, // * set drive parameters
FloppyCommandSenseDriveStatus = 4,
FloppyCommandWriteData = 5, // * write to the disk
FloppyCommandReadData = 6, // * read from the disk
FloppyCommandRecalibrate = 7, // * seek to cylinder 0
FloppyCommandSenseInterrupt = 8, // * ack IRQ6, get status of last command
FloppyCommandWriteDeletedData = 9,
FloppyCommandReadID = 10, // generates IRQ6
FloppyCommandReadDeletedData = 12,
FloppyCommandFormatTrack = 13, // *
FloppyCommandSeek = 15, // * seek both heads to cylinder X
FloppyCommandVersion = 16, // * used during initialization, once
FloppyCommandScanEqual = 17,
FloppyCommandPerpendicularMode = 18, // * used during initialization, once, maybe
FloppyCommandConfigure = 19, // * set controller parameters
FloppyCommandLock = 20, // * protect controller params from a reset
FloppyCommandVerify = 22,
FloppyCommandScanLowOrEqual = 25,
FloppyCommandScanHighOrEqual = 29,
FloppyModeMultitrack = 0x80,
FloppyModeMagneticEncoding = 0x40, // always set for read/write/verify/format
FloppyModeSkip = 0x20
};
enum FloppyMSRMasks
{
FloppyMsrRQM = 0x80,
FloppyMsrDIO = 0x40,
FloppyMsrNDMA = 0x20,
FloppyMsrBusy = 0x10
};
typedef struct {
uint32 Size, SectorsPerTrack, Heads, Tracks;
uint8 Gap, DataRate, Spec1, SRT, HLT, HUT;
uint32 Spinup, Spindown, InterruptTimeout;
string Name;
} FloppyType;
extern void FloppyInitialize();
extern void FloppyIrqHandler(_RegsStack32 *r);
extern void FloppyWaitIrq();
extern void FloppyInitDma();
extern void FloppyReset();
extern void FloppyConfigure();
extern void FloppySendCommand (uint8 command);
extern uint8 FloppyReadData ();
extern void FloppySenseInterrupt(uint8 *st0, uint8 *cyl);
extern void FloppySpecify (uint8 fd);
extern void FloppyMotor (uint8 fd_number, uint8 status);
extern void FloppySelectDrive(uint8 number);
extern void FloppyRecalibrate(uint8 fd_number);
extern void FloppyRW(uint8 isWrite, uint8 fd_number, uint8 head, uint8 cylinder, uint8 sector);
extern uint32 FloppyRead(uint8 drive, uint32 lba);
extern uint32 FloppyWrite(uint8 drive, uint32 lba);
extern uint32 Floppy0ReadRoutine (uint32 offset, void* buffer);
extern uint32 Floppy1ReadRoutine (uint32 offset, void* buffer);
extern uint32 Floppy0WriteRoutine (uint32 offset, void* buffer);
extern uint32 Floppy1WriteRoutine (uint32 offset, void* buffer);
#endif /* FLOPPY_H_ */