diff options
Diffstat (limited to 'dev/kernel/src')
| -rw-r--r-- | dev/kernel/src/Gfx/FBDeviceInterface.cc | 58 | ||||
| -rw-r--r-- | dev/kernel/src/Storage/AHCIDeviceInterface.cc | 13 | ||||
| -rw-r--r-- | dev/kernel/src/Storage/ATADeviceInterface.cc | 12 |
3 files changed, 64 insertions, 19 deletions
diff --git a/dev/kernel/src/Gfx/FBDeviceInterface.cc b/dev/kernel/src/Gfx/FBDeviceInterface.cc new file mode 100644 index 00000000..a9b2be29 --- /dev/null +++ b/dev/kernel/src/Gfx/FBDeviceInterface.cc @@ -0,0 +1,58 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + +------------------------------------------- */ + +#include <GfxKit/Gfx.h> + +using namespace Kernel; + +/// @brief Class constructor +/// @param Out Drive output +/// @param In Drive input +/// @param Cleanup Drive cleanup. +FBDeviceInterface::FBDeviceInterface(void (*out)(IDeviceObject* self, FBDevicePacket* outpacket), + void (*in)(IDeviceObject* self, FBDevicePacket* inpacket)) + : IDeviceObject(out, in) +{ +} + +/// @brief Class desctructor +FBDeviceInterface::~FBDeviceInterface() = default; + +/// @brief Output operator. +/// @param mnt the disk mountpoint. +/// @return the class itself after operation. +FBDeviceInterface& FBDeviceInterface::operator<<(FBDevicePacket* pckt) +{ + if (!pckt) + return *this; + + FBDrawInRegion(pckt->fColor, pckt->fHeight, pckt->fWidth, pckt->fY, pckt->fX); + + return *this; +} + +/// @brief Input operator. +/// @param mnt the disk mountpoint. +/// @return the class itself after operation. +FBDeviceInterface& FBDeviceInterface::operator>>(FBDevicePacket* pckt) +{ + if (!pckt) + return *this; + + pckt->fColor = *(((Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * + pckt->fX + + 4 * pckt->fY))); + + return *this; +} + +/// @brief Returns the name of the device interface. +/// @return it's name as a string. +const Char* FBDeviceInterface::Name() const +{ + return "/dev/fb{}"; +}
\ No newline at end of file diff --git a/dev/kernel/src/Storage/AHCIDeviceInterface.cc b/dev/kernel/src/Storage/AHCIDeviceInterface.cc index 1798e9a9..c5f43bf6 100644 --- a/dev/kernel/src/Storage/AHCIDeviceInterface.cc +++ b/dev/kernel/src/Storage/AHCIDeviceInterface.cc @@ -13,20 +13,13 @@ using namespace Kernel; /// @param In Drive input /// @param Cleanup Drive cleanup. AHCIDeviceInterface::AHCIDeviceInterface(void (*out)(IDeviceObject* self, MountpointInterface* outpacket), - void (*in)(IDeviceObject* self, MountpointInterface* inpacket), - void (*cleanup)(void)) - : IDeviceObject(out, in), fCleanup(cleanup) + void (*in)(IDeviceObject* self, MountpointInterface* inpacket)) + : IDeviceObject(out, in) { } /// @brief Class desctructor -AHCIDeviceInterface::~AHCIDeviceInterface() -{ - MUST_PASS(fCleanup); - - if (fCleanup) - fCleanup(); -} +AHCIDeviceInterface::~AHCIDeviceInterface() = default; /// @brief Returns the name of the device interface. /// @return it's name as a string. diff --git a/dev/kernel/src/Storage/ATADeviceInterface.cc b/dev/kernel/src/Storage/ATADeviceInterface.cc index 2e7022a7..3fe331dd 100644 --- a/dev/kernel/src/Storage/ATADeviceInterface.cc +++ b/dev/kernel/src/Storage/ATADeviceInterface.cc @@ -14,19 +14,13 @@ using namespace Kernel; /// @param Cleanup Drive cleanup. ATADeviceInterface::ATADeviceInterface( void (*Out)(IDeviceObject*, MountpointInterface* outpacket), - void (*In)(IDeviceObject*, MountpointInterface* inpacket), - void (*Cleanup)(void)) - : IDeviceObject(Out, In), fCleanup(Cleanup) + void (*In)(IDeviceObject*, MountpointInterface* inpacket)) + : IDeviceObject(Out, In) { } /// @brief Class desctructor -ATADeviceInterface::~ATADeviceInterface() -{ - MUST_PASS(fCleanup); - if (fCleanup) - fCleanup(); -} +ATADeviceInterface::~ATADeviceInterface() = default; /// @brief Returns the name of the device interface. /// @return it's name as a string. |
