OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or_debug_proxy/] [includes/] [or_debug_proxy.h] - Blame information for rev 1779

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1779 julius
/*$$HEADER*/
2
/******************************************************************************/
3
/*                                                                            */
4
/*                    H E A D E R   I N F O R M A T I O N                     */
5
/*                                                                            */
6
/******************************************************************************/
7
 
8
// Project Name                   : OpenRISC Debug Proxy
9
// File Name                      : or_debug_proxy.h
10
// Prepared By                    : jb
11
// Project Start                  : 2008-10-01
12
 
13
/*$$COPYRIGHT NOTICE*/
14
/******************************************************************************/
15
/*                                                                            */
16
/*                      C O P Y R I G H T   N O T I C E                       */
17
/*                                                                            */
18
/******************************************************************************/
19
/*
20
  This library is free software; you can redistribute it and/or
21
  modify it under the terms of the GNU Lesser General Public
22
  License as published by the Free Software Foundation;
23
  version 2.1 of the License, a copy of which is available from
24
  http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
25
 
26
  This library is distributed in the hope that it will be useful,
27
  but WITHOUT ANY WARRANTY; without even the implied warranty of
28
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
29
  Lesser General Public License for more details.
30
 
31
  You should have received a copy of the GNU Lesser General Public
32
  License along with this library; if not, write to the Free Software
33
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
34
*/
35
 
36
/*$$CHANGE HISTORY*/
37
/******************************************************************************/
38
/*                                                                            */
39
/*                         C H A N G E  H I S T O R Y                         */
40
/*                                                                            */
41
/******************************************************************************/
42
 
43
// Date         Version Description
44
//------------------------------------------------------------------------
45
// 081101               First revision                                  jb
46
 
47
#ifndef _OR_DEBUG_PROXY_H_
48
#define _OR_DEBUG_PROXY_H_
49
 
50
#ifndef DEBUG_CMDS
51
#define DEBUG_CMDS 0  // Output the actual commands being sent to the debug unit
52
#endif
53
 
54
#ifndef DEBUG_USB_DRVR_FUNCS
55
#define DEBUG_USB_DRVR_FUNCS 0 // Generate debug output from the USB driver functions
56
#endif
57
 
58
#ifndef DEBUG_GDB_BLOCK_DATA
59
#define DEBUG_GDB_BLOCK_DATA 0  // GDB Socket Block data print out
60
#endif
61
 
62
// This one is defined sometimes in the makefile, so check first
63
#ifndef DEBUG_GDB
64
#define DEBUG_GDB 0  // GDB RSP Debugging output enabled
65
#endif
66
 
67
#ifndef DEBUG_GDB_DUMP_DATA
68
#define DEBUG_GDB_DUMP_DATA 0  // GDB Socket Debugging - output all data we return to GDB client
69
#endif
70
 
71
#define Boolean uint32_t
72
#define false 0
73
#define true 1
74
 
75
/* Selects crc trailer size in bits. Currently supported: 8 */
76
#define CRC_SIZE (8)
77
 
78
#include <stdint.h>
79
 
80
extern int serverPort;
81
extern int server_fd;
82
 
83
extern int vpi_fd; // should be the descriptor for our connection to the VPI server
84
 
85
extern int current_chain;
86
extern int dbg_chain;
87
 
88
#define DBGCHAIN_SIZE           4 // Renamed from DC_SIZE due to definition clash with something in <windows.h> --jb 090302
89
#define DC_STATUS_SIZE    4
90
 
91
#define DC_WISHBONE       0
92
#define DC_CPU0           1
93
#define DC_CPU1           2
94
 
95
// Manually figure the 5-bit reversed values again if they change
96
#define DI_GO          0
97
#define DI_READ_CMD    1
98
#define DI_WRITE_CMD   2
99
#define DI_READ_CTRL   3
100
#define DI_WRITE_CTRL  4
101
 
102
#define DBG_CRC_SIZE      32
103
#define DBG_CRC_POLY      0x04c11db7
104
 
105
#define DBG_ERR_OK        0
106
#define DBG_ERR_INVALID_ENDPOINT 3
107
#define DBG_ERR_CRC       8
108
 
109
#define NUM_SOFT_RETRIES  3
110
#define NUM_HARD_RETRIES  3
111
#define NUM_ACCESS_RETRIES 10
112
 
113
/* setup connection with the target */
114
void dbg_test();
115
/* perform a reset of the debug chain (not of system!) */
116
int dbg_reset();
117
/* set instruction register of JTAG TAP */
118
int dbg_set_tap_ir(uint32_t ir);
119
/* Set "scan chain" of debug unit (NOT JTAG TAP!) */
120
int dbg_set_chain(uint32_t chain);
121
/* read a word from wishbone */
122
int dbg_wb_read32(uint32_t adr, uint32_t *data);
123
/* write a word to wishbone */
124
int dbg_wb_write32(uint32_t adr, uint32_t data);
125
/* read a block from wishbone */
126
int dbg_wb_read_block32(uint32_t adr, uint32_t *data, uint32_t len);
127
/* write a block to wishbone */
128
int dbg_wb_write_block32(uint32_t adr, uint32_t *data, uint32_t len);
129
/* read a register from cpu */
130
int dbg_cpu0_read(uint32_t adr, uint32_t *data);
131
/* read a register from cpu module */
132
int dbg_cpu0_read_ctrl(uint32_t adr, unsigned char *data);
133
/* write a cpu register */
134
int dbg_cpu0_write(uint32_t adr, uint32_t data);
135
/* write a cpu module register */
136
int dbg_cpu0_write_ctrl(uint32_t adr, unsigned char data);
137
 
138
void print_usage(); // Self explanatory
139
 
140
void check(char *fn, uint32_t l, uint32_t i);
141
 
142
/* Possible errors are listed here.  */
143
enum enum_errors  /* modified <chris@asics.ws> CZ 24/05/01 */
144
{
145
  /* Codes > 0 are for system errors */
146
 
147
  ERR_NONE = 0,
148
  ERR_CRC = -1,
149
  ERR_MEM = -2,
150
  JTAG_PROXY_INVALID_COMMAND = -3,
151
  JTAG_PROXY_SERVER_TERMINATED = -4,
152
  JTAG_PROXY_NO_CONNECTION = -5,
153
  JTAG_PROXY_PROTOCOL_ERROR = -6,
154
  JTAG_PROXY_COMMAND_NOT_IMPLEMENTED = -7,
155
  JTAG_PROXY_INVALID_CHAIN = -8,
156
  JTAG_PROXY_INVALID_ADDRESS = -9,
157
  JTAG_PROXY_ACCESS_EXCEPTION = -10, /* Write to ROM */
158
  JTAG_PROXY_INVALID_LENGTH = -11,
159
  JTAG_PROXY_OUT_OF_MEMORY = -12,
160
};
161
 
162
#endif /* _OR_DEBUG_PROXY_H_ */
163
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.