1 /*
2  * Copyright (c) 2001-2019, 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 
17 /*------------------------------------
18     DEFINES
19 -------------------------------------*/
20 
21 /**
22  * @brief The NVM_GetSwVersion function is a NVM interface function -
23  *        The function retrieves the SW version from the SRAM/NVM.
24  *    In case of OTP, we support up to 16 anti-rollback counters (taken from the certificate)
25  *
26  * @param[in] hwBaseAddress -  CryptoCell base address
27  *
28  * @param[in] counterId -  relevant only for OTP (valid values: 1,2)
29  *
30  * @param[out] swVersion   -  the minimum SW version
31  *
32  * @return CCError_t - On success the value CC_OK is returned, and on failure   -a value from NVM_error.h
33  */
34 CCError_t NVM_GetSwVersion(unsigned long hwBaseAddress, CCSbPubKeyIndexType_t keyIndex, uint32_t* swVersion);
35 
36 
37 /**
38  * @brief The run time secure boot should not support SW version update.
39  *
40  * @param[in] hwBaseAddress -  CryptoCell base address
41  *
42  * @param[in] counterId -  relevant only for OTP (valid values: 1,2)
43  *
44  * @param[out] swVersion   -  the minimum SW version
45  *
46  * @return CCError_t - always return CC_OK
47  */
48 
49 CCError_t NVM_SetSwVersion(unsigned long hwBaseAddress, CCSbPubKeyIndexType_t keyIndex, uint32_t swVersion);
50 
51 #ifdef __cplusplus
52 }
53 #endif
54 
55 #endif
56 
57 
58