summaryrefslogtreecommitdiff
path: root/kernel/fd.c
blob: 5eb2678dbcf1226eca55fa8bd637c1dfd9647a3f (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
#include "fd.h"

bool fd_write(fd* f,uint8_t c)
{
    return f->write(f->data,c);
}

uint8_t fd_read(fd* f)
{
    return f->read(f->data);
}

bool fd_has(fd* f)
{
    return f->has(f->data);
}

bool fd_close(fd* f)
{
    return f->close(f->data);
}

fd fd_from_fifo(fifo* fif)
{
    fd f;
    f.data=fif;
    f.read=fd_read;
    f.write=fd_write;
    f.close=fd_close;
    f.has=fd_has;
    return f;
}