AM263Px MCU+ SDK: dthe.h Source File

| AM263Px MCU+ SDK 26.00.00 |

dthe.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2022-24 Texas Instruments Incorporated
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the
14 * 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
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
48 #ifndef DTHE_H_
49 #define DTHE_H_
50
51 /* ========================================================================== */
52 /* Include Files */
53 /* ========================================================================== */
54
55 #include <stdint.h>
56 #include <kernel/dpl/SystemP.h>
57 #include <security_common/drivers/crypto/dthe/hw_include/cslr_dthe.h>
58 #include <drivers/hw_include/cslr_soc.h>
59 #include <security_common/drivers/crypto/dthe/dma/device_includes.h>
60
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64
65 /* ========================================================================== */
66 /* Macros & Typedefs */
67 /* ========================================================================== */
68
69
78 typedef enum DTHE_Return_e
79 {
80 DTHE_RETURN_SUCCESS = 0xCE50311AU,
81 DTHE_RETURN_FAILURE = 0x924FC5E7U,
82 }DTHE_Return_t;
83
85 typedef void *DTHE_Handle;
86
88 typedef struct
89 {
90 /*
91 * SOC configuration
92 */
93 uint32_t caBaseAddr;
95 uint32_t aesBaseAddr;
97 uint32_t shaBaseAddr;
99 uint32_t sm3BaseAddr;
101 uint32_t sm4BaseAddr;
103 uint32_t isOpen;
105 uint32_t faultStatus;
107 } DTHE_Attrs;
108
110 typedef struct
111 {
112 DTHE_Attrs *attrs;
115 uint32_t dmaEnable;
117 } DTHE_Config;
118
119 /* ========================================================================== */
120 /* Global Variables */
121 /* ========================================================================== */
122
124 extern DTHE_Config gDtheConfig[];
126 extern uint32_t gDtheConfigNum;
127
128 /* ========================================================================== */
129 /* Function Definitions */
130 /* ========================================================================== */
134 void DTHE_init(void);
135
139 void DTHE_deinit(void);
140
148 DTHE_Handle DTHE_open(uint32_t index);
149
158 DTHE_Return_t DTHE_close(DTHE_Handle handle);
159
160 #ifdef __cplusplus
161 }
162 #endif
163
164 #endif /* DTHE_H_ */
165
DTHE_Config::dmaEnable
uint32_t dmaEnable
Definition: dthe.h:115
DTHE_close
DTHE_Return_t DTHE_close(DTHE_Handle handle)
Function to close a DTHE module specified by the DTHE handle.
DTHE_Config
DTHE driver context.
Definition: dthe.h:111
DTHE_RETURN_SUCCESS
@ DTHE_RETURN_SUCCESS
Definition: dthe.h:80
gDtheConfigNum
uint32_t gDtheConfigNum
Externally defined driver configuration Num.
SystemP.h
gDtheConfig
DTHE_Config gDtheConfig[]
Externally defined driver configuration array.
DTHE_Return_t
DTHE_Return_t
DTHE Driver Error code.
Definition: dthe.h:79
DTHE_Config::attrs
DTHE_Attrs * attrs
Definition: dthe.h:112
DTHE_Attrs::sm4BaseAddr
uint32_t sm4BaseAddr
Definition: dthe.h:101
DTHE_Attrs::shaBaseAddr
uint32_t shaBaseAddr
Definition: dthe.h:97
DTHE_RETURN_FAILURE
@ DTHE_RETURN_FAILURE
Definition: dthe.h:81
DTHE_open
DTHE_Handle DTHE_open(uint32_t index)
Function to open DTHE instance, enable DTHE engine.
DTHE_Attrs::aesBaseAddr
uint32_t aesBaseAddr
Definition: dthe.h:95
DTHE_Attrs::caBaseAddr
uint32_t caBaseAddr
Definition: dthe.h:93
DTHE_Attrs
DTHE attributes.
Definition: dthe.h:89
DTHE_Attrs::sm3BaseAddr
uint32_t sm3BaseAddr
Definition: dthe.h:99
DTHE_Handle
void * DTHE_Handle
Handle to the DTHE driver.
Definition: dthe.h:85
DTHE_init
void DTHE_init(void)
This function initializes the DTHE.
DTHE_Attrs::faultStatus
uint32_t faultStatus
Definition: dthe.h:105
DTHE_Attrs::isOpen
uint32_t isOpen
Definition: dthe.h:103
DTHE_deinit
void DTHE_deinit(void)
This function de-initializes the DTHE.