=================================================================== RCS file: /cvs/funnyos/dev/fcons/fcons.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- funnyos/dev/fcons/fcons.c 2007/10/29 21:10:02 1.4 +++ funnyos/dev/fcons/fcons.c 2008/01/11 15:36:01 1.5 @@ -1,10 +1,11 @@ /* - * $Id: fcons.c,v 1.4 2007/10/29 21:10:02 init Exp $ + * $Id: fcons.c,v 1.5 2008/01/11 15:36:01 nbrk Exp $ */ #include #include #include #include +#include /* * funnyOS console. @@ -40,6 +41,11 @@ ddp->fd_currow = 0; ddp->fd_curcol = 0; + /* initialize iqueue */ +// ddp->fd_iqhead = SIMPLEQ_HEAD_INITIALIZER(ddp->fd_iqhead); + SIMPLEQ_INIT(ddp->head); + ddp->fd_iqlength = 0; + /* make current console default */ curcons = ddp; @@ -96,6 +102,42 @@ fcons_putchar(curcons, ch); return; +} + + +void +fcons_ienqueue(char ch) +{ + /* + * Enqueue character into the input data queue. + */ + struct fcons_dd *ddp; + struct fcons_char *curfc; + uint32_t i; + + /* XXX will use curcons devdata */ + ddp = curcons; + +#if 0 + if (ddp->fd_iqueue == NULL) { + /* first insertion */ + curfc = kmalloc(sizeof(struct fcons_char)); + + if(curfc == NULL) + panic("fcons_ienqueue: can't allocate memory for new element\n"); + } else { + curfc = ddp->fd_iqueue; + + /* locate last element */ + for(i = 0; i < ddp->fd_iqlength - 1; i++) + curfc = curfc->fc_next; + } +#endif + curfc = kmalloc(sizeof(struct fcons_char)); + if(curfc == NULL) + panic("fcons_ienqueue: can't allocate memory for new element\n"); + + SIMPLEQ_INSERT_TAIL(ddp->fd_iqhead, curfc, fc_next); } #if 0