Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Interfaces for entropy hardware. More...

Topics

 Entropy Driver Backend API

Files

file  entropy.h
 Main header file for entropy driver API.

Macros

#define ENTROPY_BUSYWAIT   BIT(0)
 Driver is allowed to busy-wait for random data to be ready.

Functions

static const struct deviceentropy_get_default_device (void)
 Return the default entropy device if available.
int entropy_get_entropy (const struct device *dev, uint8_t *buffer, uint16_t length)
 Fills a buffer with entropy.
static int entropy_get_entropy_isr (const struct device *dev, uint8_t *buffer, uint16_t length, uint32_t flags)
 Fills a buffer with entropy in a non-blocking or busy-wait manner.

Detailed Description

Interfaces for entropy hardware.

Since
1.10
Version
1.0.0

Macro Definition Documentation

◆ ENTROPY_BUSYWAIT

#define ENTROPY_BUSYWAIT   BIT(0)

#include <zephyr/drivers/entropy.h>

Driver is allowed to busy-wait for random data to be ready.

Function Documentation

◆ entropy_get_default_device()

const struct device * entropy_get_default_device ( void )
inlinestatic

#include <zephyr/drivers/entropy.h>

Return the default entropy device if available.

Returns in the following order:

  • The device chosen as "zephyr,entropy", if available.
  • The architectural entropy device, if enabled.
  • NULL.
Return values
Pointerto default entropy device.
NULLif not available.

◆ entropy_get_entropy()

int entropy_get_entropy ( const struct device * dev,
uint8_t * buffer,
uint16_t length )

#include <zephyr/drivers/entropy.h>

Fills a buffer with entropy.

Blocks if required in order to generate the necessary random data.

Parameters
devPointer to the entropy device.
bufferBuffer to fill with entropy.
lengthBuffer length.
Return values
0on success.
-ERRNOerrno code on error.

◆ entropy_get_entropy_isr()

int entropy_get_entropy_isr ( const struct device * dev,
uint8_t * buffer,
uint16_t length,
uint32_t flags )
inlinestatic

#include <zephyr/drivers/entropy.h>

Fills a buffer with entropy in a non-blocking or busy-wait manner.

Callable from ISRs.

Parameters
devPointer to the device structure.
bufferBuffer to fill with entropy.
lengthBuffer length.
flagsFlags to modify the behavior of the call.
Returns
number of bytes filled with entropy or -error.
Return values
-ENOSYSDriver does not implement the function