mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 07:00:05 +08:00
feat(esp8266): add esp_random function
This commit is contained in:
@ -188,6 +188,8 @@
|
||||
#define PAD_XPD_DCDC_CONF (REG_RTC_BASE + 0x0A0)
|
||||
//}}
|
||||
|
||||
#define WDEV_RAND (WDEV_COUNT_REG + 0x244)
|
||||
|
||||
//CACHE{{
|
||||
#define CACHE_FLASH_CTRL_REG (0x3ff00000 + 0x0c)
|
||||
#define CACHE_READ_EN_BIT BIT8
|
||||
|
@ -18,6 +18,13 @@
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include "esp_system.h"
|
||||
#include "esp8266/eagle_soc.h"
|
||||
|
||||
extern unsigned int adc_rand_noise;
|
||||
uint32_t esp_random(void)
|
||||
{
|
||||
return (adc_rand_noise ^ REG_READ(WDEV_RAND));
|
||||
}
|
||||
|
||||
void esp_fill_random(void *buf, size_t len)
|
||||
{
|
||||
|
Reference in New Issue
Block a user