diff options
author | Your Name <you@example.com> | 2020-06-23 04:34:02 +0200 |
---|---|---|
committer | Your Name <you@example.com> | 2020-06-23 04:34:02 +0200 |
commit | c3c5c934693543d412c65c413479d47fae10dfd6 (patch) | |
tree | 8fcd88423b640531b6a613fe42a5fe9cc627a311 | |
parent | Build Process: Added support for asm file compilation (diff) | |
download | pOS-c3c5c934693543d412c65c413479d47fae10dfd6.tar.gz pOS-c3c5c934693543d412c65c413479d47fae10dfd6.tar.bz2 pOS-c3c5c934693543d412c65c413479d47fae10dfd6.zip |
Base: Use virtual functions for the driver's base object
-rw-r--r-- | src/pOS/arch/x86/kernel/drivers.cpp | 6 | ||||
-rw-r--r-- | src/pOS/arch/x86/kernel/drivers/exampledriver.cpp | 8 | ||||
-rw-r--r-- | src/pOS/include/kernel/drivers.h | 22 |
3 files changed, 18 insertions, 18 deletions
diff --git a/src/pOS/arch/x86/kernel/drivers.cpp b/src/pOS/arch/x86/kernel/drivers.cpp index e2c6b63..865e6dc 100644 --- a/src/pOS/arch/x86/kernel/drivers.cpp +++ b/src/pOS/arch/x86/kernel/drivers.cpp @@ -3,7 +3,7 @@ Driver* Drivers::toload_drivers[1]; //vec Driver* Drivers::loaded_drivers[1]; -void Drivers::add_drivers() +void Drivers::add_drivers(void) { #ifdef DRIVER_EXAMPLE ADD_DRIVER(ExampleDriver); @@ -19,7 +19,7 @@ int Drivers::add_driver(Driver* driver) return 0; } -int Drivers::load_drivers() +int Drivers::load_drivers(void) { dbgprintf("loading drivers\n"); @@ -36,7 +36,7 @@ int Drivers::load_drivers() return result; } -int Drivers::unload_drivers() +int Drivers::unload_drivers(void) { dbgprintf("unloading drivers\n"); int result = 0; diff --git a/src/pOS/arch/x86/kernel/drivers/exampledriver.cpp b/src/pOS/arch/x86/kernel/drivers/exampledriver.cpp index 0164f0d..1eaf04e 100644 --- a/src/pOS/arch/x86/kernel/drivers/exampledriver.cpp +++ b/src/pOS/arch/x86/kernel/drivers/exampledriver.cpp @@ -2,26 +2,26 @@ static bool loaded = false; -int ExampleDriver::load() +int ExampleDriver::load(void) { dbgprintf("loaded example\n"); loaded = true; return 0; } -int ExampleDriver::unload() +int ExampleDriver::unload(void) { dbgprintf("unloaded example\n"); loaded = false; return 0; } -bool ExampleDriver::isloaded() +bool ExampleDriver::isloaded(void) { return loaded; } -const char* ExampleDriver::get_name() +const char* ExampleDriver::get_name(void) { return "Example"; } diff --git a/src/pOS/include/kernel/drivers.h b/src/pOS/include/kernel/drivers.h index acba524..4fe3588 100644 --- a/src/pOS/include/kernel/drivers.h +++ b/src/pOS/include/kernel/drivers.h @@ -7,19 +7,19 @@ class Driver { public: - virtual int load() = NULL; - virtual int unload() = NULL; - virtual bool isloaded() = NULL; - virtual const char* get_name() = NULL; + virtual int load(void) = NULL; + virtual int unload(void) = NULL; + virtual bool isloaded(void) = NULL; + virtual const char* get_name(void) = NULL; }; class Drivers { public: - static void add_drivers(); + static void add_drivers(void); static int add_driver(Driver* driver); - static int load_drivers(); - static int unload_drivers(); + static int load_drivers(void); + static int unload_drivers(void); private: static Driver* toload_drivers[1]; //need vectors - mem managing @@ -31,10 +31,10 @@ private: class ExampleDriver : public Driver { public: - int load(); - int unload(); - bool isloaded(); - const char* get_name(); + int load(void); + int unload(void); + bool isloaded(void); + const char* get_name(void); }; #define ADD_DRIVER(driver) \ |