NeKernel dev
Loading...
Searching...
No Matches
dev.h
Go to the documentation of this file.
1/* -------------------------------------------
2
3 Copyright Amlal El Mahrouss.
4
5 File: dev.h
6 Purpose: DDK device support.
7
8------------------------------------------- */
9
10#pragma once
11
12#include <DDKKit/ddk.h>
13
14struct _DDK_DEVICE;
15
16#define DDK_DEVICE_NAME_LEN (255)
17
19typedef struct _DDK_DEVICE DDK_FINAL {
20 char d_name[DDK_DEVICE_NAME_LEN]; // the device name. Could be /./DEVICE_NAME/
21 void* (*d_read)(void* arg, int len); // read from device.
22 void (*d_write)(void* arg, int len);
23 void (*d_wait)(void); // write to device.
24 struct _DDK_DEVICE* (*d_open)(const char* path); // open device.
25 void (*d_close)(struct _DDK_DEVICE* dev); // close device.
26 void (*d_seek)(struct _DDK_DEVICE* dev, size_t off);
27 size_t (*d_tell)(struct _DDK_DEVICE* dev);
29
32DDK_EXTERN DDK_DEVICE_PTR open(const char* path);
33
__SIZE_TYPE__ size_t
Definition New.h:13
#define DDK_EXTERN
Definition macros.h:28
#define DDK_FINAL
Definition macros.h:32
#define BOOL
Definition macros.h:25
DDK_EXTERN DDK_DEVICE_PTR open(const char *path)
Open a new device from path.
Definition ddk_dev.c:13
struct _DDK_DEVICE DDK_FINAL DDK_DEVICE
Kernel Device driver.
DDK_EXTERN BOOL close(DDK_DEVICE_PTR device)
Close any device.
Definition ddk_dev.c:21
#define DDK_DEVICE_NAME_LEN
Definition dev.h:16
struct _DDK_DEVICE DDK_FINAL * DDK_DEVICE_PTR
size_t(* d_tell)(struct _DDK_DEVICE *dev)
Definition dev.h:27
void(* d_close)(struct _DDK_DEVICE *dev)
Definition dev.h:25
void(* d_write)(void *arg, int len)
Definition dev.h:22
void(* d_seek)(struct _DDK_DEVICE *dev, size_t off)
Definition dev.h:26
void(* d_wait)(void)
Definition dev.h:23
char d_name[DDK_DEVICE_NAME_LEN]
Definition dev.h:20