AM263Px MCU+ SDK  10.01.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,
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 isOpen;
101  uint32_t faultStatus;
103 } DTHE_Attrs;
104 
106 typedef struct
107 {
111  uint32_t dmaEnable;
113 } DTHE_Config;
114 
115 /* ========================================================================== */
116 /* Global Variables */
117 /* ========================================================================== */
118 
120 extern DTHE_Config gDtheConfig[];
122 extern uint32_t gDtheConfigNum;
123 
124 /* ========================================================================== */
125 /* Function Definitions */
126 /* ========================================================================== */
130 void DTHE_init(void);
131 
135 void DTHE_deinit(void);
136 
144 DTHE_Handle DTHE_open(uint32_t index);
145 
155 
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 #endif /* DTHE_H_ */
161 
DTHE_Config::dmaEnable
uint32_t dmaEnable
Definition: dthe.h:111
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:107
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:108
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_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:101
DTHE_Attrs::isOpen
uint32_t isOpen
Definition: dthe.h:99
DTHE_deinit
void DTHE_deinit(void)
This function de-initializes the DTHE.