ChibiOS/HAL  7.0.3
hal_trng_lld.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 /**
18  * @file hal_trng_lld.h
19  * @brief PLATFORM TRNG subsystem low level driver header.
20  *
21  * @addtogroup TRNG
22  * @{
23  */
24 
25 #ifndef HAL_TRNG_LLD_H
26 #define HAL_TRNG_LLD_H
27 
28 #if (HAL_USE_TRNG == TRUE) || defined(__DOXYGEN__)
29 
30 /*===========================================================================*/
31 /* Driver constants. */
32 /*===========================================================================*/
33 
34 /*===========================================================================*/
35 /* Driver pre-compile time settings. */
36 /*===========================================================================*/
37 
38 /**
39  * @name PLATFORM configuration options
40  * @{
41  */
42 /**
43  * @brief TRNGD1 driver enable switch.
44  * @details If set to @p TRUE the support for TRNGD1 is included.
45  * @note The default is @p FALSE.
46  */
47 #if !defined(PLATFORM_TRNG_USE_TRNG1) || defined(__DOXYGEN__)
48 #define PLATFORM_TRNG_USE_TRNG1 FALSE
49 #endif
50 /** @} */
51 
52 /*===========================================================================*/
53 /* Derived constants and error checks. */
54 /*===========================================================================*/
55 
56 /*===========================================================================*/
57 /* Driver data structures and types. */
58 /*===========================================================================*/
59 
60 /*===========================================================================*/
61 /* Driver macros. */
62 /*===========================================================================*/
63 
64 /**
65  * @brief Low level fields of the TRNG driver structure.
66  */
67 #define trng_lld_driver_fields \
68  /* Dummy field, it is not needed.*/ \
69  uint32_t dummy
70 
71 /**
72  * @brief Low level fields of the TRNG configuration structure.
73  */
74 #define trng_lld_config_fields \
75  /* Dummy configuration, it is not needed.*/ \
76  uint32_t dummy
77 
78 /*===========================================================================*/
79 /* External declarations. */
80 /*===========================================================================*/
81 
82 #if (PLATFORM_TRNG_USE_TRNG1 == TRUE) && !defined(__DOXYGEN__)
83 extern TRNGDriver TRNGD1;
84 #endif
85 
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89  void trng_lld_init(void);
90  void trng_lld_start(TRNGDriver *trngp);
91  void trng_lld_stop(TRNGDriver *trngp);
92  bool trng_lld_generate(TRNGDriver *trngp, size_t size, uint8_t *out);
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif /* HAL_USE_TRNG == TRUE */
98 
99 #endif /* HAL_TRNG_LLD_H */
100 
101 /** @} */
void trng_lld_init(void)
Low level TRNG driver initialization.
Definition: hal_trng_lld.c:65
void trng_lld_stop(TRNGDriver *trngp)
Deactivates the TRNG peripheral.
Definition: hal_trng_lld.c:101
void trng_lld_start(TRNGDriver *trngp)
Configures and activates the TRNG peripheral.
Definition: hal_trng_lld.c:80
bool trng_lld_generate(TRNGDriver *trngp, size_t size, uint8_t *out)
True random numbers generator.
Definition: hal_trng_lld.c:129
TRNGDriver TRNGD1
TRNGD1 driver identifier.
Definition: hal_trng_lld.c:41
USBOutEndpointState out
OUT EP0 state.
Definition: hal_usb_lld.c:61
Structure representing a TRNG driver.
Definition: hal_trng.h:83