Topology: utils: add Decimal to Hexadecimal converting macro

Add macro DEC2HEX marcro to convert 2-digit decimal number to
hexadecimal one that prefixed with '0x'.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
This commit is contained in:
Keyon Jie 2020-04-11 00:36:21 +08:00 committed by Liam Girdwood
parent 79f97a6a0c
commit 6569b345f5
1 changed files with 8 additions and 0 deletions

View File

@ -57,6 +57,14 @@ define(`COMP_FORMAT_VALUE',
$1, `s32le', `0x02',
)')
# note: only support number < 256 at the moment
dnl DEC2HEX(dec_num)
define(`DEC2HEX',
`ifelse(
eval(`$1 < 16'), `1', concat(`0x0',eval($1, 16)),
eval(`$1 < 256'), `1', concat(`0x',eval($1, 16)),
)')
dnl P_GRAPH(NAME, PIPELINE_ID, CONNECTIONS)
define(`P_GRAPH',
`SectionGraph.STR($1 $2) {'