From b69c498953dc47900e6ccdd0f501727480836f23 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 18 Apr 2025 18:24:44 +0200 Subject: kernel, IMP: GfxKit: GraphicsKit. kernel, IMP: StorageKit: Remove usage of cleanup method on AHCI, DMA, and PIO. Signed-off-by: Amlal El Mahrouss --- dev/kernel/src/Gfx/FBDeviceInterface.cc | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 dev/kernel/src/Gfx/FBDeviceInterface.cc (limited to 'dev/kernel/src/Gfx') 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 + +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 -- cgit v1.2.3