topology: Add ABI version utilities

Some of the features on topology need to have
ABI version check. This adds few definitions to
check ABI version being 3.9 or more.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Sathya Prakash M R <sathya.prakash.m.r@intel.com>
This commit is contained in:
Sathya Prakash M R 2019-09-23 22:54:50 +05:30 committed by Liam Girdwood
parent b5f26539de
commit 61d153bbe3
1 changed files with 14 additions and 0 deletions

View File

@ -5,6 +5,20 @@
MAJOR=`grep '#define SOF_ABI_MAJOR ' $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o` MAJOR=`grep '#define SOF_ABI_MAJOR ' $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o`
MINOR=`grep '#define SOF_ABI_MINOR ' $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o` MINOR=`grep '#define SOF_ABI_MINOR ' $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o`
PATCH=`grep '#define SOF_ABI_PATCH ' $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o` PATCH=`grep '#define SOF_ABI_PATCH ' $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o`
MAJOR_SHIFT=`grep '#define SOF_ABI_MAJOR_SHIFT'\
$1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o`
MINOR_SHIFT=`grep '#define SOF_ABI_MINOR_SHIFT'\
$1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o`
major_val=$(($MAJOR << $MAJOR_SHIFT))
minor_val=$(($MINOR << $MINOR_SHIFT))
abi_version_3_8=$((3<<$MAJOR_SHIFT | 8<<$MINOR_SHIFT))
abi_version=$(($major_val | $minor_val))
abi_version_3_9_or_greater=$(($abi_version > $abi_version_3_8))
printf "define(\`SOF_ABI_MAJOR', \`0x%02x')\n" $MAJOR > abi.h printf "define(\`SOF_ABI_MAJOR', \`0x%02x')\n" $MAJOR > abi.h
printf "define(\`SOF_ABI_MINOR', \`0x%02x')\n" $MINOR >> abi.h printf "define(\`SOF_ABI_MINOR', \`0x%02x')\n" $MINOR >> abi.h
printf "define(\`SOF_ABI_PATCH', \`0x%02x')\n" $PATCH >> abi.h printf "define(\`SOF_ABI_PATCH', \`0x%02x')\n" $PATCH >> abi.h
printf "define(\`SOF_ABI_VERSION', \`0x%x')\n" $abi_version >> abi.h
printf "define(\`SOF_ABI_VERSION_3_9_OR_GRT', \`%d')\n"\
$abi_version_3_9_or_greater >> abi.h