blob: e051c7a3877428b8ab4147249164cdb7aba56afc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/* -------------------------------------------
Copyright ZKA Technologies.
Purpose: DDK Devices.
------------------------------------------- */
#pragma once
#include <DDK/KernelStd.h>
struct _KERNEL_DEVICE;
/// @brief Kernel Device driver.
typedef struct _KERNEL_DEVICE DK_FINAL
{
char name[255]; // the device name. Could be /./DEVICE_NAME/
void* (*read)(void* arg, int len); // read from device.
void (*write)(void* arg, int len);
void (*wait)(void); // write to device.
struct _KERNEL_DEVICE* (*open)(const char* path); // open device.
void (*close)(struct _KERNEL_DEVICE* dev); // close device.
} KERNEL_DEVICE, *KERNEL_DEVICE_PTR;
/// @brief Open a new device from path.
/// @param devicePath the device's path.
DK_EXTERN KERNEL_DEVICE_PTR KernelOpenDevice(const char* devicePath);
/// @brief Close any device.
/// @param device valid device.
DK_EXTERN void KernelCloseDevice(KERNEL_DEVICE_PTR device);
|