1 /* SPDX-License-Identifier: BSD-3-Clause 2 * 3 * Copyright(c) 2016 Intel Corporation. All rights reserved. 4 * 5 * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com> 6 */ 7 8 /** 9 * \file include/kernel/abi.h 10 * \brief ABI definitions 11 * \author Liam Girdwood <liam.r.girdwood@linux.intel.com> 12 * 13 * SOF ABI versioning is based on Semantic Versioning where we have a given 14 * MAJOR.MINOR.PATCH version number. See https://semver.org/ 15 * 16 * Rules for incrementing or changing version :- 17 * 18 * 1) Increment MAJOR version if you make incompatible API changes. MINOR and 19 * PATCH should be reset to 0. 20 * 21 * 2) Increment MINOR version if you add backwards compatible features or 22 * changes. PATCH should be reset to 0. 23 * 24 * 3) Increment PATCH version if you add backwards compatible bug fixes. 25 */ 26 27 #ifndef __KERNEL_ABI_H__ 28 #define __KERNEL_ABI_H__ 29 30 /** \brief SOF ABI version major, minor and patch numbers */ 31 #define SOF_ABI_MAJOR 3 32 #define SOF_ABI_MINOR 26 33 #define SOF_ABI_PATCH 0 34 35 /** \brief SOF ABI version number. Format within 32bit word is MMmmmppp */ 36 #define SOF_ABI_MAJOR_SHIFT 24 37 #define SOF_ABI_MAJOR_MASK 0xff 38 #define SOF_ABI_MINOR_SHIFT 12 39 #define SOF_ABI_MINOR_MASK 0xfff 40 #define SOF_ABI_PATCH_SHIFT 0 41 #define SOF_ABI_PATCH_MASK 0xfff 42 43 #define SOF_ABI_VER(major, minor, patch) \ 44 (((major) << SOF_ABI_MAJOR_SHIFT) | \ 45 ((minor) << SOF_ABI_MINOR_SHIFT) | \ 46 ((patch) << SOF_ABI_PATCH_SHIFT)) 47 48 #define SOF_ABI_VERSION_MAJOR(version) \ 49 (((version) >> SOF_ABI_MAJOR_SHIFT) & SOF_ABI_MAJOR_MASK) 50 #define SOF_ABI_VERSION_MINOR(version) \ 51 (((version) >> SOF_ABI_MINOR_SHIFT) & SOF_ABI_MINOR_MASK) 52 #define SOF_ABI_VERSION_PATCH(version) \ 53 (((version) >> SOF_ABI_PATCH_SHIFT) & SOF_ABI_PATCH_MASK) 54 55 #define SOF_ABI_VERSION_INCOMPATIBLE(sof_ver, client_ver) \ 56 (SOF_ABI_VERSION_MAJOR((sof_ver)) != \ 57 SOF_ABI_VERSION_MAJOR((client_ver)) \ 58 ) 59 60 #define SOF_ABI_VERSION SOF_ABI_VER(SOF_ABI_MAJOR, SOF_ABI_MINOR, SOF_ABI_PATCH) 61 62 /** \brief SOF ABI magic number "SOF\0". */ 63 #define SOF_ABI_MAGIC 0x00464F53 64 /** \brief SOF IPC4 ABI magic number "SOF4". */ 65 #define SOF_IPC4_ABI_MAGIC 0x34464F53 66 67 #endif /* __KERNEL_ABI_H__ */ 68