Software APIs
ibex.h
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 #ifndef OPENTITAN_SW_DEVICE_LIB_BASE_IBEX_H_
5 #define OPENTITAN_SW_DEVICE_LIB_BASE_IBEX_H_
6 
7 #include <stdbool.h>
8 #include <stddef.h>
9 #include <stdint.h>
10 
11 #include "sw/device/lib/base/status.h"
12 
13 /**
14  * Wait for random data in the RND_DATA CSR to be valid.
15  *
16  * Important: this function will hang if the entropy complex is not
17  * initialized. Callers are responsible for checking first.
18  *
19  * Returns once the random data is valid.
20  */
21 void ibex_wait_rnd_valid(void);
22 
23 /**
24  * Get random data from the EDN0 interface.
25  *
26  * Important: this function will hang if the entropy complex is not
27  * initialized. Callers are responsible for checking first.
28  *
29  * @return 32 bits of randomness from EDN0.
30  */
31 uint32_t ibex_rnd_data_read(void);
32 
33 /**
34  * Get information on the state of the RND_DATA CSR.
35  *
36  * @return the status of the randomness interface.
37  */
38 uint32_t ibex_rnd_status_read(void);
39 
40 #endif // OPENTITAN_SW_DEVICE_LIB_BASE_IBEX_H_