Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Entropy Interface

Entropy Interface. More...

Data Structures

struct  entropy_driver_api
 Entropy driver API structure. More...
 

Macros

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

Typedefs

typedef int(* entropy_get_entropy_t) (const struct device *dev, uint8_t *buffer, uint16_t length)
 Callback API to get entropy.
 
typedef int(* entropy_get_entropy_isr_t) (const struct device *dev, uint8_t *buffer, uint16_t length, uint32_t flags)
 Callback API to get entropy from an ISR.
 

Functions

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

Entropy Interface.

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.

Typedef Documentation

◆ entropy_get_entropy_isr_t

entropy_get_entropy_isr_t

#include <zephyr/drivers/entropy.h>

Callback API to get entropy from an ISR.

See entropy_get_entropy_isr() for argument description

◆ entropy_get_entropy_t

entropy_get_entropy_t

#include <zephyr/drivers/entropy.h>

Callback API to get entropy.

Note
This call has to be thread safe to satisfy requirements of the random subsystem.

See entropy_get_entropy() for argument description

Function Documentation

◆ 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()

static 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.
Return values
numberof bytes filled with entropy or -error.