summaryrefslogtreecommitdiffstats
path: root/include/hw/tricore/tc27x_soc.h
blob: 6a7e5b54f51d9111a8e7f307defc5cb2844225fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * Infineon tc27x SoC System emulation.
 *
 * Copyright (c) 2020 Andreas Konopik <andreas.konopik@efs-auto.de>
 * Copyright (c) 2020 David Brenken <david.brenken@efs-auto.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */

#ifndef TC27X_SoC_H
#define TC27X_SoC_H

#include "hw/sysbus.h"
#include "target/tricore/cpu.h"
#include "qom/object.h"

#define TYPE_TC27X_SOC ("tc27x-soc")
OBJECT_DECLARE_TYPE(TC27XSoCState, TC27XSoCClass, TC27X_SOC)

typedef struct TC27XSoCCPUMemState {

    MemoryRegion dspr;
    MemoryRegion pspr;

    MemoryRegion dcache;
    MemoryRegion dtag;
    MemoryRegion pcache;
    MemoryRegion ptag;

} TC27XSoCCPUMemState;

typedef struct TC27XSoCFlashMemState {

    MemoryRegion pflash0_c;
    MemoryRegion pflash1_c;
    MemoryRegion pflash0_u;
    MemoryRegion pflash1_u;
    MemoryRegion dflash0;
    MemoryRegion dflash1;
    MemoryRegion olda_c;
    MemoryRegion olda_u;
    MemoryRegion brom_c;
    MemoryRegion brom_u;
    MemoryRegion lmuram_c;
    MemoryRegion lmuram_u;
    MemoryRegion emem_c;
    MemoryRegion emem_u;

} TC27XSoCFlashMemState;

typedef struct TC27XSoCState {
    /*< private >*/
    SysBusDevice parent_obj;

    /*< public >*/
    TriCoreCPU cpu;

    MemoryRegion dsprX;
    MemoryRegion psprX;

    TC27XSoCCPUMemState cpu0mem;
    TC27XSoCCPUMemState cpu1mem;
    TC27XSoCCPUMemState cpu2mem;

    TC27XSoCFlashMemState flashmem;

} TC27XSoCState;

typedef struct MemmapEntry {
    hwaddr base;
    hwaddr size;
} MemmapEntry;

typedef struct TC27XSoCClass {
    DeviceClass parent_class;

    const char *name;
    const char *cpu_type;
    const MemmapEntry *memmap;
    uint32_t num_cpus;
} TC27XSoCClass;

enum {
    TC27XD_DSPR2,
    TC27XD_DCACHE2,
    TC27XD_DTAG2,
    TC27XD_PSPR2,
    TC27XD_PCACHE2,
    TC27XD_PTAG2,
    TC27XD_DSPR1,
    TC27XD_DCACHE1,
    TC27XD_DTAG1,
    TC27XD_PSPR1,
    TC27XD_PCACHE1,
    TC27XD_PTAG1,
    TC27XD_DSPR0,
    TC27XD_PSPR0,
    TC27XD_PCACHE0,
    TC27XD_PTAG0,
    TC27XD_PFLASH0_C,
    TC27XD_PFLASH1_C,
    TC27XD_OLDA_C,
    TC27XD_BROM_C,
    TC27XD_LMURAM_C,
    TC27XD_EMEM_C,
    TC27XD_PFLASH0_U,
    TC27XD_PFLASH1_U,
    TC27XD_DFLASH0,
    TC27XD_DFLASH1,
    TC27XD_OLDA_U,
    TC27XD_BROM_U,
    TC27XD_LMURAM_U,
    TC27XD_EMEM_U,
    TC27XD_PSPRX,
    TC27XD_DSPRX,
};

#endif