rse_comms_protocol_common.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2024, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. /*
  8. * Packing scheme of the control parameter
  9. *
  10. * 31 30-28 27 26-24 23-20 19 18-16 15-0
  11. * +------------+-----+------+-------+-----+-------+-------+------+
  12. * | | | | invec | | | outvec| type |
  13. * | Res | Res | Res | number| Res | Res | number| |
  14. * +------------+-----+------+-------+-----+-------+-------+------+
  15. *
  16. * Res: Reserved.
  17. */
  18. #ifndef RSE_COMMS_PROTOCOL_COMMON
  19. #define RSE_COMMS_PROTOCOL_COMMON
  20. #define TYPE_OFFSET (0U)
  21. #define TYPE_MASK (0xFFFFUL << TYPE_OFFSET)
  22. #define IN_LEN_OFFSET (24U)
  23. #define IN_LEN_MASK (0x7UL << IN_LEN_OFFSET)
  24. #define OUT_LEN_OFFSET (16U)
  25. #define OUT_LEN_MASK (0x7UL << OUT_LEN_OFFSET)
  26. #define PARAM_PACK(type, in_len, out_len) \
  27. (((((uint32_t)(type)) << TYPE_OFFSET) & TYPE_MASK) | \
  28. ((((uint32_t)(in_len)) << IN_LEN_OFFSET) & IN_LEN_MASK) | \
  29. ((((uint32_t)(out_len)) << OUT_LEN_OFFSET) & OUT_LEN_MASK))
  30. #endif /* RSE_COMMS_PROTOCOL_COMMON */