abi.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. /* SOF ABI version major, minor and patch numbers */
  25. #define SOF_ABI_MAJOR 3
  26. #define SOF_ABI_MINOR 10
  27. #define SOF_ABI_PATCH 0
  28. /* SOF ABI version number. Format within 32bit word is MMmmmppp */
  29. #define SOF_ABI_MAJOR_SHIFT 24
  30. #define SOF_ABI_MAJOR_MASK 0xff
  31. #define SOF_ABI_MINOR_SHIFT 12
  32. #define SOF_ABI_MINOR_MASK 0xfff
  33. #define SOF_ABI_PATCH_SHIFT 0
  34. #define SOF_ABI_PATCH_MASK 0xfff
  35. #define SOF_ABI_VER(major, minor, patch) \
  36. (((major) << SOF_ABI_MAJOR_SHIFT) | \
  37. ((minor) << SOF_ABI_MINOR_SHIFT) | \
  38. ((patch) << SOF_ABI_PATCH_SHIFT))
  39. #define SOF_ABI_VERSION_MAJOR(version) \
  40. (((version) >> SOF_ABI_MAJOR_SHIFT) & SOF_ABI_MAJOR_MASK)
  41. #define SOF_ABI_VERSION_MINOR(version) \
  42. (((version) >> SOF_ABI_MINOR_SHIFT) & SOF_ABI_MINOR_MASK)
  43. #define SOF_ABI_VERSION_PATCH(version) \
  44. (((version) >> SOF_ABI_PATCH_SHIFT) & SOF_ABI_PATCH_MASK)
  45. #define SOF_ABI_VERSION_INCOMPATIBLE(sof_ver, client_ver) \
  46. (SOF_ABI_VERSION_MAJOR((sof_ver)) != \
  47. SOF_ABI_VERSION_MAJOR((client_ver)) \
  48. )
  49. #define SOF_ABI_VERSION SOF_ABI_VER(SOF_ABI_MAJOR, SOF_ABI_MINOR, SOF_ABI_PATCH)
  50. /* SOF ABI magic number "SOF\0". */
  51. #define SOF_ABI_MAGIC 0x00464F53
  52. #endif