Add print_freq() to display frequencies nicely

Add a function similar to print_size() that works for frequencies. It can
handle from Hz to GHz.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass 2015-04-29 07:56:43 -06:00
parent 2ea09c836f
commit 33eac2dc25
2 changed files with 53 additions and 0 deletions

View file

@ -22,6 +22,17 @@
*/
void print_size(uint64_t size, const char *suffix);
/**
* print_freq() - Print a frequency with a suffix
*
* Print frequencies as "x.xx GHz", "xxx KHz", etc as needed; allow for
* optional trailing string (like "\n")
*
* @freq: Frequency to print in Hz
* @suffix String to print after the frequency
*/
void print_freq(uint64_t freq, const char *suffix);
/**
* print_buffer() - Print data buffer in hex and ascii form
*