diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
index 0d5a1347..2ace56d6 100644
--- a/docs/CONTRIBUTING.md
+++ b/docs/CONTRIBUTING.md
@@ -16,7 +16,7 @@ To keep the code understanble please make sure it is formatted and reable. Addit
## We Use [GitHub Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
Pull requests are the best way to propose changes to the codebase (we use [GitHub Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
-1. Fork the repo and create your branch from `master`.
+1. Fork the repo and create your branch from `m_is_master`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
diff --git a/docs/Notes.md b/docs/Notes.md
index 61be7284..2bc9dfe9 100644
--- a/docs/Notes.md
+++ b/docs/Notes.md
@@ -252,8 +252,8 @@ Here are the notes on graphics for the operating system. (May need to read hardw
- However, communicating with these ports aren't that easy as there is an index port (to tell where the data should be put) and a data port (push the data)
- And on the CRTC port there is special indexes and data that has to be set for it to unlocked before writing actual data (the reason it has to be unlocked is that if incorrect data is the hardware could be damaged)
- Similarly, the AC port has to be reset before each index & data write.
-- The VGA class that was written should have a class above that call graphicsContext which would define methods such as render_pixel(...), drawRect(...), draw_line(...), draw_circle(...) and sub-classes such as color.
-- The draw functions should rely on the render_pixel function therefore in different graphics modes that are derived from that graphicsContext class can be supported.
+- The VGA class that was written should have a class above that call m_graphics_context which would define methods such as render_pixel(...), drawRect(...), draw_line(...), draw_circle(...) and sub-classes such as color.
+- The draw functions should rely on the render_pixel function therefore in different graphics modes that are derived from that m_graphics_context class can be supported.
### VESA
- VESA is a legacy extension to VGA that allows for a higher color depth and larger screen resolutions
@@ -283,16 +283,16 @@ Here are the notes on graphics for the operating system. (May need to read hardw
### GUI - Framework
See also: Bresenham line algorithm (use for later)
-- The GUI framework will have a base class called Widget, which should have a draw function. This draw function would get a graphicsContext and draw itself onto of it using the graphicContext's draw methods.
+- The GUI framework will have a base class called Widget, which should have a draw function. This draw function would get a m_graphics_context and draw itself onto of it using the graphicContext's draw methods.
- Thees widgets will have parents and such, therefore their draw positions will be relative, meaning there has to be a function to get the absolute position.
- Widgets will also have a m_width and m_height, and a function to check if a co-ordinate is inside itself (used for mouse handling and such)
-- To handle mouse input, the widget will use a mouse event handler and handle the events onMouseDown, onMouseMoveWidget, onMouseUpEvent. However, the mouse handler won't be on the widget itself, rather it would be on the desktop.
+- To handle mouse input, the widget will use a mouse event handler and handle the events onMouseDown, onMouseMoveWidget, on_mouse_up_event. However, the mouse handler won't be on the widget itself, rather it would be on the desktop.
- This is because the mouse movement is reported in relative-ness not absolute position (desktop would store mouse position and update it based on the movement, the object can just query the x,y pos from the desktop).
- A subclass of the widget would be a composite class, which would contain an array of child widgets, and it would pass methods on to the children (e.g. the child gets drawn last so its on m_top)
- To get which widget to preform the keyEvent or mouseEvent the desktop will have a function of getting the focused widget
- The desktop will work like the composite widget, but will have to override the mouseHandler class as mouse passes movement in relative to last position (moved x pixels) so the desktop will have to translate the restiveness into absolute positions
- For better performance, instead of re-drawing the screen every time just draw it once and then when a gui object changes (e.g. moving a window) memory the object to the new state and then redraw any invalid parts (invalid is where places where there used to be the gui object)
-- To draw text the "modes.c" has various 8x8 Bitmap fonts. Using these fonts a Text widget can be made that gets the characters of a string from the font and then print all the pixels in that character.
+- To draw text the "modes.c" has various 8x8 Bitmap fonts. Using these fonts a Text widget can be made that gets the characters of a string from the m_font and then print all the pixels in that character.
# System Stuff
@@ -343,7 +343,7 @@ See also [Double Linked List](https://en.wikipedia.org/wiki/Linked_list#Doubly_l
- - size_t : size
- These Memory Chunks are just a linked list (double linked) and every chunk that has dropped from the RAM will be entered into the list, which is how the OS will keep track of used / free memory
- More than one free chunk in a row is bad as it means larger data that could have had fit into those two chunks if they were combined won't be able to. This can be prevented merging a chunk with another if it is deallocated next to another un allocated chunk.
-- To find memory easier see [multiboot.h](https://github.com/cstack/osdev/blob/master/multiboot.h), however I will implement my own for copyright reasons which will just use the multiboot structure
+- To find memory easier see [multiboot.h](https://github.com/cstack/osdev/blob/m_is_master/multiboot.h), however I will implement my own for copyright reasons which will just use the multiboot structure
- Now that there is memory management objects will be able to use the "new" and "delete" methods, allowing for virtual deconstructions
- However, if there is no free memory then the function will return 0 which would work if in user space as memory pointer 0 is out of bounds. The OS cant throw an exception like c++ normally would as currently there is no exception handler
diff --git a/docs/Styles/Coding Style.md b/docs/Styles/Coding Style.md
index 8c74289a..2610cb6e 100644
--- a/docs/Styles/Coding Style.md
+++ b/docs/Styles/Coding Style.md
@@ -1,4 +1,4 @@
-
+
# MaxOS C++ coding style
diff --git a/docs/Styles/Interface Style.md b/docs/Styles/Interface Style.md
index e6231bf2..abaf4500 100644
--- a/docs/Styles/Interface Style.md
+++ b/docs/Styles/Interface Style.md
@@ -76,4 +76,4 @@ Ellipses should be used sparingly elsewhere to avoid confusion with elision.
- Browse...
- Insert Emoji...
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/kernel/include/common/inputStream.h b/kernel/include/common/inputStream.h
index be51616f..7b28a9f3 100644
--- a/kernel/include/common/inputStream.h
+++ b/kernel/include/common/inputStream.h
@@ -309,7 +309,7 @@ namespace maxOS{
*/
template void InputStreamBuffer::on_stream_read(Type read_element) {
- // Flush the buffer if the event fire element is read
+ // flush the buffer if the event fire element is read
if(read_element == m_event_fire_element){
flush();
return;
@@ -333,7 +333,7 @@ namespace maxOS{
*/
template void InputStreamBuffer::on_end_of_stream(GenericInputStream *stream) {
- // Flush the buffer if there is any data in it
+ // flush the buffer if there is any data in it
if(m_offset > 0)
flush();
diff --git a/kernel/include/common/outputStream.h b/kernel/include/common/outputStream.h
index 7f35c633..bfb5a28a 100644
--- a/kernel/include/common/outputStream.h
+++ b/kernel/include/common/outputStream.h
@@ -52,7 +52,7 @@ namespace maxOS{
virtual void write(string string_to_write) override;
virtual void write_char(char char_to_write);
virtual void write_int(int int_to_write);
- virtual void writeHex(uint32_t hex_to_write);
+ virtual void write_hex(uint32_t hex_to_write);
OutputStream& operator << (string string_to_write) override;
OutputStream& operator << (int int_to_write);
diff --git a/kernel/include/drivers/ata.h b/kernel/include/drivers/ata.h
index 9ee9a9f9..6856ddf5 100644
--- a/kernel/include/drivers/ata.h
+++ b/kernel/include/drivers/ata.h
@@ -16,35 +16,31 @@ namespace maxOS{
class AdvancedTechnologyAttachment{
protected:
- hardwarecommunication::Port16Bit dataPort;
- hardwarecommunication::Port8Bit errorPort;
- hardwarecommunication::Port8Bit sectorCountPort;
- hardwarecommunication::Port8Bit LBAlowPort;
- hardwarecommunication::Port8Bit LBAmidPort;
- hardwarecommunication::Port8Bit LBAHiPort;
- hardwarecommunication::Port8Bit devicePort;
- hardwarecommunication::Port8Bit commandPort;
- hardwarecommunication::Port8Bit controlPort;
- bool master;
- uint16_t bytesPerSector;
-
- common::OutputStream* ataMessageStream;
+ hardwarecommunication::Port16Bit m_data_port;
+ hardwarecommunication::Port8Bit m_error_port;
+ hardwarecommunication::Port8Bit m_sector_count_port;
+ hardwarecommunication::Port8Bit m_LBA_low_port;
+ hardwarecommunication::Port8Bit m_LBA_mid_port;
+ hardwarecommunication::Port8Bit m_LBA_high_Port;
+ hardwarecommunication::Port8Bit m_device_port;
+ hardwarecommunication::Port8Bit m_command_port;
+ hardwarecommunication::Port8Bit m_control_port;
+ bool m_is_master;
+ uint16_t m_bytes_per_sector { 512 };
+
+ common::OutputStream* ata_message_stream;
public:
- AdvancedTechnologyAttachment(uint16_t portBase, bool master, common::OutputStream* ataMessageStream);
+ AdvancedTechnologyAttachment(uint16_t port_base, bool master, common::OutputStream* output_stream);
~AdvancedTechnologyAttachment();
- void Identify();
- void Read28(uint32_t sector, uint8_t* data, int count);
- void Write28(uint32_t sector, uint8_t* data, int count);
- void Flush(); //Flush Cache //TODO: See also vid 19 24:20
+ void identify();
+ void read_28(uint32_t sector, uint8_t* data, int count);
+ void write_28(uint32_t sector, uint8_t* data, int count);
+ void flush(); //TODO: See also vid 19 24:20
//TODO: Make into driver class
-
-
};
-
}
-
}
#endif //MAXOS_DRIVERS_ATA_H
diff --git a/kernel/include/drivers/clock/clock.h b/kernel/include/drivers/clock/clock.h
index 9a266c26..7bf117c5 100644
--- a/kernel/include/drivers/clock/clock.h
+++ b/kernel/include/drivers/clock/clock.h
@@ -29,7 +29,7 @@ namespace maxOS {
class TimeEvent : public common::Event{
public:
common::Time* time;
- TimeEvent(common::Time* time);
+ TimeEvent(common::Time*);
~TimeEvent();
};
@@ -71,7 +71,7 @@ namespace maxOS {
uint16_t m_ticks_until_next_event { 1 };
// Other functions
- void handle_interrupt() override;
+ void handle_interrupt() final;
uint8_t read_hardware_clock(uint8_t address);
uint8_t binary_representation(uint8_t number);
@@ -82,8 +82,8 @@ namespace maxOS {
void activate() override;
void delay(uint32_t milliseconds);
- string get_vendor_name() override;
- string get_device_name() override;
+ string get_vendor_name() final;
+ string get_device_name() final;
};
}
diff --git a/kernel/include/drivers/console/textmode.h b/kernel/include/drivers/console/textmode.h
index 6a60ef49..66b4a5e2 100644
--- a/kernel/include/drivers/console/textmode.h
+++ b/kernel/include/drivers/console/textmode.h
@@ -17,24 +17,23 @@ namespace maxOS{
class TextModeConsole : public Driver, public Console
{
+ protected:
+ uint16_t* m_video_memory { (uint16_t*)0xB8000 };
public:
TextModeConsole();
~TextModeConsole();
- uint16_t width();
- uint16_t height();
-
- void put_character(uint16_t x, uint16_t y, char c);
- void set_foreground_color(uint16_t x, uint16_t y, ConsoleColour foreground);
- void set_background_color(uint16_t x, uint16_t y, ConsoleColour background);
+ uint16_t width() final;
+ uint16_t height() final;
- char get_character(uint16_t x, uint16_t y);
- ConsoleColour get_foreground_color(uint16_t x, uint16_t y);
- ConsoleColour get_background_color(uint16_t x, uint16_t y);
+ void put_character(uint16_t x, uint16_t y, char c) final;
+ void set_foreground_color(uint16_t x, uint16_t y, ConsoleColour) final;
+ void set_background_color(uint16_t x, uint16_t y, ConsoleColour) final;
- protected:
- uint16_t* videoMemory;
+ char get_character(uint16_t x, uint16_t y) final;
+ ConsoleColour get_foreground_color(uint16_t x, uint16_t y) final;
+ ConsoleColour get_background_color(uint16_t x, uint16_t y) final;
};
}
diff --git a/kernel/include/drivers/console/vesaboot.h b/kernel/include/drivers/console/vesaboot.h
index b097aa5e..4d1c4d07 100644
--- a/kernel/include/drivers/console/vesaboot.h
+++ b/kernel/include/drivers/console/vesaboot.h
@@ -20,29 +20,26 @@ namespace maxOS{
{
public:
- VESABootConsole(common::GraphicsContext* graphicsContext);
+ VESABootConsole(common::GraphicsContext*);
~VESABootConsole();
- uint16_t width();
- uint16_t height();
+ uint16_t width() final;
+ uint16_t height() final;
- void put_character(uint16_t x, uint16_t y, char c);
- void set_foreground_color(uint16_t x, uint16_t y, ConsoleColour foreground);
- void set_background_color(uint16_t x, uint16_t y, ConsoleColour background);
+ void put_character(uint16_t x, uint16_t y, char) final;
+ void set_foreground_color(uint16_t x, uint16_t y, ConsoleColour) final;
+ void set_background_color(uint16_t x, uint16_t y, ConsoleColour) final;
- char get_character(uint16_t x, uint16_t y);
- ConsoleColour get_foreground_color(uint16_t x, uint16_t y);
- ConsoleColour get_background_color(uint16_t x, uint16_t y);
+ char get_character(uint16_t x, uint16_t y) final;
+ ConsoleColour get_foreground_color(uint16_t x, uint16_t y) final;
+ ConsoleColour get_background_color(uint16_t x, uint16_t y) final;
- common::Colour consoleColourToVESA(ConsoleColour colour);
-
- // pointer to the video memory
- uint16_t* videoMemory;
+ common::Colour console_colour_to_vesa(ConsoleColour);
protected:
-
- common::GraphicsContext* graphicsContext;
- gui::AmigaFont font;
+ uint16_t* m_video_memory;
+ common::GraphicsContext* m_graphics_context;
+ gui::AmigaFont m_font;
};
}
diff --git a/kernel/include/drivers/driver.h b/kernel/include/drivers/driver.h
index ee089794..5641bfd2 100644
--- a/kernel/include/drivers/driver.h
+++ b/kernel/include/drivers/driver.h
@@ -21,14 +21,15 @@ namespace maxOS
protected:
public:
- common::OutputStream* driverMessageStream;
+ common::OutputStream* m_driver_message_stream;
+
Driver(common::OutputStream* driverMessageStream = 0);
~Driver();
- void errorMessage(string message);
- void errorMessage(char charToWrite);
- void errorMessage(int intToWrite);
- void errorMessage(uint32_t hexToWrite);
+ void error_message(string message);
+ void error_message(char char_to_write);
+ void error_message(int int_to_write);
+ void error_message(uint32_t hex_to_write);
virtual void activate();
virtual void deactivate();
@@ -45,7 +46,7 @@ namespace maxOS
public:
DriverSelectorEventHandler();
~DriverSelectorEventHandler();
- virtual void onDriverSelected(Driver* driver);
+ virtual void on_driver_selected(Driver*);
};
class DriverSelector
@@ -53,19 +54,19 @@ namespace maxOS
public:
DriverSelector();
~DriverSelector();
- virtual void selectDrivers(DriverSelectorEventHandler* handler, hardwarecommunication::InterruptManager* interruptManager, common::OutputStream* errorMessageStream);
+ virtual void select_drivers(DriverSelectorEventHandler* handler, hardwarecommunication::InterruptManager* interruptManager, common::OutputStream* errorMessageStream);
};
class DriverManager : public DriverSelectorEventHandler {
- public:
- common::Vector drivers;
public:
DriverManager();
~DriverManager();
- void addDriver(Driver*);
- void removeDriver(Driver*);
- void onDriverSelected(Driver* driver);
+ void add_driver(Driver*);
+ void remove_driver(Driver*);
+ void on_driver_selected(Driver*);
+
+ common::Vector drivers;
};
}
}
diff --git a/kernel/include/drivers/peripherals/keyboard.h b/kernel/include/drivers/peripherals/keyboard.h
index 73b8dd91..ecdc7193 100644
--- a/kernel/include/drivers/peripherals/keyboard.h
+++ b/kernel/include/drivers/peripherals/keyboard.h
@@ -194,23 +194,22 @@ namespace maxOS
};
class KeyboardState{
- public:
- KeyboardState();
- ~KeyboardState();
-
- // Left and Right
- bool leftShift;
- bool rightShift;
- bool leftControl;
- bool rightControl;
- bool leftAlt;
- bool rightAlt;
-
- // Other Stuff
- bool capsLock;
- bool numberPadLock;
- bool scrollLock;
-
+ public:
+ KeyboardState();
+ ~KeyboardState();
+
+ // Left and Right
+ bool left_shift { false };
+ bool right_shift { false };
+ bool left_control { false };
+ bool right_control { false };
+ bool left_alt { false };
+ bool right_alt { false };
+
+ // Other Stuff
+ bool caps_lock { false };
+ bool number_pad_lock { false };
+ bool scroll_lock { false };
};
enum KeyboardEvents{
@@ -220,20 +219,20 @@ namespace maxOS
class KeyUpEvent : public common::Event{
public:
- KeyUpEvent(KeyCode keyCode, KeyboardState keyboardState);
+ KeyUpEvent(KeyCode, KeyboardState);
~KeyUpEvent();
- KeyCode keyCode;
- KeyboardState keyboardState;
+ KeyCode key_code;
+ KeyboardState keyboard_state;
};
class KeyDownEvent : public common::Event{
public:
- KeyDownEvent(KeyCode keyCode, KeyboardState keyboardState);
+ KeyDownEvent(KeyCode, KeyboardState);
~KeyDownEvent();
- KeyCode keyCode;
- KeyboardState keyboardState;
+ KeyCode key_code;
+ KeyboardState keyboard_state;
};
class KeyboardEventHandler : public common::EventHandler{
@@ -241,176 +240,173 @@ namespace maxOS
KeyboardEventHandler();
~KeyboardEventHandler();
- virtual common::Event*
- on_event(common::Event* event);
+ virtual common::Event* on_event(common::Event*);
- virtual void onKeyDown(KeyCode keyDownCode, KeyboardState keyDownState);
- virtual void onKeyUp(KeyCode keyUpCode, KeyboardState keyUpState);
+ virtual void on_key_down(KeyCode, KeyboardState);
+ virtual void on_key_up(KeyCode, KeyboardState);
};
class KeyboardInterpreter : public common::InputStreamEventHandler, public common::EventManager{
- protected:
- KeyboardState keyBoardState;
+ protected:
+ KeyboardState m_keyboard_state;
- bool nextIsExtendedCode0; // Some keyboard codes are 2 bytes long
- uint8_t currentExtendedCode1;
- uint16_t extendedCode1Buffer;
+ bool m_next_is_extended_code_0 { false };
+ uint8_t m_current_extended_code_1 { 0 };
+ uint16_t m_extended_code_1_buffer { 0 };
- public:
- KeyboardInterpreter();
- ~KeyboardInterpreter();
+ public:
+ KeyboardInterpreter();
+ ~KeyboardInterpreter();
- void onKeyRead(bool released, KeyboardState state, KeyCode keyCode);
+ void onKeyRead(bool, KeyboardState, KeyCode);
};
class KeyboardInterpreterEN_US : public KeyboardInterpreter{
- public:
-
- enum KeyCodeEN_US {
- // First Row
- escape = 0x01,
- f1 = 0x3B,
- f2 = 0x3C,
- f3 = 0x3D,
- f4 = 0x3E,
- f5 = 0x3F,
- f6 = 0x40,
- f7 = 0x41,
- f8 = 0x42,
- f9 = 0x43,
- f10 = 0x44,
- f11 = 0x57,
- f12 = 0x58,
- printScreen = 0x37,
- scrollLock = 0x46,
- pauseBreak = 0x45,
-
- // Second Row
- squigglyLine = 0x29,
- one = 0x02,
- two = 0x03,
- three = 0x04,
- four = 0x05,
- five = 0x06,
- six = 0x07,
- seven = 0x08,
- eight = 0x09,
- nine = 0x0A,
- zero = 0x0B,
- minus = 0x0C,
- equals = 0x0D,
- backspace = 0x0E,
- insert = 0x52,
- home = 0x47,
- pageUp = 0x49,
- numberPadLock = 0x45,
- numberPadForwardSlash = 0x35,
- numberPadMultiply = 0x37,
- numberPadMinus = 0x4A,
-
- // Third Row
- tab = 0x0F,
- Q = 0x10,
- W = 0x11,
- E = 0x12,
- R = 0x13,
- T = 0x14,
- Y = 0x15,
- U = 0x16,
- I = 0x17,
- O = 0x18,
- P = 0x19,
- openSquareBracket = 0x1A,
- closeSquareBracket = 0x1B,
- backslash = 0x2B,
- deleteKey = 0x53,
- end = 0x4F,
- pageDown = 0x51,
- numberPadSeven = 0x47,
- numberPadEight = 0x48,
- numberPadNine = 0x49,
- numberPadPlus = 0x4E,
-
- // Fourth Row
- capsLock = 0x3A,
- A = 0x1E,
- S = 0x1F,
- D = 0x20,
- F = 0x21,
- G = 0x22,
- H = 0x23,
- J = 0x24,
- K = 0x25,
- L = 0x26,
- semicolon = 0x27,
- apostrophe = 0x28,
- enter = 0x1C,
- numberPadFour = 0x4B,
- numberPadFive = 0x4C,
- numberPadSix = 0x4D,
-
- // Fifth Row
- leftShift = 0x2A,
- Z = 0x2C,
- X = 0x2D,
- C = 0x2E,
- V = 0x2F,
- B = 0x30,
- N = 0x31,
- M = 0x32,
- comma = 0x33,
- fullStop = 0x34,
- forwardSlash = 0x35,
- rightShift = 0x36,
- upArrow = 0x48,
- numberPadOne = 0x4F,
- numberPadTwo = 0x50,
- numberPadThree = 0x51,
- numberPadEnter = 0x1C,
-
- // Sixth Row
- leftControl = 0x1D,
- leftOS = 0x5B,
- leftAlt = 0x38,
- space = 0x39,
- rightAlt = 0x38,
- function = 0x5D,
- rightControl = 0x1D,
- leftArrow = 0x4B,
- downArrow = 0x50,
- rightArrow = 0x4D,
- numberPadZero = 0x52,
- numberPadFullStop = 0x53
- };
-
- KeyboardInterpreterEN_US();
- ~KeyboardInterpreterEN_US();
-
- void on_stream_read(uint8_t scanCode) override;
+ public:
+
+ enum KeyCodeEN_US {
+ // First Row
+ escape = 0x01,
+ f1 = 0x3B,
+ f2 = 0x3C,
+ f3 = 0x3D,
+ f4 = 0x3E,
+ f5 = 0x3F,
+ f6 = 0x40,
+ f7 = 0x41,
+ f8 = 0x42,
+ f9 = 0x43,
+ f10 = 0x44,
+ f11 = 0x57,
+ f12 = 0x58,
+ printScreen = 0x37,
+ scrollLock = 0x46,
+ pauseBreak = 0x45,
+
+ // Second Row
+ squigglyLine = 0x29,
+ one = 0x02,
+ two = 0x03,
+ three = 0x04,
+ four = 0x05,
+ five = 0x06,
+ six = 0x07,
+ seven = 0x08,
+ eight = 0x09,
+ nine = 0x0A,
+ zero = 0x0B,
+ minus = 0x0C,
+ equals = 0x0D,
+ backspace = 0x0E,
+ insert = 0x52,
+ home = 0x47,
+ pageUp = 0x49,
+ numberPadLock = 0x45,
+ numberPadForwardSlash = 0x35,
+ numberPadMultiply = 0x37,
+ numberPadMinus = 0x4A,
+
+ // Third Row
+ tab = 0x0F,
+ Q = 0x10,
+ W = 0x11,
+ E = 0x12,
+ R = 0x13,
+ T = 0x14,
+ Y = 0x15,
+ U = 0x16,
+ I = 0x17,
+ O = 0x18,
+ P = 0x19,
+ openSquareBracket = 0x1A,
+ closeSquareBracket = 0x1B,
+ backslash = 0x2B,
+ deleteKey = 0x53,
+ end = 0x4F,
+ pageDown = 0x51,
+ numberPadSeven = 0x47,
+ numberPadEight = 0x48,
+ numberPadNine = 0x49,
+ numberPadPlus = 0x4E,
+
+ // Fourth Row
+ capsLock = 0x3A,
+ A = 0x1E,
+ S = 0x1F,
+ D = 0x20,
+ F = 0x21,
+ G = 0x22,
+ H = 0x23,
+ J = 0x24,
+ K = 0x25,
+ L = 0x26,
+ semicolon = 0x27,
+ apostrophe = 0x28,
+ enter = 0x1C,
+ numberPadFour = 0x4B,
+ numberPadFive = 0x4C,
+ numberPadSix = 0x4D,
+
+ // Fifth Row
+ leftShift = 0x2A,
+ Z = 0x2C,
+ X = 0x2D,
+ C = 0x2E,
+ V = 0x2F,
+ B = 0x30,
+ N = 0x31,
+ M = 0x32,
+ comma = 0x33,
+ fullStop = 0x34,
+ forwardSlash = 0x35,
+ rightShift = 0x36,
+ upArrow = 0x48,
+ numberPadOne = 0x4F,
+ numberPadTwo = 0x50,
+ numberPadThree = 0x51,
+ numberPadEnter = 0x1C,
+
+ // Sixth Row
+ leftControl = 0x1D,
+ leftOS = 0x5B,
+ leftAlt = 0x38,
+ space = 0x39,
+ rightAlt = 0x38,
+ function = 0x5D,
+ rightControl = 0x1D,
+ leftArrow = 0x4B,
+ downArrow = 0x50,
+ rightArrow = 0x4D,
+ numberPadZero = 0x52,
+ numberPadFullStop = 0x53
+ };
+
+ KeyboardInterpreterEN_US();
+ ~KeyboardInterpreterEN_US();
+
+ void on_stream_read(uint8_t scan_code) final;
};
class KeyboardDriver : public hardwarecommunication::InterruptHandler, public Driver, public common::GenericInputStream{
- hardwarecommunication::Port8Bit dataPort;
- hardwarecommunication::Port8Bit commandPort;
+ protected:
+ hardwarecommunication::Port8Bit m_data_port;
+ hardwarecommunication::Port8Bit m_command_port;
- public:
- KeyboardDriver(hardwarecommunication::InterruptManager *manager);
- ~KeyboardDriver();
+ public:
+ KeyboardDriver(hardwarecommunication::InterruptManager*);
+ ~KeyboardDriver();
- void handle_interrupt();
+ void handle_interrupt() final;
- virtual void activate();
- string get_device_name();
+ void activate() final;
+ string get_device_name() final;
};
-
}
-
-
}
}
diff --git a/kernel/include/drivers/peripherals/mouse.h b/kernel/include/drivers/peripherals/mouse.h
index d8195072..3253baef 100644
--- a/kernel/include/drivers/peripherals/mouse.h
+++ b/kernel/include/drivers/peripherals/mouse.h
@@ -35,14 +35,14 @@ namespace maxOS {
class MouseDownEvent : public common::Event{
public:
uint8_t button;
- MouseDownEvent(uint8_t button);
+ MouseDownEvent(uint8_t);
~MouseDownEvent();
};
class MouseUpEvent : public common::Event{
public:
uint8_t button;
- MouseUpEvent(uint8_t button);
+ MouseUpEvent(uint8_t);
~MouseUpEvent();
};
@@ -53,30 +53,30 @@ namespace maxOS {
~MouseEventHandler();
common::Event*
- on_event(common::Event* event);
+ on_event(common::Event*) override;
- virtual void onMouseDownEvent(uint8_t button);
- virtual void onMouseUpEvent(uint8_t button);
- virtual void onMouseMoveEvent(int8_t x, int8_t y);
+ virtual void on_mouse_down_event(uint8_t button);
+ virtual void on_mouse_up_event(uint8_t button);
+ virtual void on_mouse_move_event(int8_t x, int8_t y);
};
class MouseDriver : public hardwarecommunication::InterruptHandler, public Driver, public common::EventManager{
- hardwarecommunication::Port8Bit dataPort;
- hardwarecommunication::Port8Bit commandPort;
+ hardwarecommunication::Port8Bit data_port;
+ hardwarecommunication::Port8Bit command_port;
void handle_interrupt();
uint8_t buffer[3];
- uint8_t offest;
- uint8_t buttons;
+ uint8_t offset { 2 };
+ uint8_t buttons { 0 };
public:
MouseDriver(hardwarecommunication::InterruptManager *manager);
~MouseDriver();
- virtual void activate();
- string get_device_name();
+ void activate() final;
+ string get_device_name() final;
};
}
}
diff --git a/kernel/include/drivers/video/vesa.h b/kernel/include/drivers/video/vesa.h
index e50a07e7..adbde325 100644
--- a/kernel/include/drivers/video/vesa.h
+++ b/kernel/include/drivers/video/vesa.h
@@ -12,7 +12,6 @@
#include
#include
-// Thanks to https://wiki.osdev.org/User:Omarrx024/VESA_Tutorial for the VESA documentation
namespace maxOS {
@@ -20,95 +19,31 @@ namespace maxOS {
namespace video {
- typedef struct vbe_info_structure {
- char signature[4]; // must be "VESA" to indicate valid VBE support
- uint16_t version; // VBE version; high byte is major version, low byte is minor version
- uint32_t oem; // segment:offset pointer to OEM
- uint32_t capabilities; // bitfield that describes card capabilities
- uint32_t video_modes; // segment:offset pointer to list of supported video modes
- uint16_t video_memory; // amount of video memory in 64KB blocks
- uint16_t software_rev; // software revision
- uint32_t vendor; // segment:offset to card vendor string
- uint32_t product_name; // segment:offset to card model name
- uint32_t product_rev; // segment:offset pointer to product revision
- char reserved[222]; // reserved for future expansion
- char oem_data[256]; // OEM BIOSes store their strings in this area
- } __attribute__ ((packed)) vesa_control_info_t;
-
- typedef struct vbe_mode_info_structure {
- uint16_t attributes; // deprecated, only bit 7 should be of interest to you, and it indicates the mode supports a linear frame buffer.
- uint8_t window_a; // deprecated
- uint8_t window_b; // deprecated
- uint16_t granularity; // deprecated; used while calculating bank numbers
- uint16_t window_size;
- uint16_t segment_a;
- uint16_t segment_b;
- uint32_t win_func_ptr; // deprecated; used to switch banks from protected mode without returning to real mode
- uint16_t pitch; // number of bytes per horizontal line
- uint16_t width; // m_width in pixels
- uint16_t height; // m_height in pixels
- uint8_t w_char; // unused...
- uint8_t y_char; // ...
- uint8_t planes;
- uint8_t bpp; // bits per pixel in this mode
- uint8_t banks; // deprecated; total number of banks in this mode
- uint8_t memory_model;
- uint8_t bank_size; // deprecated; size of a bank, almost always 64 KB but may be 16 KB...
- uint8_t image_pages;
- uint8_t reserved0;
-
- uint8_t red_mask;
- uint8_t red_position;
- uint8_t green_mask;
- uint8_t green_position;
- uint8_t blue_mask;
- uint8_t blue_position;
- uint8_t reserved_mask;
- uint8_t reserved_position;
- uint8_t direct_color_attributes;
-
- uint32_t framebuffer; // physical address of the linear frame buffer; write here to draw to the screen
- uint32_t off_screen_mem_off;
- uint16_t off_screen_mem_size; // size of memory in the framebuffer but not being displayed on the screen
- uint8_t reserved1[206];
- } __attribute__ ((packed)) vesa_mode_info_t;
-
- typedef struct vbe2_pmi_table {
- uint16_t set_window; // offset in table for protected mode code for function 0x4F05
- uint16_t set_display_start; // offset in table for protected mode code for function 0x4F07
- uint16_t set_pallette; // offset in table for protected mode code for function 0x4F09
- } __attribute__ ((packed)) vbe2_pmi_table_t;
-
- class VideoElectronicsStandardsAssociationDriver : public VideoDriver {
+ class VideoElectronicsStandardsAssociation : public VideoDriver {
private:
- vesa_control_info_t* vesaControlInfo;
- vesa_mode_info_t* vesaModeInfo;
- vbe2_pmi_table_t* vbe2PmiTable;
- uint16_t vesaMode;
-
bool init();
protected:
- bool internalSetMode( uint32_t width, uint32_t height, uint32_t colorDepth);
+ bool internal_set_mode(uint32_t width, uint32_t height, uint32_t) final;
- void render_pixel_32_bit( uint32_t x, uint32_t y, uint32_t colour);
- uint32_t get_rendered_pixel_32_bit(uint32_t x, uint32_t y);
+ void render_pixel_32_bit( uint32_t x, uint32_t y, uint32_t colour) final;
+ uint32_t get_rendered_pixel_32_bit(uint32_t x, uint32_t y) final;
- system::multiboot_info_t* multibootInfo;
+ system::multiboot_info_t* m_multiboot_info;
- uint32_t* framebufferAddress;
- uint8_t bpp; // bits per pixel in this mode
- uint16_t pitch; // number of bytes per horizontal line
+ uint32_t* m_framebuffer_address;
+ uint8_t m_bpp;
+ uint16_t m_pitch;
public:
- VideoElectronicsStandardsAssociationDriver(system::multiboot_info_t* mb_info);
- ~VideoElectronicsStandardsAssociationDriver();
+ VideoElectronicsStandardsAssociation(system::multiboot_info_t* mb_info);
+ ~VideoElectronicsStandardsAssociation();
- bool supportsMode( uint32_t width, uint32_t height, uint32_t colorDepth);
+ bool supports_mode( uint32_t width, uint32_t height, uint32_t) final;
- string get_vendor_name();
- string get_device_name();
+ string get_vendor_name() final;
+ string get_device_name() final;
};
diff --git a/kernel/include/drivers/video/vga.h b/kernel/include/drivers/video/vga.h
index 032b7833..cabac699 100644
--- a/kernel/include/drivers/video/vga.h
+++ b/kernel/include/drivers/video/vga.h
@@ -19,29 +19,24 @@ namespace maxOS{
class VideoGraphicsArray : public VideoDriver{
protected:
- uint8_t* FrameBufferSegment;
- //-The CRT Controller (CRTC) is responsible for controlling the output of video data to the display monitor.
- //-The graphics controller is responsible for managing the interface between CPU and video memory.
- //-The sequencer manages the interface between the video data and RAMDAC.
-
- hardwarecommunication::Port8Bit miscPort; //Miscellaneous
- hardwarecommunication::Port8Bit crtcIndexPort; //cathode ray tube controller (index)
- hardwarecommunication::Port8Bit crtcDataPort; //cathode ray tube controller (data)
- hardwarecommunication::Port8Bit sequenceIndexPort; //Sequence Index
- hardwarecommunication::Port8Bit sequenceDataPort; //Sequence Data
- hardwarecommunication::Port8Bit graphicsControllerIndexPort; //Graphics Controller Index
- hardwarecommunication::Port8Bit graphicsControllerDataPort; //Graphics Controller Data
- hardwarecommunication::Port8Bit attributeControllerIndexPort; //Attribute Controller Index
- hardwarecommunication::Port8Bit attributeControllerReadPort; //Attribute Controller Read
- hardwarecommunication::Port8Bit attributeControllerWritePort; //Attribute Controller Write
- hardwarecommunication::Port8Bit attributeControllerResetPort; //Attribute Controller Reset
-
- void WriteRegisters(uint8_t* registers); //Send Initialization codes to corresponding port
- uint8_t* GetFrameBufferSegment(); //Get offset for segment wanted to use
-
- bool internalSetMode(uint32_t width, uint32_t height, uint32_t colourDepth);
- void render_pixel_8_bit(uint32_t x, uint32_t y, uint8_t colour);
- uint8_t get_rendered_pixel_8_bit(uint32_t x, uint32_t y);
+ hardwarecommunication::Port8Bit m_misc_port;
+ hardwarecommunication::Port8Bit m_crtc_index_port;
+ hardwarecommunication::Port8Bit crtc_data_port;
+ hardwarecommunication::Port8Bit m_sequence_index_port;
+ hardwarecommunication::Port8Bit m_sequence_data_port;
+ hardwarecommunication::Port8Bit m_graphics_controller_index_port;
+ hardwarecommunication::Port8Bit m_graphics_controller_data_port;
+ hardwarecommunication::Port8Bit m_attribute_controller_index_port;
+ hardwarecommunication::Port8Bit m_attribute_controller_read_port;
+ hardwarecommunication::Port8Bit m_attribute_controller_write_port;
+ hardwarecommunication::Port8Bit m_attribute_controller_reset_port;
+
+ void write_registers(uint8_t* registers);
+ uint8_t* get_frame_buffer_segment();
+
+ bool internal_set_mode(uint32_t width, uint32_t height, uint32_t colour_depth) final;
+ void render_pixel_8_bit(uint32_t x, uint32_t y, uint8_t colour) final;
+ uint8_t get_rendered_pixel_8_bit(uint32_t x, uint32_t y) final;
public:
VideoGraphicsArray();
@@ -50,10 +45,9 @@ namespace maxOS{
string get_vendor_name();
string get_device_name();
- bool supportsMode(uint32_t width, uint32_t height, uint32_t colourDepth);
- };
+ bool supports_mode(uint32_t width, uint32_t height, uint32_t colour_depth);
+ };
}
-
}
}
diff --git a/kernel/include/drivers/video/video.h b/kernel/include/drivers/video/video.h
index caecb2d5..97fd962f 100644
--- a/kernel/include/drivers/video/video.h
+++ b/kernel/include/drivers/video/video.h
@@ -18,15 +18,14 @@ namespace maxOS
class VideoDriver : public Driver, public common::GraphicsContext {
protected:
- virtual bool internalSetMode(uint32_t width, uint32_t height, uint32_t colorDepth);
+ virtual bool internal_set_mode(uint32_t width, uint32_t height, uint32_t color_depth);
public:
VideoDriver();
~VideoDriver();
- virtual bool supportsMode(uint32_t width, uint32_t height, uint32_t colorDepth);
- bool setMode(uint32_t width, uint32_t height, uint32_t colorDepth);
- virtual bool setTextMode();
+ virtual bool supports_mode(uint32_t width, uint32_t height, uint32_t color_depth);
+ bool set_mode(uint32_t width, uint32_t height, uint32_t colorDepth);
};
}
diff --git a/kernel/include/gui/desktop.h b/kernel/include/gui/desktop.h
index 21e14da4..e9ca1e28 100644
--- a/kernel/include/gui/desktop.h
+++ b/kernel/include/gui/desktop.h
@@ -44,12 +44,13 @@ namespace maxOS{
void invalidate(common::Rectangle& area);
// Overrides mouse event m_handlers
- void onMouseMoveEvent(int8_t x, int8_t y);
- void onMouseDownEvent(uint8_t button);
- void onMouseUpEvent(uint8_t button);
+ void on_mouse_move_event(int8_t x, int8_t y);
+ void on_mouse_down_event(uint8_t button);
+ void on_mouse_up_event(uint8_t button);
- void onKeyDown(drivers::peripherals::KeyCode keyDownCode, drivers::peripherals::KeyboardState keyDownState);
- void onKeyUp(drivers::peripherals::KeyCode keyUpCode, drivers::peripherals::KeyboardState keyUpState);
+ void
+ on_key_down(drivers::peripherals::KeyCode keyDownCode, drivers::peripherals::KeyboardState keyDownState);
+ void on_key_up(drivers::peripherals::KeyCode keyUpCode, drivers::peripherals::KeyboardState keyUpState);
};
}
diff --git a/kernel/include/gui/widget.h b/kernel/include/gui/widget.h
index 15ca1c90..005909f7 100644
--- a/kernel/include/gui/widget.h
+++ b/kernel/include/gui/widget.h
@@ -125,7 +125,7 @@ namespace maxOS{
WidgetMoverResizer(Widget* widget);
~WidgetMoverResizer();
- void onMouseMoveEvent(int8_t x, int8_t y);
+ void on_mouse_move_event(int8_t x, int8_t y);
};
@@ -170,7 +170,7 @@ namespace maxOS{
* @param x The x position of the mouse
* @param y The y position of the mouse
*/
- template void WidgetMoverResizer::onMouseMoveEvent(int8_t x, int8_t y)
+ template void WidgetMoverResizer::on_mouse_move_event(int8_t x, int8_t y)
{
Widget* targ = this->targettedWidget;
diff --git a/kernel/include/gui/widgets/inputbox.h b/kernel/include/gui/widgets/inputbox.h
index d32b297c..fe146c70 100644
--- a/kernel/include/gui/widgets/inputbox.h
+++ b/kernel/include/gui/widgets/inputbox.h
@@ -54,7 +54,7 @@ namespace maxOS{
void onFocus();
void onFocusLost();
- void onKeyDown(drivers::peripherals::KeyCode keyDownCode, drivers::peripherals::KeyboardState keyDownState);
+ void on_key_down(drivers::peripherals::KeyCode keyDownCode, drivers::peripherals::KeyboardState keyDownState);
void updateText(string newText);
string getText();
diff --git a/kernel/include/gui/widgets/text.h b/kernel/include/gui/widgets/text.h
index 21ea17d2..0b968294 100644
--- a/kernel/include/gui/widgets/text.h
+++ b/kernel/include/gui/widgets/text.h
@@ -22,7 +22,7 @@ namespace maxOS {
public:
- //TODO: Redo so that it uses some generified font class
+ //TODO: Redo so that it uses some generified m_font class
AmigaFont font;
common::Colour foregroundColour;
diff --git a/kernel/include/hardwarecommunication/pci.h b/kernel/include/hardwarecommunication/pci.h
index 951f69f6..9fb9dc26 100644
--- a/kernel/include/hardwarecommunication/pci.h
+++ b/kernel/include/hardwarecommunication/pci.h
@@ -86,7 +86,7 @@ namespace maxOS
PeripheralComponentInterconnectController(common::OutputStream* debugMessagesStream);
~PeripheralComponentInterconnectController();
- void selectDrivers(drivers::DriverSelectorEventHandler* handler, hardwarecommunication::InterruptManager* interruptManager, common::OutputStream* errorMessageStream);
+ void select_drivers(drivers::DriverSelectorEventHandler *handler, hardwarecommunication::InterruptManager* interruptManager, common::OutputStream *errorMessageStream);
drivers::Driver* GetDriver(PeripheralComponentInterconnectDeviceDescriptor dev, InterruptManager* interruptManager);
void listKnownDeivce(PeripheralComponentInterconnectDeviceDescriptor dev);
};
diff --git a/kernel/src/common/outputStream.cpp b/kernel/src/common/outputStream.cpp
index d7566813..63703916 100644
--- a/kernel/src/common/outputStream.cpp
+++ b/kernel/src/common/outputStream.cpp
@@ -150,7 +150,7 @@ void OutputStream::write_int(int int_to_write) {
* @brief Writes a hex to the output stream.
* @param writeHex The hex to write to the output stream.
*/
-void OutputStream::writeHex(uint32_t hex_to_write) {
+void OutputStream::write_hex(uint32_t hex_to_write) {
// Write the hex prefix to the output stream
write("0x");
@@ -200,8 +200,8 @@ OutputStream &OutputStream::operator << (int int_to_write) {
*/
OutputStream &OutputStream::operator << (uint32_t hex_to_write) {
- // Call the writeHex function to write the hex to the output stream
- writeHex(hex_to_write);
+ // Call the write_hex function to write the hex to the output stream
+ write_hex(hex_to_write);
// Return the output stream
return *this;
diff --git a/kernel/src/drivers/ata.cpp b/kernel/src/drivers/ata.cpp
index 681eb89c..eaad76b4 100644
--- a/kernel/src/drivers/ata.cpp
+++ b/kernel/src/drivers/ata.cpp
@@ -9,20 +9,20 @@ using namespace maxOS::common;
using namespace maxOS::hardwarecommunication;
using namespace maxOS::drivers;
-AdvancedTechnologyAttachment::AdvancedTechnologyAttachment(uint16_t portBase, bool master, OutputStream* ataMessageStream)
-: dataPort(portBase),
- errorPort(portBase + 1),
- sectorCountPort(portBase + 2),
- LBAlowPort(portBase + 3),
- LBAmidPort(portBase + 4),
- LBAHiPort(portBase + 5),
- devicePort(portBase + 6),
- commandPort(portBase + 7),
- controlPort(portBase + 0x206)
+AdvancedTechnologyAttachment::AdvancedTechnologyAttachment(uint16_t port_base, bool master, OutputStream*output_stream)
+: m_data_port(port_base),
+ m_error_port(port_base + 1),
+ m_sector_count_port(port_base + 2),
+ m_LBA_low_port(port_base + 3),
+ m_LBA_mid_port(port_base + 4),
+ m_LBA_high_Port(port_base + 5),
+ m_device_port(port_base + 6),
+ m_command_port(port_base + 7),
+ m_control_port(port_base + 0x206),
+ m_is_master(master),
+ ata_message_stream(output_stream)
{
- bytesPerSector = 512;
- this -> master = master;
- this -> ataMessageStream = ataMessageStream;
+
}
AdvancedTechnologyAttachment::~AdvancedTechnologyAttachment() {
@@ -30,226 +30,182 @@ AdvancedTechnologyAttachment::~AdvancedTechnologyAttachment() {
}
/**
- * @details This function Identifiers the ATA device
+ * @brief Identify the ATA device
*/
-void AdvancedTechnologyAttachment::Identify() {
-
- devicePort.Write(master ? 0xA0 : 0xB0); //Select Device Master(0xA0) / Slave(0xB0)
- controlPort.Write(0); //Clear HOB bit (HOB : Set this to read back the High Order Byte of the last LBA48 value sent to an IO port.)
-
- //Floating Bus check : First you select the master, then read in the value of the status register and then compare it with 0xFF (is an invalid status value).
- devicePort.Write(0xA0); //Select Master (0xA0)
- uint8_t status = commandPort.Read(); //Read Status
- if(status == 0xFF){ //IF status is 0xFF then there is no device
- ataMessageStream -> write("Invalid Status");
- return; //Return, beacuse if there is no master then there wont be a slave either
- }
-
- devicePort.Write(master ? 0xA0 : 0xB0); //Select Device Master(0xA0) / Slave(0xB0)
- sectorCountPort.Write(0); //Sector Doesn't Matter when Identifying so select sec 0
- LBAlowPort.Write(0); //Same here
- LBAmidPort.Write(0); //Same here
- LBAHiPort.Write(0); //Same here
- commandPort.Write(0x0EC); //Command For Identifying
-
- status = commandPort.Read(); //Read Status
- if(status == 0x00){ //IF status is 0x00 then there is no device
- ataMessageStream -> write("No Device");
- return; //There is no slave/master
- }
-
- //Can take a while for there to be an answer to the identify command,
- while (
- ((status & 0x80) == 0x80) //Device is busy
- &&
- ((status & 0x01) != 0x01) //There was an error
- )
- {
- status = commandPort.Read();
- }
-
- //Check for any errors
- if(status & 0x01){
-
- ataMessageStream -> write("ERROR");
- return;
-
- }
-
- //We are reading 2 bytes from data port so , it will be 256 , so total bytes read are 512 (512 is bytes per sector)
- bool stopPrint = false;
- for (uint16_t i = 0; i < 256; ++i) {
-
- uint16_t data = dataPort.Read();
- char *text = " \0";
- text[0] = (data >> 8) & 0xFF;
- text[1] = data & 0xFF;
- if(text[0] == 'K'){
- ataMessageStream -> write(text);
- stopPrint = true; //Stop the messed up text from showing
- }
-
- if(!stopPrint) ataMessageStream -> write(text);
-
- }
-
-
+void AdvancedTechnologyAttachment::identify() {
+
+ // Select the device (master or slave)
+ m_device_port.Write(m_is_master ? 0xA0 : 0xB0);
+
+ // Reset the HOB (High Order Byte)
+ m_control_port.Write(0);
+
+ // Check if the master is present
+ m_device_port.Write(0xA0);
+ uint8_t status = m_command_port.Read();
+ if(status == 0xFF){
+ ata_message_stream-> write("Invalid Status");
+ return;
+ }
+
+ // Select the device (master or slave)
+ m_device_port.Write( m_is_master ? 0xA0 : 0xB0);
+
+ // Clear the ports
+ m_sector_count_port.Write(0);
+ m_LBA_low_port.Write(0);
+ m_LBA_mid_port.Write(0);
+ m_LBA_high_Port.Write(0);
+
+ // Send the identify command
+ m_command_port.Write(0x0EC);
+
+ // Check if the device is present
+ status = m_command_port.Read();
+ if(status == 0x00)
+ return;
+
+ // Wait for the device to be ready or for an error to occur
+ while (((status & 0x80) == 0x80) && ((status & 0x01) != 0x01))
+ status = m_command_port.Read();
+
+ //Check for any errors
+ if(status & 0x01){
+ ata_message_stream-> write("ERROR");
+ return;
+ }
+
+ // Read the data and print it
+ for (uint16_t i = 0; i < 256; ++i) {
+ uint16_t data = m_data_port.Read();
+ char *text = " \0";
+ text[0] = (data >> 8) & 0xFF;
+ text[1] = data & 0xFF;
+ ata_message_stream-> write(text);
+ }
}
/**
- * @details This function reads a sector from the ATA device
+ * @brief Read a sector from the ATA device
*
* @param sector The sector to read
* @param data The data to read into
* @param count The amount of data to read from that sector
*/
-
-void AdvancedTechnologyAttachment::Read28(uint32_t sector, uint8_t* data, int count)
+void AdvancedTechnologyAttachment::read_28(uint32_t sector, uint8_t* data, int count)
{
- //Dont Allow reading More then a sector
- if(sector & 0xF0000000)
- return;
- if(count > bytesPerSector)
+ // Don't allow reading more then a sector
+ if(sector & 0xF0000000 || count > m_bytes_per_sector)
return;
- devicePort.Write((master ? 0xE0 : 0xF0) | ((sector & 0x0F000000) >> 24));
- errorPort.Write(0);
- sectorCountPort.Write(1);
-
+ // Select the device (master or slave) and reset it
+ m_device_port.Write((m_is_master ? 0xE0 : 0xF0) | ((sector & 0x0F000000) >> 24));
+ m_error_port.Write(0);
+ m_sector_count_port.Write(1);
- LBAlowPort.Write( sector & 0x000000FF ); //Split the sector into the port (put the low 8 bits ito this port)
- LBAmidPort.Write( (sector & 0x0000FF00) >> 8); //Split the sector into the port (put the mid 8 bits ito this port)
- LBAHiPort.Write( (sector & 0x00FF0000) >> 16); //Split the sector into the port (put the hi 8 bits ito this port)
- commandPort.Write(0x20); //Command For Reading
+ // Split the sector into the ports
+ m_LBA_low_port.Write( sector & 0x000000FF );
+ m_LBA_mid_port.Write( (sector & 0x0000FF00) >> 8);
+ m_LBA_high_Port.Write( (sector & 0x00FF0000) >> 16);
+ // Send the read command
+ m_command_port.Write(0x20);
+ // Make sure the device is there
+ uint8_t status = m_command_port.Read();
+ if(status == 0x00)
+ return;
-
- uint8_t status = commandPort.Read(); //Read Status
- if(status == 0x00){ //IF status is 0x00 then there is no device
- ataMessageStream -> write("No Device");
- return; //There is no slave/master
- }
-
- //Can take a while for the disk to be fully read
- while(((status & 0x80) == 0x80)
- && ((status & 0x01) != 0x01))
- status = commandPort.Read();
+ // Wait for the device to be ready or for an error to occur
+ while(((status & 0x80) == 0x80) && ((status & 0x01) != 0x01))
+ status = m_command_port.Read();
//Check for any errors
- if(status & 0x01){
+ if(status & 0x01)
return;
- }
-
- //We are reading 2 bytes to the data port so , it will be 256 , so has to be incremented by 2
+ // Read the data and store it in the array
for(uint16_t i = 0; i < count; i+= 2)
{
- uint16_t readData = dataPort.Read();
-
- /*
- string foo = " \0";
- foo[1] = (readData >> 8) & 0x00FF;
- foo[0] = readData & 0x00FF;
- printf(foo);
- */
+ uint16_t read_data = m_data_port.Read();
- //Place into the data array
- data[i] = readData & 0x00FF;
+ data[i] = read_data & 0x00FF;
- //If we are not at the end of the array, place the next byte into the array as it is incremented by 2 each loop
+ // Place the next byte in the array if there is one
if(i+1 < count)
- data[i+1] = (readData >> 8) & 0x00FF;
+ data[i+1] = (read_data >> 8) & 0x00FF;
}
- //Hard Drive must have a full sector read, even if the data isnt the size of a full sector
- for(uint16_t i = count + (count % 2); i < bytesPerSector; i+= 2)
- dataPort.Read();
+ // Read the remaining bytes
+ for(uint16_t i = count + (count % 2); i < m_bytes_per_sector; i+= 2)
+ m_data_port.Read();
}
/**
- * @details This function writes a sector to the ATA device
+ * @brief Write to a sector on the ATA device
*
* @param sector The sector to write to
* @param count The amount of data to write to that sector
*/
-void AdvancedTechnologyAttachment::Write28(uint32_t sector, uint8_t* data, int count){
+void AdvancedTechnologyAttachment::write_28(uint32_t sector, uint8_t* data, int count){
- //Don't Allow Writing More then a sector
- if(sector > 0x0FFFFFFF)
+ // Don't allow writing more then a sector
+ if(sector > 0x0FFFFFFF || count > m_bytes_per_sector)
return;
- if(count > 512)
- return;
-
+ // Select the device (master or slave) and reset it
+ m_device_port.Write(m_is_master ? 0xE0 : 0xF0 | ((sector & 0x0F000000) >> 24) );
+ m_error_port.Write(0);
+ m_sector_count_port.Write(1);
- devicePort.Write(master ? 0xE0 : 0xF0 | ((sector & 0x0F000000) >> 24) ); //Select Device Master(0xE0) / Slave(0xF0), and add spare bits
- errorPort.Write(0); //Clear Previous Errors
- sectorCountPort.Write(1); // For now only read/write a single sector TODO: Fix this
+ // Split the sector into the ports
+ m_LBA_low_port.Write( sector & 0x000000FF );
+ m_LBA_mid_port.Write( (sector & 0x0000FF00) >> 8);
+ m_LBA_high_Port.Write( (sector & 0x00FF0000) >> 16);
+ // Send the write command
+ m_command_port.Write(0x30);
- LBAlowPort.Write( sector & 0x000000FF ); //Split the sector into the port (put the low 8 bits ito this port)
- LBAmidPort.Write( (sector & 0x0000FF00) >> 8); //Split the sector into the port (put the mid 8 bits ito this port)
- LBAHiPort.Write( (sector & 0x00FF0000) >> 16); //Split the sector into the port (put the hi 8 bits ito this port)
- commandPort.Write(0x30); //Command For Writing
+ // Write the data to the device
+ for (uint16_t i = 0; i < m_bytes_per_sector; i+= 2) {
- ataMessageStream -> write("Writing to ATA: ");
+ uint16_t writeData = data[i];
+ // Place the next byte in the array if there is one
+ if(i+1 < count)
+ writeData |= ((uint16_t)data[i+1]) << 8;
- //We are write 2 bytes to the data port so , it will be 256 , so has to be incremented by 2
- for (uint16_t i = 0; i < bytesPerSector ; i+= 2) {
-
- uint16_t writeData = data[i]; //Get the i'th byte from the data
- if(i+1 < count) //Check if next byte is there also
- writeData |= ((uint16_t)data[i+1]) << 8; //Write that byte
- dataPort.Write(writeData); //Write the data
- char *text = " \0";
- text[1] = (writeData >> 8) & 0xFF;
- text[0] = writeData & 0xFF;
-
- if(i < count) //Prevent random shit from throwing up on my screen
- ataMessageStream -> write(text);
+ m_data_port.Write(writeData);
}
- //Hard Drive must have a full sector written, even if the data isnt the size of a full sector
- for(int i = count + (count%2); i < bytesPerSector; i += 2) //If count isnt an even number then it would have already had it's byte written
- dataPort.Write(0x0000);
-
+ // Write the remaining bytes
+ for(int i = count + (count%2); i < m_bytes_per_sector; i += 2)
+ m_data_port.Write(0x0000);
}
/**
- * @details Flush the ATA device
+ * @brief Flush the cache of the ATA device
*/
-void AdvancedTechnologyAttachment::Flush() {
+void AdvancedTechnologyAttachment::flush() {
- devicePort.Write(master ? 0xE0 : 0xF0); //Select Device Master(0xE0) / Slave(0xF0)
+ // Select the device (master or slave)
+ m_device_port.Write(m_is_master ? 0xE0 : 0xF0);
- commandPort.Write(0xE7); //Command For Flushing
+ // Send the flush command
+ m_command_port.Write(0xE7);
- uint8_t status = commandPort.Read(); //Read Status
- if(status == 0x00){ //IF status is 0x00 then there is no device
- ataMessageStream -> write("No Device");
- return; //There is no slave/master
- }
+ // Make sure the device is there
+ uint8_t status = m_command_port.Read();
+ if(status == 0x00)
+ return;
- //Can take a while for there to be an answer to the flush command,
- while (
- ((status & 0x80) == 0x80) //Device is busy
- &&
- ((status & 0x01) != 0x01) //There was an error
- )
- {
- status = commandPort.Read();
- }
- //Check for any errors
- if(status & 0x01){
+ // Wait for the device to be ready or for an error to occur
+ while (((status & 0x80) == 0x80) && ((status & 0x01) != 0x01))
+ status = m_command_port.Read();
- ataMessageStream -> write("ERROR");
- return;
-
- }
+ if(status & 0x01)
+ return;
- //Flush complete
}
diff --git a/kernel/src/drivers/clock/clock.cpp b/kernel/src/drivers/clock/clock.cpp
index d74fcc76..5c38c121 100644
--- a/kernel/src/drivers/clock/clock.cpp
+++ b/kernel/src/drivers/clock/clock.cpp
@@ -169,13 +169,13 @@ void Clock::activate() {
void Clock::delay(uint32_t milliseconds) {
// Round the number of milliseconds to the nearest 100
- uint64_t roundedMilliseconds = ((milliseconds+99)/100);
+ uint64_t rounded_milliseconds = ((milliseconds+99)/100);
// Calculate the number of ticks until the delay is over
- uint64_t ticksUntilDelayIsOver = m_ticks + roundedMilliseconds;
+ uint64_t ticks_until_delay_is_over = m_ticks + rounded_milliseconds;
// Wait until the number of ticks is equal to the number of ticks until the delay is over
- while(m_ticks < ticksUntilDelayIsOver)
+ while(m_ticks < ticks_until_delay_is_over)
asm volatile("nop"); // execute the "nop" assembly instruction, which does nothing, but prevents the compiler from optimizing away the loop
}
diff --git a/kernel/src/drivers/console/textmode.cpp b/kernel/src/drivers/console/textmode.cpp
index 25d2b40d..1f69bbe9 100644
--- a/kernel/src/drivers/console/textmode.cpp
+++ b/kernel/src/drivers/console/textmode.cpp
@@ -11,8 +11,7 @@ using namespace maxOS::drivers::console;
TextModeConsole::TextModeConsole()
: Driver(),
- Console(),
- videoMemory((uint16_t*) 0xb8000)
+ Console()
{
}
@@ -22,18 +21,29 @@ TextModeConsole::~TextModeConsole()
}
+/**
+ * @brief Gets the width of the console
+ *
+ * @return The width of the console in characters
+ */
uint16_t TextModeConsole::width()
{
return 80;
}
+/**
+ * @brief Gets the height of the console
+ *
+ * @return The height of the console in characters
+ */
uint16_t TextModeConsole::height()
{
return 25;
}
/**
- * Places a character at the specified location
+ * @brief Places a character at the specified location if it is in bounds
+ *
* @param x The x coordinate
* @param y The y coordinate
* @param c The character to place
@@ -45,15 +55,16 @@ void TextModeConsole::put_character(uint16_t x, uint16_t y, char c) {
return;
// Calculate the offset
- int offset = (y* width() + x);
+ int offset = (y*width() + x);
// Set the character at the offset, by masking the character with the current character (last 8 bits)
- videoMemory[offset] = (videoMemory[offset] & 0xFF00) | (uint16_t)c;
+ m_video_memory[offset] = (m_video_memory[offset] & 0xFF00) | (uint16_t)c;
}
/**
- * Sets the foreground color at the specified location
+ * @brief Sets the foreground color at the specified location
+ *
* @param x The x coordinate
* @param y The y coordinate
* @param foreground The foreground color
@@ -68,11 +79,12 @@ void TextModeConsole::set_foreground_color(uint16_t x, uint16_t y, ConsoleColour
int offset = (y* width() + x);
// Set the foreground color at the offset, by masking the foreground color with the current foreground color (bits 8-11)
- videoMemory[offset] = (videoMemory[offset] & 0xF0FF) | ((uint16_t)foreground << 8);
+ m_video_memory[offset] = (m_video_memory[offset] & 0xF0FF) | ((uint16_t)foreground << 8);
}
/**
- * Sets the background color at the specified location
+ * @brief Sets the background color at the specified location
+ *
* @param x The x coordinate
* @param y The y coordinate
* @param background The background color
@@ -87,15 +99,16 @@ void TextModeConsole::set_background_color(uint16_t x, uint16_t y, ConsoleColour
int offset = (y* width() + x);
// Set the background color at the offset, by masking the background color with the current background color (bits 12-15)
- videoMemory[offset] = (videoMemory[offset] & 0x0FFF) | ((uint16_t)background << 12);
+ m_video_memory[offset] = (m_video_memory[offset] & 0x0FFF) | ((uint16_t)background << 12);
}
/**
- * Gets the character at the specified location
+ * @brief Gets the character at the specified location
+ *
* @param x The x coordinate
* @param y The y coordinate
- * @return The character at the specified location
+ * @return The character at the specified location or a space if the coordinates are out of bounds
*/
char TextModeConsole::get_character(uint16_t x, uint16_t y) {
@@ -107,14 +120,15 @@ char TextModeConsole::get_character(uint16_t x, uint16_t y) {
int offset = (y* width() + x);
// Return the character at the offset, by masking the character with the current character (last 8 bits)
- return (char)(videoMemory[offset] & 0x00FF);
+ return (char)(m_video_memory[offset] & 0x00FF);
}
/**
- * Gets the foreground color at the specified location
+ * @brief Gets the foreground color at the specified location
+ *
* @param x The x coordinate
* @param y The y coordinate
- * @return The foreground color at the specified location
+ * @return The foreground color at the specified location or white if the coordinates are out of bounds
*/
ConsoleColour TextModeConsole::get_foreground_color(uint16_t x, uint16_t y) {
@@ -126,16 +140,17 @@ ConsoleColour TextModeConsole::get_foreground_color(uint16_t x, uint16_t y) {
int offset = (y* width() + x);
// Return the foreground color at the offset, by masking the foreground color with the current foreground color (bits 8-11)
- return (ConsoleColour)((videoMemory[offset] & 0x0F00) >> 8);
+ return (ConsoleColour)((m_video_memory[offset] & 0x0F00) >> 8);
}
/**
- * Gets the background color at the specified location
+ * @brief Gets the background color at the specified location
+ *
* @param x The x coordinate
* @param y The y coordinate
- * @return The background color at the specified location
+ * @return The background color at the specified location or black if the coordinates are out of bounds
*/
- ConsoleColour TextModeConsole::get_background_color(uint16_t x, uint16_t y) {
+ConsoleColour TextModeConsole::get_background_color(uint16_t x, uint16_t y) {
// If the coordinates are out of bounds, return
if(x >= width() || y >= height())
@@ -145,8 +160,5 @@ ConsoleColour TextModeConsole::get_foreground_color(uint16_t x, uint16_t y) {
int offset = (y* width() + x);
// Return the background color at the offset, by masking the background color with the current background color (bits 12-15)
- return (ConsoleColour)((videoMemory[offset] & 0xF000) >> 12);
-}
-
-
-
+ return (ConsoleColour)((m_video_memory[offset] & 0xF000) >> 12);
+}
\ No newline at end of file
diff --git a/kernel/src/drivers/console/vesaboot.cpp b/kernel/src/drivers/console/vesaboot.cpp
index 216f7149..be12ad8c 100644
--- a/kernel/src/drivers/console/vesaboot.cpp
+++ b/kernel/src/drivers/console/vesaboot.cpp
@@ -11,19 +11,16 @@ using namespace maxOS::memory;
using namespace maxOS::drivers;
using namespace maxOS::drivers::console;
-VESABootConsole::VESABootConsole(GraphicsContext *graphicsContext)
+VESABootConsole::VESABootConsole(GraphicsContext *graphics_context)
: Driver(),
- Console()
+ Console(),
+ m_graphics_context(graphics_context),
+ m_font(AmigaFont())
{
- // Set the graphics context
- this->graphicsContext = graphicsContext;
-
- // Set the font
- this->font = AmigaFont();
-
// Malloc the video memory
- videoMemory = (uint16_t*)MemoryManager::activeMemoryManager->malloc(graphicsContext->get_width() * graphicsContext->get_height() * sizeof(uint16_t));
+ m_video_memory = (uint16_t*)MemoryManager::activeMemoryManager->malloc(
+ graphics_context->get_width() * graphics_context->get_height() * sizeof(uint16_t));
}
VESABootConsole::~VESABootConsole()
@@ -31,17 +28,28 @@ VESABootConsole::~VESABootConsole()
}
+/**
+ * @brief Gets the width of the console
+ *
+ * @return The width of the console in characters
+ */
uint16_t VESABootConsole::width()
{
- return graphicsContext->get_width() / 8; // 8 pixels per character
+ return m_graphics_context->get_width() / 8; // 8 pixels per character
}
+/**
+ * @brief Gets the height of the console
+ *
+ * @return The height of the console in characters
+ */
uint16_t VESABootConsole::height()
{
- return graphicsContext->get_height() / 9; // 9 pixels per character
+ return m_graphics_context->get_height() / 9; // 9 pixels per character
}
/**
- * Places a character at the specified location
+ * @brief Places a character at the specified location
+ *
* @param x The x coordinate
* @param y The y coordinate
* @param c The character to place
@@ -56,23 +64,24 @@ void VESABootConsole::put_character(uint16_t x, uint16_t y, char c) {
int offset = (y* width() + x);
// Set the character at the offset, by masking the character with the current character (last 8 bits)
- videoMemory[offset] = (videoMemory[offset] & 0xFF00) | (uint16_t)c;
+ m_video_memory[offset] = (m_video_memory[offset] & 0xFF00) | (uint16_t)c;
// Convert the char into a string
char* s = " ";
s[0] = c;
- Colour foreground = consoleColourToVESA(get_foreground_color(x, y));
- Colour background = consoleColourToVESA(get_background_color(x, y));
+ Colour foreground = console_colour_to_vesa(get_foreground_color(x, y));
+ Colour background = console_colour_to_vesa(get_background_color(x, y));
- // Use the font to draw the character
- font.drawText(x*8, y*9, foreground, background, graphicsContext, s);
+ // Use the m_font to draw the character
+ m_font.drawText(x*8, y*9, foreground, background, m_graphics_context, s);
}
/**
- * Sets the foreground color at the specified location
+ * @brief Sets the foreground color at the specified location
+ *
* @param x The x coordinate
* @param y The y coordinate
* @param foreground The foreground color
@@ -87,11 +96,12 @@ void VESABootConsole::set_foreground_color(uint16_t x, uint16_t y, ConsoleColour
int offset = (y* width() + x);
// Set the foreground color at the offset, by masking the foreground color with the current foreground color (bits 8-11)
- videoMemory[offset] = (videoMemory[offset] & 0xF0FF) | ((uint16_t)foreground << 8);
+ m_video_memory[offset] = (m_video_memory[offset] & 0xF0FF) | ((uint16_t)foreground << 8);
}
/**
- * Sets the background color at the specified location
+ * @brief Sets the background color at the specified location
+ *
* @param x The x coordinate
* @param y The y coordinate
* @param background The background color
@@ -106,15 +116,16 @@ void VESABootConsole::set_background_color(uint16_t x, uint16_t y, ConsoleColour
int offset = (y* width() + x);
// Set the background color at the offset, by masking the background color with the current background color (bits 12-15)
- videoMemory[offset] = (videoMemory[offset] & 0x0FFF) | ((uint16_t)background << 12);
+ m_video_memory[offset] = (m_video_memory[offset] & 0x0FFF) | ((uint16_t)background << 12);
}
/**
- * Gets the character at the specified location
+ * @brief Gets the character at the specified location
+ *
* @param x The x coordinate
* @param y The y coordinate
- * @return The character at the specified location
+ * @return The character at the specified location or a space if the coordinates are out of bounds
*/
char VESABootConsole::get_character(uint16_t x, uint16_t y) {
@@ -126,14 +137,15 @@ char VESABootConsole::get_character(uint16_t x, uint16_t y) {
int offset = (y* width() + x);
// Return the character at the offset, by masking the character with the current character (last 8 bits)
- return (char)(videoMemory[offset] & 0x00FF);
+ return (char)(m_video_memory[offset] & 0x00FF);
}
/**
- * Gets the foreground color at the specified location
+ * @brief Gets the foreground color at the specified location
+ *
* @param x The x coordinate
* @param y The y coordinate
- * @return The foreground color at the specified location
+ * @return The foreground color at the specified location or white if the coordinates are out of bounds
*/
ConsoleColour VESABootConsole::get_foreground_color(uint16_t x, uint16_t y) {
@@ -145,14 +157,15 @@ ConsoleColour VESABootConsole::get_foreground_color(uint16_t x, uint16_t y) {
int offset = (y* width() + x);
// Return the foreground color at the offset, by masking the foreground color with the current foreground color (bits 8-11)
- return (ConsoleColour)((videoMemory[offset] & 0x0F00) >> 8);
+ return (ConsoleColour)((m_video_memory[offset] & 0x0F00) >> 8);
}
/**
- * Gets the background color at the specified location
+ * @brief Gets the background color at the specified location
* @param x The x coordinate
* @param y The y coordinate
- * @return The background color at the specified location
+ *
+ * @return The background color at the specified location or black if the coordinates are out of bounds
*/
ConsoleColour VESABootConsole::get_background_color(uint16_t x, uint16_t y) {
@@ -164,14 +177,16 @@ ConsoleColour VESABootConsole::get_background_color(uint16_t x, uint16_t y) {
int offset = (y* width() + x);
// Return the background color at the offset, by masking the background color with the current background color (bits 12-15)
- return (ConsoleColour)((videoMemory[offset] & 0xF000) >> 12);
+ return (ConsoleColour)((m_video_memory[offset] & 0xF000) >> 12);
}
-
-
-
-
-Colour VESABootConsole::consoleColourToVESA(ConsoleColour colour) {
+/**
+ * @brief Converts a ConsoleColour to a Colour
+ *
+ * @param colour The ConsoleColour to convert
+ * @return The Colour
+ */
+Colour VESABootConsole::console_colour_to_vesa(ConsoleColour colour) {
switch (colour) {
case Black:
@@ -222,6 +237,4 @@ Colour VESABootConsole::consoleColourToVESA(ConsoleColour colour) {
case White:
return Colour(255, 255, 255);
}
-}
-
-
+}
\ No newline at end of file
diff --git a/kernel/src/drivers/driver.cpp b/kernel/src/drivers/driver.cpp
index ac4d3a4e..9b7fc601 100644
--- a/kernel/src/drivers/driver.cpp
+++ b/kernel/src/drivers/driver.cpp
@@ -8,96 +8,112 @@ using namespace maxOS::common;
using namespace maxOS::drivers;
using namespace maxOS::memory;
-Driver::Driver(OutputStream* driverMessageStream){
-
- // Set the driver message stream
- this -> driverMessageStream = driverMessageStream;
+Driver::Driver(OutputStream* driverMessageStream)
+: m_driver_message_stream(driverMessageStream) {
};
Driver::~Driver(){
- this -> driverMessageStream = 0;
+ this ->m_driver_message_stream = 0;
};
+/**
+ * @brief Activate the driver
+ */
void Driver::activate(){
}
+/**
+ * @brief Deactivate the driver
+ */
void Driver::deactivate(){
}
-
+/**
+ * @brief Initialise the driver
+ */
void Driver::initialise() {
}
-
+/**
+ * @brief Reset the driver
+ *
+ * @return How long in milliseconds it took to reset the driver
+ */
uint32_t Driver::reset(){
return 0;
}
/**
- * @details This function writes a message to the driver message stream if it is not null
- * @param message The message to write
+ * @brief Write a message to the driver message stream if it is not null
+ *
+ * @param message The message to write
*/
-void Driver::errorMessage(string message) {
+void Driver::error_message(string message) {
- // Check if the driver message stream is not null
- if( driverMessageStream != 0) {
- // Write the message to the driver message stream
- driverMessageStream -> write(message);
- }
+ // If there is a driver message stream write the message to it
+ if(m_driver_message_stream != 0)
+ m_driver_message_stream-> write(message);
}
/**
- * @details This function writes a character to the driver message stream if it is not null
- * @param charToWrite The character to write
+ * @brief Write a character to the driver message stream if it is not null
+ *
+ * @param char_to_write The character to write
*/
-void Driver::errorMessage(char charToWrite) {
+void Driver::error_message(char char_to_write) {
- // Check if the driver message stream is not null
- if( driverMessageStream != 0) {
- // Write the character to the driver message stream
- driverMessageStream->write_char(charToWrite);
- }
+ // If there is a driver message stream write the character to it
+ if(m_driver_message_stream != 0)
+ m_driver_message_stream-> write_char(char_to_write);
}
/**
- * @details This function writes a int to the driver message stream if it is not null
- * @param intToWrite The int to write
+ * @brief Write an integer to the driver message stream if it is not null
+ *
+ * @param int_to_write The integer to write
*/
-void Driver::errorMessage(int intToWrite) {
+void Driver::error_message(int int_to_write) {
- // Check if the driver message stream is not null
- if( driverMessageStream != 0) {
- // Write the character to the driver message stream
- driverMessageStream->write_int(intToWrite);
- }
+ // If there is a driver message stream write the integer to it
+ if(m_driver_message_stream != 0)
+ m_driver_message_stream-> write_int(int_to_write);
}
/**
- * @details This function writes a hex to the driver message stream if it is not null
- * @param hexToWrite The hex to write
+ * @brief Write a hex to the driver message stream if it is not null
+ *
+ * @param hex_to_write The hex to write
*/
-void Driver::errorMessage(uint32_t hexToWrite) {
+void Driver::error_message(uint32_t hex_to_write) {
- // Check if the driver message stream is not null
- if( driverMessageStream != 0) {
- // Write the character to the driver message stream
- driverMessageStream -> writeHex(hexToWrite);
- }
+ // If there is a driver message stream write the hex to it
+ if(m_driver_message_stream != 0)
+ m_driver_message_stream->write_hex(hex_to_write);
}
+/**
+ * @brief Get the vendor name of the driver
+ *
+ * @return The vendor name of the driver
+ */
string Driver::get_vendor_name()
{
return "Generic";
}
+/**
+ * @brief Get the device name of the driver
+ *
+ * @return The device name of the driver
+ */
string Driver::get_device_name()
{
return "Unknown Driver";
@@ -112,10 +128,11 @@ DriverSelectorEventHandler::~DriverSelectorEventHandler()
}
/**
- * @details This function is called when a driver is selected
+ * @brief This function is called when a driver is selected
+ *
* @param driver The driver that was selected
*/
-void DriverSelectorEventHandler::onDriverSelected(Driver*)
+void DriverSelectorEventHandler::on_driver_selected(Driver*)
{
}
@@ -127,7 +144,10 @@ DriverSelector::~DriverSelector()
{
}
-void DriverSelector::selectDrivers(DriverSelectorEventHandler*, hardwarecommunication::InterruptManager*, OutputStream*)
+/**
+ * @brief Select the drivers
+ */
+void DriverSelector::select_drivers(DriverSelectorEventHandler*, hardwarecommunication::InterruptManager*, common::OutputStream *)
{
}
@@ -137,39 +157,39 @@ DriverManager::DriverManager() {
DriverManager::~DriverManager() {
- // While there are still drivers in the driver vector
- while (!drivers.empty()) {
-
- // Remove the driver
- removeDriver(*drivers.begin());
- }
+ // Remove any drivers that are still attached
+ while (!drivers.empty())
+ remove_driver(*drivers.begin());
}
/**
- * @details Adds a driver to the driver vector
+ * @brief Adds a driver to the manager
+ *
* @param driver The driver to add
*/
-void DriverManager::addDriver(Driver* driver) { drivers.push_back(driver);
+void DriverManager::add_driver(Driver* driver){
+ drivers.push_back(driver);
}
/**
- * @details Removes a driver from the driver vector
+ * @brief Removes a driver from the driver vector
+ *
* @param driver The driver to remove
*/
-void DriverManager::removeDriver(Driver* driver) {
+void DriverManager::remove_driver(Driver* driver) {
// Deactivate the driver
driver -> deactivate();
- // Remove the driver from the driver vector
+ // Remove the driver
drivers.erase(driver);
}
/**
- * @details When a driver is selected, add it to the driver vector
+ * @brief When a driver is selected add it to the manager
*/
-void DriverManager::onDriverSelected(Driver* driver) {
- addDriver(driver);
-}
+void DriverManager::on_driver_selected(Driver* driver) {
+ add_driver(driver);
+}
\ No newline at end of file
diff --git a/kernel/src/drivers/ethernet/amd_am79c973.cpp b/kernel/src/drivers/ethernet/amd_am79c973.cpp
index 6b2ca9ff..9514b170 100644
--- a/kernel/src/drivers/ethernet/amd_am79c973.cpp
+++ b/kernel/src/drivers/ethernet/amd_am79c973.cpp
@@ -104,7 +104,7 @@ amd_am79c973::~amd_am79c973()
/**
- * @details This function activates the device and starts it (Runs when the driver-manger calls activateAll())
+ * @brief This function activates the device and starts it (Runs when the driver-manger calls activateAll())
*/
void amd_am79c973::activate()
{
@@ -129,7 +129,7 @@ void amd_am79c973::activate()
}
/**
- * @details This function resets the device
+ * @brief This function resets the device
*
* @return The amount of ms to wait
*/
@@ -144,7 +144,7 @@ uint32_t amd_am79c973::reset() {
/**
- * @details This function handles the interrupt for the device
+ * @brief This function handles the interrupt for the device
*
* @param esp The stack pointer (where to return to)
*/
@@ -158,10 +158,14 @@ void amd_am79c973::handle_interrupt() {
// Note: Cant be switch case as multiple errors can occur at the same time
// Errors
- if((temp & 0x8000) == 0x8000) errorMessage("AMD am79c973 ERROR: ");
- if((temp & 0x2000) == 0x2000) errorMessage("COLLISION ERROR\n");
- if((temp & 0x1000) == 0x1000) errorMessage("MISSED FRAME\n");
- if((temp & 0x0800) == 0x0800) errorMessage("MEMORY ERROR\n");
+ if((temp & 0x8000) == 0x8000)
+ error_message("AMD am79c973 ERROR: ");
+ if((temp & 0x2000) == 0x2000)
+ error_message("COLLISION ERROR\n");
+ if((temp & 0x1000) == 0x1000)
+ error_message("MISSED FRAME\n");
+ if((temp & 0x0800) == 0x0800)
+ error_message("MEMORY ERROR\n");
// Responses
@@ -182,7 +186,7 @@ void amd_am79c973::handle_interrupt() {
// Furthermore, STP (Start of Packet, 0x02000000) and ENP (End of Packet, 0x01000000) should be set - this indicates that the data is not split up, but that it is a single Ethernet packet.
// Furthermore, bits 12-15 must be set (0x0000F000, are probably reserved) and bits 0-11 are negative Size of the package.
/**
- * @details This function sends a package
+ * @brief This function sends a package
*
* @param buffer The buffer to send
* @param size The size of the buffer
@@ -267,7 +271,7 @@ void amd_am79c973::FetchDataSent()
/**
- * @details This function gets the MAC address
+ * @brief This function gets the MAC address
*
* @return The MAC address
*/
diff --git a/kernel/src/drivers/ethernet/ethernet.cpp b/kernel/src/drivers/ethernet/ethernet.cpp
index a302a873..b8aa92c2 100644
--- a/kernel/src/drivers/ethernet/ethernet.cpp
+++ b/kernel/src/drivers/ethernet/ethernet.cpp
@@ -71,7 +71,7 @@ EthernetDriver::~EthernetDriver()
}
/**
- * @details Get the MAC address
+ * @brief Get the MAC address
*
* @return the MAC address
*/
@@ -81,22 +81,22 @@ MediaAccessControlAddress EthernetDriver::GetMediaAccessControlAddress()
}
/**
- * @details Send data to the network via the driver backend
+ * @brief Send data to the network via the driver backend
*
* @param buffer The buffer to send
* @param size The size of the buffer
*/
void EthernetDriver::Send(uint8_t* buffer, uint32_t size)
{
- driverMessageStream -> write("Sending: ");
+ m_driver_message_stream-> write("Sending: ");
int displayType = 34; //What header to hide (Ethernet Header = 14, IP Header = 34, UDP = 42, TCP Header = 54, ARP = 42)
for(int i = displayType; i < size; i++)
{
- driverMessageStream -> writeHex(buffer[i]);
- driverMessageStream -> write(" ");
+ m_driver_message_stream->write_hex(buffer[i]);
+ m_driver_message_stream-> write(" ");
}
- driverMessageStream -> write("\n");
+ m_driver_message_stream-> write("\n");
// Raise the event
raise_event(new BeforeSendEvent(buffer, size));
@@ -105,29 +105,29 @@ void EthernetDriver::Send(uint8_t* buffer, uint32_t size)
}
/**
- * @details (Device Side) Send the data
+ * @brief (Device Side) Send the data
*/
void EthernetDriver::DoSend(uint8_t*, uint32_t)
{
}
/**
- * @details Handle the recieved data
+ * @brief Handle the recieved data
*
* @param buffer The buffer to handle
* @param size The size of the buffer
*/
void EthernetDriver::FireDataReceived(uint8_t* buffer, uint32_t size)
{
- driverMessageStream -> write("Receiving: ");
+ m_driver_message_stream-> write("Receiving: ");
//size = 64;
int displayType = 34; //What header to hide (Ethernet Header = 14, IP Header = 34, UDP = 42, TCP Header = 54, ARP = 42)
for(int i = displayType; i < size; i++)
{
- driverMessageStream -> writeHex(buffer[i]);
- driverMessageStream -> write(" ");
+ m_driver_message_stream->write_hex(buffer[i]);
+ m_driver_message_stream-> write(" ");
}
- driverMessageStream -> write("\n");
+ m_driver_message_stream-> write("\n");
// Raise the event
Vector*> values =
@@ -138,7 +138,7 @@ void EthernetDriver::FireDataReceived(uint8_t* buffer, uint32_t size)
switch ((*event)->type) {
case EthernetDriverEvents::DATA_RECEIVED:
if((*event)->return_value.boolValue){
- driverMessageStream -> write("Sending back... \n");
+ m_driver_message_stream-> write("Sending back... \n");
Send(buffer, size);
}
break;
@@ -147,11 +147,11 @@ void EthernetDriver::FireDataReceived(uint8_t* buffer, uint32_t size)
break;
}
}
- driverMessageStream -> write("DATA HANDLED\n");
+ m_driver_message_stream-> write("DATA HANDLED\n");
}
/**
- * @details Send data
+ * @brief Send data
*
* @param buffer The buffer to send
* @param size The size of the buffer
@@ -164,7 +164,7 @@ void EthernetDriver::FireDataSent(uint8_t* buffer, uint32_t size)
// if your mac address is e.g. 1c:6f:65:07:ad:1a (see output of ifconfig)
// then you would call CreateMediaAccessControlAddress(0x1c, 0x6f, 0x65, 0x07, 0xad, 0x1a)
/**
- * @details Create a Media Access Control Address
+ * @brief Create a Media Access Control Address
*
* @param digit1 The first digit
* @param digit2 The second digit
diff --git a/kernel/src/drivers/ethernet/intel_i217.cpp b/kernel/src/drivers/ethernet/intel_i217.cpp
index 09655936..67a13df0 100644
--- a/kernel/src/drivers/ethernet/intel_i217.cpp
+++ b/kernel/src/drivers/ethernet/intel_i217.cpp
@@ -69,7 +69,7 @@ intel_i217::intel_i217(PeripheralComponentInterconnectDeviceDescriptor *deviceDe
}else{
- errorMessage("ERROR, INIT FAILED, MAC ADDRESS NOT FOUND");
+ error_message("ERROR, INIT FAILED, MAC ADDRESS NOT FOUND");
while (true);
}
@@ -289,7 +289,7 @@ void intel_i217::sendInit() {
void intel_i217::activate() {
- driverMessageStream -> write("Activating Intel i217\n");
+ m_driver_message_stream-> write("Activating Intel i217\n");
//Enable interrupts
Write(interruptMaskRegister ,0x1F6DC); //Enable all interrupts
@@ -303,7 +303,7 @@ void intel_i217::activate() {
sendInit();
active = true; // Set active to true
- driverMessageStream -> write("Intel i217 INIT DONE\n");
+ m_driver_message_stream-> write("Intel i217 INIT DONE\n");
}
@@ -312,16 +312,18 @@ void intel_i217::handle_interrupt() {
Write(interruptMaskRegister, 0x1); //Clear the interrupt or it will hang
uint32_t temp = Read(0xc0); //Read the interrupt status register
- driverMessageStream -> write("Interrupt from INTEL i217");
+ m_driver_message_stream-> write("Interrupt from INTEL i217");
- if(temp & 0x04) driverMessageStream -> write("INTEL i217 START LINK");//initDone = true;
- if(temp & 0x10) driverMessageStream -> write("INTEL i217 GOOD THRESHOLD");
+ if(temp & 0x04)
+ m_driver_message_stream-> write("INTEL i217 START LINK");//initDone = true;
+ if(temp & 0x10)
+ m_driver_message_stream-> write("INTEL i217 GOOD THRESHOLD");
if(temp & 0x80) FetchDataReceived();
}
void intel_i217::FetchDataReceived() {
- driverMessageStream -> write("Fetching data... ");
+ m_driver_message_stream-> write("Fetching data... ");
uint16_t old_cur;
bool got_packet = false;
@@ -351,7 +353,7 @@ void intel_i217::FetchDataReceived() {
void intel_i217::DoSend(uint8_t* buffer, uint32_t size) {
- driverMessageStream -> write("Sending package... ");
+ m_driver_message_stream-> write("Sending package... ");
while(!active);
//Put params into send buffer
@@ -372,12 +374,12 @@ void intel_i217::DoSend(uint8_t* buffer, uint32_t size) {
//Wait for the packet to be sent
while(!(sendDsrctrs[old_cur]->status & 0xff));
- driverMessageStream -> write(" Done\n");
+ m_driver_message_stream-> write(" Done\n");
}
uint64_t intel_i217::GetMediaAccessControlAddress() {
- driverMessageStream -> write("Getting MAC address... ");
+ m_driver_message_stream-> write("Getting MAC address... ");
while(ownMAC == 0);
return ownMAC;
diff --git a/kernel/src/drivers/peripherals/keyboard.cpp b/kernel/src/drivers/peripherals/keyboard.cpp
index 6df2664c..73d629e0 100644
--- a/kernel/src/drivers/peripherals/keyboard.cpp
+++ b/kernel/src/drivers/peripherals/keyboard.cpp
@@ -23,24 +23,44 @@ KeyboardEventHandler::~KeyboardEventHandler() {
};
-void KeyboardEventHandler::onKeyDown(KeyCode keyDownCode, KeyboardState keyDownState)
+/**
+ * @brief Handle the key down event
+ *
+ * @param key_down_code The keycode of the key that was pressed
+ * @param key_down_state The state of the keyboard when the key was pressed
+ */
+void KeyboardEventHandler::on_key_down(KeyCode key_down_code, KeyboardState key_down_state)
{
}
-void KeyboardEventHandler::onKeyUp(KeyCode keyUpCode, KeyboardState keyUpState)
+/**
+ * @brief Handle the key up event
+ *
+ * @param key_up_code The keycode of the key that was released
+ * @param key_up_state The state of the keyboard when the key was released
+ */
+void KeyboardEventHandler::on_key_up(KeyCode key_up_code, KeyboardState key_up_state)
{
}
+/**
+ * @brief Handle the trigger of an event
+ *
+ * @param event The event to handle
+ * @return The event that was passed with the data modified
+ */
Event* KeyboardEventHandler::on_event(Event *event) {
switch (event -> type) {
case KeyboardEvents::KEYDOWN:
- this->onKeyDown(((KeyDownEvent*)event)->keyCode, ((KeyDownEvent*)event)->keyboardState);
+ this->on_key_down(((KeyDownEvent *)event)->key_code,
+ ((KeyDownEvent *)event)->keyboard_state);
break;
case KeyboardEvents::KEYUP:
- this->onKeyUp(((KeyUpEvent*)event)->keyCode, ((KeyUpEvent*)event)->keyboardState);
+ this->on_key_up(((KeyUpEvent *)event)->key_code,
+ ((KeyUpEvent *)event)->keyboard_state);
break;
default:
@@ -48,7 +68,6 @@ Event* KeyboardEventHandler::on_event(Event *eve
}
return event;
-
}
@@ -56,9 +75,9 @@ Event* KeyboardEventHandler::on_event(Event *eve
///___Driver___
KeyboardDriver::KeyboardDriver(InterruptManager* manager)
- : InterruptHandler(0x21, manager),
- dataPort(0x60),
- commandPort(0x64)
+: InterruptHandler(0x21, manager),
+ m_data_port(0x60),
+ m_command_port(0x64)
{
}
KeyboardDriver::~KeyboardDriver(){
@@ -66,37 +85,36 @@ KeyboardDriver::~KeyboardDriver(){
}
/**
- * @details Activate the keyboard driver
+ * @brief Activate the keyboard driver
*/
void KeyboardDriver::activate() {
- while (commandPort.Read() & 0x1) //Wait for user to stop pressing key (this is for the start-up key eg.. hold 'F12' for boot menu or hold 'del' for bios ), The wait is needed as the keyboard controller won't send anymore characters until the buffer has been read
- dataPort.Read();
-
- commandPort.Write(0xAE); // Tell: PIC to send keyboard interrupt [or] tell keyboard to send interrupts to PIC
- commandPort.Write(0x20); // Tell: get current state
- uint8_t status = (dataPort.Read() | 1) & ~ 0x10; // Read current state then set rightmost bit to 1 becuase this will be the new state and clear the bit
- commandPort.Write(0x60); // Tell: change current state
- dataPort.Write(status); // Write back the current state
-
- dataPort.Write(0xF4); // Final Activation of keyboard
-
- //Keyboard Controller Commands :
- //
- //0xAE : Enable Keyboard
- //0x20 : Read command byte , after that read the status from data port
- //0x60 : Write command byte , after that change the state of the data port
+
+ // Wait for user to stop pressing key (this is for the start-up key eg.. hold 'F12' for boot menu or hold 'del' for bios )
+ while (m_command_port.Read() & 0x1)
+ m_data_port.Read();
+
+ // Enable keyboard interrupts
+ m_command_port.Write(0xAE);
+
+ // Get the current state of the keyboard
+ m_command_port.Write(0x20);
+ uint8_t status = (m_data_port.Read() | 1) & ~ 0x10;
+
+ // Reset the keyboard
+ m_command_port.Write(0x60);
+ m_data_port.Write(status);
+
+ // Activate the keyboard
+ m_data_port.Write(0xF4);
}
/**
- * @details Handle the keyboard interrupt
- *
- * @param esp The stack pointer
- * @return returns the passed esp
+ * @brief Deactivate the keyboard driver
*/
void KeyboardDriver::handle_interrupt(){
// Read the scancode from the keyboard
- uint8_t key = dataPort.Read(); //NOTE: The 8th bit is set to 1 if key is released and cleared to 0 if key is pressed
+ uint8_t key = m_data_port.Read();
// Pass the scan code to the m_handlers
for(auto& handler : this -> m_input_stream_event_handlers){
@@ -104,28 +122,18 @@ void KeyboardDriver::handle_interrupt(){
}
}
+/**
+ * @brief Get the device name
+ * @return The device name
+ */
string KeyboardDriver::get_device_name() {
return "Keyboard";
}
///___State___
-/**
- * @details Initialise the keyboard stat with the default values being false
- */
-KeyboardState::KeyboardState() {
-
- this -> leftShift = false;
- this -> rightShift = false;
- this -> leftControl = false;
- this -> rightControl = false;
- this -> leftAlt = false;
- this -> rightAlt = false;
-
- this -> capsLock = false;
- this -> numberPadLock = false;
- this -> scrollLock = false;
+KeyboardState::KeyboardState() {
}
@@ -139,31 +147,19 @@ KeyboardInterpreter::KeyboardInterpreter()
: InputStreamEventHandler()
{
- // Extended codes are none by default
- this -> nextIsExtendedCode0 = false;
- this -> currentExtendedCode1 = 0;
- this -> extendedCode1Buffer = 0;
-
}
KeyboardInterpreter::~KeyboardInterpreter() {
}
-void KeyboardInterpreter::onKeyRead(bool released, KeyboardState state, KeyCode keyCode) {
-
- // Check if the key is released or pressed
- if(released){
-
- // Pass the release event to the m_handlers
- raise_event(new KeyUpEvent(keyCode, state));
-
- // Event handled
- return;
- }
+void KeyboardInterpreter::onKeyRead(bool released, KeyboardState state, KeyCode key_code) {
- // Pass the press event to the m_handlers
- raise_event(new KeyDownEvent(keyCode, state));
+ // Pass the key event to the handlers
+ if(released)
+ raise_event(new KeyUpEvent(key_code, state));
+ else
+ raise_event(new KeyDownEvent(key_code, state));
}
@@ -179,309 +175,342 @@ KeyboardInterpreterEN_US::~KeyboardInterpreterEN_US() {
}
-void KeyboardInterpreterEN_US::on_stream_read(uint8_t scanCode) {
+void KeyboardInterpreterEN_US::on_stream_read(uint8_t scan_code) {
- int keyType = 0; // Initialize keyType to 0 (0 represents a regular keypress)
+ // 0 is a regular key, 1 is an extended code, 2 is an extended code with e1CodeBuffer
+ int keyType = 0;
- // Check if the key was released (bit 7 set) and certain conditions are met
- bool released = (scanCode & 0x80) && (currentExtendedCode1 || (scanCode != 0xe1)) && (nextIsExtendedCode0 || (scanCode != 0xe0));
+ // Check if the key was released
+ bool released = (scan_code & 0x80) && (m_current_extended_code_1 || (scan_code != 0xe1)) && (m_next_is_extended_code_0 || (scan_code != 0xe0));
- // If the key is released, clear bit 7 (make it a regular key)
+ // Clear the released bit
if (released)
- scanCode &= ~0x80;
+ scan_code &= ~0x80;
- // If the scanCode is 0xe0, it indicates an extended code
- if (scanCode == 0xe0)
+ // Set the e0Code flag to true
+ if (scan_code == 0xe0)
{
- nextIsExtendedCode0 = true; // Set the e0Code flag to true
- return;
+ m_next_is_extended_code_0 = true;
+ return;
}
// If e0Code is true, set keyType to 1 and reset e0Code
- if (nextIsExtendedCode0)
+ if (m_next_is_extended_code_0)
{
keyType = 1;
- nextIsExtendedCode0 = false;
+ m_next_is_extended_code_0 = false;
- // Check if the scanCode represents a shift key and return (fake shift)
- if ((KeyboardInterpreterEN_US::KeyCodeEN_US)scanCode == KeyboardInterpreterEN_US::leftShift || (KeyboardInterpreterEN_US::KeyCodeEN_US)scanCode == KeyboardInterpreterEN_US::rightShift)
+ // Check if the scan_code represents a shift key and return (fake shift)
+ if ((KeyboardInterpreterEN_US::KeyCodeEN_US)scan_code == KeyboardInterpreterEN_US::leftShift || (KeyboardInterpreterEN_US::KeyCodeEN_US)scan_code == KeyboardInterpreterEN_US::rightShift)
return;
}
- // If the scanCode is 0xe1, set the e1Code flag to 1 and return
- if (scanCode == 0xe1)
+ // If the scan_code is 0xe1, set the e1Code flag to 1 and return
+ if (scan_code == 0xe1)
{
- currentExtendedCode1 = 1;
- return;
+ m_current_extended_code_1 = 1;
+ return;
}
- // If e1Code is 1, set e1Code to 2, store the scanCode in e1CodeBuffer, and return
- if (currentExtendedCode1 == 1)
+ // If e1Code is 1, set e1Code to 2, store the scan_code in e1CodeBuffer, and return
+ if (m_current_extended_code_1 == 1)
{
- currentExtendedCode1 = 2;
- extendedCode1Buffer = scanCode;
- return;
+ m_current_extended_code_1 = 2;
+ m_extended_code_1_buffer = scan_code;
+ return;
}
// If e1Code is 2, set keyType to 2, reset e1Code, and update e1CodeBuffer
- if (currentExtendedCode1 == 2)
+ if (m_current_extended_code_1 == 2)
{
keyType = 2;
- currentExtendedCode1 = 0;
- extendedCode1Buffer |= (((uint16_t)scanCode) << 8);
+ m_current_extended_code_1 = 0;
+ m_extended_code_1_buffer |= (((uint16_t)scan_code) << 8);
}
- bool isShifting = this -> keyBoardState.leftShift || this -> keyBoardState.rightShift;
- bool shouldBeUpperCase = isShifting != this -> keyBoardState.capsLock;
+ bool is_shifting = this ->m_keyboard_state.left_shift || this ->m_keyboard_state.right_shift;
+ bool should_be_upper_case = is_shifting != this ->m_keyboard_state.caps_lock;
// TODO: Probabbly a better way to do this
if(keyType == 0)
- switch ((KeyCodeEN_US)scanCode) {
+ switch ((KeyCodeEN_US)scan_code) {
// First row
case KeyCodeEN_US::escape:
- onKeyRead(released, this -> keyBoardState, KeyCode::escape);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::escape);
break;
case KeyCodeEN_US::f1:
- onKeyRead(released, this -> keyBoardState, KeyCode::f1);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f1);
break;
case KeyCodeEN_US::f2:
- onKeyRead(released, this -> keyBoardState, KeyCode::f2);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f2);
break;
case KeyCodeEN_US::f3:
- onKeyRead(released, this -> keyBoardState, KeyCode::f3);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f3);
break;
case KeyCodeEN_US::f4:
- onKeyRead(released, this -> keyBoardState, KeyCode::f4);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f4);
break;
case KeyCodeEN_US::f5:
- onKeyRead(released, this -> keyBoardState, KeyCode::f5);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f5);
break;
case KeyCodeEN_US::f6:
- onKeyRead(released, this -> keyBoardState, KeyCode::f6);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f6);
break;
case KeyCodeEN_US::f7:
- onKeyRead(released, this -> keyBoardState, KeyCode::f7);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f7);
break;
case KeyCodeEN_US::f8:
- onKeyRead(released, this -> keyBoardState, KeyCode::f8);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f8);
break;
case KeyCodeEN_US::f9:
- onKeyRead(released, this -> keyBoardState, KeyCode::f9);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f9);
break;
case KeyCodeEN_US::f10:
- onKeyRead(released, this -> keyBoardState, KeyCode::f10);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f10);
break;
case KeyCodeEN_US::f11:
- onKeyRead(released, this -> keyBoardState, KeyCode::f11);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f11);
break;
case KeyCodeEN_US::f12:
- onKeyRead(released, this -> keyBoardState, KeyCode::f12);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::f12);
break;
case KeyCodeEN_US::printScreen:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadMultiply : KeyCode::printScreen);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock
+ ? KeyCode::numberPadMultiply : KeyCode::printScreen);
break;
case KeyCodeEN_US::scrollLock:
- onKeyRead(released, this -> keyBoardState, KeyCode::scrollLock);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::scrollLock);
break;
/*
* TODO: Implement pause/break, it conflicts with numlock, I prefer numlock so that is why it is not implemented
case KeyCodeEN_US::pauseBreak:
- onKeyRead(released, this -> keyBoardState, KeyCode::pauseBreak);
+ onKeyRead(released, this -> m_keyboard_state, KeyCode::pauseBreak);
break;
*/
// Second row
case KeyCodeEN_US::squigglyLine:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::squigglyLine : KeyCode::slantedApostrophe);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::squigglyLine : KeyCode::slantedApostrophe);
break;
case KeyCodeEN_US::one:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::exclamationMark : KeyCode::one);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::exclamationMark : KeyCode::one);
break;
case KeyCodeEN_US::two:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::atSign: KeyCode::two);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::atSign: KeyCode::two);
break;
case KeyCodeEN_US::three:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::hash : KeyCode::three);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::hash : KeyCode::three);
break;
case KeyCodeEN_US::four:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::dollarSign : KeyCode::four);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::dollarSign : KeyCode::four);
break;
case KeyCodeEN_US::five:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::percentSign : KeyCode::five);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::percentSign : KeyCode::five);
break;
case KeyCodeEN_US::six:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::powerSign : KeyCode::six);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::powerSign : KeyCode::six);
break;
case KeyCodeEN_US::seven:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::andSign : KeyCode::seven);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::andSign : KeyCode::seven);
break;
case KeyCodeEN_US::eight:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::multiply : KeyCode::eight);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::multiply : KeyCode::eight);
break;
case KeyCodeEN_US::nine:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::openBracket : KeyCode::nine);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::openBracket : KeyCode::nine);
break;
case KeyCodeEN_US::zero:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::closeBracket : KeyCode::zero);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::closeBracket : KeyCode::zero);
break;
case KeyCodeEN_US::minus:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::underscore : KeyCode::minus);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::underscore : KeyCode::minus);
break;
case KeyCodeEN_US::equals:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::plus : KeyCode::equals);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::plus : KeyCode::equals);
break;
case KeyCodeEN_US::backspace:
- onKeyRead(released, this -> keyBoardState, KeyCode::backspace);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::backspace);
break;
case KeyCodeEN_US::insert:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadZero : KeyCode::insert);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock ? KeyCode::numberPadZero : KeyCode::insert);
break;
case KeyCodeEN_US::home:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadSeven : KeyCode::home);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock
+ ? KeyCode::numberPadSeven : KeyCode::home);
break;
case KeyCodeEN_US::pageUp:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadNine : KeyCode::pageUp);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock ? KeyCode::numberPadNine : KeyCode::pageUp);
break;
case KeyCodeEN_US::numberPadLock:
// Ensure this is not a repeat
if(!released){
- this -> keyBoardState.numberPadLock = !this -> keyBoardState.numberPadLock;
+ this ->m_keyboard_state.number_pad_lock = !this ->m_keyboard_state.number_pad_lock;
}
- onKeyRead(released, this -> keyBoardState, KeyCode::numberPadLock);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::numberPadLock);
break;
case KeyCodeEN_US::numberPadForwardSlash:
// Check if number pad lock is on
- if(this -> keyBoardState.numberPadLock){
- onKeyRead(released, this -> keyBoardState, KeyCode::numberPadForwardSlash);
+ if(this ->m_keyboard_state.number_pad_lock){
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::numberPadForwardSlash);
}else{
// Normal Forward Slash
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::questionMark : KeyCode::forwardSlash);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::questionMark : KeyCode::forwardSlash);
}
break;
// Number Pad Multiply is same as print screen
case KeyCodeEN_US::numberPadMinus:
- onKeyRead(released, this -> keyBoardState, KeyCode::numberPadMinus);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::numberPadMinus);
break;
// Third row
case KeyCodeEN_US::tab:
- onKeyRead(released, this -> keyBoardState, KeyCode::tab);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::tab);
break;
case KeyCodeEN_US::Q:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::Q : KeyCode::q);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::Q : KeyCode::q);
break;
case KeyCodeEN_US::W:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::W : KeyCode::w);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::W : KeyCode::w);
break;
case KeyCodeEN_US::E:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::E : KeyCode::e);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::E : KeyCode::e);
break;
case KeyCodeEN_US::R:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::R : KeyCode::r);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::R : KeyCode::r);
break;
case KeyCodeEN_US::T:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::T : KeyCode::t);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::T : KeyCode::t);
break;
case KeyCodeEN_US::Y:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::Y : KeyCode::y);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::Y : KeyCode::y);
break;
case KeyCodeEN_US::U:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::U : KeyCode::u);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::U : KeyCode::u);
break;
case KeyCodeEN_US::I:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::I : KeyCode::i);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::I : KeyCode::i);
break;
case KeyCodeEN_US::O:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::O : KeyCode::o);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::O : KeyCode::o);
break;
case KeyCodeEN_US::P:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::P : KeyCode::p);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::P : KeyCode::p);
break;
case KeyCodeEN_US::openSquareBracket:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::openCurlyBracket : KeyCode::openSquareBracket);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::openCurlyBracket : KeyCode::openSquareBracket);
break;
case KeyCodeEN_US::closeSquareBracket:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::closeCurlyBracket : KeyCode::closeSquareBracket);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::closeCurlyBracket : KeyCode::closeSquareBracket);
break;
case KeyCodeEN_US::backslash:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::lineThing : KeyCode::backslash);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::lineThing : KeyCode::backslash);
break;
case KeyCodeEN_US::deleteKey:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadFullStop : KeyCode::deleteKey);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock
+ ? KeyCode::numberPadFullStop : KeyCode::deleteKey);
break;
case KeyCodeEN_US::end:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadOne : KeyCode::end);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock ? KeyCode::numberPadOne : KeyCode::end);
break;
case KeyCodeEN_US::pageDown:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadThree : KeyCode::pageDown);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock
+ ? KeyCode::numberPadThree : KeyCode::pageDown);
break;
// Number pad 7 is same as home
case KeyCodeEN_US::numberPadEight:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadEight : KeyCode::upArrow);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock
+ ? KeyCode::numberPadEight : KeyCode::upArrow);
break;
// Number pad 9 is same as page up
case KeyCodeEN_US::numberPadPlus:
- onKeyRead(released, this -> keyBoardState, KeyCode::numberPadPlus);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::numberPadPlus);
break;
// Fourth row
@@ -489,116 +518,133 @@ void KeyboardInterpreterEN_US::on_stream_read(uint8_t scanCode) {
case KeyCodeEN_US::capsLock:
// Ensure this is not a repeat
if(!released){
- this -> keyBoardState.capsLock = !this -> keyBoardState.capsLock;
+ this ->m_keyboard_state.caps_lock = !this ->m_keyboard_state.caps_lock;
}
- onKeyRead(released, this -> keyBoardState, KeyCode::capsLock);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::capsLock);
break;
case KeyCodeEN_US::A:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::A : KeyCode::a);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::A : KeyCode::a);
break;
case KeyCodeEN_US::S:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::S : KeyCode::s);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::S : KeyCode::s);
break;
case KeyCodeEN_US::D:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::D : KeyCode::d);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::D : KeyCode::d);
break;
case KeyCodeEN_US::F:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::F : KeyCode::f);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::F : KeyCode::f);
break;
case KeyCodeEN_US::G:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::G : KeyCode::g);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::G : KeyCode::g);
break;
case KeyCodeEN_US::H:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::H : KeyCode::h);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::H : KeyCode::h);
break;
case KeyCodeEN_US::J:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::J : KeyCode::j);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::J : KeyCode::j);
break;
case KeyCodeEN_US::K:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::K : KeyCode::k);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::K : KeyCode::k);
break;
case KeyCodeEN_US::L:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::L : KeyCode::l);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::L : KeyCode::l);
break;
case KeyCodeEN_US::semicolon:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::colon : KeyCode::semicolon);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::colon : KeyCode::semicolon);
break;
case KeyCodeEN_US::apostrophe:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::quotationMark : KeyCode::apostrophe);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::quotationMark : KeyCode::apostrophe);
break;
case KeyCodeEN_US::enter:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadEnter : KeyCode::enter);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock
+ ? KeyCode::numberPadEnter : KeyCode::enter);
break;
case KeyCodeEN_US::numberPadFour:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadFour : KeyCode::leftArrow);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock ? KeyCode::numberPadFour : KeyCode::leftArrow);
break;
case KeyCodeEN_US::numberPadFive:
- onKeyRead(released, this -> keyBoardState, KeyCode::numberPadFive);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::numberPadFive);
break;
case KeyCodeEN_US::numberPadSix:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadSix : KeyCode::rightArrow);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock ? KeyCode::numberPadSix : KeyCode::rightArrow);
break;
// Fifth row
case KeyCodeEN_US::leftShift:
- // Check if this is a repeat
- if(!released){
- this -> keyBoardState.leftShift = !this -> keyBoardState.leftShift;
- }
-
- onKeyRead(released, this -> keyBoardState, KeyCode::leftShift);
+ this ->m_keyboard_state.left_shift = !this ->m_keyboard_state.left_shift;
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::leftShift);
break;
case KeyCodeEN_US::Z:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::Z : KeyCode::z);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::Z : KeyCode::z);
break;
case KeyCodeEN_US::X:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::X : KeyCode::x);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::X : KeyCode::x);
break;
case KeyCodeEN_US::C:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::C : KeyCode::c);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::C : KeyCode::c);
break;
case KeyCodeEN_US::V:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::V : KeyCode::v);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::V : KeyCode::v);
break;
case KeyCodeEN_US::B:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::B : KeyCode::b);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::B : KeyCode::b);
break;
case KeyCodeEN_US::N:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::N : KeyCode::n);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::N : KeyCode::n);
break;
case KeyCodeEN_US::M:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::M : KeyCode::m);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::M : KeyCode::m);
break;
case KeyCodeEN_US::comma:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::lessThan : KeyCode::comma);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::lessThan : KeyCode::comma);
break;
case KeyCodeEN_US::fullStop:
- onKeyRead(released, this -> keyBoardState, shouldBeUpperCase ? KeyCode::greaterThan : KeyCode::fullStop);
+ onKeyRead(released, this ->m_keyboard_state,
+ should_be_upper_case ? KeyCode::greaterThan : KeyCode::fullStop);
break;
// Forward slash is same as number pad forward slash
@@ -606,10 +652,10 @@ void KeyboardInterpreterEN_US::on_stream_read(uint8_t scanCode) {
case KeyCodeEN_US::rightShift:
// Check if this is a repeat
if(!released){
- this -> keyBoardState.rightShift = !this -> keyBoardState.rightShift;
+ this ->m_keyboard_state.right_shift = !this ->m_keyboard_state.right_shift;
}
- onKeyRead(released, this -> keyBoardState, KeyCode::rightShift);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::rightShift);
break;
// Up Arrow is the same as number pad 8
@@ -617,7 +663,7 @@ void KeyboardInterpreterEN_US::on_stream_read(uint8_t scanCode) {
// Number pad 1 is the same as end
case KeyCodeEN_US::numberPadTwo:
- onKeyRead(released, this -> keyBoardState, this -> keyBoardState.numberPadLock ? KeyCode::numberPadTwo : KeyCode::downArrow);
+ onKeyRead(released, this ->m_keyboard_state, this ->m_keyboard_state.number_pad_lock ? KeyCode::numberPadTwo : KeyCode::downArrow);
break;
// Number pad 3 is the same as page down
@@ -628,29 +674,29 @@ void KeyboardInterpreterEN_US::on_stream_read(uint8_t scanCode) {
case KeyCodeEN_US::leftControl:
// Check if this is a repeat
if(!released){
- this -> keyBoardState.leftControl = !this -> keyBoardState.leftControl;
- this -> keyBoardState.rightControl = !this -> keyBoardState.rightControl;
+ this ->m_keyboard_state.left_control = !this ->m_keyboard_state.left_control;
+ this ->m_keyboard_state.right_control = !this ->m_keyboard_state.right_control;
}
- onKeyRead(released, this -> keyBoardState, KeyCode::leftControl);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::leftControl);
break;
case KeyCodeEN_US::leftOS:
- onKeyRead(released, this -> keyBoardState, KeyCode::leftOS);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::leftOS);
break;
case KeyCodeEN_US::leftAlt:
// Check if this is a repeat
if(!released){
- this -> keyBoardState.leftAlt = !this -> keyBoardState.leftAlt;
- this -> keyBoardState.rightAlt = !this -> keyBoardState.rightAlt;
+ this ->m_keyboard_state.left_alt = !this ->m_keyboard_state.left_alt;
+ this ->m_keyboard_state.right_alt = !this ->m_keyboard_state.right_alt;
}
- onKeyRead(released, this -> keyBoardState, KeyCode::leftAlt);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::leftAlt);
break;
case KeyCodeEN_US::space:
- onKeyRead(released, this -> keyBoardState, KeyCode::space);
+ onKeyRead(released, this ->m_keyboard_state, KeyCode::space);
break;
// Right Alt is the same as left alt
@@ -675,23 +721,23 @@ void KeyboardInterpreterEN_US::on_stream_read(uint8_t scanCode) {
}
KeyDownEvent::KeyDownEvent(KeyCode keyCode, KeyboardState keyboardState)
-: Event(KeyboardEvents::KEYDOWN){
- this -> keyCode = keyCode;
- this -> keyboardState = keyboardState;
+: Event(KeyboardEvents::KEYDOWN),
+ key_code(keyCode),
+ keyboard_state(keyboardState)
+{
}
KeyDownEvent::~KeyDownEvent() {
}
-KeyUpEvent::KeyUpEvent(KeyCode keyCode, KeyboardState keyboardState)
-: Event(KeyboardEvents::KEYUP){
- this -> keyCode = keyCode;
- this -> keyboardState = keyboardState;
+KeyUpEvent::KeyUpEvent(KeyCode key_code, KeyboardState keyboard_state)
+: Event(KeyboardEvents::KEYUP),
+ key_code(key_code),
+ keyboard_state(keyboard_state)
+{
}
KeyUpEvent::~KeyUpEvent() {
-}
-
-
+}
\ No newline at end of file
diff --git a/kernel/src/drivers/peripherals/mouse.cpp b/kernel/src/drivers/peripherals/mouse.cpp
index 7cd0af71..0554a664 100644
--- a/kernel/src/drivers/peripherals/mouse.cpp
+++ b/kernel/src/drivers/peripherals/mouse.cpp
@@ -17,22 +17,25 @@ MouseEventHandler::MouseEventHandler() {
}
/**
- * @details This function is called when an event is triggered and calls the appropriate function
+ * @brief Handles the triggered event and calls the appropriate function
* @param event The event that was triggered
+ *
+ * @return The event that was triggered with the modified data
*/
Event* MouseEventHandler::on_event(Event *event) {
switch (event->type){
case MOUSE_MOVE:
- this->onMouseMoveEvent(((MouseMoveEvent*)event)->x, ((MouseMoveEvent*)event)->y);
+ this->on_mouse_move_event(((MouseMoveEvent *)event)->x,
+ ((MouseMoveEvent *)event)->y);
break;
case MOUSE_DOWN:
- this->onMouseDownEvent(((MouseDownEvent*)event)->button);
+ this->on_mouse_down_event(((MouseDownEvent *)event)->button);
break;
case MOUSE_UP:
- this->onMouseUpEvent(((MouseUpEvent*)event)->button);
+ this->on_mouse_up_event(((MouseUpEvent *)event)->button);
break;
}
@@ -41,16 +44,31 @@ Event* MouseEventHandler::on_event(Event *event) {
return event;
}
-
-void MouseEventHandler::onMouseDownEvent(uint8_t button){
+/**
+ * @brief Called when the mouse is pressed
+ *
+ * @param button The button that was pressed
+ */
+void MouseEventHandler::on_mouse_down_event(uint8_t button){
}
-void MouseEventHandler::onMouseUpEvent(uint8_t button){
+/**
+ * @brief Called when the mouse is released
+ *
+ * @param button The button that was released
+ */
+void MouseEventHandler::on_mouse_up_event(uint8_t button){
}
-void MouseEventHandler::onMouseMoveEvent(int8_t x, int8_t y){
+/**
+ * @brief Called when the mouse is moved
+ *
+ * @param x How much the mouse moved in the x direction
+ * @param y How much the mouse moved in the y direction
+ */
+void MouseEventHandler::on_mouse_move_event(int8_t x, int8_t y){
}
@@ -61,82 +79,69 @@ MouseEventHandler::~MouseEventHandler() {
///__Driver__
MouseDriver::MouseDriver(InterruptManager* manager)
- : InterruptHandler(0x2C, manager), //0x2C is mouse object, pass the manager paramerter to the base object
- dataPort(0x60),
- commandPort(0x64)
+: InterruptHandler(0x2C, manager),
+ data_port(0x60),
+ command_port(0x64)
{
- offest = 2;
- buttons = 0;
+
}
MouseDriver::~MouseDriver(){
}
/**
- * @details Activate the mouse
+ * @brief Activate the mouse
*/
void MouseDriver::activate() {
+ // Tell the PIC to start listening to the mouse
+ command_port.Write(0xAB);
+
+ // Get the current state of the mouse
+ command_port.Write(0x20);
+ uint8_t status = (data_port.Read() | 2);
- commandPort.Write(0xAB); //Tell: PIC to send mouse interrupt [or] tell mouse to send interrupts to PIC
- commandPort.Write(0x20); //Tell: get current state
- uint8_t status = (dataPort.Read() | 2); //Read current state then set it to 2 becuase this will be the new state and clear the bit
- commandPort.Write(0x60); //Tell: change current state
- dataPort.Write(status); //Write back the current state
+ // Write the new state
+ command_port.Write(0x60);
+ data_port.Write(status);
- commandPort.Write(0xD4); //Forward commands
- dataPort.Write(0xF4); //Final Activation of mouse
- dataPort.Read();
+ // Activate the mouse
+ command_port.Write(0xD4);
+ data_port.Write(0xF4);
+ data_port.Read();
- //Commands to the keyboard controller: (YES the keyboard)
- //0xA8 | Activate mouse
- //0xA7 | Deactivate mouse
- //0x20 | Read command byte
- //0x60 | Write command byte
- //0xD4 | send the next command to the mouse instead of the keyboard
- //Commands to the mouse controller: (Once forwarded)
- //0xF4 | Tell the mouse to send data to the CPU , Enable Packet streaming when mouse is moved or clicked .
- //0xF5 | Tell the mouse not to send any data to the CPU
- //0xF6 | Reset mouse settings to default settings
}
/**
- * @details Handle the mouse interrupt
- *
- * @param esp
- * @return always returns esp
+ * @brief Handle the mouse interrupt
+
*/
void MouseDriver::handle_interrupt(){
- //The mouse triggers 3 interrupts , one for each byte .
- //Byte 1 : Y overflow | X overflow | Y sign bit | X sign bit | Reserved (1) | Middle button pressed | Right button pressed | Left button pressed
- //Byte 2 : X Movement since the last data packet. "delta X" value -- that is, it measures horizontal mouse movement, with left being negative.
- //Byte 3 : Y Movement since the last data packet, "delta Y", with down (toward the user) being negative.
-
- uint8_t status = commandPort.Read();
- if(!(status & 0x20)) //Only if the 6th bit of data is one then there is data to handle
- return; //Otherwise don't bother handling this input
-
+ //Only if the 6th bit of data is one then there is data to handle
+ uint8_t status = command_port.Read();
+ if(!(status & 0x20))
+ return;
- buffer[offest] = dataPort.Read(); //Read mouse info into buffer
- offest = (offest + 1) % 3; //Move through the offset
+ // Read the data and store it in the buffer
+ buffer[offset] = data_port.Read();
+ offset = (offset + 1) % 3;
- //If the mouse data transmission is incomplete (3rd piece of data isn't through)
- if(offest != 0)
+ // If the mouse data transmission is incomplete (3rd piece of data isn't through)
+ if(offset != 0)
return;
- // If the mouse is moved (buffer 1 and 2 store x and y)
+ // If the mouse is moved (y-axis is inverted)
if(buffer[1] != 0 || buffer[2] != 0)
- raise_event(new MouseMoveEvent(buffer[1], -buffer[2])); // Flip the y axis
+ raise_event(new MouseMoveEvent(buffer[1], -buffer[2]));
- //Detect button press
for (int i = 0; i < 3; ++i) {
- //Check if it's the same as the previous becuase if the current state of the buttons is not equal to the previous state of the buttons , then the button must have been pressed or released
+ // Check if the button state has changed
if((buffer[0] & (0x1<(MouseEvents::MOUSE_UP)
+: Event(MouseEvents::MOUSE_UP),
+ button(button)
{
- this->button = button;
+
}
MouseUpEvent::~MouseUpEvent() {
@@ -166,9 +177,9 @@ MouseUpEvent::~MouseUpEvent() {
}
MouseDownEvent::MouseDownEvent(uint8_t button)
-: Event(MouseEvents::MOUSE_DOWN)
+: Event(MouseEvents::MOUSE_DOWN),
+ button(button)
{
- this->button = button;
}
MouseDownEvent::~MouseDownEvent() {
@@ -176,10 +187,10 @@ MouseDownEvent::~MouseDownEvent() {
}
MouseMoveEvent::MouseMoveEvent(int8_t x, int8_t y)
-: Event(MouseEvents::MOUSE_MOVE)
+: Event(MouseEvents::MOUSE_MOVE),
+ x(x),
+ y(y)
{
- this->x = x;
- this->y = y;
}
MouseMoveEvent::~MouseMoveEvent() {
diff --git a/kernel/src/drivers/video/vesa.cpp b/kernel/src/drivers/video/vesa.cpp
index e6304559..229fe699 100644
--- a/kernel/src/drivers/video/vesa.cpp
+++ b/kernel/src/drivers/video/vesa.cpp
@@ -10,26 +10,20 @@ using namespace maxOS::drivers::video;
using namespace maxOS::memory;
using namespace maxOS::system;
-VideoElectronicsStandardsAssociationDriver::VideoElectronicsStandardsAssociationDriver(multiboot_info_t* mb_info)
- : VideoDriver()
+VideoElectronicsStandardsAssociation::VideoElectronicsStandardsAssociation(multiboot_info_t* mb_info)
+: VideoDriver(),
+ m_multiboot_info(mb_info),
+ m_framebuffer_address((uint32_t*)mb_info->framebuffer_addr),
+ m_bpp(mb_info->framebuffer_bpp),
+ m_pitch(mb_info->framebuffer_pitch)
{
-
- // Store the multiboot info
- this->multibootInfo = mb_info;
-
- // Info from multiboot
- this->framebufferAddress = (uint32_t*)multibootInfo->framebuffer_addr;
- this->bpp = multibootInfo->framebuffer_bpp;
- this->pitch = multibootInfo->framebuffer_pitch;
-
-
}
-VideoElectronicsStandardsAssociationDriver::~VideoElectronicsStandardsAssociationDriver(){
+VideoElectronicsStandardsAssociation::~VideoElectronicsStandardsAssociation(){
}
-bool VideoElectronicsStandardsAssociationDriver::init() {
+bool VideoElectronicsStandardsAssociation::init() {
//Multiboot inits this for us
return true;
@@ -37,17 +31,17 @@ bool VideoElectronicsStandardsAssociationDriver::init() {
/**
* @brief Sets the mode of the VESA driver (TODO: List of modes)
+ *
* @param width Width of the screen
* @param height Height of the screen
- * @param colorDepth Color depth of the screen
+ * @param color_depth Color depth of the screen
* @return True if the mode was set successfully, false otherwise
*/
-bool VideoElectronicsStandardsAssociationDriver::internalSetMode(uint32_t width, uint32_t height, uint32_t colorDepth) {
+bool VideoElectronicsStandardsAssociation::internal_set_mode(uint32_t width, uint32_t height, uint32_t color_depth) {
// Check if the mode is supported
- if(!supportsMode(width, height, colorDepth)) {
- // Mode is not supported
+ if(!supports_mode(width, height, color_depth)) {
return false;
}
@@ -65,15 +59,16 @@ bool VideoElectronicsStandardsAssociationDriver::internalSetMode(uint32_t width,
/**
* @brief Checks if the VESA driver supports the given mode
+ *
* @param width The m_width of the screen
* @param height The m_height of the screen
- * @param colorDepth The color depth of the screen
+ * @param color_depth The color depth of the screen
* @return
*/
-bool VideoElectronicsStandardsAssociationDriver::supportsMode(uint32_t width, uint32_t height, uint32_t colorDepth) {
+bool VideoElectronicsStandardsAssociation::supports_mode(uint32_t width, uint32_t height, uint32_t color_depth) {
// Check if the mode is supported
- if(width == (int)multibootInfo->framebuffer_width && height == (int)multibootInfo->framebuffer_height && colorDepth == (int)multibootInfo->framebuffer_bpp) {
+ if(width == (int)m_multiboot_info->framebuffer_width && height == (int)m_multiboot_info->framebuffer_height && color_depth == (int)m_multiboot_info->framebuffer_bpp) {
return true;
}
return false;
@@ -81,32 +76,55 @@ bool VideoElectronicsStandardsAssociationDriver::supportsMode(uint32_t width, ui
/**
* @brief Renders a pixel on the screen in 32 bit mode
+ *
* @param x The x coordinate of the pixel
* @param y The y coordinate of the pixel
* @param colour The 32bit colour of the pixel
*/
-void VideoElectronicsStandardsAssociationDriver::render_pixel_32_bit(uint32_t x, uint32_t y, uint32_t colour) {
+void VideoElectronicsStandardsAssociation::render_pixel_32_bit(uint32_t x, uint32_t y, uint32_t colour) {
// Get the address of the pixel
- uint32_t* pixelAddress = (uint32_t*)((uint8_t *)framebufferAddress + pitch * (y) + bpp * (x) / 8);
+ uint32_t*pixel_address = (uint32_t*)((uint8_t *)m_framebuffer_address + m_pitch * (y) + m_bpp * (x) / 8);
// Set the pixel
- *pixelAddress = colour;
+ *pixel_address = colour;
}
-uint32_t VideoElectronicsStandardsAssociationDriver::get_rendered_pixel_32_bit(uint32_t x, uint32_t y) {
+/**
+ * @brief Gets the colour of a pixel on the screen in 32 bit mode
+ *
+ * @param x The x coordinate of the pixel
+ * @param y The y coordinate of the pixel
+ * @return The 32bit colour of the pixel
+ */
+uint32_t VideoElectronicsStandardsAssociation::get_rendered_pixel_32_bit(uint32_t x, uint32_t y) {
+
// Get the address of the pixel
- uint32_t* pixelAddress = (uint32_t*)((uint8_t *)framebufferAddress + pitch * (y) + bpp * (x) / 8);
+ uint32_t*pixel_address = (uint32_t*)((uint8_t *)m_framebuffer_address + m_pitch * (y) + m_bpp * (x) / 8);
- // Set the pixel
- return *pixelAddress; // Return the colour of the pixel
+ // Return the pixel
+ return *pixel_address;
}
-string VideoElectronicsStandardsAssociationDriver::get_vendor_name() {
+/**
+ * @brief Renders a pixel on the screen in 16 bit mode
+ *
+ * @param x The x coordinate of the pixel
+ * @param y The y coordinate of the pixel
+ * @param colour The 16bit colour of the pixel
+ */
+string VideoElectronicsStandardsAssociation::get_vendor_name() {
return "NEC Home Electronics"; // Creator of the VESA standard
}
-string VideoElectronicsStandardsAssociationDriver::get_device_name() {
+/**
+ * @brief Gets the colour of a pixel on the screen in 16 bit mode
+ *
+ * @param x The x coordinate of the pixel
+ * @param y The y coordinate of the pixel
+ * @return The 16bit colour of the pixel
+ */
+string VideoElectronicsStandardsAssociation::get_device_name() {
return "VESA compatible graphics card";
}
diff --git a/kernel/src/drivers/video/vga.cpp b/kernel/src/drivers/video/vga.cpp
index 7e47ffa5..33a87e69 100644
--- a/kernel/src/drivers/video/vga.cpp
+++ b/kernel/src/drivers/video/vga.cpp
@@ -12,17 +12,17 @@ using namespace maxOS::hardwarecommunication;
// http://files.osdev.org/mirrors/geezer/osd/graphics/modes.c - helpful so thanks
VideoGraphicsArray::VideoGraphicsArray()
-:miscPort(0x3C2),
- crtcIndexPort(0x3D4),
- crtcDataPort(0x3D5),
- sequenceIndexPort(0x3C4),
- sequenceDataPort(0x3C5),
- graphicsControllerIndexPort(0x3CE),
- graphicsControllerDataPort(0x3CF),
- attributeControllerIndexPort(0x3C0),
- attributeControllerReadPort(0x3C1),
- attributeControllerWritePort(0x3C0),
- attributeControllerResetPort(0x3DA)
+: m_misc_port(0x3C2),
+ m_crtc_index_port(0x3D4),
+ crtc_data_port(0x3D5),
+ m_sequence_index_port(0x3C4),
+ m_sequence_data_port(0x3C5),
+ m_graphics_controller_index_port(0x3CE),
+ m_graphics_controller_data_port(0x3CF),
+ m_attribute_controller_index_port(0x3C0),
+ m_attribute_controller_read_port(0x3C1),
+ m_attribute_controller_write_port(0x3C0),
+ m_attribute_controller_reset_port(0x3DA)
{
}
@@ -31,79 +31,80 @@ VideoGraphicsArray::~VideoGraphicsArray() {
}
/**
- * @details This function is used to write to the VGA registers.
+ * @brief This function is used to write to the VGA registers.
*
* @param registers The VGA registers to write to.
*/
-void VideoGraphicsArray::WriteRegisters(uint8_t* registers)
+void VideoGraphicsArray::write_registers(uint8_t* registers)
{
- //MISC (1 val)
- miscPort.Write(*(registers++)); //Get pointer to register, write first to misc, and increase pointer
+ // Move to the next register
+ m_misc_port.Write(*(registers++));
- //SEQ (5 vals)
+ // Set the sequencer registers
for (uint8_t i = 0; i < 5; i++ ) {
- sequenceIndexPort.Write(i); //Tell where the data is to be written
- sequenceDataPort.Write(*(registers++)); //Get pointer to register, first to sequence, and increase pointer
+ m_sequence_index_port.Write(i);
+ m_sequence_data_port.Write(*(registers++));
}
- //Unlock CRTC controller (registers 0-7 of port 0x3D4 are write protected by the protect bit (bit 7 of index 0x11) so we must clear it to write to the registers .)
- crtcIndexPort.Write(0x03);
- crtcDataPort.Write(crtcDataPort.Read() | 0x80); //Set 0x03 (third's) first bit to 1
- crtcIndexPort.Write(0x11);
- crtcDataPort.Write(crtcDataPort.Read() | ~0x80); //Set 0x11 (eleventh's) first bit to 0
+ // Clear protection bit to enable writing to CR0-7
+ m_crtc_index_port.Write(0x03);
+ crtc_data_port.Write(crtc_data_port.Read() | 0x80);
+ m_crtc_index_port.Write(0x11);
+ crtc_data_port.Write(crtc_data_port.Read() | ~0x80);
- //Make sure that the unlock isn't overwritten
- registers[0x03] = registers[0x03] | 0x80; //In the register 0x03 also set first 1
- registers[0x11] = registers[0x11] & ~0x80; //In the register 0x11 also set first 0
+ // Ensure protection bit is set
+ registers[0x03] = registers[0x03] | 0x80;
+ registers[0x11] = registers[0x11] & ~0x80;
- //CRTC (25 vals)
+ // Write the CRTC registers
for (uint8_t i = 0; i < 25; i++ ) {
- crtcIndexPort.Write(i); //Tell where the data is to be written
- crtcDataPort.Write(*(registers++)); //Get pointer to register, write to cathode thingy, and increase pointer
+ m_crtc_index_port.Write(i);
+ crtc_data_port.Write(*(registers++));
}
- //GC (9 vals)
+ // Write the graphics controller registers
for(uint8_t i = 0; i < 9; i++)
{
- graphicsControllerIndexPort.Write(i); //Tell where the data is to be written
- graphicsControllerDataPort.Write(*(registers++)); //Get pointer to register, write to graphics controller, and increase pointer
+ m_graphics_controller_index_port.Write(i);
+ m_graphics_controller_data_port.Write(*(registers++));
}
- //AC (21 vals)
+ // Write the attribute controller registers
for(uint8_t i = 0; i < 21; i++)
{
- attributeControllerResetPort.Read(); //Reset the Controller
- attributeControllerIndexPort.Write(i); //Tell where the data is to be written
- attributeControllerWritePort.Write(*(registers++)); //Get pointer to register, write to attribute controller, and increase pointer
+ m_attribute_controller_reset_port.Read();
+ m_attribute_controller_index_port.Write(i);
+ m_attribute_controller_write_port.Write(*(registers++));
}
- //Re-Lock CRTC and unblank display
- attributeControllerResetPort.Read();
- attributeControllerIndexPort.Write(0x20);
+ // Re-Lock CRTC and unblank display
+ m_attribute_controller_reset_port.Read();
+ m_attribute_controller_index_port.Write(0x20);
}
/**
- * @details This function is used to get the maximum resolution of the VGA and colour depth.
+ * @brief Checks if the specified resolution is supported.
*
* @return True if the specified resolution is supported, otherwise false.
*/
-bool VideoGraphicsArray::supportsMode(uint32_t width, uint32_t height, uint32_t colourDepth)
+bool VideoGraphicsArray::supports_mode(uint32_t width, uint32_t height, uint32_t colour_depth)
{
- return width == 320 && height == 200 && colourDepth == 8;
+ return width == 320 && height == 200 && colour_depth == 8;
}
/**
- * @details This function is used to set the specified resolution and colour depth.
+ * @brief Set the resolution of the screen.
*
- * @param width The m_width of the resolution.
- * @param height The m_height of the resolution.
- * @param colourDepth The colour depth of the resolution.
- * @return True if the specified resolution is supported, otherwise false.
+ * @param width The width of the resolution.
+ * @param height The height of the resolution.
+ * @param colour_depth The colour depth of the resolution.
+ *
+ * @return True if the card was able to set the resolution, otherwise false.
*/
-bool VideoGraphicsArray::internalSetMode(uint32_t width, uint32_t height, uint32_t colourDepth)
+bool VideoGraphicsArray::internal_set_mode(uint32_t width, uint32_t height, uint32_t colour_depth)
{
- if(!supportsMode(width, height, colourDepth))
+ if(!supports_mode(width, height, colour_depth))
return false;
//Values from osdev / modes.c
@@ -127,24 +128,25 @@ bool VideoGraphicsArray::internalSetMode(uint32_t width, uint32_t height, uint32
0x41, 0x00, 0x0F, 0x00, 0x00
};
- WriteRegisters(g_320x200x256);
+ write_registers(g_320x200x256);
return true;
}
/**
- * @details This function is used to get the framebuffer address.
+ * @brief This function is used to get the framebuffer address.
*
* @return The framebuffer address.
*/
-uint8_t* VideoGraphicsArray::GetFrameBufferSegment()
+uint8_t* VideoGraphicsArray::get_frame_buffer_segment()
{
// Optimise so that dont have to read and write to the port every time
return (uint8_t*)0xA0000;
//Read data from index number 6
- graphicsControllerIndexPort.Write(0x06);
- uint8_t segmentNumber = graphicsControllerDataPort.Read() & (3<<2); //Shift by 2 as only intrested in bits 3 & 4 (& 3 so all the other bits are removed)
+ m_graphics_controller_index_port.Write(0x06);
+ uint8_t segmentNumber =
+ m_graphics_controller_data_port.Read() & (3<<2); //Shift by 2 as only intrested in bits 3 & 4 (& 3 so all the other bits are removed)
switch(segmentNumber)
{
default:
@@ -156,9 +158,8 @@ uint8_t* VideoGraphicsArray::GetFrameBufferSegment()
}
-//8 bit vga mode only has 256 colours. colorIndex selects which one to display
/**
- * @details This function is used to put a pixel on the screen.
+ * @brief Puts a 8 bit pixel on the screen.
*
* @param x The x coordinate of the pixel.
* @param y The y coordinate of the pixel.
@@ -166,20 +167,43 @@ uint8_t* VideoGraphicsArray::GetFrameBufferSegment()
*/
void VideoGraphicsArray::render_pixel_8_bit(uint32_t x, uint32_t y, uint8_t colour){
- uint8_t* pixelAddress = GetFrameBufferSegment() + 320*y + x; // Get where to put the pixel in memory and x y pos
- *pixelAddress = colour; // Set the colour of the pixel
+ // Get the address of the pixel
+ uint8_t*pixel_address = get_frame_buffer_segment() + 320*y + x;
+
+ // Set the pixel
+ *pixel_address = colour;
}
+/**
+ * @brief Gets a 8 bit pixel from the screen.
+ *
+ * @param x The x coordinate of the pixel.
+ * @param y The y coordinate of the pixel.
+ * @return The colour of the pixel.
+ */
uint8_t VideoGraphicsArray::get_rendered_pixel_8_bit(uint32_t x, uint32_t y) {
- uint8_t* pixelAddress = GetFrameBufferSegment() + y*320 + x; // Get where the pixel is in memory and x y pos
- return *pixelAddress; // Return the colour of the pixel
+
+ // Get the address of the pixel
+ uint8_t*pixel_address = get_frame_buffer_segment() + 320*y + x;
+
+ // Return the pixel
+ return *pixel_address;
}
+/**
+ * @brief Gets the name of the vendor.
+ *
+ * @return The name of the vendor.
+ */
string VideoGraphicsArray::get_vendor_name() {
return "IBM"; // VGA was made by IBM
}
+/**
+ * @brief Gets the name of the device.
+ *
+ * @return The name of the device.
+ */
string VideoGraphicsArray::get_device_name() {
return "VGA compatible graphics card";
-}
-
+}
\ No newline at end of file
diff --git a/kernel/src/drivers/video/video.cpp b/kernel/src/drivers/video/video.cpp
index 99668a65..edd5e0ce 100644
--- a/kernel/src/drivers/video/video.cpp
+++ b/kernel/src/drivers/video/video.cpp
@@ -18,33 +18,53 @@ VideoDriver::~VideoDriver() {
}
-bool VideoDriver::internalSetMode(uint32_t width, uint32_t height, uint32_t colorDepth) {
+/**
+ * @brief Set the mode of the video driver
+ *
+ * @param width The width of the screen
+ * @param height The height of the screen
+ * @param color_depth The color depth of the screen
+ * @return true If the mode was set successfully false otherwise
+ */
+bool VideoDriver::internal_set_mode(uint32_t width, uint32_t height, uint32_t color_depth) {
return false;
}
-bool VideoDriver::supportsMode(uint32_t width, uint32_t height, uint32_t colorDepth) {
+/**
+ * @brief Check if the video driver supports a certain mode
+ *
+ * @param width The width of the screen
+ * @param height The height of the screen
+ * @param color_depth The color depth of the screen
+ * @return true If the mode is supported, false otherwise
+ */
+bool VideoDriver::supports_mode(uint32_t width, uint32_t height, uint32_t color_depth) {
return false;
}
-bool VideoDriver::setMode(uint32_t width, uint32_t height, uint32_t colorDepth) {
+/**
+ * @brief Set the mode of the video driver
+ *
+ * @param width The width of the screen
+ * @param height The height of the screen
+ * @param color_depth The color depth of the screen
+ * @return true If the mode was set successfully (and the screen was updated) false otherwise
+ */
+bool VideoDriver::set_mode(uint32_t width, uint32_t height, uint32_t colorDepth) {
// Check if the mode is supported
- if(!supportsMode(width, height, colorDepth))
+ if(!supports_mode(width, height, colorDepth))
return false;
// Set the mode
- if(internalSetMode(width, height, colorDepth))
+ if(internal_set_mode(width, height, colorDepth))
{
- this ->m_width = width;
- this ->m_height = height;
- this ->m_color_depth = colorDepth;
+ this -> m_width = width;
+ this -> m_height = height;
+ this -> m_color_depth = colorDepth;
return true;
}
// If setting the mode failed, return false
return false;
-}
-
-bool VideoDriver::setTextMode() {
- return false;
}
\ No newline at end of file
diff --git a/kernel/src/filesystem/fat32.cpp b/kernel/src/filesystem/fat32.cpp
index 6f0959c4..8e15e409 100644
--- a/kernel/src/filesystem/fat32.cpp
+++ b/kernel/src/filesystem/fat32.cpp
@@ -13,7 +13,7 @@ using namespace maxOS::memory;
//TODO: Fix folders after lib not found error
/**
- * @details Intialize the FAT32 filesystem
+ * @brief Intialize the FAT32 filesystem
*
* @param hd The hard disk to initialise the FAT32 filesystem on
* @param partitionOffset The offset of the partition to initialise the FAT32 filesystem on
@@ -28,7 +28,7 @@ Fat32::Fat32(drivers::AdvancedTechnologyAttachment *hd, uint32_t partitionOffset
//Read the BIOS block from the first sector of the partition
BiosParameterBlock32 bpb;
- hd->Read28(partitionOffset, (uint8_t*)&bpb, sizeof(BiosParameterBlock32));
+ hd->read_28(partitionOffset, (uint8_t *)&bpb, sizeof(BiosParameterBlock32));
//Read information from the BIOS block and store it in the global variables
uint32_t fatStart = partitionOffset + bpb.reservedSectors; //The FAT is located after the reserved sectors
@@ -48,7 +48,7 @@ Fat32::~Fat32() {
}
/**
- * @details Get the current directory traverser
+ * @brief Get the current directory traverser
*
* @return The current directory traverser
*/
@@ -59,7 +59,7 @@ DirectoryTraverser* Fat32::getDirectoryTraverser() {
}
/**
- * @details Allocate a new cluster in the FAT
+ * @brief Allocate a new cluster in the FAT
*
* @param currentCluster The current cluster to allocate a new cluster after
* @param fatLocation The location of the FAT table
@@ -73,7 +73,8 @@ uint32_t Fat32::AllocateCluster(drivers::AdvancedTechnologyAttachment *hd, uint3
uint32_t nextFreeCluster = -1;
for (int sector = 0; sector < fat_size; ++sector) { //Loop the sectors of the FAT table
- hd -> Read28(fatLocation + sector, (uint8_t*)fatBuffer, sizeof(fatBuffer)); //Read the sector of the FAT table
+ hd->read_28(fatLocation + sector, (uint8_t *)fatBuffer,
+ sizeof(fatBuffer)); //Read the sector of the FAT table
for (int j = 0; j < 512 / sizeof(uint32_t); ++j) { //Loop through each entry in the sectort
if(fatBuffer[j] == 0){ //Fat entries are available if it is 0x000000
@@ -101,7 +102,7 @@ uint32_t Fat32::AllocateCluster(drivers::AdvancedTechnologyAttachment *hd, uint3
/**
- * @details Deallocates all clusters in a file
+ * @brief Deallocates all clusters in a file
*
* @param hd pointer to the AdvancedTechnologyAttachment object representing the hard drive
* @param firstCluster The first cluster of the file to be deallocated
@@ -118,7 +119,8 @@ void Fat32::DeallocateCluster(drivers::AdvancedTechnologyAttachment *hd, uint32_
uint32_t fatBuffer[512 / sizeof(uint32_t)]; //Create a buffer to store a sector of the FAT table
uint32_t sector = nextCluster / (512 / sizeof(uint32_t)); //Calculate the sector of the FAT table
uint32_t offset = nextCluster % (512 / sizeof(uint32_t)); //Calculate the offset of the FAT table
- hd -> Read28(fatLocation + sector, (uint8_t*)fatBuffer, sizeof(fatBuffer)); //Read the sector of the FAT table
+ hd->read_28(fatLocation + sector, (uint8_t *)fatBuffer,
+ sizeof(fatBuffer)); //Read the sector of the FAT table
//Mark the current cluster as free
UpdateEntryInFat(hd, nextCluster, 0x00000000, fatLocation);
@@ -129,7 +131,7 @@ void Fat32::DeallocateCluster(drivers::AdvancedTechnologyAttachment *hd, uint32_
}
/**
- * @details Update the entry in the FAT
+ * @brief Update the entry in the FAT
*
* @param cluster The cluster to update
* @param newFatValue The new value to set the entry to
@@ -140,14 +142,16 @@ void Fat32::UpdateEntryInFat(drivers::AdvancedTechnologyAttachment *hd, uint32_t
uint32_t fatBuffer[512 / sizeof(uint32_t)];
uint32_t sector = cluster / (512 / sizeof(uint32_t)); //Calculate the sector of the FAT table
uint32_t offset = cluster % (512 / sizeof(uint32_t)); //Calculate the offset of the FAT table
- hd -> Read28(fatLocation + sector, (uint8_t*)fatBuffer, sizeof(fatBuffer)); //Read the sector of the FAT table
+ hd->read_28(fatLocation + sector, (uint8_t *)fatBuffer,
+ sizeof(fatBuffer)); //Read the sector of the FAT table
fatBuffer[offset] = newFatValue; //Set the entry to 0x0FFFFFFF
- hd -> Write28(fatLocation + sector, (uint8_t*)fatBuffer, sizeof(fatBuffer)); //Write the changes to the disk //Write the sector of the FAT table
+ hd->write_28(fatLocation + sector, (uint8_t *)fatBuffer,
+ sizeof(fatBuffer)); //Write the changes to the disk //Write the sector of the FAT table
};
/**
- * @details Check if a string is a valid FAT32 name
+ * @brief Check if a string is a valid FAT32 name
*
* @param name Pointer to the char array to check
* @return true if the name is valid, false otherwise
@@ -239,7 +243,9 @@ void FatDirectoryTraverser::ReadEntrys(){
while(true){
//Read the sector
- hd -> Read28(directoryReadSector + sectorOffset, (uint8_t*)&tempDirent[0], 16*sizeof(DirectoryEntry)); //Read the directory entries
+ hd->read_28(
+ directoryReadSector + sectorOffset, (uint8_t *)&tempDirent[0],
+ 16 * sizeof(DirectoryEntry)); //Read the directory entries
sectorOffset++; //Increment the sector offset
//Loop through all the entries
@@ -288,7 +294,7 @@ void FatDirectoryTraverser::ReadEntrys(){
uint32_t offset = nextCluster % (512 / sizeof(uint32_t)); //Calculate the offset of the FAT table
//Read the FAT sector for the current cluster
- hd -> Read28(fatLocation + sector, fatBuffer, 512);
+ hd->read_28(fatLocation + sector, fatBuffer, 512);
//Set the next cluster to the next cluster in the FAT
nextCluster = ((uint32_t*)&fatBuffer)[offset] & 0x0FFFFFFF;
@@ -301,7 +307,7 @@ void FatDirectoryTraverser::ReadEntrys(){
}
/**
- * @details Changes the current directory to the specified directory, re reads the directory entries
+ * @brief Changes the current directory to the specified directory, re reads the directory entries
*
* @param directory The directory to change to
*/
@@ -556,7 +562,9 @@ void FatDirectoryTraverser::UpdateDirectoryEntrysToDisk(){
}
//Write a sectors worth of directory entries
- hd -> Write28(directoryReadSector + sectorOffset, (uint8_t*)&tempDirent[0], 16*sizeof(DirectoryEntry)); //Read the directory entries
+ hd->write_28(
+ directoryReadSector + sectorOffset, (uint8_t *)&tempDirent[0],
+ 16 * sizeof(DirectoryEntry)); //Read the directory entries
sectorOffset++; //Increment the sector offset
@@ -570,7 +578,7 @@ void FatDirectoryTraverser::UpdateDirectoryEntrysToDisk(){
uint32_t offset = nextCluster % (512 / sizeof(uint32_t)); //Calculate the offset of the FAT table
//Read the FAT sector for the current cluster
- hd -> Read28(fatLocation + sector, fatBuffer, 512);
+ hd->read_28(fatLocation + sector, fatBuffer, 512);
//Set the next cluster to the next cluster in the FAT
nextCluster = ((uint32_t*)&fatBuffer)[offset] & 0x0FFFFFFF;
@@ -604,7 +612,7 @@ FatDirectoryEnumerator::~FatDirectoryEnumerator() {
}
/**
- * @details Get the name of the directory
+ * @brief Get the name of the directory
*
* @return The name of the directory
*/
@@ -617,7 +625,7 @@ string FatDirectoryEnumerator::getDirectoryName() {
}
/**
- * @details Change the name of the directory
+ * @brief Change the name of the directory
*
* @param newDirectoryName The new name of the directory
* @return The old name of the directory
@@ -643,7 +651,7 @@ string FatDirectoryEnumerator::changeDirectoryName(string newDirectoryName) {
}
/**
- * @details Check if there is another directory in the parent directory
+ * @brief Check if there is another directory in the parent directory
*
* @return True if there is another directory, false if not
*/
@@ -653,7 +661,7 @@ bool FatDirectoryEnumerator::hasNext() {
}
/**
- * @details Get the next directory in the parent directory
+ * @brief Get the next directory in the parent directory
*
* @return The next directory in the parent directory
*/
@@ -695,7 +703,7 @@ FatFileEnumerator::~FatFileEnumerator() {
}
/**
- * @details Get the name of the file
+ * @brief Get the name of the file
*
* @return The name of the file
*/
@@ -708,7 +716,7 @@ string FatFileEnumerator::getFileName() {
}
/**
- * @details Changes the name of the currently enumerated file
+ * @brief Changes the name of the currently enumerated file
*
* @param newFileName The new filename
* @return The old filename
@@ -732,7 +740,7 @@ string FatFileEnumerator::changeFileName(string newFileName) {
}
/**
- * @details Gets a reference to the current reader object
+ * @brief Gets a reference to the current reader object
*
* @return The current reader object
*/
@@ -741,7 +749,7 @@ FileReader* FatFileEnumerator::getReader() {
}
/**
- * @details Gets a reference to the current writer object
+ * @brief Gets a reference to the current writer object
*
* @return The current writer object
*/
@@ -750,7 +758,7 @@ FileWriter* FatFileEnumerator::getWriter() {
}
/**
- * @details Checks if there is a another file enumerater after this one
+ * @brief Checks if there is a another file enumerater after this one
*
* @return True if there is another file, false if not
*/
@@ -759,7 +767,7 @@ bool FatFileEnumerator::hasNext() {
}
/**
- * @details Creates a new FatFileEnumerator object for the next file in the directory (Note: this is why you should store the return value in a varible and refernce that value instead of calling x -> next() -> doY(); )
+ * @brief Creates a new FatFileEnumerator object for the next file in the directory (Note: this is why you should store the return value in a varible and refernce that value instead of calling x -> next() -> doY(); )
*
* @return The next file in the directory
*/
@@ -793,7 +801,7 @@ FatFileReader::~FatFileReader() {
}
/**
- * @details Read a number of bytes from the file
+ * @brief Read a number of bytes from the file
*
* @param data The buffer to read the data into
* @param size The number of bytes to read
@@ -826,8 +834,8 @@ uint32_t FatFileReader::Read(uint8_t *data, uint32_t size) {
//Loop the sectors of the file
for (; fSIZE > 0; fSIZE -= 512) {
-
- traverser -> hd -> Read28(fileSector + sectorOffset, fileBuffer, 512); //Read the specified sector of the file
+ traverser->hd->read_28(fileSector + sectorOffset, fileBuffer,
+ 512); //Read the specified sector of the file
sectorOffset++; //Increment the sector offset
@@ -866,7 +874,9 @@ uint32_t FatFileReader::Read(uint8_t *data, uint32_t size) {
uint32_t fatSectorForCurrentCluster = nextFileCluster / (512 / sizeof(uint32_t)); //The FAT sector for the current cluster is the current cluster divided by the number of entries per sector
//Read the FAT sector for the current cluster
- traverser -> hd -> Read28(traverser -> fatLocation + fatSectorForCurrentCluster, fatBuffer, 512);
+ traverser->hd->read_28(traverser->fatLocation +
+ fatSectorForCurrentCluster,
+ fatBuffer, 512);
//Get the offset of the current cluster in the FAT sector
uint32_t fatOffsetInSectorForCurrentCluster = nextFileCluster % (512/sizeof(uint32_t));
@@ -880,7 +890,7 @@ uint32_t FatFileReader::Read(uint8_t *data, uint32_t size) {
}
/**
- * @details Moves the file offset to a new position
+ * @brief Moves the file offset to a new position
*
* @param position The new position of the file offset
* @param seek The type of seek to perform. (SEEK_SET, offset = position) (SEEK_CUR, offset = offset + position) (SEEK_END, offset = fileSize + position)
@@ -906,7 +916,7 @@ uint32_t FatFileReader::Seek(uint32_t position, SeekType seek) {
}
/**
- * @details Get the current position of the file offset
+ * @brief Get the current position of the file offset
*
* @return the current position of the file offset
*/
@@ -915,7 +925,7 @@ uint32_t FatFileReader::GetPosition() {
}
/**
- * @details Get the size of the file
+ * @brief Get the size of the file
*
* @return the size of the file
*/
@@ -940,7 +950,7 @@ FatFileWriter::~FatFileWriter() {
}
/**
- * @details Writes data to a file starting at the current seek position and ending at the current seek position + size
+ * @brief Writes data to a file starting at the current seek position and ending at the current seek position + size
*
* @param data The buffer to write the data from
* @param size The size that is to be written
@@ -979,7 +989,9 @@ uint32_t FatFileWriter::Write(uint8_t *data, uint32_t size) {
if(writePos < offsetPosition){
///If the data will not be written at the right place then read the sector and then begin writing after the offset
- traverser -> hd -> Read28(fileSector + sectorOffset, fileBuffer, 512); //Read the specified sector of the file
+ traverser->hd->read_28(
+ fileSector + sectorOffset, fileBuffer,
+ 512); //Read the specified sector of the file
}
@@ -999,7 +1011,8 @@ uint32_t FatFileWriter::Write(uint8_t *data, uint32_t size) {
//Check that the data buffer is not full / that the requested size has not been reached, if it is then write the data early and then
if (dataOffset >= size){
- traverser -> hd -> Write28(fileSector + sectorOffset, fileBuffer, i); //Write the sector to the disk
+ traverser->hd->write_28(fileSector + sectorOffset, fileBuffer,
+ i); //Write the sector to the disk
return size;
}
@@ -1009,7 +1022,7 @@ uint32_t FatFileWriter::Write(uint8_t *data, uint32_t size) {
}
//Write the sector to the disk
- traverser -> hd -> Write28(fileSector + sectorOffset, fileBuffer, 512);
+ traverser->hd->write_28(fileSector + sectorOffset, fileBuffer, 512);
//If the next sector is in a different cluster then break
if (sectorOffset > traverser -> sectorsPrCluster)
@@ -1048,7 +1061,8 @@ uint32_t FatFileWriter::Write(uint8_t *data, uint32_t size) {
uint32_t offset = nextFileCluster % (512 / sizeof(uint32_t)); //Calculate the offset of the FAT table
//Read the FAT sector for the current cluster
- traverser -> hd -> Read28(traverser -> fatLocation + sector, fatBuffer, 512);
+ traverser->hd->read_28(traverser->fatLocation + sector, fatBuffer,
+ 512);
//Set the next cluster to the next cluster in the FAT
nextFileCluster = ((uint32_t*)&fatBuffer)[offset ] & 0x0FFFFFFF;
diff --git a/kernel/src/filesystem/filesystem.cpp b/kernel/src/filesystem/filesystem.cpp
index 4b73d7f2..ded731ed 100644
--- a/kernel/src/filesystem/filesystem.cpp
+++ b/kernel/src/filesystem/filesystem.cpp
@@ -23,7 +23,7 @@ DirectoryTraverser *FileSystem::getDirectoryTraverser() {
}
/**
- * @details Get the directory traverser for the filesystem
+ * @brief Get the directory traverser for the filesystem
*
* @return
*/
@@ -42,7 +42,7 @@ DirectoryTraverser::~DirectoryTraverser() {
}
/**
- * @details Change what directory is being traversed
+ * @brief Change what directory is being traversed
*
* @param directory the directory to traverse
*/
@@ -54,7 +54,7 @@ void DirectoryTraverser::changeDirectory(DirectoryEnumerator directory) {
}
/**
- * @details Creates a new directory
+ * @brief Creates a new directory
*
* @param name the name of the directory
*/
@@ -63,7 +63,7 @@ void DirectoryTraverser::makeDirectory(string name) {
}
/**
- * @details Removes a directory and all its contents
+ * @brief Removes a directory and all its contents
*
* @param name the name of the directory to remove
*/
@@ -75,7 +75,7 @@ void DirectoryTraverser::removeDirectory(string name) {
/**
- * @details Gets the file enumerator for the current directory
+ * @brief Gets the file enumerator for the current directory
*
* @return the file enumerator
*/
@@ -84,7 +84,7 @@ FileEnumerator* DirectoryTraverser::getFileEnumerator() {
}
/**
- * @details Gets the directory enumerator for the current directory
+ * @brief Gets the directory enumerator for the current directory
*
* @return the directory enumerator
*/
@@ -93,7 +93,7 @@ DirectoryEnumerator* DirectoryTraverser::getDirectoryEnumerator() {
}
/**
- * @details Creates a new file
+ * @brief Creates a new file
*
* @param name the name of the file
*/
@@ -102,7 +102,7 @@ void DirectoryTraverser::makeFile(string name) {
}
/**
- * @details Removes a file
+ * @brief Removes a file
*
* @param name the name of the file
*/
@@ -126,7 +126,7 @@ DirectoryEnumerator::~DirectoryEnumerator() {
}
/**
- * @details Gets the name of the directory
+ * @brief Gets the name of the directory
*
* @return the name of the directory
*/
@@ -135,7 +135,7 @@ string DirectoryEnumerator::getDirectoryName() {
}
/**
- * @details Checks if there is another directory
+ * @brief Checks if there is another directory
*
* @return true if there is another directory, false otherwise
*/
@@ -144,7 +144,7 @@ bool DirectoryEnumerator::hasNext() {
}
/**
- * @details Gets the next directoryEnumerator in this DirectoryTraverser
+ * @brief Gets the next directoryEnumerator in this DirectoryTraverser
*
* @return the next directoryEnumerator
*/
@@ -164,7 +164,7 @@ FileEnumerator::~FileEnumerator() {
}
/**
- * @details Gets the name of the current file
+ * @brief Gets the name of the current file
*
* @return the name of the file
*/
@@ -174,7 +174,7 @@ string FileEnumerator::getFileName() {
}
/**
- * @details Gets the reader for the current file
+ * @brief Gets the reader for the current file
*
* @return the reader for the file
*/
@@ -183,7 +183,7 @@ FileReader* FileEnumerator::getReader() {
}
/**
- * @details Gets the writer for the current file
+ * @brief Gets the writer for the current file
*
* @return the writer for the file
*/
@@ -192,7 +192,7 @@ FileWriter* FileEnumerator::getWriter() {
}
/**
- * @details Checks if there is another file
+ * @brief Checks if there is another file
*
* @return true if there is another file, false otherwise
*/
@@ -201,7 +201,7 @@ bool FileEnumerator::hasNext() {
}
/**
- * @details Gets the next file in this DirectoryTraverser
+ * @brief Gets the next file in this DirectoryTraverser
*
* @return The next file
*/
@@ -222,7 +222,7 @@ FileReader::~FileReader() {
}
/**
- * @details Reads from the file and stores the data in the buffer at the given position (default 0 + how many bytes has been read this fileEnumeration)
+ * @brief Reads from the file and stores the data in the buffer at the given position (default 0 + how many bytes has been read this fileEnumeration)
*
* @param data the data pointer to read into
* @param size the size of the data to read
@@ -233,7 +233,7 @@ uint32_t FileReader::Read(uint8_t *data, uint32_t size) {
}
/**
- * @details Moves the position in the file
+ * @brief Moves the position in the file
*
* @param position how many bytes to move the position
* @param seek The type of seek to perform. (SEEK_SET, offset = position) (SEEK_CUR, offset = offset + position) (SEEK_END, offset = fileSize + position)
@@ -244,7 +244,7 @@ uint32_t FileReader::Seek(uint32_t position, SeekType seek) {
}
/**
- * @details Gets the current position in the file
+ * @brief Gets the current position in the file
*
* @return the current position in the file
*/
@@ -253,7 +253,7 @@ uint32_t FileReader::GetPosition() {
}
/**
- * @details Gets the size of the file
+ * @brief Gets the size of the file
*
* @return the size of the file
*/
@@ -274,7 +274,7 @@ FileWriter::~FileWriter() {
}
/**
- * @details Writes to the file at the given position (default 0 + how many bytes has been read this fileEnumeration)
+ * @brief Writes to the file at the given position (default 0 + how many bytes has been read this fileEnumeration)
*
* @param data the data pointer to write from
* @param size the size of the data to write
@@ -285,7 +285,7 @@ uint32_t FileWriter::Write(uint8_t *data, uint32_t size) {
}
/**
- * @details Moves the position in the file
+ * @brief Moves the position in the file
*
* @param position the position to move to
* @param seek The type of seek to perform. (SEEK_SET, offset = position) (SEEK_CUR, offset = offset + position) (SEEK_END, offset = fileSize + position)
@@ -296,7 +296,7 @@ uint32_t FileWriter::Seek(uint32_t position, SeekType seek) {
}
/**
- * @details Closes the current file
+ * @brief Closes the current file
*
* @return True if the file was closed successfully, false otherwise
*/
@@ -305,7 +305,7 @@ bool FileWriter::Close() {
}
/**
- * @details Flushes the current file (writes all data to the disk)
+ * @brief Flushes the current file (writes all data to the disk)
*
* @return True if the file was flushed successfully, false otherwise
*/
@@ -314,7 +314,7 @@ bool FileWriter::Flush() {
}
/**
- * @details Gets the current position in the file
+ * @brief Gets the current position in the file
*
* @return the current position in the file
*/
@@ -323,7 +323,7 @@ uint32_t FileWriter::GetPosition() {
}
/**
- * @details Gets the size of the file
+ * @brief Gets the size of the file
*
* @return the size of the file
*/
diff --git a/kernel/src/filesystem/msdospart.cpp b/kernel/src/filesystem/msdospart.cpp
index 701d39c6..c35451b5 100644
--- a/kernel/src/filesystem/msdospart.cpp
+++ b/kernel/src/filesystem/msdospart.cpp
@@ -10,7 +10,7 @@ using namespace maxOS::common;
using namespace maxOS::filesystem;
/**
- * @details Read the partition table of a given hard disk
+ * @brief Read the partition table of a given hard disk
*
* @param hd The hard disk to read the partition table from
*/
@@ -18,7 +18,9 @@ void MSDOSPartitionTable::ReadPartitions(AdvancedTechnologyAttachment *hd) {
MasterBootRecord masterBootRecord; // Create a MasterBootRecord object
- hd -> Read28(0, (uint8_t*)&masterBootRecord, sizeof(MasterBootRecord)); // Read the MasterBootRecord from the disk
+ hd->read_28(
+ 0, (uint8_t *)&masterBootRecord,
+ sizeof(MasterBootRecord)); // Read the MasterBootRecord from the disk
/*
printf("MBR: ");
diff --git a/kernel/src/gui/desktop.cpp b/kernel/src/gui/desktop.cpp
index a7a06881..57acef86 100644
--- a/kernel/src/gui/desktop.cpp
+++ b/kernel/src/gui/desktop.cpp
@@ -10,7 +10,7 @@ using namespace maxOS::gui;
using namespace maxOS::drivers::peripherals;
/**
- * @details Creates a new desktop with the given graphics context
+ * @brief Creates a new desktop with the given graphics context
*
* @param gc The graphics context to use
*/
@@ -46,7 +46,7 @@ Desktop::~Desktop() {
}
/**
- * @details Updates the currently focussed widget to be the given widget
+ * @brief Updates the currently focussed widget to be the given widget
*
* @param widget The widget that is now in focus
*/
@@ -69,7 +69,7 @@ void Desktop::setFocus(Widget* widget) {
}
/**
- * @details Brings the given widget to the front of the desktop
+ * @brief Brings the given widget to the front of the desktop
*
* @param frontWidget The widget to bring to the front
*/
@@ -90,7 +90,7 @@ void Desktop::bringToFront(Widget* frontWidget) {
}
/**
- * @details Draws the mouse cursor at the current mouse position by inverting the pixels (mouse is a plus sign)
+ * @brief Draws the mouse cursor at the current mouse position by inverting the pixels (mouse is a plus sign)
*/
void Desktop::invertMouseCursor() {
@@ -108,7 +108,7 @@ void Desktop::invertMouseCursor() {
}
/**
- * @details Goes through the passed areas and invalidates the areas that are covered by the given area
+ * @brief Goes through the passed areas and invalidates the areas that are covered by the given area
*
* @param area The area that is now invalid
* @param start The start of the invalid areas
@@ -156,7 +156,7 @@ void Desktop::internalInvalidate(Rectangle &area, Vector &area) {
}
/**
- * @details Adds a child widget to the desktop
+ * @brief Adds a child widget to the desktop
*
* @param widget The widget to add
*/
@@ -205,7 +205,7 @@ void Desktop::addChild(Widget* childWidget) {
}
/**
- * @details Redraws the desktop when a time event occurs
+ * @brief Redraws the desktop when a time event occurs
*
* @param time The time when the event occurred
*/
@@ -238,7 +238,7 @@ void Desktop::on_time(common::Time const &time) {
}
/**
- * @details Invalidate the given area of the desktop
+ * @brief Invalidate the given area of the desktop
*
* @param area The area that is now invalid
*/
@@ -251,12 +251,12 @@ void Desktop::invalidate(Rectangle &area) {
/**
- * @details When the mouse moves on the desktop update the position of the mouse and redraw the cursor. Pass the event to the widget that the mouse is over
+ * @brief When the mouse moves on the desktop update the position of the mouse and redraw the cursor. Pass the event to the widget that the mouse is over
*
* @param x The x position of the mouse
* @param y The y position of the mouse
*/
-void Desktop::onMouseMoveEvent(int8_t x, int8_t y) {
+void Desktop::on_mouse_move_event(int8_t x, int8_t y) {
// Store the position of the desktop for calculations
Rectangle desktopPosition = getPosition();
@@ -278,7 +278,8 @@ void Desktop::onMouseMoveEvent(int8_t x, int8_t y) {
if(draggedWidget != 0)
{
// Pass the mouse move event to the widget being dragged
- draggedWidget -> onMouseMoveEvent(newMouseX - mouseX, newMouseY - mouseY);
+ draggedWidget->on_mouse_move_event(newMouseX - mouseX,
+ newMouseY - mouseY);
}
// Handle the mouse moving event (pass it to the widget that the mouse is over)
@@ -293,11 +294,11 @@ void Desktop::onMouseMoveEvent(int8_t x, int8_t y) {
}
/**
- * @details When the mouse button is pressed pass the event to the widget that the mouse is over
+ * @brief When the mouse button is pressed pass the event to the widget that the mouse is over
*
* @param button The button that was pressed
*/
-void Desktop::onMouseDownEvent(uint8_t button) {
+void Desktop::on_mouse_down_event(uint8_t button) {
// The widget that handled the event becomes the widget being dragged
draggedWidget = CompositeWidget::onMouseButtonPressed(mouseX, mouseY, button);
@@ -305,11 +306,11 @@ void Desktop::onMouseDownEvent(uint8_t button) {
}
/**
- * @details When the mouse button is released pass the event to the widget that the mouse is over
+ * @brief When the mouse button is released pass the event to the widget that the mouse is over
*
* @param button The button that was released
*/
-void Desktop::onMouseUpEvent(uint8_t button) {
+void Desktop::on_mouse_up_event(uint8_t button) {
// Pass the event to the widget
CompositeWidget::onMouseButtonReleased(mouseX, mouseY, button);
@@ -320,28 +321,28 @@ void Desktop::onMouseUpEvent(uint8_t button) {
}
/**
- * @details When a key is pressed pass the event to the widget that is currently focussed
+ * @brief When a key is pressed pass the event to the widget that is currently focussed
* @param keyDownCode The key that was pressed
* @param keyDownState The state of the keyboard
*/
-void Desktop::onKeyDown(drivers::peripherals::KeyCode keyDownCode, drivers::peripherals::KeyboardState keyDownState) {
+void Desktop::on_key_down(KeyCode keyDownCode, KeyboardState keyDownState) {
// Pass the event to the widget that is in focus
if (focussedWidget != 0) {
- focussedWidget -> onKeyDown(keyDownCode, keyDownState);
+ focussedWidget->on_key_down(keyDownCode, keyDownState);
}
}
/**
- * @details When a key is pressed pass the event to the widget that is currently focussed
+ * @brief When a key is pressed pass the event to the widget that is currently focussed
* @param keyUpCode The key that was pressed
* @param keyUpState The state of the keyboard
*/
-void Desktop::onKeyUp(drivers::peripherals::KeyCode keyUpCode, drivers::peripherals::KeyboardState keyUpState) {
+void Desktop::on_key_up(KeyCode keyUpCode, KeyboardState keyUpState) {
// Pass the event to the widget that is in focus
if (focussedWidget != 0) {
- focussedWidget -> onKeyUp(keyUpCode, keyUpState);
+ focussedWidget->on_key_up(keyUpCode, keyUpState);
}
}
diff --git a/kernel/src/gui/font.cpp b/kernel/src/gui/font.cpp
index 0c6c54c3..a90ea7bc 100644
--- a/kernel/src/gui/font.cpp
+++ b/kernel/src/gui/font.cpp
@@ -25,7 +25,7 @@ Font::~Font() {
}
/**
- * @details Write the entire text to the screen
+ * @brief Write the entire text to the screen
* @param x The x coordinate of the text
* @param y The y coordinate of the text
* @param context The graphics context to draw the text on
@@ -48,7 +48,7 @@ void Font::drawText(int32_t x, int32_t y, Colour foregroundColour, Colour backgr
/**
- * @details Write the entire text to the screen
+ * @brief Write the entire text to the screen
* @param x The x coordinate of the text
* @param y The y coordinate of the text
* @param context The graphics context to draw the text on
@@ -57,8 +57,8 @@ void Font::drawText(int32_t x, int32_t y, Colour foregroundColour, Colour backgr
*/
void Font::drawText(int32_t x, int32_t y, Colour foregroundColour, Colour backgroundColour, GraphicsContext *context, string text, Rectangle limitArea) {
- uint8_t font8x8[2048]; // Declare an array to hold the font data
- getFont8x8(font8x8); // Get the font data
+ uint8_t font8x8[2048]; // Declare an array to hold the m_font data
+ getFont8x8(font8x8); // Get the m_font data
// Convert the colours
uint32_t foreground = context->colour_to_int(foregroundColour);
@@ -133,7 +133,7 @@ void Font::drawText(int32_t x, int32_t y, Colour foregroundColour, Colour backgr
}
/**
- * @details Get the m_height of the text
+ * @brief Get the m_height of the text
* @param text The text to get the m_height of
* @return The m_height of the text
*/
@@ -144,7 +144,7 @@ uint32_t Font::getTextHeight(string text) {
}
/**
- * @details Get the m_width of the text
+ * @brief Get the m_width of the text
* @param text The text to get the m_width of
* @return The m_width of the text
*/
diff --git a/kernel/src/gui/widget.cpp b/kernel/src/gui/widget.cpp
index cb7057c9..a90c8977 100644
--- a/kernel/src/gui/widget.cpp
+++ b/kernel/src/gui/widget.cpp
@@ -53,7 +53,7 @@ Widget::~Widget(){
}
/**
- * @details Draw the widget on the screen
+ * @brief Draw the widget on the screen
*
* @param gc The graphics context to draw the widgets pixels on
* @param area The area of the widget to draw
@@ -63,7 +63,7 @@ void Widget::draw(GraphicsContext *gc, Rectangle &area) {
}
/**
- * @details Invalidates the entire widget. This forces the widget to be redrawn on the next screen update
+ * @brief Invalidates the entire widget. This forces the widget to be redrawn on the next screen update
*/
void Widget::invalidate() {
@@ -79,7 +79,7 @@ void Widget::invalidate() {
}
/**
- * @details Invalidates a specific area of the widget. This forces that part of the screen to be redrawn on the next screen update
+ * @brief Invalidates a specific area of the widget. This forces that part of the screen to be redrawn on the next screen update
*
* @param area The area of the widget to invalidate
*/
@@ -93,7 +93,7 @@ void Widget::invalidate(Rectangle &area) {
}
/**
- * @details Set the parent of a widget to this widget, making it into a child
+ * @brief Set the parent of a widget to this widget, making it into a child
*
* @param child The child to add
*/
@@ -117,7 +117,7 @@ Coordinates Widget::absoluteCoordinates(Coordinates coordinates) {
}
/**
- * @details Check if the widget contains a specific coordinate
+ * @brief Check if the widget contains a specific coordinate
*
* @param x The x coordinate
* @param y The y coordinate
@@ -130,7 +130,7 @@ bool Widget::containsCoordinate(uint32_t x, uint32_t y) {
}
/**
- * @details Get the position of the widget
+ * @brief Get the position of the widget
*
* @return The position of the widget
*/
@@ -139,7 +139,7 @@ Rectangle Widget::getPosition() {
}
/**
- * @details Set the position of the widget, and invalidate the old and new positions so they are redrawn
+ * @brief Set the position of the widget, and invalidate the old and new positions so they are redrawn
*
* @param left The new left position of the rectangle
* @param top The new top position of the rectangle
@@ -157,7 +157,7 @@ void Widget::move(int32_t left, int32_t top) {
}
/**
- * @details Set the size of the widget, and invalidate the old and new positions so they are redrawn
+ * @brief Set the size of the widget, and invalidate the old and new positions so they are redrawn
*
* @param width The new m_width of the rectangle
* @param height The new m_height of the rectangle
@@ -197,7 +197,7 @@ void Widget::resize(int32_t width, int32_t height) {
}
/**
- * @details Set the current focuesd widget to be this widget
+ * @brief Set the current focuesd widget to be this widget
*/
void Widget::focus() {
// Set the focus the widget to this widget
@@ -205,7 +205,7 @@ void Widget::focus() {
}
/**
- * @details Sets the widget that is currently focussed
+ * @brief Sets the widget that is currently focussed
* @param widget The widget to set as focussed
*/
void Widget::setFocus(Widget *widget) {
@@ -217,21 +217,21 @@ void Widget::setFocus(Widget *widget) {
}
/**
- * @details Handles the event when the widget is focussed
+ * @brief Handles the event when the widget is focussed
*/
void Widget::onFocus() {
}
/**
- * @details Handles the event when the widget is unfocussed
+ * @brief Handles the event when the widget is unfocussed
*/
void Widget::onFocusLost() {
}
/**
- * @details Brings this widget to the front of the screen
+ * @brief Brings this widget to the front of the screen
*/
void Widget::bringToFront() {
@@ -241,7 +241,7 @@ void Widget::bringToFront() {
}
/**
- * @details Brings a specific widget to the front of the screen
+ * @brief Brings a specific widget to the front of the screen
*
* @param widget The widget to bring to the front
*/
@@ -255,7 +255,7 @@ void Widget::bringToFront(Widget *widget) {
}
/**
- * @details Handles the event when the mouse is moved on to the widget
+ * @brief Handles the event when the mouse is moved on to the widget
*
* @param toX The x coordinate of the mouse
* @param toY The y coordinate of the mouse
@@ -265,7 +265,7 @@ void Widget::onMouseEnterWidget(uint32_t toX, uint32_t toY) {
}
/**
- * @details Handles the event when the mouse is moved out of the widget
+ * @brief Handles the event when the mouse is moved out of the widget
*
* @param fromX The x coordinate of the mouse
* @param fromY The y coordinate of the mouse
@@ -275,7 +275,7 @@ void Widget::onMouseLeaveWidget(uint32_t fromX, uint32_t fromY) {
}
/**
- * @details Handles the event when the mouse is moved over the widget
+ * @brief Handles the event when the mouse is moved over the widget
*
* @param fromX The x original coordinate of the mouse
* @param fromY The y original coordinate of the mouse
@@ -287,7 +287,7 @@ void Widget::onMouseMoveWidget(uint32_t fromX, uint32_t fromY, uint32_t toX, uin
}
/**
- * @details Handles the event when the mouse is pressed on the widget
+ * @brief Handles the event when the mouse is pressed on the widget
*
* @param x The x coordinate of the mouse when it was pressed
* @param y The y coordinate of the mouse when it was pressed
@@ -307,7 +307,7 @@ peripherals::MouseEventHandler* Widget::onMouseButtonPressed(uint32_t x, uint32_
}
/**
- * @details Handles the event when the mouse is released on the widget
+ * @brief Handles the event when the mouse is released on the widget
*
* @param x The x coordinate of the mouse when it was released
* @param y The y coordinate of the mouse when it was released
@@ -334,7 +334,7 @@ CompositeWidget::~CompositeWidget() {
}
/**
- * @details Draws a section of the widget and its children
+ * @brief Draws a section of the widget and its children
*
* @param gc The graphics context to draw to
* @param area The area to draw
@@ -347,7 +347,7 @@ void CompositeWidget::draw(GraphicsContext *gc, Rectangle &area) {
}
/**
- * @details Draws a section of the widget and the children after a specific child
+ * @brief Draws a section of the widget and the children after a specific child
*
* @param gc The graphics context to draw to
* @param area The area to draw
@@ -401,7 +401,7 @@ void CompositeWidget::draw(GraphicsContext *gc, Rectangle &area, Vector
}
/**
- * @details Draws the widget itself (should be overridden by the derived class)
+ * @brief Draws the widget itself (should be overridden by the derived class)
*
* @param gc The graphics context to draw to
* @param area The area to draw
@@ -411,7 +411,7 @@ void CompositeWidget::drawSelf(GraphicsContext *gc, Rectangle &area) {
}
/**
- * @details Adds a child to the widget
+ * @brief Adds a child to the widget
*
* @param child The child to add
*/
@@ -425,7 +425,7 @@ void CompositeWidget::addChild(Widget *child) {
}
/**
- * @details Passes the event to the child that the mouse is over. (Event handling should be done by the derived class)
+ * @brief Passes the event to the child that the mouse is over. (Event handling should be done by the derived class)
*
* @param toX The x coordinate of the mouse
* @param toY The y coordinate of the mouse
@@ -455,7 +455,7 @@ void CompositeWidget::onMouseEnterWidget(uint32_t toX, uint32_t toY) {
}
/**
- * @details Passes the event to the child that the mouse is over. (Event handling should be done by the derived class)
+ * @brief Passes the event to the child that the mouse is over. (Event handling should be done by the derived class)
*
* @param fromX The x coordinate of the mouse
* @param fromY The y coordinate of the mouse
@@ -484,7 +484,7 @@ void CompositeWidget::onMouseLeaveWidget(uint32_t fromX, uint32_t fromY) {
}
/**
- * @details Passes the event to the child that the mouse is over, also generates a leave/enter event for children (Event handling should be done by the derived class)
+ * @brief Passes the event to the child that the mouse is over, also generates a leave/enter event for children (Event handling should be done by the derived class)
*
* @param fromX The x coordinate of the mouse
* @param fromY The y coordinate of the mouse
@@ -542,7 +542,7 @@ void CompositeWidget::onMouseMoveWidget(uint32_t fromX, uint32_t fromY, uint32_t
}
/**
- * @details Passes the event to the child that the mouse is over. (Event handling should be done by the derived class)
+ * @brief Passes the event to the child that the mouse is over. (Event handling should be done by the derived class)
*
* @param x The x coordinate of the mouse
* @param y The y coordinate of the mouse
@@ -574,7 +574,7 @@ peripherals::MouseEventHandler *CompositeWidget::onMouseButtonPressed(uint32_t x
}
/**
- * @details Passes the event to the child that the mouse is over. (Event handling should be done by the derived class)
+ * @brief Passes the event to the child that the mouse is over. (Event handling should be done by the derived class)
*
* @param x The x coordinate of the mouse
* @param y The y coordinate of the mouse
diff --git a/kernel/src/gui/widgets/button.cpp b/kernel/src/gui/widgets/button.cpp
index 61962aeb..72deb4cf 100644
--- a/kernel/src/gui/widgets/button.cpp
+++ b/kernel/src/gui/widgets/button.cpp
@@ -21,7 +21,7 @@ ButtonEventHandler::~ButtonEventHandler() {
}
/**
- * @details Handles the button events
+ * @brief Handles the button events
* @param event The event to handle
*/
Event* ButtonEventHandler::on_event(Event *event) {
@@ -46,7 +46,7 @@ Event* ButtonEventHandler::on_event(Event *event) {
}
/**
- * @details Handles the button pressed event
+ * @brief Handles the button pressed event
* @param source The source of the event
*/
void ButtonEventHandler::onButtonPressed(Button *source) {
@@ -54,7 +54,7 @@ void ButtonEventHandler::onButtonPressed(Button *source) {
}
/**
- * @details Handles the button released event
+ * @brief Handles the button released event
* @param source The source of the event
*/
void ButtonEventHandler::onButtonReleased(Button *source) {
@@ -81,7 +81,7 @@ Button::~Button() {
}
/**
- * @details Draws the button
+ * @brief Draws the button
* @param gc The graphics context to draw to
* @param area The area to draw to
*/
@@ -145,7 +145,7 @@ void Button::draw(GraphicsContext *gc, Rectangle &area) {
}
/**
- * @details Handles the mouse button pressed event
+ * @brief Handles the mouse button pressed event
* @param x The x position of the mouse
* @param y The y position of the mouse
* @param button The button that was pressed
@@ -164,7 +164,7 @@ MouseEventHandler* Button::onMouseButtonPressed(uint32_t x, uint32_t y, uint8_t
}
/**
- * @details Handles the mouse button released event
+ * @brief Handles the mouse button released event
* @param x The x position of the mouse
* @param y The y position of the mouse
* @param button The button that was released
diff --git a/kernel/src/gui/widgets/inputbox.cpp b/kernel/src/gui/widgets/inputbox.cpp
index 080bbb2c..3947d5ef 100644
--- a/kernel/src/gui/widgets/inputbox.cpp
+++ b/kernel/src/gui/widgets/inputbox.cpp
@@ -146,7 +146,7 @@ void InputBox::onFocusLost() {
invalidate();
}
-void InputBox::onKeyDown(KeyCode keyDownCode, KeyboardState keyDownState) {
+void InputBox::on_key_down(KeyCode keyDownCode, KeyboardState keyDownState) {
// Handle the key press
switch(keyDownCode)
diff --git a/kernel/src/gui/widgets/text.cpp b/kernel/src/gui/widgets/text.cpp
index 236ae7c2..e761a81d 100644
--- a/kernel/src/gui/widgets/text.cpp
+++ b/kernel/src/gui/widgets/text.cpp
@@ -12,7 +12,7 @@ using namespace maxOS::gui::widgets;
Text::Text(int32_t left, int32_t top, uint32_t width, uint32_t height, string text)
: Widget(left, top, width, height)
{
- // Set the default font
+ // Set the default m_font
this -> font = AmigaFont();
// Set the text
@@ -29,7 +29,7 @@ Text::~Text() {
}
/**
- * @details Draw the text on the screen
+ * @brief Draw the text on the screen
*
* @param gc The graphics context to draw on
* @param area The area of the text to draw
@@ -57,7 +57,7 @@ void Text::draw(GraphicsContext *gc, Rectangle& area) {
}
/**
- * @details Update the text of the widget
+ * @brief Update the text of the widget
* @param newText The new text to display
*/
void Text::updateText(string newText) {
diff --git a/kernel/src/gui/window.cpp b/kernel/src/gui/window.cpp
index 7d49ed77..716d56c3 100644
--- a/kernel/src/gui/window.cpp
+++ b/kernel/src/gui/window.cpp
@@ -84,7 +84,7 @@ Window::~Window() {
}
/**
- * @details This function is called when a button is pressed.
+ * @brief This function is called when a button is pressed.
*
* @param x The x coordinate of the mouse.
* @param y The y coordinate of the mouse.
@@ -136,7 +136,7 @@ MouseEventHandler* Window::onMouseButtonPressed(uint32_t mouseX, uint32_t mouseY
}
/**
- * @details This function draws the window.
+ * @brief This function draws the window.
*
* @param gc The graphics context to draw on.
*/
@@ -241,7 +241,7 @@ void Window::drawSelf(common::GraphicsContext* gc, common::Rectangle& a
}
/**
- * @details Adds a child to the window.
+ * @brief Adds a child to the window.
*
* @param child The child to add.
*/
diff --git a/kernel/src/hardwarecommunication/interrupts.cpp b/kernel/src/hardwarecommunication/interrupts.cpp
index 7344179c..59aa9f77 100644
--- a/kernel/src/hardwarecommunication/interrupts.cpp
+++ b/kernel/src/hardwarecommunication/interrupts.cpp
@@ -49,7 +49,7 @@ void InterruptHandler::handle_interrupt() {
///__Manger__
/**
- * @details This function is used to set an entry in the IDT
+ * @brief This function is used to set an entry in the IDT
*
* @param interrupt Interrupt number
* @param CodeSegment Code segment
@@ -133,7 +133,7 @@ InterruptManager::InterruptManager(uint16_t hardwareInterruptOffset, system::Glo
SetInterruptDescriptorTableEntry(0x1F, CodeSegment, &HandleException0x1F, 0, IDT_INTERRUPT_GATE); //reserved
- //Set up the hardware interrupts (offest by 0x20) //Ranges 0x20 - 0x30
+ //Set up the hardware interrupts (offset by 0x20) //Ranges 0x20 - 0x30
SetInterruptDescriptorTableEntry(hardwareInterruptOffset + 0x00, CodeSegment, &HandleInterruptRequest0x00, 0, IDT_INTERRUPT_GATE); //0x20 - Default PIC interval / Timer
SetInterruptDescriptorTableEntry(hardwareInterruptOffset + 0x01, CodeSegment, &HandleInterruptRequest0x01, 0, IDT_INTERRUPT_GATE); //0x21 - Keyboard
SetInterruptDescriptorTableEntry(hardwareInterruptOffset + 0x02, CodeSegment, &HandleInterruptRequest0x02, 0, IDT_INTERRUPT_GATE); //0x22 - Cascade (used internally by the two PICs. never raised)
@@ -186,7 +186,7 @@ InterruptManager::~InterruptManager()
}
/**
- * @details This function activates the interrupt manager
+ * @brief This function activates the interrupt manager
*/
void InterruptManager::Activate() {
@@ -200,7 +200,7 @@ void InterruptManager::Activate() {
}
/**
- * @details This function deactivates the interrupt manager
+ * @brief This function deactivates the interrupt manager
*/
void InterruptManager::Deactivate()
{
@@ -213,7 +213,7 @@ void InterruptManager::Deactivate()
}
/**
- * @details This function passes the interrupt request on to the active interrupt manager
+ * @brief This function passes the interrupt request on to the active interrupt manager
*
* @param interruptNumber The interrupt number
* @param esp The stack pointer
@@ -230,7 +230,7 @@ uint32_t InterruptManager::HandleInterrupt(uint8_t interrupt, uint32_t esp)
}
/**
- * @details This function handles the interrupt request
+ * @brief This function handles the interrupt request
*
* @param interruptNumber The interrupt number
* @param esp The stack pointer
@@ -379,7 +379,7 @@ uint32_t InterruptManager::DoHandleInterruptRequest(uint8_t interrupt, uint32_t
default:
errorMessages->write("UNHANDLED INTERRUPT 0x");
- errorMessages->writeHex(interrupt);
+ errorMessages->write_hex(interrupt);
errorMessages->write(" ");
break;
@@ -401,7 +401,7 @@ uint32_t InterruptManager::DoHandleInterruptRequest(uint8_t interrupt, uint32_t
//Send Answer to tell PIC the interrupt was received
programmableInterruptControllerMasterCommandPort.Write(0x20);
- //Answer the master always, but don't answer the slave unless the slave called the interrupt
+ //Answer the m_is_master always, but don't answer the slave unless the slave called the interrupt
if(0x28 <= interrupt)
programmableInterruptControllerSlaveCommandPort.Write(0x20);
}
@@ -412,7 +412,7 @@ uint32_t InterruptManager::DoHandleInterruptRequest(uint8_t interrupt, uint32_t
}
/**
- * @details This function returns the offset of the hardware interrupt
+ * @brief This function returns the offset of the hardware interrupt
*
* @return The offset of the hardware interrupt
*/
diff --git a/kernel/src/hardwarecommunication/pci.cpp b/kernel/src/hardwarecommunication/pci.cpp
index 0efb3a53..6a9cecc4 100644
--- a/kernel/src/hardwarecommunication/pci.cpp
+++ b/kernel/src/hardwarecommunication/pci.cpp
@@ -86,7 +86,7 @@ PeripheralComponentInterconnectController::~PeripheralComponentInterconnectContr
}
/**
- * @details Read data from the PCI Controller
+ * @brief Read data from the PCI Controller
*
* @param bus Bus number
* @param device Device number
@@ -116,7 +116,7 @@ uint32_t PeripheralComponentInterconnectController::Read(uint16_t bus, uint16_t
}
/**
- * @details Write data to the PCI Controller
+ * @brief Write data to the PCI Controller
*
* @param bus Bus number
* @param device Device number
@@ -136,7 +136,7 @@ void PeripheralComponentInterconnectController::Write(uint16_t bus, uint16_t dev
}
/**
- * @details Check if the device has a function
+ * @brief Check if the device has a function
*
* @param bus Bus number
* @param device Device number
@@ -149,13 +149,15 @@ bool PeripheralComponentInterconnectController::DeviceHasFunctions(uint16_t bus,
}
/**
- * @details Select the driver for the device
+ * @brief Select the driver for the device
*
* @param driverManager device driver manager
* @param interruptManager Interrupt manager
* @return Driver for the device
*/
-void PeripheralComponentInterconnectController::selectDrivers(drivers::DriverSelectorEventHandler *handler, hardwarecommunication::InterruptManager *interruptManager, OutputStream *errorMessageStream) {
+void PeripheralComponentInterconnectController::select_drivers(
+ DriverSelectorEventHandler *handler, hardwarecommunication::InterruptManager *interruptManager,
+ common::OutputStream *errorMessageStream) {
for (int bus = 0; bus < 8; ++bus) {
for (int device = 0; device < 32; ++device) {
@@ -186,7 +188,7 @@ void PeripheralComponentInterconnectController::selectDrivers(drivers::DriverSel
// Instantiate the driver and add it to the driver manager
Driver* driver = GetDriver(deviceDescriptor, interruptManager);
if(driver != 0){
- handler->onDriverSelected(driver);
+ handler->on_driver_selected(driver);
debugMessagesStream->write(driver->get_vendor_name());
debugMessagesStream->write(" ");
debugMessagesStream->write(driver->get_device_name());
@@ -204,7 +206,7 @@ void PeripheralComponentInterconnectController::selectDrivers(drivers::DriverSel
}
/**
- * @details Get the device descriptor
+ * @brief Get the device descriptor
*
* @param bus Bus number
* @param device Device number
@@ -232,7 +234,7 @@ PeripheralComponentInterconnectDeviceDescriptor PeripheralComponentInterconnectC
}
/**
- * @details Get the driver for the device
+ * @brief Get the driver for the device
*
* @param dev Device descriptor
* @param interruptManager Interrupt manager
@@ -313,7 +315,7 @@ void PeripheralComponentInterconnectController::listKnownDeivce(PeripheralCompon
switch (dev.device_ID)
{
default:
- debugMessagesStream->writeHex(dev.device_ID);
+ debugMessagesStream->write_hex(dev.device_ID);
break;
}
break;
@@ -334,7 +336,7 @@ void PeripheralComponentInterconnectController::listKnownDeivce(PeripheralCompon
}
default:
- debugMessagesStream->writeHex(dev.device_ID);
+ debugMessagesStream->write_hex(dev.device_ID);
break;
}
break;
@@ -434,16 +436,16 @@ void PeripheralComponentInterconnectController::listKnownDeivce(PeripheralCompon
}
default: // Unknown
- debugMessagesStream ->writeHex(dev.vendor_ID);
+ debugMessagesStream->write_hex(dev.vendor_ID);
debugMessagesStream ->write(" ");
- debugMessagesStream ->writeHex(dev.device_ID);
+ debugMessagesStream->write_hex(dev.device_ID);
break;
}
}
/**
- * @details Get the base address register
+ * @brief Get the base address register
*
* @param bus Bus number
* @param device Device number
diff --git a/kernel/src/hardwarecommunication/port.cpp b/kernel/src/hardwarecommunication/port.cpp
index 65f98eca..c20746fc 100644
--- a/kernel/src/hardwarecommunication/port.cpp
+++ b/kernel/src/hardwarecommunication/port.cpp
@@ -25,7 +25,7 @@ Port8Bit::~Port8Bit() {
}
/**
- * @details Write a byte to the port (8Bit)
+ * @brief Write a byte to the port (8Bit)
*
* @param data the byte to write
*/
@@ -34,7 +34,7 @@ void Port8Bit::Write(uint8_t data){
}
/**
- * @details Read a byte from the port (8Bit)
+ * @brief Read a byte from the port (8Bit)
*
* @return the byte read
*/
@@ -54,7 +54,7 @@ Port8BitSlow::~Port8BitSlow() {
}
/**
- * @details Write a byte to the port (8BitSlow)
+ * @brief Write a byte to the port (8BitSlow)
*
* @param data the byte to write
*/
@@ -76,7 +76,7 @@ Port16Bit::~Port16Bit() {
}
/**
- * @details Write a word to the port (16Bit)
+ * @brief Write a word to the port (16Bit)
*
* @param data the word to write
*/
@@ -85,7 +85,7 @@ void Port16Bit::Write(uint16_t data){
}
/**
- * @details Read a word from the port (16Bit)
+ * @brief Read a word from the port (16Bit)
*
* @return the word read
*/
@@ -107,7 +107,7 @@ Port32Bit::~Port32Bit() {
}
/**
- * @details Write a double word to the port (32Bit)
+ * @brief Write a double word to the port (32Bit)
*
* @param data the double word to write
*/
@@ -116,7 +116,7 @@ void Port32Bit::Write(uint32_t data){
}
/**
- * @details Read a double word from the port (32Bit)
+ * @brief Read a double word from the port (32Bit)
*
* @return the double word read
*/
diff --git a/kernel/src/hardwarecommunication/serial.cpp b/kernel/src/hardwarecommunication/serial.cpp
index 3d56e268..8141d1a9 100644
--- a/kernel/src/hardwarecommunication/serial.cpp
+++ b/kernel/src/hardwarecommunication/serial.cpp
@@ -11,7 +11,7 @@ using namespace maxOS::hardwarecommunication;
/**
- * @details This function is the constructor for the serial port
+ * @brief This function is the constructor for the serial port
*/
serial::serial(InterruptManager* interruptManager)
: InterruptHandler(interruptManager -> HardwareInterruptOffset() + 4, interruptManager),
@@ -56,7 +56,7 @@ serial::~serial() {
}
/**
- * @details This function checks if the serial port is ready to read data
+ * @brief This function checks if the serial port is ready to read data
*/
int serial::receive() {
//Check if the data is ready to be read
@@ -64,7 +64,7 @@ int serial::receive() {
}
/**
- * @details This function reads a byte from the serial port
+ * @brief This function reads a byte from the serial port
*
* @return The byte read from the serial port
*/
@@ -78,7 +78,7 @@ char serial::Read() {
}
/**
- * @details This function checks if the serial port is ready to write data
+ * @brief This function checks if the serial port is ready to write data
*/
int serial::isTransmitEmpty() {
@@ -88,7 +88,7 @@ int serial::isTransmitEmpty() {
}
/**
- * @details This function writes a header for the message
+ * @brief This function writes a header for the message
*
* @param col The color of the header
* @param type The type of the text
@@ -142,7 +142,7 @@ void serial::printHeader(string col, string type, string msg){
/**
- * @details This function tests all the different messages that can be printed
+ * @brief This function tests all the different messages that can be printed
*/
void serial::Test(){
@@ -164,7 +164,7 @@ void serial::Test(){
}
/**
- * @details This function writes a message to the serial port
+ * @brief This function writes a message to the serial port
*
* @param str The message to be written
* @param type The type of the message 1 = info, 2 = warning, 3 = error, 4 = fatal, 5 = success, 6 = debug, 7 = kernel, 8 = unknown
@@ -235,7 +235,7 @@ void serial::Write(string str, int type) {
}
/**
- * @details Read from the serial port when the interrupt is triggered
+ * @brief Read from the serial port when the interrupt is triggered
*
* @param esp The stack pointer
* @return The stack pointer (where the processor will go when the interrupt is finished) (always will be what is passed in)
diff --git a/kernel/src/kernel.cpp b/kernel/src/kernel.cpp
index 45ff23f4..afadbdbd 100644
--- a/kernel/src/kernel.cpp
+++ b/kernel/src/kernel.cpp
@@ -86,9 +86,11 @@ extern "C" void kernelMain(const multiboot_info& multibootHeader, uint32_t multi
MemoryManager memoryManager(heap, memSize); //Memory Mangement
// Initialise the VESA Driver
- VideoElectronicsStandardsAssociationDriver vesa((multiboot_info_t *)&multibootHeader);
+ VideoElectronicsStandardsAssociation vesa((multiboot_info_t *)&multibootHeader);
VideoDriver* videoDriver = (VideoDriver*)&vesa;
- videoDriver -> setMode((int)multibootHeader.framebuffer_width, (int)multibootHeader.framebuffer_height, (int)multibootHeader.framebuffer_bpp);
+ videoDriver->set_mode((int)multibootHeader.framebuffer_width,
+ (int)multibootHeader.framebuffer_height,
+ (int)multibootHeader.framebuffer_bpp);
// Initialise Console
VESABootConsole console(&vesa);
@@ -198,19 +200,19 @@ extern "C" void kernelMain(const multiboot_info& multibootHeader, uint32_t multi
KeyboardDriver keyboard(&interrupts);
KeyboardInterpreterEN_US keyboardInterpreter;
keyboard.connect_input_stream_event_handler(&keyboardInterpreter);
- driverManager.addDriver(&keyboard);
+ driverManager.add_driver(&keyboard);
cout << "-- Set Up Keyboard\n";
deviceSetupHeaderStream << ".";
//Mouse
MouseDriver mouse(&interrupts);
- driverManager.addDriver(&mouse);
+ driverManager.add_driver(&mouse);
cout << "-- Set Up Mouse\n";
deviceSetupHeaderStream << ".";
//Clock
Clock kernelClock(&interrupts, 1);
- driverManager.addDriver(&kernelClock);
+ driverManager.add_driver(&kernelClock);
cout << "-- Set Up Clock\n";
deviceSetupHeaderStream << ".";
@@ -241,7 +243,7 @@ extern "C" void kernelMain(const multiboot_info& multibootHeader, uint32_t multi
for(Vector::iterator selector = driverSelectors.begin(); selector != driverSelectors.end(); selector++)
{
cout << ".";
- (*selector)->selectDrivers(&driverManager, &interrupts, 0);
+ (*selector)->select_drivers(&driverManager, &interrupts, 0);
}
cout << " Found\n";
deviceSetupHeaderStream << ".";
@@ -313,7 +315,7 @@ extern "C" void kernelMain(const multiboot_info& multibootHeader, uint32_t multi
// Get the driver
EthernetDriver* ethernetDriver = (EthernetDriver*)driverManager.drivers[4];
- ethernetDriver->driverMessageStream = &networkConsoleStream;
+ ethernetDriver->m_driver_message_stream = &networkConsoleStream;
cout << "Got Ethernet Driver: " << ethernetDriver->get_device_name() << "\n";
networkSetupHeaderStream << ".";
diff --git a/kernel/src/memory/memoryIO.cpp b/kernel/src/memory/memoryIO.cpp
index 167e734f..f28c0911 100644
--- a/kernel/src/memory/memoryIO.cpp
+++ b/kernel/src/memory/memoryIO.cpp
@@ -28,7 +28,7 @@ MemIO8Bit::~MemIO8Bit() {
}
/**
- * @details Writes data to the memory address
+ * @brief Writes data to the memory address
*
* @param data the data to write
*/
@@ -37,7 +37,7 @@ void MemIO8Bit::Write(uint8_t data){
}
/**
- * @details Reads data from the memory address
+ * @brief Reads data from the memory address
*
* @return the data read
*/
@@ -58,7 +58,7 @@ MemIO16Bit::~MemIO16Bit() {
}
/**
- * @details Writes data to the memory address
+ * @brief Writes data to the memory address
*
* @param data the data to write
*/
@@ -67,7 +67,7 @@ void MemIO16Bit::Write(uint16_t data){
}
/**
- * @details Reads data from the memory address
+ * @brief Reads data from the memory address
*
* @return the data read
*/
@@ -88,7 +88,7 @@ MemIO32Bit::~MemIO32Bit() {
}
/**
- * @details Writes data to the memory address
+ * @brief Writes data to the memory address
*
* @param data the data to write
*/
@@ -97,7 +97,7 @@ void MemIO32Bit::Write(uint32_t data){
}
/**
- * @details Reads data from the memory address
+ * @brief Reads data from the memory address
*
* @return the data read
*/
@@ -118,7 +118,7 @@ MemIO64Bit::~MemIO64Bit() {
}
/**
- * @details Writes data to the memory address
+ * @brief Writes data to the memory address
*
* @param data the data to write
*/
@@ -127,7 +127,7 @@ void MemIO64Bit::Write(uint64_t data){
}
/**
- * @details Reads data from the memory address
+ * @brief Reads data from the memory address
*
* @return the data read
*/
diff --git a/kernel/src/memory/memorymanagement.cpp b/kernel/src/memory/memorymanagement.cpp
index e777c2d6..ff7de0e8 100644
--- a/kernel/src/memory/memorymanagement.cpp
+++ b/kernel/src/memory/memorymanagement.cpp
@@ -35,7 +35,7 @@ MemoryManager::~MemoryManager() {
}
/**
- * @details Allocates a block of memory
+ * @brief Allocates a block of memory
*
* @param size size of the block
* @return a pointer to the block, 0 if no block is available
@@ -91,7 +91,7 @@ void* MemoryManager::malloc(size_t size) {
/**
- * @details Frees a block of memory
+ * @brief Frees a block of memory
*
* @param pointer A pointer to the block
*/
diff --git a/kernel/src/net/arp.cpp b/kernel/src/net/arp.cpp
index d777e973..941d2a67 100644
--- a/kernel/src/net/arp.cpp
+++ b/kernel/src/net/arp.cpp
@@ -25,7 +25,7 @@ net::AddressResolutionProtocol::~AddressResolutionProtocol() {
}
/**
- * @details Called when an ARP packet is received.
+ * @brief Called when an ARP packet is received.
*
* @param etherframePayload The payload of the ARP packet.
* @param size The size of the ARP packet.
@@ -82,7 +82,7 @@ bool AddressResolutionProtocol::handleEthernetFramePayload(uint8_t* etherframePa
/**
- * @details Request the MAC address of a given IP address.
+ * @brief Request the MAC address of a given IP address.
*
* @param IP_BE The IP address in BigEndian.
*/
@@ -112,7 +112,7 @@ void AddressResolutionProtocol::RequestMACAddress(InternetProtocolAddress addres
/**
- * @details Get the MAC address from an IP via ARP.
+ * @brief Get the MAC address from an IP via ARP.
*
* @param IP_BE The IP address to get the MAC address from.
* @return The MAC address of the IP address.
diff --git a/kernel/src/net/ethernetframe.cpp b/kernel/src/net/ethernetframe.cpp
index ef568251..2818e0a6 100644
--- a/kernel/src/net/ethernetframe.cpp
+++ b/kernel/src/net/ethernetframe.cpp
@@ -25,7 +25,7 @@ EthernetFramePayloadHandler::EthernetFramePayloadHandler(EthernetFrameHandler* f
}
/**
- * @details Destroy the EtherFrameHandler:: EtherFrameHandler object, Removes it from the handler list
+ * @brief Destroy the EtherFrameHandler:: EtherFrameHandler object, Removes it from the handler list
*
*/
EthernetFramePayloadHandler::~EthernetFramePayloadHandler() {
@@ -40,7 +40,7 @@ bool EthernetFramePayloadHandler::handleEthernetframePayload(uint8_t* ethernetfr
}
/**
- * @details Send an packet via the backend driver
+ * @brief Send an packet via the backend driver
*
* @param dstMAC the destination MAC address
* @param data the data to send
@@ -73,7 +73,7 @@ drivers::ethernet::MediaAccessControlAddress EthernetFrameHandler::getMAC() {
/**
- * @details Handle the received packet
+ * @brief Handle the received packet
*
* @param buffer the buffer with the received data
* @param size the size of the received data
@@ -114,7 +114,7 @@ bool EthernetFrameHandler::DataReceived(uint8_t* buffer, uint32_t size) {
//If the handler is not found, print an error message
errorMessages -> write("EFH: Unhandled ethernet frame type 0x");
- errorMessages -> writeHex(frame->type);
+ errorMessages->write_hex(frame->type);
errorMessages -> write("\n");
}
@@ -146,7 +146,7 @@ void EthernetFrameHandler::connectHandler(EthernetFramePayloadHandler *handler)
}
/**
- * @details Send an packet via the backend driver
+ * @brief Send an packet via the backend driver
*
* @param dstMAC_BE the destination MAC address
* @param etherType_BE the type of the protocol
diff --git a/kernel/src/net/icmp.cpp b/kernel/src/net/icmp.cpp
index f3fe3228..9db2419c 100644
--- a/kernel/src/net/icmp.cpp
+++ b/kernel/src/net/icmp.cpp
@@ -21,7 +21,7 @@ InternetControlMessageProtocol::~InternetControlMessageProtocol() {
}
/**
- * @details Called by the InternetProtocolProvider when a new packet has arrived
+ * @brief Called by the InternetProtocolProvider when a new packet has arrived
*
* @param srcIP_BE The source IP address of the packet
* @param dstIP_BE The destination IP address of the packet
@@ -70,7 +70,7 @@ bool InternetControlMessageProtocol::handleInternetProtocolPayload(InternetProto
}
/**
- * @details Sends an ICMP echo request to the specified IP address
+ * @brief Sends an ICMP echo request to the specified IP address
*
* @param ip_be The IP address to send the request to
*/
diff --git a/kernel/src/net/ipv4.cpp b/kernel/src/net/ipv4.cpp
index bb41cb03..91f78e64 100644
--- a/kernel/src/net/ipv4.cpp
+++ b/kernel/src/net/ipv4.cpp
@@ -54,7 +54,7 @@ InternetProtocolPayloadHandler::~InternetProtocolPayloadHandler() {
}
/**
- * @details Called when an IP packet is received. (Deafult, does nothing, overide for use)
+ * @brief Called when an IP packet is received. (Deafult, does nothing, overide for use)
*
* @param srcIP_BE The source IP address.
* @param dstIP_BE The destination IP address.
@@ -70,7 +70,7 @@ bool InternetProtocolPayloadHandler::handleInternetProtocolPayload(maxOS::net::I
}
/**
- * @details Sends an IP packet.
+ * @brief Sends an IP packet.
*
* @param dstIP_BE The destination IP address.
* @param internetprotocolPayload The payload of the IP packet.
@@ -104,7 +104,7 @@ InternetProtocolHandler::~InternetProtocolHandler() {
}
/**
- * @details Called when an IP packet is received.
+ * @brief Called when an IP packet is received.
*
* @param etherframePayload The payload of the IP packet.
* @param size The size of the IP packet.
@@ -162,7 +162,7 @@ bool InternetProtocolHandler::handleEthernetframePayload(uint8_t* ethernetframeP
/**
- * @details Sends an IP packet.
+ * @brief Sends an IP packet.
*
* @param dstIP_BE The destination IP address.
* @param protocol The protocol of the IP packet.
@@ -212,7 +212,7 @@ void InternetProtocolHandler::sendInternetProtocolPacket(uint32_t dstIP_BE, uint
}
/**
- * @details Creates a checksum for the given data.
+ * @brief Creates a checksum for the given data.
*
* @param data The data to create a checksum for.
* @param lengthInBytes The length of the data in bytes.
diff --git a/kernel/src/net/tcp.cpp b/kernel/src/net/tcp.cpp
index 58d50e90..ca642574 100644
--- a/kernel/src/net/tcp.cpp
+++ b/kernel/src/net/tcp.cpp
@@ -68,7 +68,7 @@ TransmissionControlProtocolSocket::~TransmissionControlProtocolSocket()
{
}
/**
- * @details Handle the TCP message (socket end)
+ * @brief Handle the TCP message (socket end)
*
* @param data The datah
* @param size The size of the data
@@ -83,7 +83,7 @@ bool TransmissionControlProtocolSocket::handleTransmissionControlProtocolPayload
}
/**
- * @details Send data over the socket
+ * @brief Send data over the socket
*
* @param data The data to send
* @param size The size of the data
@@ -98,7 +98,7 @@ void TransmissionControlProtocolSocket::Send(uint8_t* data, uint16_t size)
}
/**
- * @details Disconnect the socket
+ * @brief Disconnect the socket
*/
void TransmissionControlProtocolSocket::Disconnect()
{
@@ -151,7 +151,7 @@ uint32_t bigEndian16(uint16_t x)
}
/**
- * @details Handle the TCP message (provider end)
+ * @brief Handle the TCP message (provider end)
*
* @param srcIP_BE The source IP address
* @param dstIP_BE The destination IP address
@@ -378,7 +378,7 @@ bool TransmissionControlProtocolHandler::handleInternetProtocolPayload(InternetP
}
/**
- * @details Send a packet (Throught the provider)
+ * @brief Send a packet (Throught the provider)
*
* @param socket The socket to send the packet from
* @param data The data to send
@@ -441,7 +441,7 @@ void TransmissionControlProtocolHandler::sendTransmissionControlProtocolPacket(T
}
/**
- * @details Connect to a remote host through the TCP protocol
+ * @brief Connect to a remote host through the TCP protocol
* @param ip The IP of the remote host
* @param port The port of the remote host
* @return The socket that is connected to the remote host, 0 if it failed
@@ -516,7 +516,7 @@ TransmissionControlProtocolSocket *TransmissionControlProtocolHandler::Connect(s
}
/**
- * @details Begin the disconnect process
+ * @brief Begin the disconnect process
*
* @param socket The socket to disconnect
*/
@@ -529,7 +529,7 @@ void TransmissionControlProtocolHandler::Disconnect(TransmissionControlProtocolS
}
/**
- * @details Begin listening on a port
+ * @brief Begin listening on a port
*
* @param port The port to listen on
* @return The socket that will handle the connection
@@ -560,7 +560,7 @@ TransmissionControlProtocolSocket* TransmissionControlProtocolHandler::Listen(ui
/**
- * @details Bind a data handler to this socket
+ * @brief Bind a data handler to this socket
*
* @param socket The socket to bind the handler to
* @param transmissionControlProtocolHandler The handler to bind
diff --git a/kernel/src/net/udp.cpp b/kernel/src/net/udp.cpp
index 4de42467..2c9f44e0 100644
--- a/kernel/src/net/udp.cpp
+++ b/kernel/src/net/udp.cpp
@@ -81,7 +81,7 @@ UserDatagramProtocolHandler::~UserDatagramProtocolHandler() {
}
/**
- * @details Handle the recivement of an UDP packet
+ * @brief Handle the recivement of an UDP packet
*
* @param srcIP_BE The source IP address in big endian
* @param dstIP_BE The destination IP address in big endian
@@ -197,7 +197,7 @@ UserDatagramProtocolSocket *UserDatagramProtocolHandler::Connect(string internet
}
/**
- * @details Listens for incoming packets on the port
+ * @brief Listens for incoming packets on the port
*
* @param port The port to listen on
* @return The socket that is listening
@@ -224,7 +224,7 @@ UserDatagramProtocolSocket *UserDatagramProtocolHandler::Listen(uint16_t port) {
}
/**
- * @details Disconnects the socket from the remote IP and port
+ * @brief Disconnects the socket from the remote IP and port
*
* @param socket The socket to disconnect
*/
@@ -243,7 +243,7 @@ void UserDatagramProtocolHandler::Disconnect(UserDatagramProtocolSocket *socket)
}
/**
- * @details Sends a packet to the remote IP and port
+ * @brief Sends a packet to the remote IP and port
*
* @param socket The socket to send the packet from
* @param data The data to send
@@ -283,7 +283,7 @@ void UserDatagramProtocolHandler::Send(UserDatagramProtocolSocket *socket, uint8
}
/**
- * @details Binds a handler to the socket
+ * @brief Binds a handler to the socket
*
* @param socket The socket to bind the handler to
* @param userDatagramProtocolHandler The handler to bind
diff --git a/kernel/src/system/gdt.cpp b/kernel/src/system/gdt.cpp
index eecf44b0..ac4eb12a 100644
--- a/kernel/src/system/gdt.cpp
+++ b/kernel/src/system/gdt.cpp
@@ -7,7 +7,7 @@ using namespace maxOS;
using namespace maxOS::system;
/**
- * @details Global Descriptor Table
+ * @brief Global Descriptor Table
*/
GlobalDescriptorTable::GlobalDescriptorTable(const multiboot_info& multibootHeader)
: nullSegmentSelector(0, 0, 0), //Ignored
@@ -34,7 +34,7 @@ GlobalDescriptorTable::~GlobalDescriptorTable()
/**
- * @details Data Segment Selector
+ * @brief Data Segment Selector
*
* @return The data segment selector offset
*/
@@ -44,7 +44,7 @@ uint16_t GlobalDescriptorTable::DataSegmentSelector()
}
/**
- * @details Code Segment Selector
+ * @brief Code Segment Selector
*
* @return The code segment selector offset
*/
@@ -54,7 +54,7 @@ uint16_t GlobalDescriptorTable::CodeSegmentSelector()
}
/**
- * @details Task State Segment Selector
+ * @brief Task State Segment Selector
*
* @return The task state segment selector offset
*/
@@ -65,7 +65,7 @@ uint16_t GlobalDescriptorTable::TaskStateSegmentSelector()
//Setup GDT for memory
/**
- * @details Constructor for Segment Selector
+ * @brief Constructor for Segment Selector
*
*
* @param base Base address
@@ -118,7 +118,7 @@ GlobalDescriptorTable::SegmentDescriptor::SegmentDescriptor(uint32_t base, uint3
target[5] = type;
}
/**
- * @details Look up the pointer
+ * @brief Look up the pointer
*
* @return The pointer
*/
@@ -135,7 +135,7 @@ uint32_t GlobalDescriptorTable::SegmentDescriptor::Base() //To look up the point
}
/**
- * @details Look up the limit
+ * @brief Look up the limit
*
* @return The limit
*/
diff --git a/kernel/src/system/multitasking.cpp b/kernel/src/system/multitasking.cpp
index abfd7f0c..18ee1a53 100644
--- a/kernel/src/system/multitasking.cpp
+++ b/kernel/src/system/multitasking.cpp
@@ -60,7 +60,7 @@ TaskManager::~TaskManager() {
}
/**
- * @details Adds a task to the task manager
+ * @brief Adds a task to the task manager
*
* @param task The task to add
*/
@@ -76,7 +76,7 @@ bool TaskManager::AddTask(Task *task) {
}
/**
- * @details Switches to the next task
+ * @brief Switches to the next task
*
* @param cpuState The current CPU state
* @return The new CPU state
diff --git a/kernel/src/system/multithreading.cpp b/kernel/src/system/multithreading.cpp
index 9a7f3fe1..33e8050b 100644
--- a/kernel/src/system/multithreading.cpp
+++ b/kernel/src/system/multithreading.cpp
@@ -51,7 +51,7 @@ ThreadManager::~ThreadManager()
}
/**
- * @details Add a thread to an empty place in the array
+ * @brief Add a thread to an empty place in the array
*
* @param Thread thread to add
* @return true if succesfully added
@@ -84,7 +84,7 @@ int ThreadManager::CreateThread(void entrypoint())
}
/**
- * @details Schedules the next thread to be executed by checking its yieldsStatus.
+ * @brief Schedules the next thread to be executed by checking its yieldsStatus.
*
* @param cpustate state
* @return CPUState_Thread* thread to be executed state
@@ -135,7 +135,7 @@ CPUState_Thread *ThreadManager::Schedule(CPUState_Thread* cpustate)
}
/**
- * @details Terminates a thread by removing it from an array by making its pointer nullptr
+ * @brief Terminates a thread by removing it from an array by making its pointer nullptr
*
* @param tid thread id to terminate
* @return true if sucessfully terminated
@@ -158,7 +158,7 @@ bool ThreadManager::TerminateThread(int tid)
}
/**
- * @details Joins a thread by waiting to finish
+ * @brief Joins a thread by waiting to finish
*
* @param other thread to join
* @return true if succesfully joined
@@ -182,7 +182,7 @@ bool ThreadManager::JoinThreads(int other)
}
/**
- * @details Makes yield status true of the current thread
+ * @brief Makes yield status true of the current thread
*
*/
void ThreadManager::YieldThreads(int tid)
@@ -191,7 +191,7 @@ void ThreadManager::YieldThreads(int tid)
}
/**
- * @details Checks if a thread is terminated
+ * @brief Checks if a thread is terminated
*
* @param tid thread id to check
* @return false if thread is terminated
diff --git a/kernel/src/system/process.cpp b/kernel/src/system/process.cpp
index cf429f2e..112eae8c 100644
--- a/kernel/src/system/process.cpp
+++ b/kernel/src/system/process.cpp
@@ -40,7 +40,7 @@ void Process::threadMain(void entrypoint(), Process* process){
}
/**
- * @details Create a new thread, as a child of this process
+ * @brief Create a new thread, as a child of this process
*
* @param entrypoint Entry point of the thread
*/
@@ -60,7 +60,7 @@ void Process::CreateChildThread(void (*entrypoint)()) {
}
/**
- * @details Kill the process's child thread
+ * @brief Kill the process's child thread
*
* @param threadID ID of the thread to kill
*/
@@ -79,7 +79,7 @@ void Process::KillChildThread(int threadID) {
}
/**
- * @details kill all the child threads
+ * @brief kill all the child threads
*/
void Process::KillAllChildThreads() {
@@ -99,7 +99,7 @@ void Process::KillAllChildThreads() {
}
/**
- * @details refresh the process, removing any empty child threads
+ * @brief refresh the process, removing any empty child threads
*/
void Process::RefreshProcess() {
@@ -117,7 +117,7 @@ void Process::RefreshProcess() {
}
/**
- * @details Kill the process
+ * @brief Kill the process
*/
void Process::Kill() {
//Kill all child threads
diff --git a/kernel/src/system/syscalls.cpp b/kernel/src/system/syscalls.cpp
index 3d75fd8d..96b1fd44 100644
--- a/kernel/src/system/syscalls.cpp
+++ b/kernel/src/system/syscalls.cpp
@@ -21,7 +21,7 @@ SyscallHandler::~SyscallHandler()
}
/**
- * @details Handles the interrupt for a system call
+ * @brief Handles the interrupt for a system call
*
* @param esp The stack frame
*/
@@ -34,7 +34,7 @@ void SyscallHandler::handle_interrupt()
///__Syscall__///
/**
- * @details terminate the calling process
+ * @brief terminate the calling process
*
* @param status The exit code
*/
@@ -44,7 +44,7 @@ void sys_exit(int status)
}
/**
- * @details creates a new process by duplicating the calling process.
+ * @brief creates a new process by duplicating the calling process.
The new process is referred to as the child process. The calling
process is referred to as the parent process.
@@ -56,7 +56,7 @@ void sys_fork(CPUState_Thread* cpu)
}
/**
- * @details attempts to read up to count bytes from file descriptor fd
+ * @brief attempts to read up to count bytes from file descriptor fd
into the buffer starting at buf.
* @param fd The file descriptor
@@ -76,7 +76,7 @@ size_t sys_read(unsigned int fd, char *buf, size_t count){
}
/**
- * @details attempts to write up to count bytes from the buffer starting
+ * @brief attempts to write up to count bytes from the buffer starting
at buf to the file referred to by the file descriptor fd.
* @param fd The file descriptor
@@ -96,7 +96,7 @@ size_t sys_write(int fd, const void *buf, size_t count){
}
/**
- * @details opens the file specified by pathname. If
+ * @brief opens the file specified by pathname. If
the specified file does not exist, it may optionally (if O_CREAT
is specified in flags) be created by open().
@@ -115,7 +115,7 @@ size_t sys_write(int fd, const void *buf, size_t count){
} */
/**
- * @details closes a file descriptor, so that it no longer refers to any
+ * @brief closes a file descriptor, so that it no longer refers to any
file and may be reused.
* @param fd The file descriptor to close
@@ -130,7 +130,7 @@ int sys_close(int fd){
}
/**
- * @details waits for a child process to stop or terminate.
+ * @brief waits for a child process to stop or terminate.
*
* @param pid The process ID of the child process
* @param status The exit code of the child process
@@ -165,7 +165,7 @@ int sys_close(int fd){
} */
/**
- * @details creates a new link (also known as a hard link) to an
+ * @brief creates a new link (also known as a hard link) to an
existing file.
* @param oldpath The path to the existing file
@@ -181,7 +181,7 @@ int sys_link(const char *oldpath, const char *newpath){
}
/**
- * @details deletes a name from the file system. If that name was the
+ * @brief deletes a name from the file system. If that name was the
last link to a file and no processes have the file open, the file
is deleted and the space it was using is made available for reuse.