display_options.h 2.2 KB

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