console

console - /* * Machine (and hardware) independent console...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * Machine (and hardware) independent console driver. * * We expose a simple interface to the rest of the kernel: "putch" to * print a character, "getch" to read one. * * As long as the device we're connected to does, we allow printing in * an interrupt handler or with interrupts off (by polling), * transparently to the caller. Note that getch by polling is not * supported, although such support could be added without undue * difficulty. * * Note that nothing happens until we have a device to write to. A * buffer of size DELAYBUFSIZE is used to hold output that is * generated before this point. This means that (1) using kprintf for * debugging problems that occur early in initialization is awkward, * and (2) if the system crashes before we find a console, no output * at all may appear. * * Note that we have no input buffering; characters typed too rapidly * will be lost. */ #include <types.h> #include <kern/errno.h> #include <lib.h> #include <machine/spl.h> #include <synch.h> #include <generic/console.h> #include <dev.h> #include <vfs.h> #include <uio.h> #include "autoconf.h" /* * The console device. */ static struct con_softc *the_console = NULL; /* * Lock so user I/Os are atomic. * We use two locks so readers waiting for input don't lock out writers. */ static struct lock *con_userlock_read = NULL; static struct lock *con_userlock_write = NULL; ////////////////////////////////////////////////// /* * This is for accumulating characters printed before the * console is set up. Upon console setup they are dumped
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

console - /* * Machine (and hardware) independent console...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online