Skip to content

Commit

Permalink
random: mcux: rename random_mcux to random_mcux_rnga
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bogdan-davidoaia authored and galak committed Mar 2, 2017
1 parent 419fc7d commit 50cb5a6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion arch/arm/soc/nxp_kinetis/k6x/Kconfig.defconfig.mk64f12
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ endif # NET_L2_ETHERNET

if RANDOM_GENERATOR

config RANDOM_MCUX
config RANDOM_MCUX_RNGA
def_bool y

endif # RANDOM_GENERATOR
Expand Down
4 changes: 2 additions & 2 deletions drivers/random/Kconfig.mcux
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#
# SPDX-License-Identifier: Apache-2.0

menuconfig RANDOM_MCUX
bool "MCUX Random driver"
menuconfig RANDOM_MCUX_RNGA
bool "MCUX RNGA driver"
depends on RANDOM_GENERATOR && HAS_RNGA
default n
select RANDOM_HAS_DRIVER
Expand Down
2 changes: 1 addition & 1 deletion drivers/random/Makefile
Original file line number Diff line number Diff line change
@@ -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_X86_TSC_RANDOM_GENERATOR) += rand32_timestamp.o
26 changes: 13 additions & 13 deletions drivers/random/random_mcux.c → drivers/random/random_mcux_rnga.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "fsl_rnga.h"

static uint8_t random_mcux_get_uint8(void)
static uint8_t random_mcux_rnga_get_uint8(void)
{
uint32_t random;
uint8_t output = 0;
Expand All @@ -36,32 +36,32 @@ static uint8_t random_mcux_get_uint8(void)
return output;
}

static int random_mcux_get_entropy(struct device *dev, uint8_t *buffer,
uint16_t length)
static int random_mcux_rnga_get_entropy(struct device *dev, uint8_t *buffer,
uint16_t length)
{
int i;

ARG_UNUSED(dev);

for (i = 0; i < length; i++) {
buffer[i] = random_mcux_get_uint8();
buffer[i] = random_mcux_rnga_get_uint8();
}

return 0;
}

static const struct random_driver_api random_mcux_api_funcs = {
.get_entropy = random_mcux_get_entropy
static const struct random_driver_api random_mcux_rnga_api_funcs = {
.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,
random_mcux_init, NULL, NULL,
DEVICE_AND_API_INIT(random_mcux_rnga, CONFIG_RANDOM_NAME,
random_mcux_rnga_init, NULL, NULL,
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();

Expand All @@ -85,8 +85,8 @@ uint32_t sys_rand32_get(void)
uint32_t output;
int r;

r = random_mcux_get_entropy(DEVICE_GET(random_mcux),
(uint8_t *) &output, sizeof(output));
r = random_mcux_rnga_get_entropy(DEVICE_GET(random_mcux_rnga),
(uint8_t *) &output, sizeof(output));
__ASSERT_NO_MSG(!r);

return output;
Expand Down
2 changes: 1 addition & 1 deletion ext/hal/nxp/mcux/drivers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

obj-$(CONFIG_ETH_MCUX) += fsl_enet.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_SPI_MCUX) += fsl_dspi.o
obj-$(CONFIG_UART_MCUX) += fsl_uart.o
Expand Down

0 comments on commit 50cb5a6

Please sign in to comment.