• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef _REG_TRNG_H_
16 #define _REG_TRNG_H_
17 
18 #include "chip.h"
19 
20 typedef struct
21 {
22   __IO uint32_t                    trng_en;                      //0x00000000
23   __IO uint32_t                    trng_status;                  //0x00000004
24   __IO uint32_t                    trng_data;                    //0x00000008
25   __IO uint32_t Reserved_0000000C;              //0x0000000C
26   __IO uint32_t                    trng_div_dly;                 //0x00000010
27   __IO uint32_t                    trng_sel;                     //0x00000014
28 } CS_TRNG_TypeDef;
29 
30 static CS_TRNG_TypeDef * const CS_TRNG = ((CS_TRNG_TypeDef *)CS_TRNG_BASE);
31 
32 //trng_en
33 #define TRNG_STRNGENQ              (1<<2)
34 #define TRNG_STRNGIEQ              (1<<3)
35 #define TRNG_STRNGEEQ              (1<<4)
36 
37 //trng_status
38 #define TRNG_SDRDYQ                (1<<0)
39 #define TRNG_SSECSQ                (1<<2)
40 #define TRNG_SSEISQ                (1<<6)
41 
42 //trng_data
43 #define TRNG_SDRQ(n)               (((n)&0xFFFFFFFF)<<0)
44 
45 //trng_div_dly
46 #define TRNG_SDIVNUMQ(n)           (((n)&0xFF)<<0)
47 #define TRNG_SDIVHIGHQ(n)          (((n)&0xFF)<<8)
48 #define TRNG_SDLYNUMQ(n)           (((n)&0xFF)<<16)
49 
50 //trng_sel
51 #define TRNG_STRNGSEL0Q(n)         (((n)&0xFF)<<0)
52 #define TRNG_STRNGSEL1Q(n)         (((n)&0xFF)<<8)
53 #define TRNG_SLFSRGEN0Q(n)         (((n)&0xFF)<<16)
54 #define TRNG_SLFSRGEN1Q(n)         (((n)&0xFF)<<24)
55 
56 #endif /* _REG_TRNG_H_ */
57