Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
0002 /*
0003  * This file is provided under a dual BSD/GPLv2 license.  When using or
0004  * redistributing this file, you may do so under either license.
0005  *
0006  * Copyright(c) 2018 Intel Corporation. All rights reserved.
0007  */
0008 
0009 /**
0010  * SOF ABI versioning is based on Semantic Versioning where we have a given
0011  * MAJOR.MINOR.PATCH version number. See https://semver.org/
0012  *
0013  * Rules for incrementing or changing version :-
0014  *
0015  * 1) Increment MAJOR version if you make incompatible API changes. MINOR and
0016  *    PATCH should be reset to 0.
0017  *
0018  * 2) Increment MINOR version if you add backwards compatible features or
0019  *    changes. PATCH should be reset to 0.
0020  *
0021  * 3) Increment PATCH version if you add backwards compatible bug fixes.
0022  */
0023 
0024 #ifndef __INCLUDE_UAPI_SOUND_SOF_ABI_H__
0025 #define __INCLUDE_UAPI_SOUND_SOF_ABI_H__
0026 
0027 #include <linux/types.h>
0028 
0029 /* SOF ABI version major, minor and patch numbers */
0030 #define SOF_ABI_MAJOR 3
0031 #define SOF_ABI_MINOR 23
0032 #define SOF_ABI_PATCH 0
0033 
0034 /* SOF ABI version number. Format within 32bit word is MMmmmppp */
0035 #define SOF_ABI_MAJOR_SHIFT 24
0036 #define SOF_ABI_MAJOR_MASK  0xff
0037 #define SOF_ABI_MINOR_SHIFT 12
0038 #define SOF_ABI_MINOR_MASK  0xfff
0039 #define SOF_ABI_PATCH_SHIFT 0
0040 #define SOF_ABI_PATCH_MASK  0xfff
0041 
0042 #define SOF_ABI_VER(major, minor, patch) \
0043     (((major) << SOF_ABI_MAJOR_SHIFT) | \
0044     ((minor) << SOF_ABI_MINOR_SHIFT) | \
0045     ((patch) << SOF_ABI_PATCH_SHIFT))
0046 
0047 #define SOF_ABI_VERSION_MAJOR(version) \
0048     (((version) >> SOF_ABI_MAJOR_SHIFT) & SOF_ABI_MAJOR_MASK)
0049 #define SOF_ABI_VERSION_MINOR(version)  \
0050     (((version) >> SOF_ABI_MINOR_SHIFT) & SOF_ABI_MINOR_MASK)
0051 #define SOF_ABI_VERSION_PATCH(version)  \
0052     (((version) >> SOF_ABI_PATCH_SHIFT) & SOF_ABI_PATCH_MASK)
0053 
0054 #define SOF_ABI_VERSION_INCOMPATIBLE(sof_ver, client_ver)       \
0055     (SOF_ABI_VERSION_MAJOR((sof_ver)) !=                \
0056         SOF_ABI_VERSION_MAJOR((client_ver))         \
0057     )
0058 
0059 #define SOF_ABI_VERSION SOF_ABI_VER(SOF_ABI_MAJOR, SOF_ABI_MINOR, SOF_ABI_PATCH)
0060 
0061 /* SOF ABI magic number "SOF\0". */
0062 #define SOF_ABI_MAGIC       0x00464F53
0063 
0064 #endif