laurenw-arm | 4fc77a7 | 2022-08-11 15:29:56 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2023, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef RSS_PLATFORM_API_H |
| 9 | #define RSS_PLATFORM_API_H |
| 10 | |
| 11 | #include <stdint.h> |
| 12 | |
| 13 | #include "psa/error.h" |
| 14 | |
| 15 | #define RSS_PLATFORM_API_ID_NV_READ (1010) |
| 16 | #define RSS_PLATFORM_API_ID_NV_INCREMENT (1011) |
| 17 | |
| 18 | /* |
| 19 | * Increments the given non-volatile (NV) counter by one |
| 20 | * |
| 21 | * counter_id NV counter ID. |
| 22 | * |
| 23 | * PSA_SUCCESS if the value is read correctly. Otherwise, |
| 24 | * it returns a PSA_ERROR. |
| 25 | */ |
| 26 | psa_status_t |
| 27 | rss_platform_nv_counter_increment(uint32_t counter_id); |
| 28 | |
| 29 | /* |
| 30 | * Reads the given non-volatile (NV) counter |
| 31 | * |
| 32 | * counter_id NV counter ID. |
| 33 | * size Size of the buffer to store NV counter value |
| 34 | * in bytes. |
| 35 | * val Pointer to store the current NV counter value. |
| 36 | * |
| 37 | * PSA_SUCCESS if the value is read correctly. Otherwise, |
| 38 | * it returns a PSA_ERROR. |
| 39 | */ |
| 40 | psa_status_t |
| 41 | rss_platform_nv_counter_read(uint32_t counter_id, |
| 42 | uint32_t size, uint8_t *val); |
| 43 | |
| 44 | #endif /* RSS_PLATFORM_API_H */ |