Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-pico
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-pico
Commits
3068cd0a
Unverified
Commit
3068cd0a
authored
Dec 10, 2023
by
Earle F. Philhower, III
Committed by
GitHub
Dec 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use SW random generator for all LWIP (#1892)
parent
fa390f48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
13 deletions
+4
-13
cores/rp2040/lwip_wrap.cpp
cores/rp2040/lwip_wrap.cpp
+4
-13
No files found.
cores/rp2040/lwip_wrap.cpp
View file @
3068cd0a
...
@@ -70,26 +70,17 @@ public:
...
@@ -70,26 +70,17 @@ public:
extern
"C"
{
extern
"C"
{
static
XoshiroCpp
::
Xoshiro256PlusPlus
*
_lwip_rng
=
nullptr
;
static
XoshiroCpp
::
Xoshiro256PlusPlus
*
_lwip_rng
=
nullptr
;
// Random number generator for LWIP
. Bare metal, use the HW. FreeRTOS, use xoshiro generator to avoid needing to freeze the other core
// Random number generator for LWIP
unsigned
long
__lwip_rand
()
{
unsigned
long
__lwip_rand
()
{
if
(
__isFreeRTOS
)
{
return
(
unsigned
long
)(
*
_lwip_rng
)();
return
(
unsigned
long
)(
*
_lwip_rng
)();
}
else
{
return
get_rand_32
();
}
}
}
// Avoid calling lwip_init multiple times
// Avoid calling lwip_init multiple times
extern
void
__real_lwip_init
();
extern
void
__real_lwip_init
();
void
__wrap_lwip_init
()
{
void
__wrap_lwip_init
()
{
static
bool
initted
=
false
;
if
(
!
_lwip_rng
)
{
if
(
!
initted
)
{
_lwip_rng
=
new
XoshiroCpp
::
Xoshiro256PlusPlus
(
get_rand_64
());
if
(
__isFreeRTOS
)
{
_lwip_rng
=
new
XoshiroCpp
::
Xoshiro256PlusPlus
(
rp2040
.
getCycleCount
());
}
__real_lwip_init
();
__real_lwip_init
();
initted
=
true
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment