PebbleOS v4.47.0-1312-gf1984a001
Loading...
Searching...
No Matches
Nordic nRF5 RNG

Random number generator of the nRF52, which fills a cache of bytes from its interrupt. More...

Data Structures

struct  pbl_rng_nrf5_state
 RNG runtime state. More...
 
struct  pbl_rng_nrf5
 RNG. More...
 

Macros

#define PBL_RNG_NRF5_DEFINE(sym, _name, _base, _irq)
 Define the RNG, connecting its interrupt with priority CONFIG_RNG_NRF5_IRQ_PRIO.
 

Functions

void pbl_rng_nrf5_irq_handler (const struct pbl_rng_nrf5 *nrf5)
 RNG interrupt handler, connected by PBL_RNG_NRF5_DEFINE().
 

Detailed Description

Random number generator of the nRF52, which fills a cache of bytes from its interrupt.


Data Structure Documentation

◆ pbl_rng_nrf5_state

struct pbl_rng_nrf5_state

RNG runtime state.

Data Fields
uint8_t cache[PBL_RNG_NRF5_CACHE_SIZE] Bytes generated, not yet read.
volatile uint8_t count Bytes in the cache.
uint8_t in Where the next generated byte goes.
uint8_t out Where the next byte is read from.

◆ pbl_rng_nrf5

struct pbl_rng_nrf5

RNG.

Data Fields
uintptr_t base Registers.
uint32_t irq Interrupt line.
struct pbl_rng rng Random number generator.
struct pbl_rng_nrf5_state * state Runtime state.

Macro Definition Documentation

◆ PBL_RNG_NRF5_DEFINE

#define PBL_RNG_NRF5_DEFINE (   sym,
  _name,
  _base,
  _irq 
)
Value:
static struct pbl_rng_nrf5_state sym##_nrf5_state; \
PBL_DEVICE_INSTANCE(sym, struct pbl_rng_nrf5, struct pbl_rng, rng){ \
.rng = PBL_RNG_INIT(sym, _name, nullptr, &pbl_rng_nrf5_ops), \
.state = &sym##_nrf5_state, \
.base = (_base), \
.irq = (_irq), \
}; \
PBL_IRQ_CONNECT_NUM(_irq, CONFIG_RNG_NRF5_IRQ_PRIO, pbl_rng_nrf5_irq_handler, &sym##_inst, 0)
RNG.
Definition nrf5.h:35
RNG runtime state.
Definition nrf5.h:23
void pbl_rng_nrf5_irq_handler(const struct pbl_rng_nrf5 *nrf5)
RNG interrupt handler, connected by PBL_RNG_NRF5_DEFINE().
Random number generator.
Definition rng.h:40
#define PBL_RNG_INIT(sym, _name, _parent, _ops)
Initialize a struct pbl_rng.
Definition rng.h:70
#define PBL_RNG_STATE_DEFINE(sym)
Define the class state of a random number generator.
Definition rng.h:60

Define the RNG, connecting its interrupt with priority CONFIG_RNG_NRF5_IRQ_PRIO.

Parameters
symSymbol of the device.
_nameName.
_baseRegisters.
_irqInterrupt line, a plain number.

Function Documentation

◆ pbl_rng_nrf5_irq_handler()

void pbl_rng_nrf5_irq_handler ( const struct pbl_rng_nrf5 *  nrf5)

RNG interrupt handler, connected by PBL_RNG_NRF5_DEFINE().

Parameters
nrf5RNG.