TRNG

[English]

TRNG API Status

TRNG API Reference

Header File

Functions

bk_err_t bk_trng_driver_init(void)

Init the TRNG driver.

This API init the resoure common:

  • Init TRNG driver control memory

Attention

1. This API should be called before any other TRNG APIs.

Returns

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_trng_driver_deinit(void)

Deinit the TRNG driver.

This API free all resource related to TRNG and disable TRNG.

Returns

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_trng_start(void)

Start the TRNG.

Returns

  • BK_OK: succeed

  • BK_ERR_TRNG_DRIVER_NOT_INIT: TRNG driver not init

  • others: other errors.

bk_err_t bk_trng_stop(void)

Stop the TRNG.

Returns

  • BK_OK: succeed

  • BK_ERR_TRNG_DRIVER_NOT_INIT: TRNG driver not init

  • others: other errors.

int bk_rand(void)

Get the random number.

Returns

random number between 0 and RAND_MAX

TRNG API Typedefs

Header File

Macros

BK_ERR_TRNG_DRIVER_NOT_INIT

TRNG driver not init

Header File

Type Definitions

typedef uint8_t trng_unit_t

trng uint id