xref: /openbmc/u-boot/doc/README.console (revision 9d466f2f)
1/*
2 * (C) Copyright 2000
3 * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
4 *
5 * SPDX-License-Identifier:	GPL-2.0+
6 */
7
8U-Boot console handling
9========================
10
11HOW THE CONSOLE WORKS?
12----------------------
13
14At system startup U-Boot initializes a serial console. When U-Boot
15relocates itself to RAM, all console drivers are initialized (they
16will register all detected console devices to the system for further
17use).
18
19If not defined in the environment, the first input device is assigned
20to the 'stdin' file, the first output one to 'stdout' and 'stderr'.
21
22You can use the command "coninfo" to see all registered console
23devices and their flags. You can assign a standard file (stdin,
24stdout or stderr) to any device you see in that list simply by
25assigning its name to the corresponding environment variable. For
26example:
27
28    setenv stdin serial		<- To use the serial input
29    setenv stdout video		<- To use the video console
30
31Do a simple "saveenv" to save the console settings in the environment
32and get them working on the next startup, too.
33
34HOW CAN I USE STANDARD FILE INTO THE SOURCES?
35---------------------------------------------
36
37You can use the following functions to access the console:
38
39* STDOUT:
40    putc	(to put a char to stdout)
41    puts	(to put a string to stdout)
42    printf	(to format and put a string to stdout)
43
44* STDIN:
45    tstc	(to test for the presence of a char in stdin)
46    getc	(to get a char from stdin)
47
48* STDERR:
49    eputc	(to put a char to stderr)
50    eputs	(to put a string to stderr)
51    eprintf	(to format and put a string to stderr)
52
53* FILE (can be 'stdin', 'stdout', 'stderr'):
54    fputc	(like putc but redirected to a file)
55    fputs	(like puts but redirected to a file)
56    fprintf	(like printf but redirected to a file)
57    ftstc	(like tstc but redirected to a file)
58    fgetc	(like getc but redirected to a file)
59
60Remember that all FILE-related functions CANNOT be used before
61U-Boot relocation (done in 'board_init_r' in arch/*/lib/board.c).
62
63HOW CAN I USE STANDARD FILE INTO APPLICATIONS?
64----------------------------------------------
65
66Use the 'bd_mon_fnc' field of the bd_t structure passed to the
67application to do everything you want with the console.
68
69But REMEMBER that that will work only if you have not overwritten any
70U-Boot code while loading (or uncompressing) the image of your
71application.
72
73For example, you won't get the console stuff running in the Linux
74kernel because the kernel overwrites U-Boot before running. Only
75some parameters like the framebuffer descriptors are passed to the
76kernel in the high memory area to let the applications (the kernel)
77use the framebuffers initialized by U-Boot.
78
79SUPPORTED DRIVERS
80-----------------
81
82Working drivers:
83
84    serial	(architecture dependent serial stuff)
85    video	(mpc8xx video controller)
86
87Work in progress:
88
89    wl_kbd	(Wireless 4PPM keyboard)
90
91Waiting for volounteers:
92
93    lcd	(mpc8xx lcd controller; to )
94
95TESTED CONFIGURATIONS
96---------------------
97
98The driver has been tested with the following configurations (see
99CREDITS for other contact informations):
100
101- MPC823FADS with AD7176 on a PAL TV (YCbYCr)	- arsenio@tin.it
102