tests: entropy: api: Add nocache buffer option
Add a Kconfig option to put the buffer for random numbers in the nocache region instead of on the stack. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
This commit is contained in:
parent
2f88e509f1
commit
fe1dd118c8
10
tests/drivers/entropy/api/Kconfig
Normal file
10
tests/drivers/entropy/api/Kconfig
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Copyright NXP 2022
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
mainmenu "Entropy API Test"
|
||||
|
||||
source "Kconfig.zephyr"
|
||||
source "tests/drivers/entropy/api/Kconfig.mcux"
|
||||
|
||||
config RANDOM_BUFFER_NOCACHED
|
||||
bool "Put the buffer of randomly generated numbers in nocache region."
|
|
@ -25,6 +25,13 @@
|
|||
#define BUFFER_LENGTH 10
|
||||
#define RECHECK_RANDOM_ENTROPY 0x10
|
||||
|
||||
#ifdef CONFIG_RANDOM_BUFFER_NOCACHED
|
||||
__attribute__((__section__(".nocache")))
|
||||
static uint8_t buffer[BUFFER_LENGTH] = {0};
|
||||
#else
|
||||
static uint8_t buffer[BUFFER_LENGTH] = {0};
|
||||
#endif
|
||||
|
||||
static int random_entropy(const struct device *dev, char *buffer, char num)
|
||||
{
|
||||
int ret, i;
|
||||
|
@ -69,7 +76,6 @@ static int random_entropy(const struct device *dev, char *buffer, char num)
|
|||
static int get_entropy(void)
|
||||
{
|
||||
const struct device *const dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy));
|
||||
uint8_t buffer[BUFFER_LENGTH] = { 0 };
|
||||
int ret;
|
||||
|
||||
if (!device_is_ready(dev)) {
|
||||
|
|
Loading…
Reference in a new issue