1 /*
2  * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _NVM_OTP_H
8 #define _NVM_OTP_H
9 
10 #ifdef __cplusplus
11 extern "C"
12 {
13 #endif
14 
15 #include "cc_crypto_boot_defs.h"
16 #include "cc_pal_types.h"
17 
18 /*------------------------------------
19     DEFINES
20 -------------------------------------*/
21 
22 
23 
24 /**
25  * @brief The NVM_GetSwVersion function is a NVM interface function -
26  *        The function retrieves the SW version from the SRAM/NVM.
27  *        In case of OTP, we support up to 16 anti-rollback counters (taken from the certificate)
28  *
29  * @param[in] hwBaseAddress -  CryptoCell base address
30  *
31  * @param[in] counterId -  relevant only for OTP (valid values: 1,2)
32  *
33  * @param[out] swVersion   -  the minimum SW version
34  *
35  * @return CCError_t - On success the value CC_OK is returned, and on failure   -a value from NVM_error.h
36  */
37 CCError_t NVM_GetSwVersion(unsigned long hwBaseAddress, CCSbSwVersionId_t counterId, uint32_t *swVersion);
38 
39 
40 /**
41  * @brief The NVM_SetSwVersion function is a NVM interface function -
42  *        The function writes the SW version into the SRAM/NVM.
43  *        In case of OTP, we support up to 16 anti-rollback counters (taken from the certificate)
44  *
45  * @param[in] hwBaseAddress -  CryptoCell base address
46  *
47  * @param[in] counterId -  relevant only for OTP (valid values: 1,2)
48  *
49  * @param[in] swVersion   -  the minimum SW version
50  *
51  * @return CCError_t - On success the value CC_OK is returned, and on failure   -a value from NVM_error.h
52  */
53 CCError_t NVM_SetSwVersion(unsigned long hwBaseAddress, CCSbSwVersionId_t counterId, uint32_t swVersion);
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 
59 #endif
60