Mistake on this page?
Report an issue in GitHub or email us
trng_api.h
1 
2 /** \addtogroup hal */
3 /** @{*/
4 /* mbed Microcontroller Library
5  * Copyright (c) 2016 ARM Limited
6  * SPDX-License-Identifier: Apache-2.0
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 #ifndef MBED_TRNG_API_H
21 #define MBED_TRNG_API_H
22 
23 #include <stddef.h>
24 #include "device.h"
25 
26 #if DEVICE_TRNG
27 
28 /** TRNG HAL structure. trng_s is declared in the target's HAL
29  */
30 typedef struct trng_s trng_t;
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /**
37  * \defgroup hal_trng TRNG hal functions
38  * @{
39  */
40 
41 /** Initialize the TRNG peripheral
42  *
43  * @param obj The TRNG object
44  */
45 void trng_init(trng_t *obj);
46 
47 /** Deinitialize the TRNG peripheral
48  *
49  * @param obj The TRNG object
50  */
51 void trng_free(trng_t *obj);
52 
53 /** Get random data from TRNG peripheral
54  *
55  * @param obj The TRNG object
56  * @param output The pointer to an output array
57  * @param length The size of output data, to avoid buffer overwrite
58  * @param output_length The length of generated data
59  * @return 0 success, -1 fail
60  */
61 int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_length);
62 
63 /**@}*/
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #endif
70 
71 #endif
72 
73 /** @}*/
struct trng_s trng_t
TRNG HAL structure.
Definition: trng_api.h:30
void trng_init(trng_t *obj)
Initialize the TRNG peripheral.
void trng_free(trng_t *obj)
Deinitialize the TRNG peripheral.
int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_length)
Get random data from TRNG peripheral.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.