14 #define DISABLE_INCREMENT 0
15 #define ENABLE_INCREMENT 1
17 #define TOTAL_PS_NV_COUNTERS 3
18 #define INIT_NV_COUNTERS_VALUE 42
27 static uint32_t get_nv_counter_position(
enum tfm_nv_counter_t counter_id)
46 nv_pos = get_nv_counter_position(counter_id);
52 *val = test_nv_counters[nv_pos];
65 nv_pos = get_nv_counter_position(counter_id);
70 if (test_nv_counters[nv_pos] == UINT32_MAX) {
75 test_nv_counters[nv_pos]++;
108 nv_pos = get_nv_counter_position(counter_id);
113 if (test_nv_counters[nv_pos] == 0) {
118 test_nv_counters[nv_pos]--;
128 nv_pos = get_nv_counter_position(counter_id);
134 test_nv_counters[nv_pos] = value;
psa_status_t ps_read_nv_counter(enum tfm_nv_counter_t counter_id, uint32_t *val)
Reads the given non-volatile (NV) counter.
psa_status_t ps_increment_nv_counter(enum tfm_nv_counter_t counter_id)
Increments the given non-volatile (NV) counter.
#define INIT_NV_COUNTERS_VALUE
#define TFM_PS_NV_COUNTER_1
#define PSA_ERROR_GENERIC_ERROR
#define TFM_PS_NV_COUNTER_3
psa_status_t test_ps_set_nv_counter(enum tfm_nv_counter_t counter_id, uint32_t value)
Sets a new value into the given non-volatile (NV) counter.
psa_status_t test_ps_decrement_nv_counter(enum tfm_nv_counter_t counter_id)
Decrements the given non-volatile (NV) counter.
psa_status_t test_ps_read_nv_counter(enum tfm_nv_counter_t counter_id, uint32_t *val)
Reads the given non-volatile (NV) counter.
psa_status_t test_ps_increment_nv_counter(enum tfm_nv_counter_t counter_id)
Increments the given non-volatile (NV) counter.
void test_ps_enable_increment_nv_counter(void)
Enables PS increment nv counter function to work normally.
void test_ps_disable_increment_nv_counter(void)
Disables PS increment nv counter function to force PSA_ERROR_GENERIC_ERROR return value as an indicat...
#define TFM_PS_NV_COUNTER_2
int32_t psa_status_t
Function return status.
#define DISABLE_INCREMENT
#define TOTAL_PS_NV_COUNTERS