Changeset 7ddc2c7 in mainline for kernel/generic/src


Ignore:
Timestamp:
2014-03-17T15:00:13Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9df6b0f
Parents:
e1fc679a
Message:

add support for framebuffer history paging (using Page Up and Page Down keys), inspiration taken from the code by Sebastian Köln
add support for input device out-of-band signalling

Location:
kernel/generic/src/console
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/chardev.c

    re1fc679a r7ddc2c7  
    9494{
    9595        if (atomic_get(&haltstate)) {
    96                 /* If we are here, we are hopefully on the processor that
     96                /*
     97                 * If we are here, we are hopefully on the processor that
    9798                 * issued the 'halt' command, so proceed to read the character
    9899                 * directly from input
     
    115116        waitq_sleep(&indev->wq);
    116117        irq_spinlock_lock(&indev->lock, true);
    117         wchar_t ch = indev->buffer[(indev->index - indev->counter) % INDEV_BUFLEN];
     118        wchar_t ch = indev->buffer[(indev->index - indev->counter) %
     119            INDEV_BUFLEN];
    118120        indev->counter--;
    119121        irq_spinlock_unlock(&indev->lock, true);
    120122       
    121123        return ch;
     124}
     125
     126/** Signal out-of-band condition
     127 *
     128 * @param indev  Input character device.
     129 * @param signal Out-of-band condition to signal.
     130 *
     131 */
     132void indev_signal(indev_t *indev, indev_signal_t signal)
     133{
     134        if ((indev != NULL) && (indev->op != NULL) &&
     135            (indev->op->signal != NULL))
     136                indev->op->signal(indev, signal);
    122137}
    123138
  • kernel/generic/src/console/console.c

    re1fc679a r7ddc2c7  
    8484static outdev_t stdout_source;
    8585
     86static void stdin_signal(indev_t *, indev_signal_t);
     87
    8688static indev_operations_t stdin_ops = {
    87         .poll = NULL
     89        .poll = NULL,
     90        .signal = stdin_signal
    8891};
    8992
    9093static void stdout_write(outdev_t *, wchar_t);
    9194static void stdout_redraw(outdev_t *);
     95static void stdout_scroll_up(outdev_t *);
     96static void stdout_scroll_down(outdev_t *);
    9297
    9398static outdev_operations_t stdout_ops = {
    9499        .write = stdout_write,
    95         .redraw = stdout_redraw
     100        .redraw = stdout_redraw,
     101        .scroll_up = stdout_scroll_up,
     102        .scroll_down = stdout_scroll_down
    96103};
    97104
     
    113120}
    114121
     122static void stdin_signal(indev_t *indev, indev_signal_t signal)
     123{
     124        switch (signal) {
     125        case INDEV_SIGNAL_SCROLL_UP:
     126                if (stdout != NULL)
     127                        stdout_scroll_up(stdout);
     128                break;
     129        case INDEV_SIGNAL_SCROLL_DOWN:
     130                if (stdout != NULL)
     131                        stdout_scroll_down(stdout);
     132                break;
     133        }
     134}
     135
    115136void stdout_wire(outdev_t *outdev)
    116137{
     
    136157                if ((sink) && (sink->op->redraw))
    137158                        sink->op->redraw(sink);
     159        }
     160}
     161
     162static void stdout_scroll_up(outdev_t *dev)
     163{
     164        list_foreach(dev->list, link, outdev_t, sink) {
     165                if ((sink) && (sink->op->scroll_up))
     166                        sink->op->scroll_up(sink);
     167        }
     168}
     169
     170static void stdout_scroll_down(outdev_t *dev)
     171{
     172        list_foreach(dev->list, link, outdev_t, sink) {
     173                if ((sink) && (sink->op->scroll_down))
     174                        sink->op->scroll_down(sink);
    138175        }
    139176}
     
    229266                        }
    230267                }
     268               
    231269                if (chr_encode(ch, buf, &offset, buflen - 1) == EOK) {
    232270                        putchar(ch);
     
    264302
    265303/** Flush characters that are stored in the output buffer
    266  * 
     304 *
    267305 */
    268306void kio_flush(void)
     
    294332
    295333/** Put a character into the output buffer.
    296  * 
     334 *
    297335 * The caller is required to hold kio_lock
    298336 */
Note: See TracChangeset for help on using the changeset viewer.