Skip to content

Commit f1b52a6

Browse files
moved constants to stm32u545
1 parent 4ef2194 commit f1b52a6

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;
@@ -152,8 +153,8 @@ unsafe fn start() -> (
152153
);
153154
usart1.register();
154155
let trng = static_init!(
155-
stm32u545::Trng<'static>,
156-
stm32u545::Trng::new(stm32u545::entropy::RNG_BASE)
156+
stm32u545::entropy::Trng<'static>,
157+
stm32u545::entropy::Trng::new(RNG_BASE)
157158
);
158159

159160
// 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)