TRNGCC26X2.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, 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  */
71 #ifndef ti_drivers_TRNG_TRNGCC26X2__include
72 #define ti_drivers_TRNG_TRNGCC26X2__include
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
78 #include <stdint.h>
79 #include <stdbool.h>
80 
81 #include <ti/drivers/Power.h>
82 #include <ti/drivers/TRNG.h>
84 
85 #include <ti/drivers/dpl/HwiP.h>
86 #include <ti/drivers/dpl/SwiP.h>
87 #include <ti/drivers/dpl/SemaphoreP.h>
88 
90 #define TRNGCC26X2_SAMPLES_PER_CYCLE_MIN 256
91 
93 #define TRNGCC26X2_SAMPLES_PER_CYCLE_DEFAULT 240000
94 
95 #define TRNGCC26X2_SAMPLES_PER_CYCLE_MAX 16777216
96 
103 typedef struct TRNGCC26X2_HWAttrs {
116  uint8_t intPriority;
122  uint32_t swiPriority;
128  uint32_t samplesPerCycle;
130 
136 typedef struct TRNGCC26X2_Object {
137  bool isOpen;
139  int_fast16_t returnStatus;
143  const uint8_t *upperBound;
144  uint8_t *entropyBuffer;
146  uint32_t samplesPerCycle;
148  SwiP_Struct callbackSwi;
150 
164 extern int_fast16_t TRNGCC26X2_setSamplesPerCycle(TRNG_Handle handle, uint32_t samplesPerCycle);
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif /* ti_drivers_TRNG_TRNGCC26X2__include */
const uint8_t * upperBound
Definition: TRNGCC26X2.h:143
bool isOpen
Definition: TRNGCC26X2.h:137
enum TRNG_ReturnBehavior_ TRNG_ReturnBehavior
The way in which TRNG function calls return after generating the requested entropy.
size_t entropyRequested
Definition: TRNGCC26X2.h:141
The CryptoKey type is an opaque representation of a cryptographic key.
TRNG_CallbackFxn callbackFxn
Definition: TRNGCC26X2.h:147
uint32_t swiPriority
TRNG SWI priority. The higher the number, the higher the priority. The minimum is 0 and the maximum i...
Definition: TRNGCC26X2.h:122
Power Manager interface.
CryptoKey datastructure.
Definition: CryptoKey.h:210
size_t entropyGenerated
Definition: TRNGCC26X2.h:140
struct TRNGCC26X2_Object TRNGCC26X2_Object
TRNGCC26XX Object.
int_fast16_t returnStatus
Definition: TRNGCC26X2.h:139
TRNG_ReturnBehavior returnBehavior
Definition: TRNGCC26X2.h:138
struct TRNGCC26X2_HWAttrs TRNGCC26X2_HWAttrs
TRNGCC26X2 Hardware Attributes.
uint8_t intPriority
Crypto Peripheral&#39;s interrupt priority.
Definition: TRNGCC26X2.h:116
uint32_t semaphoreTimeout
Definition: TRNGCC26X2.h:142
TRNGCC26XX Object.
Definition: TRNGCC26X2.h:136
CryptoKey * entropyKey
Definition: TRNGCC26X2.h:145
int_fast16_t TRNGCC26X2_setSamplesPerCycle(TRNG_Handle handle, uint32_t samplesPerCycle)
Sets the number of entropy generation cycles before the results are returned.
TRNG driver header.
TRNG Global configuration.
Definition: TRNG.h:395
uint32_t samplesPerCycle
TRNG Maximum Samples per Cycle. Changes the maximum number of randomness samples in each entropy gene...
Definition: TRNGCC26X2.h:128
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:414
SwiP_Struct callbackSwi
Definition: TRNGCC26X2.h:148
uint32_t samplesPerCycle
Definition: TRNGCC26X2.h:146
TRNGCC26X2 Hardware Attributes.
Definition: TRNGCC26X2.h:103
uint8_t * entropyBuffer
Definition: TRNGCC26X2.h:144
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale