Skip to content

Commit 1abcaad

Browse files
moved constants to stm32u545
1 parent fcd9580 commit 1abcaad

4 files changed

Lines changed: 16 additions & 13 deletions

File tree

boards/nucleo_u545re_q/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use kernel::platform::{KernelResources, SyscallDriverLookup};
1515
use kernel::utilities::single_thread_value::SingleThreadValue;
1616
use kernel::{create_capability, static_init};
1717

18+
use stm32u545::entropy::RNG_BASE;
1819
use stm32u545::gpio::PinId;
1920

2021
pub mod io;
@@ -165,8 +166,8 @@ unsafe fn start() -> (
165166
);
166167
usart1.register();
167168
let trng = static_init!(
168-
stm32u545::Trng<'static>,
169-
stm32u545::Trng::new(stm32u545::entropy::RNG_BASE)
169+
stm32u545::entropy::Trng<'static>,
170+
stm32u545::entropy::Trng::new(RNG_BASE)
170171
);
171172

172173
// Load Peripherals Bundle

chips/stm32u545/src/entropy.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// specified in the documentation (NIST compliant RNG configuration table in AN4230 available from www.st.com.)
2+
// that values for the CR, HTCR and NSCR should be 0x00F11F00, 0x76B3 and 0x24C2 respectivly. CR config
3+
// is that value, 0x00F11F00, plus the CONDRST bit
4+
pub const RNG_CR_CONFIG_U545: u32 = 0x40F11F00;
5+
pub const RNG_HTCR_CONFIG_U545: u32 = 0x76B3;
6+
pub const RNG_NSCR_CONFIG_U545: u32 = 0x24C2;
7+
8+
pub type Trng<'a> =
9+
stm32u5xx::entropy::Trng<'a, RNG_CR_CONFIG_U545, RNG_HTCR_CONFIG_U545, RNG_NSCR_CONFIG_U545>;
10+
11+
pub use stm32u5xx::entropy::RNG_BASE;

chips/stm32u545/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44

55
#![no_std]
66

7-
use stm32u5xx::entropy::{RNG_CR_CONFIG_U545, RNG_HTCR_CONFIG_U545, RNG_NSCR_CONFIG_U545};
8-
pub use stm32u5xx::{chip, dma, entropy, exti, gpio, rcc, tim, usart};
7+
pub use stm32u5xx::{chip, dma, exti, gpio, rcc, tim, usart};
98

109
use cortexm33::{CortexM33, CortexMVariant};
1110

12-
pub type Trng<'a> =
13-
stm32u5xx::entropy::Trng<'a, RNG_CR_CONFIG_U545, RNG_HTCR_CONFIG_U545, RNG_NSCR_CONFIG_U545>;
11+
pub mod entropy;
1412

1513
#[cfg_attr(all(target_arch = "arm", target_os = "none"), used)]
1614
#[cfg_attr(all(target_arch = "arm", target_os = "none"), link_section = ".irqs")]

chips/stm32u5xx/src/entropy.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ use kernel::utilities::registers::interfaces::{ReadWriteable, Readable, Writeabl
1111
use kernel::utilities::registers::{register_bitfields, register_structs, ReadOnly, ReadWrite};
1212
use kernel::utilities::StaticRef;
1313

14-
// specified in the documentation (NIST compliant RNG configuration table in AN4230 available from www.st.com.)
15-
// that values for the CR, HTCR and NSCR should be 0x00F11F00, 0x76B3 and 0x24C2 respectivly. CR config
16-
// is that value, 0x00F11F00, plus the CONDRST bit
17-
pub const RNG_CR_CONFIG_U545: u32 = 0x40F11F00;
18-
pub const RNG_HTCR_CONFIG_U545: u32 = 0x76B3;
19-
pub const RNG_NSCR_CONFIG_U545: u32 = 0x24C2;
20-
2114
register_structs! {
2215
/// Random number generator
2316
pub RngRegisters {

0 commit comments

Comments
 (0)