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