samples: drivers: remove entropy sample
This sample doesn't do anything interesting and we have tests/drivers/entropy to can show how to call the API. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
262c7deca6
commit
b6781264d7
5 changed files with 0 additions and 112 deletions
|
@ -1,8 +0,0 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cmake_minimum_required(VERSION 3.13.1)
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(entropy)
|
||||
|
||||
FILE(GLOB app_sources src/*.c)
|
||||
target_sources(app PRIVATE ${app_sources})
|
|
@ -1,33 +0,0 @@
|
|||
.. _entropy_sample:
|
||||
|
||||
Entropy
|
||||
#######
|
||||
|
||||
Overview
|
||||
********
|
||||
Sample for the entropy gathering driver
|
||||
|
||||
Building and Running
|
||||
********************
|
||||
|
||||
This project writes an infinite series of random numbers to the
|
||||
console, 9 per second.
|
||||
|
||||
It can be built and executed on frdm_k64f as follows:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/drivers/entropy
|
||||
:host-os: unix
|
||||
:board: frdm_k64f
|
||||
:goals: run
|
||||
:compact:
|
||||
|
||||
Sample Output
|
||||
=============
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
Entropy Example! arm
|
||||
entropy device is 0x2000008c, name is ENTROPY_0
|
||||
0xd7 0x42 0xb0 0x7b 0x56 0x3b 0xc3 0x43 0x8a 0xa3
|
||||
0xfa 0xec 0xd8 0xc3 0x36 0xf8 0x7b 0x82 0x2b 0x39
|
|
@ -1,2 +0,0 @@
|
|||
CONFIG_ENTROPY_GENERATOR=y
|
||||
CONFIG_STDOUT_CONSOLE=y
|
|
@ -1,14 +0,0 @@
|
|||
sample:
|
||||
name: Sample for the entropy gathering driver
|
||||
tests:
|
||||
sample.drivers.entropy:
|
||||
tags: crypto entropy
|
||||
filter: CONFIG_ENTROPY_HAS_DRIVER
|
||||
harness: console
|
||||
harness_config:
|
||||
type: multi_line
|
||||
ordered: true
|
||||
regex:
|
||||
- "Entropy Example! (.*)"
|
||||
- "entropy device is (.*), name is (.*)"
|
||||
- "(\\s*0x([0-9a-f]){2}){9}"
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016 ARM Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <drivers/entropy.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void main(void)
|
||||
{
|
||||
const struct device *dev;
|
||||
|
||||
printf("Entropy Example! %s\n", CONFIG_ARCH);
|
||||
|
||||
dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy));
|
||||
if (!device_is_ready(dev)) {
|
||||
printf("error: no entropy device\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("entropy device is %p, name is %s\n",
|
||||
dev, dev->name);
|
||||
|
||||
while (1) {
|
||||
#define BUFFER_LENGTH 10
|
||||
uint8_t buffer[BUFFER_LENGTH] = {0};
|
||||
int r;
|
||||
|
||||
/* The BUFFER_LENGTH-1 is used so the driver will not
|
||||
* write the last byte of the buffer. If that last
|
||||
* byte is not 0 on return it means the driver wrote
|
||||
* outside the passed buffer, and that should never
|
||||
* happen.
|
||||
*/
|
||||
r = entropy_get_entropy(dev, buffer, BUFFER_LENGTH-1);
|
||||
if (r) {
|
||||
printf("entropy_get_entropy failed: %d\n", r);
|
||||
break;
|
||||
}
|
||||
|
||||
if (buffer[BUFFER_LENGTH-1] != 0U) {
|
||||
printf("entropy_get_entropy buffer overflow\n");
|
||||
}
|
||||
|
||||
for (int i = 0; i < BUFFER_LENGTH-1; i++) {
|
||||
printf(" 0x%02x", buffer[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
k_sleep(K_MSEC(1000));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue