Use hwrand for the sdk uses of rand, in particular with the NMI.
The fiq NMI calls rand() from lmac:lmac.a:sdk_lmacTxFrame and the NMI must not touch the newlib reent structure or enter critical regions etc, so just use the simple and safe hwrand implementation as a substitute.
This commit is contained in:
parent
e17b1a5db6
commit
6a0da03809
2 changed files with 8 additions and 2 deletions
|
@ -10,8 +10,13 @@
|
||||||
#include <esp/wdev_regs.h>
|
#include <esp/wdev_regs.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* Return a random 32-bit number */
|
/* Return a random 32-bit number.
|
||||||
uint32_t hwrand(void)
|
*
|
||||||
|
* This is also used as a substitute for rand() called from
|
||||||
|
* lmac.a:sdk_lmacTxFrame to avoid touching the newlib reent structures within
|
||||||
|
* the NMI and the NMI code needs to be in IRAM.
|
||||||
|
*/
|
||||||
|
uint32_t IRAM hwrand(void)
|
||||||
{
|
{
|
||||||
return WDEV.HWRNG;
|
return WDEV.HWRNG;
|
||||||
}
|
}
|
||||||
|
|
|
@ -419,6 +419,7 @@ ram_set_txbb_atten sdk_ram_set_txbb_atten
|
||||||
ram_start_noisefloor sdk_ram_start_noisefloor
|
ram_start_noisefloor sdk_ram_start_noisefloor
|
||||||
ram_tx_mac_disable sdk_ram_tx_mac_disable
|
ram_tx_mac_disable sdk_ram_tx_mac_disable
|
||||||
ram_tx_mac_enable sdk_ram_tx_mac_enable
|
ram_tx_mac_enable sdk_ram_tx_mac_enable
|
||||||
|
rand hwrand
|
||||||
rc4_skip sdk_rc4_skip
|
rc4_skip sdk_rc4_skip
|
||||||
rcAttach sdk_rcAttach
|
rcAttach sdk_rcAttach
|
||||||
rc_cal sdk_rc_cal
|
rc_cal sdk_rc_cal
|
||||||
|
|
Loading…
Reference in a new issue