TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ps_nv_counters.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __PS_NV_COUNTERS_H__
9 #define __PS_NV_COUNTERS_H__
10 
11 /* NOTE: This API abstracts PS NV counters operations. This API detaches the
12  * use of NV counters from the TF-M NV counters implementation, provided
13  * by the platform, and provides a mechanism to compile in a different
14  * API implementation for test purposes. A PS test suite may provide
15  * its own custom implementation to be able to test different PS service
16  * use cases.
17  */
18 
19 #include <stdint.h>
20 #include "psa/protected_storage.h"
21 #include "tfm_plat_nv_counters.h"
22 
23 #define TFM_PS_NV_COUNTER_1 PLAT_NV_COUNTER_0
24 #define TFM_PS_NV_COUNTER_2 PLAT_NV_COUNTER_1
25 #define TFM_PS_NV_COUNTER_3 PLAT_NV_COUNTER_2
26 
27 #define PS_NV_COUNTER_SIZE 4 /* In bytes */
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
42 psa_status_t ps_read_nv_counter(enum tfm_nv_counter_t counter_id,
43  uint32_t *val);
44 
53 psa_status_t ps_increment_nv_counter(enum tfm_nv_counter_t counter_id);
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 
59 #endif /* __PS_NV_COUNTERS_H__ */
psa_status_t ps_increment_nv_counter(enum tfm_nv_counter_t counter_id)
Increments the given non-volatile (NV) counter.
psa_status_t ps_read_nv_counter(enum tfm_nv_counter_t counter_id, uint32_t *val)
Reads the given non-volatile (NV) counter.
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:43