diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-07-07 10:35:32 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-07-07 10:35:32 +0200 |
| commit | f7ca4eff84fa67283f0e0ac1e107e4bd6f569ca0 (patch) | |
| tree | 178d0d44fcda1bcecf8a9f831310192ef127266d | |
| parent | eb076dbf3754f44efdda926e1cc55a5c86136f5c (diff) | |
MHR-36: Implementing ARM64 support: Implementing GT.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
| -rw-r--r-- | Kernel/HALKit/AMD64/HalTimer.cxx | 14 | ||||
| -rw-r--r-- | Kernel/HALKit/ARM64/HalTimer.cxx | 11 | ||||
| -rw-r--r-- | Kernel/KernelKit/Framebuffer.hpp | 10 | ||||
| -rw-r--r-- | Kernel/Sources/Framebuffer.cxx | 136 | ||||
| -rw-r--r-- | Meta/TimerArch.drawio | 46 |
5 files changed, 149 insertions, 68 deletions
diff --git a/Kernel/HALKit/AMD64/HalTimer.cxx b/Kernel/HALKit/AMD64/HalTimer.cxx index e69de29b..448fbca9 100644 --- a/Kernel/HALKit/AMD64/HalTimer.cxx +++ b/Kernel/HALKit/AMD64/HalTimer.cxx @@ -0,0 +1,14 @@ +/* -------------------------------------------
+
+ Copyright Zeta Electronics Corporation
+
+ File: HalTimer.cxx
+ Purpose: HAL timer
+
+ Revision History:
+
+ 07/07/24: Added file (amlel)
+
+------------------------------------------- */
+
+#include <ArchKit/ArchKit.hpp>
\ No newline at end of file diff --git a/Kernel/HALKit/ARM64/HalTimer.cxx b/Kernel/HALKit/ARM64/HalTimer.cxx index aa39adef..6b59162c 100644 --- a/Kernel/HALKit/ARM64/HalTimer.cxx +++ b/Kernel/HALKit/ARM64/HalTimer.cxx @@ -2,6 +2,15 @@ Copyright Zeta Electronics Corporation + File: HalTimer.cxx + Purpose: HAL timer + + Revision History: + + 07/07/24: Added file (amlel) + ------------------------------------------- */ -#include <NewKit/Defines.hpp> +#include <ArchKit/ArchKit.hpp> + +struct TimerInfoStruct; diff --git a/Kernel/KernelKit/Framebuffer.hpp b/Kernel/KernelKit/Framebuffer.hpp index 6cafb767..86e77afc 100644 --- a/Kernel/KernelKit/Framebuffer.hpp +++ b/Kernel/KernelKit/Framebuffer.hpp @@ -35,14 +35,8 @@ namespace Kernel class Framebuffer final { public: - explicit Framebuffer(Ref<FramebufferContext*>& addr) - : fFrameBufferAddr(addr) - { - } - - ~Framebuffer() - { - } + explicit Framebuffer(Ref<FramebufferContext*>& addr); + ~Framebuffer() = default; Framebuffer& operator=(const Framebuffer&) = delete; Framebuffer(const Framebuffer&) = default; diff --git a/Kernel/Sources/Framebuffer.cxx b/Kernel/Sources/Framebuffer.cxx index 2e0333d7..440bd3a4 100644 --- a/Kernel/Sources/Framebuffer.cxx +++ b/Kernel/Sources/Framebuffer.cxx @@ -9,88 +9,106 @@ 01/02/24: Added file (amlel) 02/02/24: Add documentation (amlel) + 07/07/07: Moved Framebuffer methods into Kernel:: ------------------------------------------- */ #include <KernelKit/Framebuffer.hpp> +#include <HintKit/CompilerHint.hxx> /** * @brief Framebuffer object implementation. * */ -using namespace Kernel; - namespace Kernel { - const UInt32 kRgbRed = 0x000000FF; - const UInt32 kRgbGreen = 0x0000FF00; - const UInt32 kRgbBlue = 0x00FF0000; - const UInt32 kRgbBlack = 0x00000000; - const UInt32 kRgbWhite = 0xFFFFFFFF; -} // namespace Kernel + Framebuffer::Framebuffer(_Input Ref<FramebufferContext*>& addr) + : fFrameBufferAddr(addr) + { + } -/** - * @brief Get Pixel at - * - * @param pos position of pixel. - * @return volatile* - */ -volatile UIntPtr* Framebuffer::operator[](const UIntPtr& pos) -{ - return (UIntPtr*)(fFrameBufferAddr->fBase * pos); -} + /** + * @brief Get Pixel at **pos** + * + * @param pos position of pixel. + * @return volatile* + */ + _Output volatile UIntPtr* Framebuffer::operator[](_Input const UIntPtr& pos) + { + return (UIntPtr*)(fFrameBufferAddr->fBase * pos); + } -/// @brief Boolean operator. -Framebuffer::operator bool() -{ - return fFrameBufferAddr.Leak()->fBase != 0 && - fColour != FramebufferColorKind::INVALID && - fFrameBufferAddr.Leak()->fBase != kBadPtr; -} - -/// @brief Set color kind of framebuffer. -/// @param colour -/// @return -const FramebufferColorKind& Framebuffer::Color( - const FramebufferColorKind& colour) -{ - if (fColour != FramebufferColorKind::INVALID && - colour != FramebufferColorKind::INVALID) + /// @brief Boolean operator. + Framebuffer::operator bool() { - fColour = colour; + return fFrameBufferAddr.Leak()->fBase != 0 && + fColour != FramebufferColorKind::INVALID && + fFrameBufferAddr.Leak()->fBase != kBadPtr; } - return fColour; -} + /// @brief Set color kind of framebuffer. + /// @param colour + /// @return + _Output const FramebufferColorKind& Framebuffer::Color( + const FramebufferColorKind& colour) + { + if (fColour != FramebufferColorKind::INVALID && + colour != FramebufferColorKind::INVALID) + { + fColour = colour; + } + + return fColour; + } -/// @brief Leak framebuffer context. -/// @return The reference of the framebuffer context. -Ref<FramebufferContext*>& Framebuffer::Leak() -{ - return this->fFrameBufferAddr; -} + /// @brief Leak framebuffer context. + /// @return The reference of the framebuffer context. + _Output Ref<FramebufferContext*>& Framebuffer::Leak() + { + return this->fFrameBufferAddr; + } -Framebuffer& Framebuffer::DrawRect(SizeT width, SizeT height, SizeT x, SizeT y, UInt32 color) -{ - for (Kernel::SizeT i = x; i < width + x; ++i) + /// @brief Draws a rectangle. + /// @param width + /// @param height + /// @param x + /// @param y + /// @param color + /// @return + _Output Framebuffer& Framebuffer::DrawRect(SizeT width, SizeT height, + SizeT x, SizeT y, UInt32 color) { - for (Kernel::SizeT u = y; u < height + y; ++u) + for (Kernel::SizeT i = x; i < width + x; ++i) { - *(((volatile Kernel::UInt32*)(fFrameBufferAddr.Leak()->fBase + - 4 * fFrameBufferAddr.Leak()->fBpp * i + - 4 * u))) = color; + for (Kernel::SizeT u = y; u < height + y; ++u) + { + *(((volatile Kernel::UInt32*)(fFrameBufferAddr.Leak()->fBase + + 4 * fFrameBufferAddr.Leak()->fBpp * i + + 4 * u))) = color; + } } + + return *this; } - return *this; -} + /// @brief Put a pixel on the screen. + /// @param x + /// @param y + /// @param color + /// @return + _Output Framebuffer& Framebuffer::PutPixel(SizeT x, SizeT y, UInt32 color) + { + *(((volatile Kernel::UInt32*)(fFrameBufferAddr.Leak()->fBase + + 4 * fFrameBufferAddr.Leak()->fBpp * x + + 4 * y))) = color; -Framebuffer& Framebuffer::PutPixel(SizeT x, SizeT y, UInt32 color) -{ - *(((volatile Kernel::UInt32*)(fFrameBufferAddr.Leak()->fBase + - 4 * fFrameBufferAddr.Leak()->fBpp * x + - 4 * y))) = color; + return *this; + } - return *this; -}
\ No newline at end of file + const UInt32 kRgbRed = 0x000000FF; + const UInt32 kRgbGreen = 0x0000FF00; + const UInt32 kRgbBlue = 0x00FF0000; + const UInt32 kRgbBlack = 0x00000000; + const UInt32 kRgbWhite = 0xFFFFFFFF; +} // namespace Kernel diff --git a/Meta/TimerArch.drawio b/Meta/TimerArch.drawio new file mode 100644 index 00000000..9b5a9a88 --- /dev/null +++ b/Meta/TimerArch.drawio @@ -0,0 +1,46 @@ +<mxfile host="app.diagrams.net" modified="2024-07-07T08:32:41.621Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" etag="UqJl_3VXuitRxImxFo5W" version="24.6.2" type="device"> + <diagram name="Page-1" id="SMmOiZGLec9H7ruN5qyQ"> + <mxGraphModel dx="1400" dy="743" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> + <root> + <mxCell id="0" /> + <mxCell id="1" parent="0" /> + <mxCell id="c-_7pHU60HQ0aR4bwu-4-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="c-_7pHU60HQ0aR4bwu-4-1" target="c-_7pHU60HQ0aR4bwu-4-2"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="c-_7pHU60HQ0aR4bwu-4-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="c-_7pHU60HQ0aR4bwu-4-1" target="c-_7pHU60HQ0aR4bwu-4-4"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="c-_7pHU60HQ0aR4bwu-4-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="c-_7pHU60HQ0aR4bwu-4-1" target="c-_7pHU60HQ0aR4bwu-4-6"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="c-_7pHU60HQ0aR4bwu-4-1" value="TimeInfoStruct" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="340" y="230" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="c-_7pHU60HQ0aR4bwu-4-2" value="APIC/PIC/IOAPIC" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="340" y="400" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="c-_7pHU60HQ0aR4bwu-4-4" value="GT" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="530" y="400" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="c-_7pHU60HQ0aR4bwu-4-6" value="CLINT" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="150" y="400" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="c-_7pHU60HQ0aR4bwu-4-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="c-_7pHU60HQ0aR4bwu-4-8" target="c-_7pHU60HQ0aR4bwu-4-1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="c-_7pHU60HQ0aR4bwu-4-8" value="Scheduler context switch (on non MT mode),<br>Also HardwareTimer gets implemented." style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="160" y="60" width="120" height="90" as="geometry" /> + </mxCell> + <mxCell id="c-_7pHU60HQ0aR4bwu-4-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0;entryDx=0;entryDy=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="c-_7pHU60HQ0aR4bwu-4-10"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="530" y="120" as="sourcePoint" /> + <mxPoint x="430" y="230" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="c-_7pHU60HQ0aR4bwu-4-10" value="Hook 2 system calls for timing purposes.<br>(Wait, WaitUntil)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="560" y="90" width="120" height="60" as="geometry" /> + </mxCell> + </root> + </mxGraphModel> + </diagram> +</mxfile> |
