2019-06-02 04:52:02 +08:00
|
|
|
#!/bin/bash
|
2019-06-02 04:58:16 +08:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright(c) 2019 Intel Corporation. All rights reserved.
|
|
|
|
|
2021-03-23 04:52:31 +08:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2019-05-31 21:04:48 +08:00
|
|
|
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`
|
|
|
|
PATCH=`grep '#define SOF_ABI_PATCH ' $1/src/include/kernel/abi.h | grep -E ".[[:digit:]]$" -o`
|
2019-09-24 01:24:50 +08:00
|
|
|
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))
|
2020-08-13 08:52:31 +08:00
|
|
|
abi_version_3_17=$((3<<$MAJOR_SHIFT | 17<<$MINOR_SHIFT))
|
|
|
|
abi_version_3_17_or_greater=$(($abi_version >= $abi_version_3_17))
|
2019-09-24 01:24:50 +08:00
|
|
|
|
2019-03-18 16:35:00 +08:00
|
|
|
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_PATCH', \`0x%02x')\n" $PATCH >> abi.h
|
2019-09-24 01:24:50 +08:00
|
|
|
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
|
2020-08-13 08:52:31 +08:00
|
|
|
printf "define(\`SOF_ABI_VERSION_3_17_OR_GRT', \`%d')\n"\
|
|
|
|
$abi_version_3_17_or_greater >> abi.h
|