master
h 68 lines 1.17 KB
Raw
1 /*
2 * MAX78000 AES
3 *
4 * Copyright (c) 2025 Jackson Donaldson <jcksn@duck.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8 #ifndef HW_MAX78000_AES_H
9 #define HW_MAX78000_AES_H
10
11 #include "hw/core/sysbus.h"
12 #include "crypto/aes.h"
13 #include "qom/object.h"
14
15 #define TYPE_MAX78000_AES "max78000-aes"
16 OBJECT_DECLARE_SIMPLE_TYPE(Max78000AesState, MAX78000_AES)
17
18 #define CTRL 0
19 #define STATUS 4
20 #define INTFL 8
21 #define INTEN 0xc
22 #define FIFO 0x10
23
24 #define KEY_BASE 0x400
25 #define KEY_END 0x420
26
27 /* CTRL */
28 #define TYPE (1 << 9 | 1 << 8)
29 #define KEY_SIZE (1 << 7 | 1 << 6)
30 #define OUTPUT_FLUSH (1 << 5)
31 #define INPUT_FLUSH (1 << 4)
32 #define START (1 << 3)
33
34 #define AES_EN (1 << 0)
35
36 /* STATUS */
37 #define OUTPUT_FULL (1 << 4)
38 #define OUTPUT_EMPTY (1 << 3)
39 #define INPUT_FULL (1 << 2)
40 #define INPUT_EMPTY (1 << 1)
41 #define BUSY (1 << 0)
42
43 /* INTFL*/
44 #define DONE (1 << 0)
45
46 struct Max78000AesState {
47 SysBusDevice parent_obj;
48
49 MemoryRegion mmio;
50
51 uint32_t ctrl;
52 uint32_t status;
53 uint32_t intfl;
54 uint32_t inten;
55 uint32_t data_index;
56 uint8_t data[16];
57
58 uint8_t key[32];
59 AES_KEY internal_key;
60
61 uint32_t result_index;
62 uint8_t result[16];
63
64
65 qemu_irq irq;
66 };
67
68 #endif