1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +00:00

Merge Disk namespace into the IDEDiskDevice class.

This commit is contained in:
Andreas Kling 2018-11-10 15:15:31 +01:00
parent cba05ce75e
commit b8264e7d47
10 changed files with 231 additions and 244 deletions

View file

@ -1,13 +1,16 @@
#pragma once
#include <AK/Lock.h>
#include <AK/RetainPtr.h>
#include <VirtualFileSystem/DiskDevice.h>
#include "IRQHandler.h"
class IDEDiskDevice final : public DiskDevice {
class IDEDiskDevice final : public IRQHandler, public DiskDevice {
public:
static RetainPtr<IDEDiskDevice> create();
virtual ~IDEDiskDevice();
virtual ~IDEDiskDevice() override;
// ^DiskDevice
virtual unsigned blockSize() const override;
virtual bool readBlock(unsigned index, byte*) const override;
virtual bool writeBlock(unsigned index, const byte*) override;
@ -16,6 +19,28 @@ protected:
IDEDiskDevice();
private:
// ^IRQHandler
virtual void handleIRQ() override;
// ^DiskDevice
virtual const char* className() const override;
struct CHS {
dword cylinder;
word head;
word sector;
};
CHS lba_to_chs(dword) const;
void initialize();
bool wait_for_irq();
bool read_sectors(dword start_sector, word count, byte* outbuf);
SpinLock m_lock;
word m_cylinders { 0 };
word m_heads { 0 };
word m_sectors_per_track { 0 };
mutable volatile bool m_interrupted { false };
};