summaryrefslogtreecommitdiffhomepage
path: root/dev/libDDK/DriverKit/dev.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-08-25 10:28:07 +0200
committerGitHub <noreply@github.com>2025-08-25 10:28:07 +0200
commit1057fd299e17fcc04f6b3a1aa3ace1026f8652a0 (patch)
treea663c7dcd26779295ce0d9681418964f802f2d14 /dev/libDDK/DriverKit/dev.h
parent1a32b9307357ac0fc9095e853b2b6d94f9fe62bb (diff)
parent328b34360ab8b2462ea5858441693277b3d23f08 (diff)
Merge pull request #56 from nekernel-org/dev
Errata: v0.0.4
Diffstat (limited to 'dev/libDDK/DriverKit/dev.h')
-rw-r--r--dev/libDDK/DriverKit/dev.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/dev/libDDK/DriverKit/dev.h b/dev/libDDK/DriverKit/dev.h
new file mode 100644
index 00000000..adb1c1d0
--- /dev/null
+++ b/dev/libDDK/DriverKit/dev.h
@@ -0,0 +1,36 @@
+/* -------------------------------------------
+
+ Copyright Amlal El Mahrouss.
+
+ File: dev.h
+ Purpose: DDK device support.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <DriverKit/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.
+ void (*d_seek)(struct _DDK_DEVICE* dev, size_t off);
+ size_t (*d_tell)(struct _DDK_DEVICE* dev);
+} 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);