1*cc1c8a13Swdenk/* 2*cc1c8a13Swdenk * (C) Copyright 2000 3*cc1c8a13Swdenk * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it 4*cc1c8a13Swdenk * 5*cc1c8a13Swdenk * See file CREDITS for list of people who contributed to this 6*cc1c8a13Swdenk * project. 7*cc1c8a13Swdenk * 8*cc1c8a13Swdenk * This program is free software; you can redistribute it and/or 9*cc1c8a13Swdenk * modify it under the terms of the GNU General Public License as 10*cc1c8a13Swdenk * published by the Free Software Foundation; either version 2 of 11*cc1c8a13Swdenk * the License, or (at your option) any later version. 12*cc1c8a13Swdenk * 13*cc1c8a13Swdenk * This program is distributed in the hope that it will be useful, 14*cc1c8a13Swdenk * but WITHOUT ANY WARRANTY; without even the implied warranty of 15*cc1c8a13Swdenk * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*cc1c8a13Swdenk * GNU General Public License for more details. 17*cc1c8a13Swdenk * 18*cc1c8a13Swdenk * You should have received a copy of the GNU General Public License 19*cc1c8a13Swdenk * along with this program; if not, write to the Free Software 20*cc1c8a13Swdenk * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21*cc1c8a13Swdenk * MA 02111-1307 USA 22*cc1c8a13Swdenk */ 23*cc1c8a13Swdenk 24*cc1c8a13SwdenkU-Boot console handling 25*cc1c8a13Swdenk======================== 26*cc1c8a13Swdenk 27*cc1c8a13SwdenkHOW THE CONSOLE WORKS? 28*cc1c8a13Swdenk---------------------- 29*cc1c8a13Swdenk 30*cc1c8a13SwdenkAt system startup U-Boot initializes a serial console. When U-Boot 31*cc1c8a13Swdenkrelocates itself to RAM, all console drivers are initialized (they 32*cc1c8a13Swdenkwill register all detected console devices to the system for further 33*cc1c8a13Swdenkuse). 34*cc1c8a13Swdenk 35*cc1c8a13SwdenkIf not defined in the environment, the first input device is assigned 36*cc1c8a13Swdenkto the 'stdin' file, the first output one to 'stdout' and 'stderr'. 37*cc1c8a13Swdenk 38*cc1c8a13SwdenkYou can use the command "coninfo" to see all registered console 39*cc1c8a13Swdenkdevices and their flags. You can assign a standard file (stdin, 40*cc1c8a13Swdenkstdout or stderr) to any device you see in that list simply by 41*cc1c8a13Swdenkassigning its name to the corresponding environment variable. For 42*cc1c8a13Swdenkexample: 43*cc1c8a13Swdenk 44*cc1c8a13Swdenk setenv stdin wl_kbd <- To use the wireless keyboard 45*cc1c8a13Swdenk setenv stdout video <- To use the video console 46*cc1c8a13Swdenk 47*cc1c8a13SwdenkDo a simple "saveenv" to save the console settings in the environment 48*cc1c8a13Swdenkand get them working on the next startup, too. 49*cc1c8a13Swdenk 50*cc1c8a13SwdenkHOW CAN I USE STANDARD FILE INTO THE SOURCES? 51*cc1c8a13Swdenk--------------------------------------------- 52*cc1c8a13Swdenk 53*cc1c8a13SwdenkYou can use the following functions to access the console: 54*cc1c8a13Swdenk 55*cc1c8a13Swdenk* STDOUT: 56*cc1c8a13Swdenk putc (to put a char to stdout) 57*cc1c8a13Swdenk puts (to put a string to stdout) 58*cc1c8a13Swdenk printf (to format and put a string to stdout) 59*cc1c8a13Swdenk 60*cc1c8a13Swdenk* STDIN: 61*cc1c8a13Swdenk tstc (to test for the presence of a char in stdin) 62*cc1c8a13Swdenk getc (to get a char from stdin) 63*cc1c8a13Swdenk 64*cc1c8a13Swdenk* STDERR: 65*cc1c8a13Swdenk eputc (to put a char to stderr) 66*cc1c8a13Swdenk eputs (to put a string to stderr) 67*cc1c8a13Swdenk eprintf (to format and put a string to stderr) 68*cc1c8a13Swdenk 69*cc1c8a13Swdenk* FILE (can be 'stdin', 'stdout', 'stderr'): 70*cc1c8a13Swdenk fputc (like putc but redirected to a file) 71*cc1c8a13Swdenk fputs (like puts but redirected to a file) 72*cc1c8a13Swdenk fprintf (like printf but redirected to a file) 73*cc1c8a13Swdenk ftstc (like tstc but redirected to a file) 74*cc1c8a13Swdenk fgetc (like getc but redirected to a file) 75*cc1c8a13Swdenk 76*cc1c8a13SwdenkRemember that all FILE-related functions CANNOT be used before 77*cc1c8a13SwdenkU-Boot relocation (done in 'board_init_r' in common/board.c). 78*cc1c8a13Swdenk 79*cc1c8a13SwdenkHOW CAN I USE STANDARD FILE INTO APPLICATIONS? 80*cc1c8a13Swdenk---------------------------------------------- 81*cc1c8a13Swdenk 82*cc1c8a13SwdenkUse the 'bd_mon_fnc' field of the bd_t structure passed to the 83*cc1c8a13Swdenkapplication to do everything you want with the console. 84*cc1c8a13Swdenk 85*cc1c8a13SwdenkBut REMEMBER that that will work only if you have not overwritten any 86*cc1c8a13SwdenkU-Boot code while loading (or uncompressing) the image of your 87*cc1c8a13Swdenkapplication. 88*cc1c8a13Swdenk 89*cc1c8a13SwdenkFor example, you won't get the console stuff running in the Linux 90*cc1c8a13Swdenkkernel because the kernel overwrites U-Boot before running. Only 91*cc1c8a13Swdenksome parameters like the framebuffer descriptors are passed to the 92*cc1c8a13Swdenkkernel in the high memory area to let the applications (the kernel) 93*cc1c8a13Swdenkuse the framebuffers initialized by U-Boot. 94*cc1c8a13Swdenk 95*cc1c8a13SwdenkSUPPORTED DRIVERS 96*cc1c8a13Swdenk----------------- 97*cc1c8a13Swdenk 98*cc1c8a13SwdenkWorking drivers: 99*cc1c8a13Swdenk 100*cc1c8a13Swdenk serial (architecture dependent serial stuff) 101*cc1c8a13Swdenk video (mpc8xx video controller) 102*cc1c8a13Swdenk 103*cc1c8a13SwdenkWork in progress: 104*cc1c8a13Swdenk 105*cc1c8a13Swdenk wl_kbd (Wireless 4PPM keyboard) 106*cc1c8a13Swdenk 107*cc1c8a13SwdenkWaiting for volounteers: 108*cc1c8a13Swdenk 109*cc1c8a13Swdenk lcd (mpc8xx lcd controller; to ) 110*cc1c8a13Swdenk 111*cc1c8a13SwdenkTESTED CONFIGURATIONS 112*cc1c8a13Swdenk--------------------- 113*cc1c8a13Swdenk 114*cc1c8a13SwdenkThe driver has been tested with the following configurations (see 115*cc1c8a13SwdenkCREDITS for other contact informations): 116*cc1c8a13Swdenk 117*cc1c8a13Swdenk- MPC823FADS with AD7176 on a PAL TV (YCbYCr) - arsenio@tin.it 118*cc1c8a13Swdenk- GENIETV with AD7177 on a PAL TV (YCbYCr) - arsenio@tin.it 119