summaryrefslogtreecommitdiffhomepage
path: root/dev/ddk/src/ddk_dev.c
blob: 86b8466fe78eba7964657a26f67fae4c187c81d3 (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
/* -------------------------------------------

	Copyright Amlal El Mahrouss.

	Purpose: DDK Text I/O.

------------------------------------------- */

#include <DDKKit/dev.h>
#include <DDKKit/str.h>

/// @brief Open a new binary device from path.
DDK_EXTERN DDK_DEVICE_PTR open(const char* devicePath)
{
	if (!devicePath)
		return nil;

	return ke_call("sk_open_dev", 1, (void*)devicePath, kstrlen(devicePath));
}

/// @brief Close any device.
/// @param device valid device.
DDK_EXTERN BOOL close(DDK_DEVICE_PTR device)
{
	if (!device)
		return NO;

	ke_call("sk_close_dev", 1, device, sizeof(DDK_DEVICE));
	return YES;
}