aboutsummaryrefslogtreecommitdiff
path: root/kernel/inc/io.h
blob: 5176bd3770fef3d02e3f3acfbd2c3a9f91084b22 (plain) (blame)
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
// MIT License, Copyright (c) 2021 Marvin Borner

#ifndef DEV_H
#define DEV_H

#include <boot.h>
#include <def.h>
#include <sys.h>

struct io_dev {
	res (*read)(void *buf, u32 offset, u32 count) NONNULL;
	res (*write)(void *buf, u32 offset, u32 count) NONNULL;
	res (*control)(u32 request, void *arg1, void *arg2, void *arg3);
	res (*ready)(void);
};

void io_install(struct boot_info *boot);
void io_add(enum io_type io, struct io_dev *dev) NONNULL;

res io_control(enum io_type io, u32 request, void *arg1, void *arg2, void *arg3);
res io_write(enum io_type io, void *buf, u32 offset, u32 count);
res io_read(enum io_type io, void *buf, u32 offset, u32 count);
res io_poll(u32 *devs) NONNULL;

#endif