Ignore:
Timestamp:
2009-08-22T10:48:00Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
04803bf
Parents:
1ea99cc (diff), a71c158 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r1ea99cc rb50b5af2  
    7171
    7272/** Kernel log spinlock */
    73 SPINLOCK_INITIALIZE(klog_lock);
     73SPINLOCK_STATIC_INITIALIZE_NAME(klog_lock, "*klog_lock");
    7474
    7575/** Physical memory area used for klog buffer */
    7676static parea_t klog_parea;
     77
     78static indev_t stdin_sink;
     79static outdev_t stdout_source;
    7780
    7881static indev_operations_t stdin_ops = {
     
    8083};
    8184
     85static void stdout_write(outdev_t *dev, wchar_t ch, bool silent);
     86static void stdout_redraw(outdev_t *dev);
     87
     88static outdev_operations_t stdout_ops = {
     89        .write = stdout_write,
     90        .redraw = stdout_redraw
     91};
     92
    8293/** Silence output */
    8394bool silent = false;
     
    90101{
    91102        if (stdin == NULL) {
    92                 stdin = malloc(sizeof(indev_t), FRAME_ATOMIC);
    93                 if (stdin != NULL)
    94                         indev_initialize("stdin", stdin, &stdin_ops);
     103                indev_initialize("stdin", &stdin_sink, &stdin_ops);
     104                stdin = &stdin_sink;
    95105        }
    96106       
    97107        return stdin;
     108}
     109
     110void stdout_wire(outdev_t *outdev)
     111{
     112        if (stdout == NULL) {
     113                outdev_initialize("stdout", &stdout_source, &stdout_ops);
     114                stdout = &stdout_source;
     115        }
     116       
     117        list_append(&outdev->link, &stdout->list);
     118}
     119
     120static void stdout_write(outdev_t *dev, wchar_t ch, bool silent)
     121{
     122        link_t *cur;
     123       
     124        for (cur = dev->list.next; cur != &dev->list; cur = cur->next) {
     125                outdev_t *sink = list_get_instance(cur, outdev_t, link);
     126                if ((sink) && (sink->op->write))
     127                        sink->op->write(sink, ch, silent);
     128        }
     129}
     130
     131static void stdout_redraw(outdev_t *dev)
     132{
     133        link_t *cur;
     134       
     135        for (cur = dev->list.next; cur != &dev->list; cur = cur->next) {
     136                outdev_t *sink = list_get_instance(cur, outdev_t, link);
     137                if ((sink) && (sink->op->redraw))
     138                        sink->op->redraw(sink);
     139        }
    98140}
    99141
     
    128170       
    129171        silent = false;
    130         arch_grab_console();
     172        if ((stdout) && (stdout->op->redraw))
     173                stdout->op->redraw(stdout);
    131174       
    132175        /* Force the console to print the prompt */
     
    137180void release_console(void)
    138181{
     182        // FIXME arch_release_console
    139183        silent = true;
    140         arch_release_console();
    141184}
    142185
Note: See TracChangeset for help on using the changeset viewer.