diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-12 12:54:30 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-12 12:54:30 +0200 |
| commit | c3b3b7727b9e2e7cbddcd0997c53d96ba3bb0e82 (patch) | |
| tree | db2fbe59e73e5610a678028a3214041773f134bc | |
| parent | 3fca74d9544fc4cf0218b6e8154b53625bd3df66 (diff) | |
kernel: update IPC protocol header, framebuffer header.
servers/display: Add display server.
private: rename LinkerScripts to just Linker.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
| -rw-r--r-- | Private/KernelKit/Framebuffer.hpp | 20 | ||||
| -rw-r--r-- | Private/Linker/16x0.json (renamed from Private/LinkerScripts/16x0.json) | 0 | ||||
| -rw-r--r-- | Private/Linker/32x0.json (renamed from Private/LinkerScripts/32x0.json) | 0 | ||||
| -rw-r--r-- | Private/Linker/64x0.json (renamed from Private/LinkerScripts/64x0.json) | 0 | ||||
| -rw-r--r-- | Private/NetworkKit/IPCEP.hxx | 33 | ||||
| -rw-r--r-- | Private/Source/Network/IPCEP.cxx | 7 | ||||
| -rw-r--r-- | Servers/DisplayManager/Server.c | 30 |
7 files changed, 68 insertions, 22 deletions
diff --git a/Private/KernelKit/Framebuffer.hpp b/Private/KernelKit/Framebuffer.hpp index 39b1eb5e..555aad2d 100644 --- a/Private/KernelKit/Framebuffer.hpp +++ b/Private/KernelKit/Framebuffer.hpp @@ -2,6 +2,9 @@ Copyright Mahrouss Logic + File: Framebuffer.hpp + Purpose: Framebuffer object. + ------------------------------------------- */ #ifndef __INC_FB_HPP__ @@ -45,12 +48,12 @@ class Framebuffer final { Ref<FramebufferContext *> &Leak(); /// @brief Draws a rectangle inside the fb. - /// @param width - /// @param height - /// @param x - /// @param y - /// @param color - /// @return + /// @param width the width of it + /// @param height the height of it + /// @param x its x coord. + /// @param y its y coord. + /// @param color the color of it. + /// @return the framebuffer object. Framebuffer &DrawRect(SizeT width, SizeT height, SizeT x, SizeT y, UInt32 color); @@ -58,7 +61,7 @@ class Framebuffer final { /// @param x where in X /// @param y where in Y /// @param color the color of it. - /// @return + /// @return the framebuffer object. Framebuffer &PutPixel(SizeT x, SizeT y, UInt32 color); private: @@ -67,7 +70,7 @@ class Framebuffer final { }; /***********************************************************************************/ -/// Color utils. +/// Some common colors. /***********************************************************************************/ extern const UInt32 kRgbRed; @@ -81,6 +84,7 @@ extern const UInt32 kRgbWhite; /// Color macros. /***********************************************************************************/ +/// @brief Macro hack to make a color (as hexadecimal) #define RGB(R, G, B) (NewOS::UInt32)(0x##R##G##B) #endif /* ifndef __INC_FB_HPP__ */ diff --git a/Private/LinkerScripts/16x0.json b/Private/Linker/16x0.json index 1dd7abbd..1dd7abbd 100644 --- a/Private/LinkerScripts/16x0.json +++ b/Private/Linker/16x0.json diff --git a/Private/LinkerScripts/32x0.json b/Private/Linker/32x0.json index 1dd7abbd..1dd7abbd 100644 --- a/Private/LinkerScripts/32x0.json +++ b/Private/Linker/32x0.json diff --git a/Private/LinkerScripts/64x0.json b/Private/Linker/64x0.json index 1dd7abbd..1dd7abbd 100644 --- a/Private/LinkerScripts/64x0.json +++ b/Private/Linker/64x0.json diff --git a/Private/NetworkKit/IPCEP.hxx b/Private/NetworkKit/IPCEP.hxx index b3b8a759..cd7345e4 100644 --- a/Private/NetworkKit/IPCEP.hxx +++ b/Private/NetworkKit/IPCEP.hxx @@ -1,6 +1,8 @@ /* ------------------------------------------- - Copyright Mahrouss Logic + Copyright Mahrouss Logic. + + File: IPCEP.hxx, Purpose: Common IPC protocol. ------------------------------------------- */ @@ -10,36 +12,39 @@ #include <NewKit/Defines.hpp> #include <NewKit/String.hpp> -/// @brief IPC Endpoint Protocol (IPCEP) definition. +/// @brief Common IPC Endpoint Protocol (Common IPC for short). /// IA separator. #define kRemoteSeparator "." -/// Interchange address, consists of domain+namespace. -#define kRemoteInvalid "00.00.00.00:0" -#define kRemoteMaxLen 21 +/// Interchange address, consists of domain:namespace. +#define kRemoteInvalid "00.00.00.00:0000" +#define kRemoteBitWidth 96 /* 96-bit address space. */ -#define kRemoteHeaderMagic 0xFFEEAACCEE +#define kRemoteHeaderMagic 0xFEEDFACE namespace NewOS { /// @brief 96-bit number to represent the domain and namespace -struct PACKED IPCEPNumber final { +struct PACKED IPCEPAddress { UInt32 RemoteAddress; UInt64 RemoteNamespace; }; -typedef struct IPCEPNumber IPCEPNumberType; +typedef struct IPCEPAddress IPCEPAddressType; + +enum { kIPCEPLittleEndian = 0, kIPCEPBigEndian = 1 }; /// @brief IPCEP connection header -typedef struct IPCEPConnectionHeader final { - UInt64 IpcHeader; // 0xFFEEAACCEE +typedef struct IPCEPConnectionHeader { + UInt32 IpcHeader; // kRemoteHeaderMagic UInt8 IpcEndianess; // 0 : LE, 1 : BE SizeT IpcPacketSize; - IPCEPNumberType IpcFrom; - IPCEPNumberType IpcTo; + IPCEPAddressType IpcFrom; + IPCEPAddressType IpcTo; UInt32 IpcCRC32; - Char IpcPad[8]; + SizeT IpcDataSize; + Char IpcData[]; } PACKED IPCEPConnectionHeader; } // namespace NewOS -#endif // _INC_IPC_ENDPOINT_HXX_
\ No newline at end of file +#endif // _INC_IPC_ENDPOINT_HXX_ diff --git a/Private/Source/Network/IPCEP.cxx b/Private/Source/Network/IPCEP.cxx new file mode 100644 index 00000000..67c0b5a8 --- /dev/null +++ b/Private/Source/Network/IPCEP.cxx @@ -0,0 +1,7 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#include <NetworkKit/IPCEP.hxx> diff --git a/Servers/DisplayManager/Server.c b/Servers/DisplayManager/Server.c new file mode 100644 index 00000000..673cf479 --- /dev/null +++ b/Servers/DisplayManager/Server.c @@ -0,0 +1,30 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: Server.c + Purpose: DisplayManager server. + +------------------------------------------- */ + +#include "Server.h" + +/// @brief Called when the server starts. +DWordType ServerStartup(VoidType) +{ + DMInitDisplay(kDMNoFlags); // init standard display. Need to notify other endpoits. + // as well. + // + + IPCSendMessage(kIPCBroadcast); /// broadcast our presence + + return 0; +} + +/// @brief Called when the server shuts down. +DWordType ServerShutdown(VoidType) +{ + DMCloseDisplay(); /// takes no arguments. + return 0; +} + |
