TRNGCC26XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2019, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
55 #ifndef ti_drivers_TRNG_TRNGCC26XX__include
56 #define ti_drivers_TRNG_TRNGCC26XX__include
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 #include <stdint.h>
63 #include <stdbool.h>
64 
65 #include <ti/drivers/Power.h>
66 #include <ti/drivers/TRNG.h>
68 
69 #include <ti/drivers/dpl/HwiP.h>
70 #include <ti/drivers/dpl/SwiP.h>
71 #include <ti/drivers/dpl/SemaphoreP.h>
72 
74 #define TRNGCC26XX_SAMPLES_PER_CYCLE_MIN 256
75 
78 #define TRNGCC26XX_SAMPLES_PER_CYCLE_DEFAULT 240000
79 
80 #define TRNGCC26XX_SAMPLES_PER_CYCLE_MAX 16777216
81 
88 #define TRNGCC26XX_MIN_BYTES_PER_ITERATION 8
89 
96 typedef struct TRNGCC26XX_HWAttrs {
109  uint8_t intPriority;
115  uint32_t swiPriority;
121  uint32_t samplesPerCycle;
123 
129 typedef struct TRNGCC26XX_Object {
130  bool isOpen;
132  int_fast16_t returnStatus;
136  uint8_t *entropyBuffer;
138  uint32_t samplesPerCycle;
141 
155 extern int_fast16_t TRNGCC26XX_setSamplesPerCycle(TRNG_Handle handle, uint32_t samplesPerCycle);
156 
157 /*
158  * This function exists for internal use only. It is not a
159  * top-level function for now.
160  *
161  * Use it like this:
162  *
163  * TRNGCC26XX_Object object = {0};
164  * const TRNGCC26XX_HWAttrs hwAttrs = {
165  * .intPriority = 0xFF
166  * };
167  *
168  * TRNG_Config config = {
169  * .object = &object,
170  * .hwAttrs = &hwAttrs
171  * };
172  *
173  * TRNG_Handle handle = TRNG_construct(&config, ...);
174  *
175  */
176 extern TRNG_Handle TRNGCC26XX_construct(TRNG_Config *config, const TRNG_Params *params);
177 
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 #endif /* ti_drivers_TRNG_TRNGCC26XX__include */
bool isOpen
Definition: TRNGCC26XX.h:130
uint8_t * entropyBuffer
Definition: TRNGCC26XX.h:136
The CryptoKey type is an opaque representation of a cryptographic key.
size_t entropyRequested
Definition: TRNGCC26XX.h:134
TRNGCC26XX Hardware Attributes.
Definition: TRNGCC26XX.h:96
TRNG Parameters.
Definition: TRNG.h:347
Power Manager.
TRNG Global configuration.
Definition: TRNG.h:316
CryptoKey datastructure.
Definition: CryptoKey.h:210
struct TRNGCC26XX_Object TRNGCC26XX_Object
TRNGCC26XX Object.
uint32_t semaphoreTimeout
Definition: TRNGCC26XX.h:135
TRNGCC26XX Object.
Definition: TRNGCC26XX.h:129
TRNG_ReturnBehavior
The way in which TRNG function calls return after generating the requested entropy.
Definition: TRNG.h:288
uint32_t samplesPerCycle
Definition: TRNGCC26XX.h:138
int_fast16_t TRNGCC26XX_setSamplesPerCycle(TRNG_Handle handle, uint32_t samplesPerCycle)
Sets the number of entropy generation cycles before the results are returned.
uint32_t samplesPerCycle
TRNG Maximum Samples per Cycle. Changes the maximum number of randomness samples in each entropy gene...
Definition: TRNGCC26XX.h:121
TRNG_ReturnBehavior returnBehavior
Definition: TRNGCC26XX.h:131
TRNG driver header.
size_t entropyGenerated
Definition: TRNGCC26XX.h:133
TRNG_CallbackFxn callbackFxn
Definition: TRNGCC26XX.h:139
void(* TRNG_CallbackFxn)(TRNG_Handle handle, int_fast16_t returnValue, CryptoKey *entropy)
The definition of a callback function used by the TRNG driver when used in TRNG_RETURN_BEHAVIOR_CALLB...
Definition: TRNG.h:335
uint32_t swiPriority
TRNG SWI priority. The higher the number, the higher the priority. The minimum is 0 and the maximum i...
Definition: TRNGCC26XX.h:115
uint8_t intPriority
Crypto Peripheral&#39;s interrupt priority.
Definition: TRNGCC26XX.h:109
TRNG_Handle TRNGCC26XX_construct(TRNG_Config *config, const TRNG_Params *params)
struct TRNGCC26XX_HWAttrs TRNGCC26XX_HWAttrs
TRNGCC26XX Hardware Attributes.
CryptoKey * entropyKey
Definition: TRNGCC26XX.h:137
int_fast16_t returnStatus
Definition: TRNGCC26XX.h:132
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale