summaryrefslogtreecommitdiff
path: root/kernel/fd.c
blob: 524737ea2fdbea4ba124da0ed18ee786c84af250 (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
33
#include "fd.h"
#include "fifo.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=fifo_get;
    f.write=fifo_put;
//    f.close=fd_close;
    f.has=fifo_has;
    return f;
}