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