aboutsummaryrefslogtreecommitdiff
path: root/src/target/nds32_edm.h
blob: 2b5067a3455f7e482f6f69999da0d18006a55116 (plain)
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
/***************************************************************************
 *   Copyright (C) 2013 Andes Technology                                   *
 *   Hsiangkai Wang <hkwang@andestech.com>                                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program 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 General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
 ***************************************************************************/

#ifndef OPENOCD_TARGET_NDS32_EDM_H
#define OPENOCD_TARGET_NDS32_EDM_H

#include "helper/types.h"

/**
 * @file
 * This is the interface to the Embedded Debug Module for Andes cores.
 */

/* EDM misc registers */
enum nds_edm_misc_reg {
	NDS_EDM_MISC_DIMIR = 0x0,
	NDS_EDM_MISC_SBAR,
	NDS_EDM_MISC_EDM_CMDR,
	NDS_EDM_MISC_DBGER,
	NDS_EDM_MISC_ACC_CTL,
	NDS_EDM_MISC_EDM_PROBE,
	NDS_EDM_MISC_GEN_PORT0,
	NDS_EDM_MISC_GEN_PORT1,
};

/* EDM system registers */
enum nds_edm_system_reg {
	NDS_EDM_SR_BPC0 = 0x00,
	ND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TO = 0,
	NDS_MEMORY_SELECT_MEM = 1,
	NDS_MEMORY_SELECT_ILM = 2,
	NDS_MEMORY_SELECT_DLM = 3,
};

#define NDS_DBGER_DEX		(0x1)
#define NDS_DBGER_DPED		(0x2)
#define NDS_DBGER_CRST		(0x4)
#define NDS_DBGER_AT_MAX	(0x8)
#define NDS_DBGER_ILL_SEC_ACC	(0x10)
#define NDS_DBGER_ALL_SUPRS_EX	(0x40000000)
#define NDS_DBGER_RESACC	(0x80000000)
#define NDS_DBGER_CLEAR_ALL	(0x1F)

#define NDS_EDMSW_WDV		(1 << 0)
#define NDS_EDMSW_RDV		(1 << 1)

#endif /* OPENOCD_TARGET_NDS32_EDM_H */