1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright (c) 2015 Google, Inc 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * (C) Copyright 2000-2002 5*4882a593Smuzhiyun * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+ 8*4882a593Smuzhiyun */ 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun #ifndef __DISPLAY_OPTIONS_H 11*4882a593Smuzhiyun #define __DISPLAY_OPTIONS_H 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun /** 14*4882a593Smuzhiyun * print_size() - Print a size with a suffix 15*4882a593Smuzhiyun * 16*4882a593Smuzhiyun * Print sizes as "xxx KiB", "xxx.y KiB", "xxx MiB", "xxx.y MiB", 17*4882a593Smuzhiyun * xxx GiB, xxx.y GiB, etc as needed; allow for optional trailing string 18*4882a593Smuzhiyun * (like "\n") 19*4882a593Smuzhiyun * 20*4882a593Smuzhiyun * @size: Size to print 21*4882a593Smuzhiyun * @suffix String to print after the size 22*4882a593Smuzhiyun */ 23*4882a593Smuzhiyun void print_size(uint64_t size, const char *suffix); 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun /** 26*4882a593Smuzhiyun * print_freq() - Print a frequency with a suffix 27*4882a593Smuzhiyun * 28*4882a593Smuzhiyun * Print frequencies as "x.xx GHz", "xxx KHz", etc as needed; allow for 29*4882a593Smuzhiyun * optional trailing string (like "\n") 30*4882a593Smuzhiyun * 31*4882a593Smuzhiyun * @freq: Frequency to print in Hz 32*4882a593Smuzhiyun * @suffix String to print after the frequency 33*4882a593Smuzhiyun */ 34*4882a593Smuzhiyun void print_freq(uint64_t freq, const char *suffix); 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun /** 37*4882a593Smuzhiyun * print_buffer() - Print data buffer in hex and ascii form 38*4882a593Smuzhiyun * 39*4882a593Smuzhiyun * Data reads are buffered so that each memory address is only read once. 40*4882a593Smuzhiyun * This is useful when displaying the contents of volatile registers. 41*4882a593Smuzhiyun * 42*4882a593Smuzhiyun * @addr: Starting address to display at start of line 43*4882a593Smuzhiyun * @data: pointer to data buffer 44*4882a593Smuzhiyun * @width: data value width. May be 1, 2, or 4. 45*4882a593Smuzhiyun * @count: number of values to display 46*4882a593Smuzhiyun * @linelen: Number of values to print per line; specify 0 for default length 47*4882a593Smuzhiyun */ 48*4882a593Smuzhiyun int print_buffer(ulong addr, const void *data, uint width, uint count, 49*4882a593Smuzhiyun uint linelen); 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun /** 52*4882a593Smuzhiyun * display_options() - display the version string / build tag 53*4882a593Smuzhiyun * 54*4882a593Smuzhiyun * This displays the U-Boot version string. If a build tag is available this 55*4882a593Smuzhiyun * is displayed also. 56*4882a593Smuzhiyun */ 57*4882a593Smuzhiyun int display_options(void); 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun /* Suggested length of the buffer to pass to display_options_get_banner() */ 60*4882a593Smuzhiyun #define DISPLAY_OPTIONS_BANNER_LENGTH 200 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun /** 63*4882a593Smuzhiyun * display_options_get_banner() - Get the U-Boot banner as a string 64*4882a593Smuzhiyun * 65*4882a593Smuzhiyun * This returns the U-Boot banner string 66*4882a593Smuzhiyun * 67*4882a593Smuzhiyun * @newlines: true to include two newlines at the start 68*4882a593Smuzhiyun * @buf: place to put string 69*4882a593Smuzhiyun * @size: Size of buf (string is truncated to fit) 70*4882a593Smuzhiyun * @return buf 71*4882a593Smuzhiyun */ 72*4882a593Smuzhiyun char *display_options_get_banner(bool newlines, char *buf, int size); 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun /* This function is used for testing only */ 75*4882a593Smuzhiyun char *display_options_get_banner_priv(bool newlines, const char *build_tag, 76*4882a593Smuzhiyun char *buf, int size); 77*4882a593Smuzhiyun 78*4882a593Smuzhiyun #endif 79