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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or_debug_proxy/] [includes/] [gdb.h] - Blame information for rev 775

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 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                      : gdb.h
10
// Prepared By                    : jb, rmd
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, adapted from existing "jp" 
46
//                      debug proxy.                               jb, rmd
47
 
48
#ifndef GDB_H
49
#define GDB_H
50
 
51
#include <sys/types.h>
52
#include <inttypes.h>
53
 
54
extern void HandleServerSocket(void);
55
extern void handle_rsp (void);
56
int GetServerSocket(const char* name, const char* proto, int port);
57
extern void JTAGRequest(void);
58
void setup_or32(void);
59
void gdb_close();
60
 
61
extern int err;
62
 
63 497 julius
extern int kernel_debug;
64
 
65 39 julius
/* All JTAG chains.  */
66
enum jtag_chains
67
  {
68
    SC_GLOBAL,      /* 0 Global BS Chain */
69
    SC_RISC_DEBUG,  /* 1 RISC Debug Interface chain */
70
    SC_RISC_TEST,   /* 2 RISC Test Chain */
71
    SC_TRACE,       /* 3 Trace Chain */
72
    SC_REGISTER,    /* 4 Register Chain */
73
    SC_WISHBONE,    /* 5 Memory chain */
74
    SC_BLOCK,       /* 6 Block Chains */
75
  };
76
 
77
/* See JTAG documentation about these.  */
78
#define JI_SIZE (4)
79
enum jtag_instr
80
  {
81
    JI_EXTEST,
82
    JI_SAMPLE_PRELOAD,
83
    JI_IDCODE,
84
    JI_CHAIN_SELECT,
85
    JI_INTEST,
86
    JI_CLAMP,
87
    JI_CLAMPZ,
88
    JI_HIGHZ,
89
    JI_DEBUG,
90
    JI_BYPASS = 0xF
91
  };
92
 
93
/* JTAG registers.  */
94
#define JTAG_MODER  (0x0)
95
#define JTAG_TSEL   (0x1)
96
#define JTAG_QSEL   (0x2)
97
#define JTAG_SSEL   (0x3)
98
#define JTAG_RISCOP (0x4)
99
#define JTAG_RECWP0 (0x10)
100
#define JTAG_RECBP0 (0x1b)
101
 
102
/* This is repeated from gdb tm-or1k.h There needs to be
103
   a better mechanism for tracking this, but I don't see
104
   an easy way to share files between modules. */
105
 
106
typedef enum {
107
  JTAG_COMMAND_READ = 1,
108
  JTAG_COMMAND_WRITE = 2,
109
  JTAG_COMMAND_BLOCK_READ = 3,
110
  JTAG_COMMAND_BLOCK_WRITE = 4,
111
  JTAG_COMMAND_CHAIN = 5,
112
} JTAG_proxy_protocol_commands;
113
 
114
/* Each transmit structure must begin with an integer
115
   which specifies the type of command. Information
116
   after this is variable. Make sure to have all information
117
   aligned properly. If we stick with 32 bit integers, it
118
   should be portable onto every platform. These structures
119
   will be transmitted across the network in network byte
120
   order.
121
*/
122
 
123
typedef struct {
124
  uint32_t command;
125
  uint32_t length;
126
  uint32_t address;
127
  uint32_t data_H;
128
  uint32_t data_L;
129
} JTAGProxyWriteMessage;
130
 
131
typedef struct {
132
  uint32_t command;
133
  uint32_t length;
134
  uint32_t address;
135
} JTAGProxyReadMessage;
136
 
137
typedef struct {
138
  uint32_t command;
139
  uint32_t length;
140
  uint32_t address;
141
  int32_t  nRegisters;
142
  uint32_t data[1];
143
} JTAGProxyBlockWriteMessage;
144
 
145
typedef struct {
146
  uint32_t command;
147
  uint32_t length;
148
  uint32_t address;
149
  int32_t  nRegisters;
150
} JTAGProxyBlockReadMessage;
151
 
152
typedef struct {
153
  uint32_t command;
154
  uint32_t length;
155
  uint32_t chain;
156
} JTAGProxyChainMessage;
157
 
158
/* The responses are messages specific, however convention
159
   states the first word should be an error code. Again,
160
   sticking with 32 bit integers should provide maximum
161
   portability. */
162
 
163
typedef struct {
164
  int32_t status;
165
} JTAGProxyWriteResponse;
166
 
167
typedef struct {
168
  int32_t status;
169
  uint32_t data_H;
170
  uint32_t data_L;
171
} JTAGProxyReadResponse;
172
 
173
typedef struct {
174
  int32_t status;
175
} JTAGProxyBlockWriteResponse;
176
 
177
typedef struct {
178
  int32_t status;
179
  int32_t nRegisters;
180
  uint32_t data[1];
181
  /* uint32_t data[nRegisters-1] still unread */
182
} JTAGProxyBlockReadResponse;
183
 
184
typedef struct {
185
  int32_t status;
186
} JTAGProxyChainResponse;
187
 
188
 
189
#endif /* GDB_H */

powered by: WebSVN 2.1.0

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