Max OS 0.3
Loading...
Searching...
No Matches
disk.cpp
Go to the documentation of this file.
1
9#include <drivers/disk/disk.h>
10
11using namespace MaxOS;
12using namespace MaxOS::common;
13using namespace MaxOS::drivers;
14using namespace MaxOS::drivers::disk;
15
16Disk::Disk() = default;
17
18Disk::~Disk() = default;
19
27
28 size_t amount = (data_buffer->capacity() > 512) ? 512 : data_buffer->capacity();
30
31}
32
43
51
52 size_t amount = (data->capacity() > 512) ? 512 : data->capacity();
53 write(sector, data, amount);
54
55}
56
65}
66
73}
74
81
88 return "Disk";
89}
90
97 return "Generic";
98}
Wrapper class for a region of bytes in memor in an attempt to add some memory safety....
Definition buffer.h:25
size_t capacity() const
The max bytes the buffer can currently store.
Definition buffer.cpp:95
Stores the left, top, width and height of a rectangle.
Definition rectangle.h:22
virtual void activate()
Activate the driver.
Definition driver.cpp:25
void activate() override
Activate the disk driver.
Definition disk.cpp:78
string vendor_name() override
Get the vendor name.
Definition disk.cpp:96
string device_name() override
Get the device name.
Definition disk.cpp:87
void write(uint32_t sector, common::buffer_t *data)
write data to the disk from a buffer (max capacity 512 bytes)
Definition disk.cpp:50
void read(uint32_t sector, common::buffer_t *data_buffer)
read data from the disk into a buffer (max capacity 512 bytes)
Definition disk.cpp:26
virtual void flush()
Flush the disk cache.
Definition disk.cpp:72
Defines a generic Disk driver for reading and writing data to disk drives.