#include #include "fd.h" #include "terminal.h" #include "screen.h" #include "vesa.h" #include "kmalloc.h" fd fd_from_term() { uint8_t *mem=kballoc(1); term_out *screen=mem; terminal_tty *tty1=mem+sizeof(term_out); fifo *fif=tty1+sizeof(terminal_tty); screen->put_char=console_put_char; screen->update_cursor=update_cursor; *tty1=terminal_init(screen,NULL); fif->data=tty1; fif->put=terminal_put; return fd_from_fifo(fif); } fd fd_from_fb_term() { uint8_t *mem=kballoc(1); term_out *screen=mem; terminal_tty *tty1=mem+sizeof(term_out); fifo *fif=tty1+sizeof(terminal_tty); screen->put_char=vesa_console_put_char; screen->update_cursor=vesa_update_cursor; *tty1=terminal_init(screen,NULL); fif->data=tty1; fif->put=terminal_put; return fd_from_fifo(fif); } fd fd_from_ringbuffer() { fifo *f=kballoc(1); ringbuffer *r=kballoc(1); *r=ringbuffer_init(1); f->data=r; f->put=ringbuffer_put; f->get=ringbuffer_get; f->has=ringbuffer_has; f->full=ringbuffer_full; return fd_from_fifo(f); }