MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / arch / nios2nommu / kernel / nios_gdb_stub.h
blob3900109fbd2fe0cbf75b909ae8cff5583a15a068
1 // file: nios_gdb_stub.h
2 // Author: Altera Santa Cruz \ 2000
3 //
4 // You can modify this header file to
5 // enable some features useful for
6 // debugging the debugger. They're
7 // good features also to just show
8 // signs of life on your Nios board.
9 // But they consume valuable peripherals!
11 // The 'GDB_DEBUG_PRINT' option ties
12 // up the LCD living on the 5v port,
13 // showing useful internals of the stub.
15 // dvb@altera.com
18 #ifdef ETHER_DEBUG
19 #ifdef na_enet
20 #define ethernet_exists
21 #endif
22 #endif
24 #ifdef ETHER_DEBUG
25 #ifdef ethernet_exists
26 #include "plugs.h"
27 #endif
28 #endif
30 #define MAX_DATA_SIZE 650
31 #define kTextBufferSize ((2*MAX_DATA_SIZE)+4)
32 #define kMaximumBreakpoints 4
33 #define GDB_ETH_PORT 7070
34 #define GDB_WHOLE_PACKET 0
35 #define GDB_SKIP_FIRST 1
36 #define GDB_RETRY_CNT 3
39 * This register structure must match
40 * its counterpart in the GDB host, since
41 * it is blasted across in byte notation.
43 typedef struct
45 int r[32];
46 long pc;
47 short ctl0;
48 short ctl1;
49 short ctl2;
50 short ctl3;
51 } NiosGDBRegisters;
53 typedef struct
55 short *address;
56 short oldContents;
57 } NiosGDBBreakpoint;
59 typedef struct
61 NiosGDBRegisters registers;
62 int trapNumber; // stashed by ISR, to distinguish types
63 char textBuffer[kTextBufferSize];
64 int breakpointCount; // breakpoints used for stepping
65 int comlink;
66 int stop;
67 int gdb_eth_plug;
68 NiosGDBBreakpoint breakpoint[kMaximumBreakpoints];
69 #ifdef ETHER_DEBUG
70 #ifdef ethernet_exists
71 volatile int ACKstatus;
72 net_32 host_ip_address;
73 net_16 host_port_number;
74 #endif
75 #endif
76 } NiosGDBGlobals;
78 #ifdef ETHER_DEBUG
79 #ifdef ethernet_exists
80 enum
82 ne_gdb_ack_notwaiting,
83 ne_gdb_ack_waiting,
84 ne_gdb_ack_acked,
85 ne_gdb_ack_nacked
87 #endif
88 #endif
90 enum
92 ne_gdb_serial,
93 ne_gdb_ethernet
96 #ifndef GDB_DEBUG_PRINT
97 #define GDB_DEBUG_PRINT 0
98 #endif
100 void GDB_Main(void); // initialize gdb and begin.
102 char GDBGetChar(void);
103 void GDBPutChar(char c);
104 void GDB_Print2(char *s,int v1,int v2);