rss_platform.c 879 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2023, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #include <stdint.h>
  8. #include <psa/client.h>
  9. #include <psa_manifest/sid.h>
  10. #include <rss_platform_api.h>
  11. psa_status_t
  12. rss_platform_nv_counter_increment(uint32_t counter_id)
  13. {
  14. struct psa_invec in_vec[1];
  15. in_vec[0].base = &counter_id;
  16. in_vec[0].len = sizeof(counter_id);
  17. return psa_call(RSS_PLATFORM_SERVICE_HANDLE,
  18. RSS_PLATFORM_API_ID_NV_INCREMENT,
  19. in_vec, 1, NULL, 0);
  20. }
  21. psa_status_t
  22. rss_platform_nv_counter_read(uint32_t counter_id,
  23. uint32_t size, uint8_t *val)
  24. {
  25. struct psa_invec in_vec[1];
  26. struct psa_outvec out_vec[1];
  27. in_vec[0].base = &counter_id;
  28. in_vec[0].len = sizeof(counter_id);
  29. out_vec[0].base = val;
  30. out_vec[0].len = size;
  31. return psa_call(RSS_PLATFORM_SERVICE_HANDLE,
  32. RSS_PLATFORM_API_ID_NV_READ,
  33. in_vec, 1, out_vec, 1);
  34. }