1 /******************************************************************************
2  * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
3  * All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************/
18 
19 /********************************************************************************************************
20  * @file	trng.h
21  *
22  * @brief	This is the header file for B91
23  *
24  * @author	Driver Group
25  *
26  *******************************************************************************************************/
27 /**	@page TRNG
28  *
29  *	Introduction
30  *	===============
31  *	TLSRB91 supports hardware trng.
32  *
33  *	API Reference
34  *	===============
35  *	Header File: trng.h
36  */
37 #ifndef TRNG_H_
38 #define TRNG_H_
39 
40 #include "sys.h"
41 #include "stimer.h"
42 #include "reg_include/register_b91.h"
43 
44 /**********************************************************************************************************************
45  *                                         global constants                                                           *
46  *********************************************************************************************************************/
47 
48 /**********************************************************************************************************************
49  *                                           global macro                                                             *
50  *********************************************************************************************************************/
51 
52 /**********************************************************************************************************************
53  *                                         global data type                                                           *
54  *********************************************************************************************************************/
55 
56 /**********************************************************************************************************************
57  *                                     global variable declaration                                                    *
58  *********************************************************************************************************************/
59 
60 /**********************************************************************************************************************
61  *                                      global function prototype                                                     *
62  *********************************************************************************************************************/
63 
64 /**
65  * @brief     This function performs to get one random number.If chip in suspend TRNG module should be close.
66  *            else its current will be larger.
67  * @return    none
68  **/
69 void trng_init(void);
70 
71 /**
72  * @brief     This function performs to get one random number.
73  * @return    the value of one random number
74  **/
75 unsigned int trng_rand(void);
76 
77 #endif
78