feat(esp8266): add esp_random function

This commit is contained in:
Zhang Jun Hao
2020-05-26 10:27:42 +08:00
parent bec5ca6fe6
commit 7192a85b2d
2 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -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)
{