162306a36Sopenharmony_ci/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license.  When using or
462306a36Sopenharmony_ci * redistributing this file, you may do so under either license.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright(c) 2018 Intel Corporation. All rights reserved.
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/**
1062306a36Sopenharmony_ci * SOF ABI versioning is based on Semantic Versioning where we have a given
1162306a36Sopenharmony_ci * MAJOR.MINOR.PATCH version number. See https://semver.org/
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci * Rules for incrementing or changing version :-
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci * 1) Increment MAJOR version if you make incompatible API changes. MINOR and
1662306a36Sopenharmony_ci *    PATCH should be reset to 0.
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci * 2) Increment MINOR version if you add backwards compatible features or
1962306a36Sopenharmony_ci *    changes. PATCH should be reset to 0.
2062306a36Sopenharmony_ci *
2162306a36Sopenharmony_ci * 3) Increment PATCH version if you add backwards compatible bug fixes.
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#ifndef __INCLUDE_UAPI_SOUND_SOF_ABI_H__
2562306a36Sopenharmony_ci#define __INCLUDE_UAPI_SOUND_SOF_ABI_H__
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#include <linux/types.h>
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/* SOF ABI version major, minor and patch numbers */
3062306a36Sopenharmony_ci#define SOF_ABI_MAJOR 3
3162306a36Sopenharmony_ci#define SOF_ABI_MINOR 23
3262306a36Sopenharmony_ci#define SOF_ABI_PATCH 0
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/* SOF ABI version number. Format within 32bit word is MMmmmppp */
3562306a36Sopenharmony_ci#define SOF_ABI_MAJOR_SHIFT	24
3662306a36Sopenharmony_ci#define SOF_ABI_MAJOR_MASK	0xff
3762306a36Sopenharmony_ci#define SOF_ABI_MINOR_SHIFT	12
3862306a36Sopenharmony_ci#define SOF_ABI_MINOR_MASK	0xfff
3962306a36Sopenharmony_ci#define SOF_ABI_PATCH_SHIFT	0
4062306a36Sopenharmony_ci#define SOF_ABI_PATCH_MASK	0xfff
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#define SOF_ABI_VER(major, minor, patch) \
4362306a36Sopenharmony_ci	(((major) << SOF_ABI_MAJOR_SHIFT) | \
4462306a36Sopenharmony_ci	((minor) << SOF_ABI_MINOR_SHIFT) | \
4562306a36Sopenharmony_ci	((patch) << SOF_ABI_PATCH_SHIFT))
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define SOF_ABI_VERSION_MAJOR(version) \
4862306a36Sopenharmony_ci	(((version) >> SOF_ABI_MAJOR_SHIFT) & SOF_ABI_MAJOR_MASK)
4962306a36Sopenharmony_ci#define SOF_ABI_VERSION_MINOR(version)	\
5062306a36Sopenharmony_ci	(((version) >> SOF_ABI_MINOR_SHIFT) & SOF_ABI_MINOR_MASK)
5162306a36Sopenharmony_ci#define SOF_ABI_VERSION_PATCH(version)	\
5262306a36Sopenharmony_ci	(((version) >> SOF_ABI_PATCH_SHIFT) & SOF_ABI_PATCH_MASK)
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#define SOF_ABI_VERSION_INCOMPATIBLE(sof_ver, client_ver)		\
5562306a36Sopenharmony_ci	(SOF_ABI_VERSION_MAJOR((sof_ver)) !=				\
5662306a36Sopenharmony_ci		SOF_ABI_VERSION_MAJOR((client_ver))			\
5762306a36Sopenharmony_ci	)
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci#define SOF_ABI_VERSION SOF_ABI_VER(SOF_ABI_MAJOR, SOF_ABI_MINOR, SOF_ABI_PATCH)
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci/* SOF ABI magic number "SOF\0". */
6262306a36Sopenharmony_ci#define SOF_ABI_MAGIC		0x00464F53
6362306a36Sopenharmony_ci/* SOF IPC4 ABI magic number "SOF4". */
6462306a36Sopenharmony_ci#define SOF_IPC4_ABI_MAGIC	0x34464F53
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci#endif
67