summaryrefslogtreecommitdiffhomepage
path: root/dev/ddk/DDKKit/dev.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-03-29 05:03:14 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-03-29 05:06:15 +0100
commitc4870d08fa4bfb2613bf22a0b7cf306b388f58a4 (patch)
treec8b5023a5ab4fe257f7687573812053c6e5273fb /dev/ddk/DDKKit/dev.h
parenta8bd5ed975031d63eb448d2ed4f160cf7159c3bc (diff)
ddk: refactor: reorganize kit into a standard kernel kit.
sched: refactor: refactor scheduler file names, for future additions. xcoff: refactor: document and improve XCOFF for NeFS (regarding Ne's FW) codemgr: refactor: make a difference between kernel and user processes. refactor: document project overall. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/ddk/DDKKit/dev.h')
-rw-r--r--dev/ddk/DDKKit/dev.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/dev/ddk/DDKKit/dev.h b/dev/ddk/DDKKit/dev.h
new file mode 100644
index 00000000..929aafa4
--- /dev/null
+++ b/dev/ddk/DDKKit/dev.h
@@ -0,0 +1,35 @@
+/* -------------------------------------------
+
+ Copyright Amlal EL Mahrouss.
+
+ File: dev.h
+ Purpose: DDK device support.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <DDKKit/ddk.h>
+
+struct _DDK_DEVICE;
+
+#define DDK_DEVICE_NAME_LEN (255)
+
+/// @brief Kernel Device driver.
+typedef struct _DDK_DEVICE DDK_FINAL
+{
+ char d_name[DDK_DEVICE_NAME_LEN]; // the device name. Could be /./DEVICE_NAME/
+ void* (*d_read)(void* arg, int len); // read from device.
+ void (*d_write)(void* arg, int len);
+ void (*d_wait)(void); // write to device.
+ struct _DDK_DEVICE* (*d_open)(const char* path); // open device.
+ void (*d_close)(struct _DDK_DEVICE* dev); // close device.
+} DDK_DEVICE, *DDK_DEVICE_PTR;
+
+/// @brief Open a new device from path.
+/// @param path the device's path.
+DDK_EXTERN DDK_DEVICE_PTR open(const char* path);
+
+/// @brief Close any device.
+/// @param device valid device.
+DDK_EXTERN BOOL close(DDK_DEVICE_PTR device);