summaryrefslogtreecommitdiff
path: root/include/kernel/serial.h
blob: 4767722723c2a5c498cf862313efb4e22f18ae67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef KERNEL_SERIAL_H
#define KERNEL_SERIAL_H

#include <stdint.h>
#include <stddef.h>

int serial_init(void);
void serial_putchar(char c);
char serial_getchar(void);

static inline void serial_write(const char *data, size_t size) {
        for (size_t i = 0; i < size; i++)
                serial_putchar(data[i]);
}

static inline void serial_read(char *data, size_t size) {
        for (size_t i = 0; i < size; i++)
                data[i] = serial_getchar();
}

#endif