Software APIs
dt_aes.h
Go to the documentation of this file.
1// Copyright lowRISC contributors (OpenTitan project).
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4//
5// Device table API auto-generated by `dtgen`
6
7#ifndef OPENTITAN_DT_AES_H_
8#define OPENTITAN_DT_AES_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif // __cplusplus
13
14/**
15 * @file
16 * @brief Device Tables (DT) for IP aes and top englishbreakfast.
17 *
18 * This file contains the type definitions and global functions of the aes.
19 */
20
21#include "hw/top/dt/dt_api.h"
22#include <stdint.h>
23
24
25
26/**
27 * List of instances.
28 */
29typedef enum dt_aes {
30 kDtAes = 0, /**< aes */
31 kDtAesFirst = 0, /**< \internal First instance */
32 kDtAesCount = 1, /**< \internal Number of instances */
34
35/**
36 * List of register blocks.
37 *
38 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
39 */
40typedef enum dt_aes_reg_block {
41 kDtAesRegBlockCore = 0, /**< */
42 kDtAesRegBlockCount = 1, /**< \internal Number of register blocks */
44
45/** Primary register block (associated with the "primary" set of registers that control the IP). */
46static const dt_aes_reg_block_t kDtAesRegBlockPrimary = kDtAesRegBlockCore;
47
48/**
49 * List of memories.
50 *
51 * Memories are guaranteed to start at 0 and to be consecutively numbered.
52 */
53typedef enum dt_aes_memory {
54 kDtAesMemoryCount = 0, /**< \internal Number of memories */
56
57/**
58 * List of clock ports.
59 *
60 * Clock ports are guaranteed to be numbered consecutively from 0.
61 */
62typedef enum dt_aes_clock {
63 kDtAesClockClk = 0, /**< Clock port clk_i */
64 kDtAesClockEdn = 1, /**< Clock port clk_edn_i */
65 kDtAesClockCount = 2, /**< \internal Number of clock ports */
67
68/**
69 * List of reset ports.
70 *
71 * Reset ports are guaranteed to be numbered consecutively from 0.
72 */
73typedef enum dt_aes_reset {
74 kDtAesResetRst = 0, /**< Reset port rst_ni */
75 kDtAesResetEdn = 1, /**< Reset port rst_edn_ni */
76 kDtAesResetCount = 2, /**< \internal Number of reset ports */
78
79/**
80 * List of supported hardware features.
81 */
82#define OPENTITAN_AES_HAS_KEY_LEN_128 1
83#define OPENTITAN_AES_HAS_KEY_LEN_192 1
84#define OPENTITAN_AES_HAS_KEY_LEN_256 1
85#define OPENTITAN_AES_HAS_MODE_ECB 1
86#define OPENTITAN_AES_HAS_MODE_CBC 1
87#define OPENTITAN_AES_HAS_MODE_CFB_128 1
88#define OPENTITAN_AES_HAS_MODE_OFB 1
89#define OPENTITAN_AES_HAS_MODE_CTR 1
90#define OPENTITAN_AES_HAS_KEY_SIDELOAD 1
91#define OPENTITAN_AES_HAS_CLEAR_DATA_OUT 1
92#define OPENTITAN_AES_HAS_CLEAR_KEY_IV_DATA_IN 1
93#define OPENTITAN_AES_HAS_PRNG_RESEED_RATE 1
94#define OPENTITAN_AES_HAS_PRNG_KEY_TOUCH_FORCES_RESEED 1
95#define OPENTITAN_AES_HAS_PRNG_FORCE_MASKS 1
96#define OPENTITAN_AES_HAS_MANUAL_OPERATION 1
97
98
99
100/**
101 * Get the aes instance from an instance ID
102 *
103 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
104 *
105 * @param inst_id Instance ID.
106 * @return A aes instance.
107 *
108 * **Note:** This function only makes sense if the instance ID has device type aes,
109 * otherwise the returned value is unspecified.
110 */
112
113/**
114 * Get the instance ID of an instance.
115 *
116 * @param dt Instance of aes.
117 * @return The instance ID of that instance.
118 */
120
121/**
122 * Get the register base address of an instance.
123 *
124 * @param dt Instance of aes.
125 * @param reg_block The register block requested.
126 * @return The register base address of the requested block.
127 */
128uint32_t dt_aes_reg_block(
129 dt_aes_t dt,
130 dt_aes_reg_block_t reg_block);
131
132/**
133 * Get the primary register base address of an instance.
134 *
135 * This is just a convenience function, equivalent to
136 * `dt_aes_reg_block(dt, kDtAesRegBlockCore)`
137 *
138 * @param dt Instance of aes.
139 * @return The register base address of the primary register block.
140 */
141static inline uint32_t dt_aes_primary_reg_block(
142 dt_aes_t dt) {
143 return dt_aes_reg_block(dt, kDtAesRegBlockCore);
144}
145
146/**
147 * Get the base address of a memory.
148 *
149 * @param dt Instance of aes.
150 * @param mem The memory requested.
151 * @return The base address of the requested memory.
152 */
153uint32_t dt_aes_memory_base(
154 dt_aes_t dt,
155 dt_aes_memory_t mem);
156
157/**
158 * Get the size of a memory.
159 *
160 * @param dt Instance of aes.
161 * @param mem The memory requested.
162 * @return The size of the requested memory.
163 */
164uint32_t dt_aes_memory_size(
165 dt_aes_t dt,
166 dt_aes_memory_t mem);
167
168
169
170
171/**
172 * Get the clock signal connected to a clock port of an instance.
173 *
174 * @param dt Instance of aes.
175 * @param clk Clock port.
176 * @return Clock signal.
177 */
179 dt_aes_t dt,
180 dt_aes_clock_t clk);
181
182/**
183 * Get the reset signal connected to a reset port of an instance.
184 *
185 * @param dt Instance of aes.
186 * @param rst Reset port.
187 * @return Reset signal.
188 */
190 dt_aes_t dt,
191 dt_aes_reset_t rst);
192
193
194
195#ifdef __cplusplus
196} // extern "C"
197#endif // __cplusplus
198
199#endif // OPENTITAN_DT_AES_H_