diff options
Diffstat (limited to 'viengoos/output.h')
-rw-r--r-- | viengoos/output.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/viengoos/output.h b/viengoos/output.h new file mode 100644 index 0000000..922ad28 --- /dev/null +++ b/viengoos/output.h @@ -0,0 +1,75 @@ +/* output.h - Output routines interfaces. + Copyright (C) 2003, 2007 Free Software Foundation, Inc. + Written by Marcus Brinkmann. + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ + +#ifndef _OUTPUT_H +#define _OUTPUT_H 1 + + +/* Every architecture must define at least one output driver, but might + define several. For each output driver, the name and operations on + the driver must be provided in the following structure. */ + +struct output_driver +{ + const char *name; + + /* Initialize the output device. */ + void (*init) (const char *cfg); + + /* Deinitialize the output device. */ + void (*deinit) (void); + + /* Output a character. */ + void (*putchar) (int chr); +}; + + +/* Every architecture must provide a list of all output drivers, + terminated by a driver structure which has a null pointer as its + name. */ +extern struct output_driver *output_drivers[]; + + +#include <stdarg.h> + +/* Activate the output driver DRIVER or the default one if DRIVER is a + null pointer. Must be called once at startup, before calling + putchar or any other output routine. DRIVER has the pattern + NAME[,CONFIG...], for example "serial,uart2,speed=9600". Returns 0 + if DRIVER is not a valid output driver specification, otherwise 1 + on success. */ +int output_init (const char *driver); + + +/* Deactivate the output driver. Must be called after the last time + putchar or any other output routine is called. */ +void output_deinit (void); + + +/* Print the single character CHR on the output device. */ +int putchar (int chr); + +int puts (const char *str); + +int vprintf (const char *fmt, va_list ap); + +int printf (const char *fmt, ...); + +#endif /* _OUTPUT_H */ |