random: mcux: rename random_mcux to random_mcux_rnga
MCUX contains more than one type of random number generator, so refrect this in config and file names. Change-Id: Iba4482a1ae41f35d471686f8b159c113147c4df8 Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
This commit is contained in:
parent
419fc7d473
commit
50cb5a6bd3
5 changed files with 18 additions and 18 deletions
|
@ -62,7 +62,7 @@ endif # NET_L2_ETHERNET
|
||||||
|
|
||||||
if RANDOM_GENERATOR
|
if RANDOM_GENERATOR
|
||||||
|
|
||||||
config RANDOM_MCUX
|
config RANDOM_MCUX_RNGA
|
||||||
def_bool y
|
def_bool y
|
||||||
|
|
||||||
endif # RANDOM_GENERATOR
|
endif # RANDOM_GENERATOR
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
menuconfig RANDOM_MCUX
|
menuconfig RANDOM_MCUX_RNGA
|
||||||
bool "MCUX Random driver"
|
bool "MCUX RNGA driver"
|
||||||
depends on RANDOM_GENERATOR && HAS_RNGA
|
depends on RANDOM_GENERATOR && HAS_RNGA
|
||||||
default n
|
default n
|
||||||
select RANDOM_HAS_DRIVER
|
select RANDOM_HAS_DRIVER
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
obj-$(CONFIG_RANDOM_MCUX) += random_mcux.o
|
obj-$(CONFIG_RANDOM_MCUX_RNGA) += random_mcux_rnga.o
|
||||||
obj-$(CONFIG_TIMER_RANDOM_GENERATOR) = rand32_timer.o
|
obj-$(CONFIG_TIMER_RANDOM_GENERATOR) = rand32_timer.o
|
||||||
obj-$(CONFIG_X86_TSC_RANDOM_GENERATOR) += rand32_timestamp.o
|
obj-$(CONFIG_X86_TSC_RANDOM_GENERATOR) += rand32_timestamp.o
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "fsl_rnga.h"
|
#include "fsl_rnga.h"
|
||||||
|
|
||||||
static uint8_t random_mcux_get_uint8(void)
|
static uint8_t random_mcux_rnga_get_uint8(void)
|
||||||
{
|
{
|
||||||
uint32_t random;
|
uint32_t random;
|
||||||
uint8_t output = 0;
|
uint8_t output = 0;
|
||||||
|
@ -36,32 +36,32 @@ static uint8_t random_mcux_get_uint8(void)
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int random_mcux_get_entropy(struct device *dev, uint8_t *buffer,
|
static int random_mcux_rnga_get_entropy(struct device *dev, uint8_t *buffer,
|
||||||
uint16_t length)
|
uint16_t length)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ARG_UNUSED(dev);
|
ARG_UNUSED(dev);
|
||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
buffer[i] = random_mcux_get_uint8();
|
buffer[i] = random_mcux_rnga_get_uint8();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct random_driver_api random_mcux_api_funcs = {
|
static const struct random_driver_api random_mcux_rnga_api_funcs = {
|
||||||
.get_entropy = random_mcux_get_entropy
|
.get_entropy = random_mcux_rnga_get_entropy
|
||||||
};
|
};
|
||||||
|
|
||||||
static int random_mcux_init(struct device *);
|
static int random_mcux_rnga_init(struct device *);
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(random_mcux, CONFIG_RANDOM_NAME,
|
DEVICE_AND_API_INIT(random_mcux_rnga, CONFIG_RANDOM_NAME,
|
||||||
random_mcux_init, NULL, NULL,
|
random_mcux_rnga_init, NULL, NULL,
|
||||||
PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||||
&random_mcux_api_funcs);
|
&random_mcux_rnga_api_funcs);
|
||||||
|
|
||||||
static int random_mcux_init(struct device *dev)
|
static int random_mcux_rnga_init(struct device *dev)
|
||||||
{
|
{
|
||||||
uint32_t seed = k_cycle_get_32();
|
uint32_t seed = k_cycle_get_32();
|
||||||
|
|
||||||
|
@ -85,8 +85,8 @@ uint32_t sys_rand32_get(void)
|
||||||
uint32_t output;
|
uint32_t output;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = random_mcux_get_entropy(DEVICE_GET(random_mcux),
|
r = random_mcux_rnga_get_entropy(DEVICE_GET(random_mcux_rnga),
|
||||||
(uint8_t *) &output, sizeof(output));
|
(uint8_t *) &output, sizeof(output));
|
||||||
__ASSERT_NO_MSG(!r);
|
__ASSERT_NO_MSG(!r);
|
||||||
|
|
||||||
return output;
|
return output;
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
obj-$(CONFIG_ETH_MCUX) += fsl_enet.o
|
obj-$(CONFIG_ETH_MCUX) += fsl_enet.o
|
||||||
obj-$(CONFIG_I2C_MCUX) += fsl_i2c.o
|
obj-$(CONFIG_I2C_MCUX) += fsl_i2c.o
|
||||||
obj-$(CONFIG_RANDOM_MCUX) += fsl_rnga.o
|
obj-$(CONFIG_RANDOM_MCUX_RNGA) += fsl_rnga.o
|
||||||
obj-$(CONFIG_SOC_FLASH_MCUX) += fsl_flash.o
|
obj-$(CONFIG_SOC_FLASH_MCUX) += fsl_flash.o
|
||||||
obj-$(CONFIG_SPI_MCUX) += fsl_dspi.o
|
obj-$(CONFIG_SPI_MCUX) += fsl_dspi.o
|
||||||
obj-$(CONFIG_UART_MCUX) += fsl_uart.o
|
obj-$(CONFIG_UART_MCUX) += fsl_uart.o
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue