MAX32675 Peripheral Driver API
Peripheral Driver API for the MAX32675
trng.h
1 
6 /* ****************************************************************************
7  * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
23  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Except as contained in this notice, the name of Maxim Integrated
28  * Products, Inc. shall not be used except as stated in the Maxim Integrated
29  * Products, Inc. Branding Policy.
30  *
31  * The mere transfer of this software does not imply any licenses
32  * of trade secrets, proprietary technology, copyrights, patents,
33  * trademarks, maskwork rights, or any other form of intellectual
34  * property whatsoever. Maxim Integrated Products, Inc. retains all
35  * ownership rights.
36  *
37  *************************************************************************** */
38 
39 #ifndef _TRNG_H_
40 #define _TRNG_H_
41 
42 /***** Includes *****/
43 #include "trng_regs.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
56 /***** Function Prototypes *****/
57 typedef void (*mxc_trng_complete_t) (void* req, int result);
58 
59 /* ************************************************************************* */
60 /* Global Control/Configuration functions */
61 /* ************************************************************************* */
62 
68 int MXC_TRNG_Init (void);
69 
74 void MXC_TRNG_EnableInt ();
75 
80 void MXC_TRNG_DisableInt ();
81 
87 int MXC_TRNG_Shutdown (void);
88 
93 void MXC_TRNG_Handler (void);
94 
95 /* ************************************************************************* */
96 /* True Random Number Generator (TRNG) functions */
97 /* ************************************************************************* */
98 
104 int MXC_TRNG_RandomInt (void);
105 
114 int MXC_TRNG_Random (uint8_t* data, uint32_t len);
115 
125 void MXC_TRNG_RandomAsync (uint8_t* data, uint32_t len, mxc_trng_complete_t callback);
126 
130 void MXC_TRNG_GenerateKey(void);
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 
137 #endif /* _TRNG_H_ */
MXC_TRNG_DisableInt
void MXC_TRNG_DisableInt()
Disable TRNG Interrupts.
MXC_TRNG_RandomAsync
void MXC_TRNG_RandomAsync(uint8_t *data, uint32_t len, mxc_trng_complete_t callback)
Get a random number of length len, do not block while generating data.
MXC_TRNG_Random
int MXC_TRNG_Random(uint8_t *data, uint32_t len)
Get a random number of length len.
MXC_TRNG_EnableInt
void MXC_TRNG_EnableInt()
Enable TRNG Interrupts.
MXC_TRNG_RandomInt
int MXC_TRNG_RandomInt(void)
Get a random number.
MXC_TRNG_GenerateKey
void MXC_TRNG_GenerateKey(void)
Generate an AES key and transfer to the AES block.
MXC_TRNG_Shutdown
int MXC_TRNG_Shutdown(void)
Disable and reset portions of the TRNG.
MXC_TRNG_Handler
void MXC_TRNG_Handler(void)
This function should be called from the TRNG ISR Handler when using Async functions.
MXC_TRNG_Init
int MXC_TRNG_Init(void)
Enable portions of the TRNG.