Select one of the symbols to view example projects that use it.
 
Outline
#define _HARDWARE_STRUCTS_TRNG_H
#include "hardware/address_mapped.h"
#include "hardware/regs/trng.h"
trng_hw_t
#define trng_hw
Files
loading...
SourceVuRaspberry Pi Pico SDK and ExamplesPicoSDKsrc/rp2350/hardware_structs/include/hardware/structs/trng.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
// THIS HEADER FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT /** * Copyright (c) 2024 Raspberry Pi Ltd. * * SPDX-License-Identifier: BSD-3-Clause *//* ... */ #ifndef _HARDWARE_STRUCTS_TRNG_H #define _HARDWARE_STRUCTS_TRNG_H /** * \file rp2350/trng.h *//* ... */ #include "hardware/address_mapped.h" #include "hardware/regs/trng.h" // Reference to datasheet: https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf#tab-registerlist_trng // // The _REG_ macro is intended to help make the register navigable in your IDE (for example, using the "Go to Definition" feature) // _REG_(x) will link to the corresponding register in hardware/regs/trng.h. // // Bit-field descriptions are of the form: // BITMASK [BITRANGE] FIELDNAME (RESETVALUE) DESCRIPTION typedef struct { _REG_(TRNG_RNG_IMR_OFFSET) // TRNG_RNG_IMR // Interrupt masking // 0xfffffff0 [31:4] RESERVED (0x0000000) RESERVED // 0x00000008 [3] VN_ERR_INT_MASK (1) 1'b1-mask interrupt, no interrupt will be generated // 0x00000004 [2] CRNGT_ERR_INT_MASK (1) 1'b1-mask interrupt, no interrupt will be generated // 0x00000002 [1] AUTOCORR_ERR_INT_MASK (1) 1'b1-mask interrupt, no interrupt will be generated // 0x00000001 [0] EHR_VALID_INT_MASK (1) 1'b1-mask interrupt, no interrupt will be generated io_rw_32 rng_imr; _REG_(TRNG_RNG_ISR_OFFSET) // TRNG_RNG_ISR // RNG status register // 0xfffffff0 [31:4] RESERVED (0x0000000) RESERVED // 0x00000008 [3] VN_ERR (0) 1'b1 indicates Von Neuman error // 0x00000004 [2] CRNGT_ERR (0) 1'b1 indicates CRNGT in the RNG test failed // 0x00000002 [1] AUTOCORR_ERR (0) 1'b1 indicates Autocorrelation test failed four times in a row // 0x00000001 [0] EHR_VALID (0) 1'b1 indicates that 192 bits have been collected in the... io_ro_32 rng_isr; _REG_(TRNG_RNG_ICR_OFFSET) // TRNG_RNG_ICR // Interrupt/status bit clear Register // 0xfffffff0 [31:4] RESERVED (0x0000000) RESERVED // 0x00000008 [3] VN_ERR (0) Write 1'b1 - clear corresponding bit in RNG_ISR // 0x00000004 [2] CRNGT_ERR (0) Write 1'b1 - clear corresponding bit in RNG_ISR // 0x00000002 [1] AUTOCORR_ERR (0) Cannot be cleared by SW! Only RNG reset clears this bit // 0x00000001 [0] EHR_VALID (0) Write 1'b1 - clear corresponding bit in RNG_ISR io_rw_32 rng_icr; _REG_(TRNG_TRNG_CONFIG_OFFSET) // TRNG_TRNG_CONFIG // Selecting the inverter-chain length // 0xfffffffc [31:2] RESERVED (0x00000000) RESERVED // 0x00000003 [1:0] RND_SRC_SEL (0x0) Selects the number of inverters (out of four possible... io_rw_32 trng_config; _REG_(TRNG_TRNG_VALID_OFFSET) // TRNG_TRNG_VALID // 192 bit collection indication // 0xfffffffe [31:1] RESERVED (0x00000000) RESERVED // 0x00000001 [0] EHR_VALID (0) 1'b1 indicates that collection of bits in the RNG is... io_ro_32 trng_valid; // (Description copied from array index 0 register TRNG_EHR_DATA0 applies similarly to other array indexes) _REG_(TRNG_EHR_DATA0_OFFSET) // TRNG_EHR_DATA0 // RNG collected bits // 0xffffffff [31:0] EHR_DATA0 (0x00000000) Bits [31:0] of Entropy Holding Register (EHR) - RNG... io_ro_32 ehr_data[6]; _REG_(TRNG_RND_SOURCE_ENABLE_OFFSET) // TRNG_RND_SOURCE_ENABLE // Enable signal for the random source // 0xfffffffe [31:1] RESERVED (0x00000000) RESERVED // 0x00000001 [0] RND_SRC_EN (0) * 1'b1 - entropy source is enabled io_rw_32 rnd_source_enable; _REG_(TRNG_SAMPLE_CNT1_OFFSET) // TRNG_SAMPLE_CNT1 // Counts clocks between sampling of random bit // 0xffffffff [31:0] SAMPLE_CNTR1 (0x0000ffff) Sets the number of rng_clk cycles between two... io_rw_32 sample_cnt1; _REG_(TRNG_AUTOCORR_STATISTIC_OFFSET) // TRNG_AUTOCORR_STATISTIC // Statistic about Autocorrelation test activations // 0xffc00000 [31:22] RESERVED (0x000) RESERVED // 0x003fc000 [21:14] AUTOCORR_FAILS (0x00) Count each time an autocorrelation test fails // 0x00003fff [13:0] AUTOCORR_TRYS (0x0000) Count each time an autocorrelation test starts io_rw_32 autocorr_statistic; _REG_(TRNG_TRNG_DEBUG_CONTROL_OFFSET) // TRNG_TRNG_DEBUG_CONTROL // Debug register // 0x00000008 [3] AUTO_CORRELATE_BYPASS (0) When set, the autocorrelation test in the TRNG module is bypassed // 0x00000004 [2] TRNG_CRNGT_BYPASS (0) When set, the CRNGT test in the RNG is bypassed // 0x00000002 [1] VNC_BYPASS (0) When set, the Von-Neuman balancer is bypassed (including... // 0x00000001 [0] RESERVED (0) N/A io_rw_32 trng_debug_control; uint32_t _pad0; _REG_(TRNG_TRNG_SW_RESET_OFFSET) // TRNG_TRNG_SW_RESET // Generate internal SW reset within the RNG block // 0xfffffffe [31:1] RESERVED (0x00000000) RESERVED // 0x00000001 [0] TRNG_SW_RESET (0) Writing 1'b1 to this register causes an internal RNG reset io_rw_32 trng_sw_reset; uint32_t _pad1[28]; _REG_(TRNG_RNG_DEBUG_EN_INPUT_OFFSET) // TRNG_RNG_DEBUG_EN_INPUT // Enable the RNG debug mode // 0xfffffffe [31:1] RESERVED (0x00000000) RESERVED // 0x00000001 [0] RNG_DEBUG_EN (0) * 1'b1 - debug mode is enabled io_rw_32 rng_debug_en_input; _REG_(TRNG_TRNG_BUSY_OFFSET) // TRNG_TRNG_BUSY // RNG Busy indication // 0xfffffffe [31:1] RESERVED (0x00000000) RESERVED // 0x00000001 [0] TRNG_BUSY (0) Reflects rng_busy status io_ro_32 trng_busy; _REG_(TRNG_RST_BITS_COUNTER_OFFSET) // TRNG_RST_BITS_COUNTER // Reset the counter of collected bits in the RNG // 0xfffffffe [31:1] RESERVED (0x00000000) RESERVED // 0x00000001 [0] RST_BITS_COUNTER (0) Writing any value to this address will reset the bits... io_rw_32 rst_bits_counter; _REG_(TRNG_RNG_VERSION_OFFSET) // TRNG_RNG_VERSION // Displays the version settings of the TRNG // 0xffffff00 [31:8] RESERVED (0x000000) RESERVED // 0x00000080 [7] RNG_USE_5_SBOXES (0) * 1'b1 - 5 SBOX AES // 0x00000040 [6] RESEEDING_EXISTS (0) * 1'b1 - Exists // 0x00000020 [5] KAT_EXISTS (0) * 1'b1 - Exists // 0x00000010 [4] PRNG_EXISTS (0) * 1'b1 - Exists // 0x00000008 [3] TRNG_TESTS_BYPASS_EN (0) * 1'b1 - Exists // 0x00000004 [2] AUTOCORR_EXISTS (0) * 1'b1 - Exists // 0x00000002 [1] CRNGT_EXISTS (0) * 1'b1 - Exists // 0x00000001 [0] EHR_WIDTH_192 (0) * 1'b1 - 192-bit EHR io_ro_32 rng_version; uint32_t _pad2[7]; // (Description copied from array index 0 register TRNG_RNG_BIST_CNTR_0 applies similarly to other array indexes) _REG_(TRNG_RNG_BIST_CNTR_0_OFFSET) // TRNG_RNG_BIST_CNTR_0 // Collected BIST results // 0xffc00000 [31:22] RESERVED (0x000) RESERVED // 0x003fffff [21:0] ROSC_CNTR_VAL (0x000000) Reflects the results of RNG BIST counter io_ro_32 rng_bist_cntr[3]; ...} trng_hw_t; #define trng_hw ((trng_hw_t *)(TRNG_BASE + TRNG_RNG_IMR_OFFSET)) static_assert(sizeof (trng_hw_t) == 0x00ec, ""); /* ... */ #endif // _HARDWARE_STRUCTS_TRNG_H
Details