* only from fgetc() which assures it.
* No attempt is made to demultiplex multiple input sources.
*/
-static int iomux_getc(void)
+static int console_getc(int file)
{
unsigned char ret;
return ret;
}
-static int iomux_tstc(int file)
+static int console_tstc(int file)
{
int i, ret;
device_t *dev;
return 0;
}
-static void iomux_putc(int file, const char c)
+static void console_putc(int file, const char c)
{
int i;
device_t *dev;
}
}
-static void iomux_puts(int file, const char *s)
+static void console_puts(int file, const char *s)
{
int i;
device_t *dev;
dev->puts(s);
}
}
+
+static inline void console_printdevs(int file)
+{
+ iomux_printdevs(file);
+}
+
+static inline void console_doenv(int file, device_t *dev)
+{
+ iomux_doenv(file, dev->name);
+}
+#else
+static inline int console_getc(int file)
+{
+ return stdio_devices[file]->getc();
+}
+
+static inline int console_tstc(int file)
+{
+ return stdio_devices[file]->tstc();
+}
+
+static inline void console_putc(int file, const char c)
+{
+ stdio_devices[file]->putc(c);
+}
+
+static inline void console_puts(int file, const char *s)
+{
+ stdio_devices[file]->puts(s);
+}
+
+static inline void console_printdevs(int file)
+{
+ printf("%s\n", stdio_devices[file]->name);
+}
+
+static inline void console_doenv(int file, device_t *dev)
+{
+ console_setfile(file, dev);
+}
#endif /* defined(CONFIG_CONSOLE_MUX) */
/** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/
* check for that first.
*/
if (tstcdev != NULL)
- return iomux_getc();
- iomux_tstc(file);
+ return console_getc(file);
+ console_tstc(file);
#ifdef CONFIG_WATCHDOG
/*
* If the watchdog must be rate-limited then it should
#endif
}
#else
- return stdio_devices[file]->getc();
+ return console_getc(file);
#endif
}
int ftstc(int file)
{
if (file < MAX_FILES)
-#if defined(CONFIG_CONSOLE_MUX)
- return iomux_tstc(file);
-#else
- return stdio_devices[file]->tstc();
-#endif
+ return console_tstc(file);
return -1;
}
void fputc(int file, const char c)
{
if (file < MAX_FILES)
-#if defined(CONFIG_CONSOLE_MUX)
- iomux_putc(file, c);
-#else
- stdio_devices[file]->putc(c);
-#endif
+ console_putc(file, c);
}
void fputs(int file, const char *s)
{
if (file < MAX_FILES)
-#if defined(CONFIG_CONSOLE_MUX)
- iomux_puts(file, s);
-#else
- stdio_devices[file]->puts(s);
-#endif
+ console_puts(file, s);
}
void fprintf(int file, const char *fmt, ...)
}
/* Initializes output console first */
if (outputdev != NULL) {
-#ifdef CONFIG_CONSOLE_MUX
/* need to set a console if not done above. */
- iomux_doenv(stdout, outputdev->name);
-#else
- console_setfile(stdout, outputdev);
-#endif
+ console_doenv(stdout, outputdev);
}
if (errdev != NULL) {
-#ifdef CONFIG_CONSOLE_MUX
/* need to set a console if not done above. */
- iomux_doenv(stderr, errdev->name);
-#else
- console_setfile(stderr, errdev);
-#endif
+ console_doenv(stderr, errdev);
}
if (inputdev != NULL) {
-#ifdef CONFIG_CONSOLE_MUX
/* need to set a console if not done above. */
- iomux_doenv(stdin, inputdev->name);
-#else
- console_setfile(stdin, inputdev);
-#endif
+ console_doenv(stdin, inputdev);
}
#ifdef CONFIG_CONSOLE_MUX
if (stdio_devices[stdin] == NULL) {
puts("No input devices available!\n");
} else {
-#ifdef CONFIG_CONSOLE_MUX
- iomux_printdevs(stdin);
-#else
- printf("%s\n", stdio_devices[stdin]->name);
-#endif
+ console_printdevs(stdin);
}
puts("Out: ");
if (stdio_devices[stdout] == NULL) {
puts("No output devices available!\n");
} else {
-#ifdef CONFIG_CONSOLE_MUX
- iomux_printdevs(stdout);
-#else
- printf("%s\n", stdio_devices[stdout]->name);
-#endif
+ console_printdevs(stdout);
}
puts("Err: ");
if (stdio_devices[stderr] == NULL) {
puts("No error devices available!\n");
} else {
-#ifdef CONFIG_CONSOLE_MUX
- iomux_printdevs(stderr);
-#else
- printf("%s\n", stdio_devices[stderr]->name);
-#endif
+ console_printdevs(stderr);
}
#endif /* CONFIG_SYS_CONSOLE_INFO_QUIET */