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