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

Subversion Repositories openrisc_me

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

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

powered by: WebSVN 2.1.0

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