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  _CC_RNG_PLAT_H
8 #define  _CC_RNG_PLAT_H
9 
10 #include "cc_rnd_local.h"
11 #include "cc_plat.h"
12 
13 /****************  Defines  ********************/
14 #define CC_RNG_OTP_SUB_SAMPL_RATIO_BIT_SIZE     7
15 #define CC_RNG_OTP_SUB_SAMPL_RATIO_MAX_VAL      ((1UL << CC_RNG_OTP_SUB_SAMPL_RATIO_BIT_SIZE) - 1)
16 
17 /* Default TRNG parameters: used when in OTP set 0 in appropriate bits */
18 #define CC_RNG_DEFAULT_ROSCS_ALLOWED_FLAG       0xF
19 
20 /* Default, increment and mininimal values, for Sampling Ratio */
21 
22 /* On  FE mode */
23 #define CC_RNG_DEFAULT_SAMPL_RATIO_ON_FE_MODE 1000
24 #define CC_RNG_SAMPL_RATIO_INCREM_ON_FE_MODE  50
25 #define CC_RNG_MIN_SAMPL_RATIO_ON_FE_MODE     1000
26 
27 /* Maximal value of SamplingRatio */
28 #define CC_RNG_MAX_SAMPL_RATIO_ON_SWEE_MODE     CC_RNG_OTP_SUB_SAMPL_RATIO_MAX_VAL
29 #define CC_RNG_MAX_SAMPL_RATIO_ON_FE_MODE     (CC_RNG_MIN_SAMPL_RATIO_ON_FE_MODE + \
30                         CC_RNG_SAMPL_RATIO_INCREM_ON_FE_MODE * CC_RNG_OTP_SUB_SAMPL_RATIO_MAX_VAL)
31 
32 /****************************************************************************************/
33 /**
34  *
35  * @brief The function retrievess the TRNG parameters, provided by the User trough NVM,
36  *        and sets them into structures given by pointers rndState_ptr and trngParams_ptr.
37  *
38  * @author reuvenl (6/26/2012)
39  *
40  * @param[out] trngParams_ptr - The pointer to structure, containing parameters
41  *                            of HW TRNG.
42  *
43  * @return CCError_t - no return value
44  */
45 CCError_t RNG_PLAT_SetUserRngParameters(
46                         CCRndParams_t  *pTrngParams);
47 
48 
49 #endif  /* _CC_RNG_PLAT_H */
50