Max OS 0.3
Loading...
Searching...
No Matches
disk.h
Go to the documentation of this file.
1
9#ifndef MAXOS_DRIVERS_DISK_H
10#define MAXOS_DRIVERS_DISK_H
11
12#include <common/outputStream.h>
13#include <common/buffer.h>
14#include <drivers/driver.h>
15#include <cstdint>
16
17
18namespace MaxOS::drivers::disk {
19
24 class Disk : public Driver {
25
26 public:
27 Disk();
28 ~Disk();
29
30 void read(uint32_t sector, common::buffer_t* data_buffer);
31 virtual void read(uint32_t sector, common::buffer_t* data_buffer, size_t amount);
32
33 void write(uint32_t sector, common::buffer_t* data);
34 virtual void write(uint32_t sector, common::buffer_t* data, size_t count);
35
36 virtual void flush();
37
38 void activate() override;
39
40 string device_name() override;
41 string vendor_name() override;
42 };
43}
44
45
46#endif //MAXOS_DRIVERS_DISK_H
Defines a Buffer class for safe memory operations.
Wrapper class for a region of bytes in memor in an attempt to add some memory safety....
Definition buffer.h:25
base class for all drivers, handles the activation, deactivation, initialisation and reset of the dri...
Definition driver.h:27
Generic Disk, handles the reading and writing of data to the hard drive.
Definition disk.h:24
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 base Driver class and DriverManager for managing drivers.
Defines OutputStream and GenericOutputStream classes for writing data to streams.