abi.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
  2. /*
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * Copyright(c) 2018 Intel Corporation. All rights reserved.
  7. */
  8. /**
  9. * SOF ABI versioning is based on Semantic Versioning where we have a given
  10. * MAJOR.MINOR.PATCH version number. See https://semver.org/
  11. *
  12. * Rules for incrementing or changing version :-
  13. *
  14. * 1) Increment MAJOR version if you make incompatible API changes. MINOR and
  15. * PATCH should be reset to 0.
  16. *
  17. * 2) Increment MINOR version if you add backwards compatible features or
  18. * changes. PATCH should be reset to 0.
  19. *
  20. * 3) Increment PATCH version if you add backwards compatible bug fixes.
  21. */
  22. #ifndef __INCLUDE_UAPI_SOUND_SOF_ABI_H__
  23. #define __INCLUDE_UAPI_SOUND_SOF_ABI_H__
  24. #include <linux/types.h>
  25. /* SOF ABI version major, minor and patch numbers */
  26. #define SOF_ABI_MAJOR 3
  27. #define SOF_ABI_MINOR 23
  28. #define SOF_ABI_PATCH 0
  29. /* SOF ABI version number. Format within 32bit word is MMmmmppp */
  30. #define SOF_ABI_MAJOR_SHIFT 24
  31. #define SOF_ABI_MAJOR_MASK 0xff
  32. #define SOF_ABI_MINOR_SHIFT 12
  33. #define SOF_ABI_MINOR_MASK 0xfff
  34. #define SOF_ABI_PATCH_SHIFT 0
  35. #define SOF_ABI_PATCH_MASK 0xfff
  36. #define SOF_ABI_VER(major, minor, patch) \
  37. (((major) << SOF_ABI_MAJOR_SHIFT) | \
  38. ((minor) << SOF_ABI_MINOR_SHIFT) | \
  39. ((patch) << SOF_ABI_PATCH_SHIFT))
  40. #define SOF_ABI_VERSION_MAJOR(version) \
  41. (((version) >> SOF_ABI_MAJOR_SHIFT) & SOF_ABI_MAJOR_MASK)
  42. #define SOF_ABI_VERSION_MINOR(version) \
  43. (((version) >> SOF_ABI_MINOR_SHIFT) & SOF_ABI_MINOR_MASK)
  44. #define SOF_ABI_VERSION_PATCH(version) \
  45. (((version) >> SOF_ABI_PATCH_SHIFT) & SOF_ABI_PATCH_MASK)
  46. #define SOF_ABI_VERSION_INCOMPATIBLE(sof_ver, client_ver) \
  47. (SOF_ABI_VERSION_MAJOR((sof_ver)) != \
  48. SOF_ABI_VERSION_MAJOR((client_ver)) \
  49. )
  50. #define SOF_ABI_VERSION SOF_ABI_VER(SOF_ABI_MAJOR, SOF_ABI_MINOR, SOF_ABI_PATCH)
  51. /* SOF ABI magic number "SOF\0". */
  52. #define SOF_ABI_MAGIC 0x00464F53
  53. /* SOF IPC4 ABI magic number "SOF4". */
  54. #define SOF_IPC4_ABI_MAGIC 0x34464F53
  55. #endif