Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
TRNG: keep track of initialization status
  • Loading branch information
pennam committed Dec 2, 2025
commit 6427765f23575adff1226b60aaeea64d286a65c7
10 changes: 8 additions & 2 deletions cores/arduino/WMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ extern "C" {
static long trng()
{
uint32_t value[4];
if (HW_SCE_McuSpecificInit() != FSP_SUCCESS)
return -1;
static bool SCE_inited = false;
if (!SCE_inited) {
if (HW_SCE_McuSpecificInit() != FSP_SUCCESS) {
return -1;
}
SCE_inited = true;
}

HW_SCE_RNG_Read(value);
return (long)value[0] >= 0 ? value[0] : -value[0];
}
Expand Down