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