X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=examples%2Fapi%2Fdemo.c;h=8c30457ce7ffe37acaf22d5f49db0721f7226da6;hb=24b852a7a2b8eca71789100983bdb5104cc00696;hp=df9c4bd8bc8db72966411e2d0bd51f63dae4a92f;hpb=d4abc757c26c531293f5bbc4262ade44a317eec9;p=u-boot diff --git a/examples/api/demo.c b/examples/api/demo.c index df9c4bd8bc..8c30457ce7 100644 --- a/examples/api/demo.c +++ b/examples/api/demo.c @@ -3,24 +3,7 @@ * * Written by: Rafal Jaworowski * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * + * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -41,13 +24,14 @@ void test_dump_sig(struct api_signature *); static char buf[BUF_SZ]; -int main(int argc, char *argv[]) +int main(int argc, char * const argv[]) { int rv = 0, h, i, j, devs_no; struct api_signature *sig = NULL; ulong start, now; struct device_info *di; lbasize_t rlen; + struct display_info disinfo; if (!api_search_sig(&sig)) return -1; @@ -176,6 +160,36 @@ int main(int argc, char *argv[]) while ((env = ub_env_enum(env)) != NULL) printf("%s = %s\n", env, ub_env_get(env)); + printf("\n*** Display ***\n"); + + if (ub_display_get_info(DISPLAY_TYPE_LCD, &disinfo)) { + printf("LCD info: failed\n"); + } else { + printf("LCD info:\n"); + printf(" pixel width: %d\n", disinfo.pixel_width); + printf(" pixel height: %d\n", disinfo.pixel_height); + printf(" screen rows: %d\n", disinfo.screen_rows); + printf(" screen cols: %d\n", disinfo.screen_cols); + } + if (ub_display_get_info(DISPLAY_TYPE_VIDEO, &disinfo)) { + printf("video info: failed\n"); + } else { + printf("video info:\n"); + printf(" pixel width: %d\n", disinfo.pixel_width); + printf(" pixel height: %d\n", disinfo.pixel_height); + printf(" screen rows: %d\n", disinfo.screen_rows); + printf(" screen cols: %d\n", disinfo.screen_cols); + } + + printf("*** Press any key to continue ***\n"); + printf("got char 0x%x\n", ub_getc()); + + /* + * This only clears messages on screen, not on serial port. It is + * equivalent to a no-op if no display is available. + */ + ub_display_clear(); + /* reset */ printf("\n*** Resetting board ***\n"); ub_reset();