annotate packages/hal/common/current/include/generic-stub.h @ 112:02ea4320376c ecos-sw-2000-07-21

Merge from eCos master repository on 2000-07-21-21:01:39-BST
author jlarmour
date Fri, 21 Jul 2000 21:34:11 +0000
parents 435cced73e2f
children 6ed91473a1cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
64
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
1 //========================================================================
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
2 //
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
3 // generic-stub.h
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
4 //
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
5 // Definitions for the generic GDB remote stub
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
6 //
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
7 //========================================================================
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
8 //####COPYRIGHTBEGIN####
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
9 //
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
10 // -------------------------------------------
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
11 // The contents of this file are subject to the Red Hat eCos Public License
66
bf00f99aec69 Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents: 64
diff changeset
12 // Version 1.1 (the "License"); you may not use this file except in
64
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
13 // compliance with the License. You may obtain a copy of the License at
66
bf00f99aec69 Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents: 64
diff changeset
14 // http://www.redhat.com/
64
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
15 //
66
bf00f99aec69 Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents: 64
diff changeset
16 // Software distributed under the License is distributed on an "AS IS"
64
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
18 // License for the specific language governing rights and limitations under
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
19 // the License.
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
20 //
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
21 // The Original Code is eCos - Embedded Configurable Operating System,
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
22 // released September 30, 1998.
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
23 //
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
24 // The Initial Developer of the Original Code is Red Hat.
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
25 // Portions created by Red Hat are
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
27 // All Rights Reserved.
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
28 // -------------------------------------------
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
29 //
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
30 //####COPYRIGHTEND####
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
31 //========================================================================
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
32 //#####DESCRIPTIONBEGIN####
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
33 //
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
34 // Author(s): Red Hat, nickg
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
35 // Contributors: Red Hat, nickg
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
36 // Date: 1998-06-08
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
37 // Purpose:
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
38 // Description: Definitions for the generic GDB remote stub
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
39 // Usage: This header is not to be included by user code, and is
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
40 // only placed in a publically accessible directory so
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
41 // that platform stub packages are able to include it
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
42 // if required.
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
43 //
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
44 //####DESCRIPTIONEND####
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
45 //
c38311975d4f Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents: 54
diff changeset
46 //========================================================================
54
f10165814f1e Merge from eCos master repository on 1999-11-19-22:24:39-GMT
jlarmour
parents: 34
diff changeset
47
f10165814f1e Merge from eCos master repository on 1999-11-19-22:24:39-GMT
jlarmour
parents: 34
diff changeset
48
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
49 #ifndef GENERIC_STUB_H
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
50 #define GENERIC_STUB_H
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
51
76
435cced73e2f eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents: 66
diff changeset
52 #ifdef __cplusplus
435cced73e2f eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents: 66
diff changeset
53 extern "C" {
435cced73e2f eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents: 66
diff changeset
54 #endif
435cced73e2f eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents: 66
diff changeset
55
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
56 /* Three typedefs must be provided before including this file.
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
57 target_register_t should correspond to the largest register value on
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
58 this target processor.
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
59 regnames_t corresponds to a type representing a register number.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
60 uint32 must correspond to at least a 32-bit unsigned integer type
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
61 (it may be larger). */
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
62
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
63 #ifndef ASM
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
64
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
65 #ifndef __ECOS__
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
66 #include "dbg-serial.h"
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
67 #endif // __ECOS__
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
68
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
69 struct gdb_packet
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
70 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
71 /* The checksum calculated so far. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
72 uint32 checksum;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
73 /* The checksum we've received from the remote side. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
74 uint32 xmitcsum;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
75 /* Contents of the accumulated packet. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
76 char *contents;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
77 /* Number of characters received. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
78 uint32 length;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
79 /*
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
80 * state is the current state:
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
81 * 0 = looking for start of packet
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
82 * 1 = got start of packet, looking for # terminator
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
83 * 2 = looking for first byte of checksum
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
84 * 3 = looking for second byte of checksum (indicating end of packet)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
85 */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
86 char state;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
87 };
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
88
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
89 /* Return the currently-saved value corresponding to register REG. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
90 extern target_register_t get_register (regnames_t reg);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
91
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
92 /* Store VALUE in the register corresponding to WHICH. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
93 extern void put_register (regnames_t which, target_register_t value);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
94
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
95 /* Set the next instruction to be executed when the user program resumes
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
96 execution to PC. */
112
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
97 #if !defined(SET_PC_PROTOTYPE_EXISTS) && !defined(set_pc)
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
98 #define SET_PC_PROTOTYPE_EXISTS
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
99 extern void set_pc (target_register_t pc);
112
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
100 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
101
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
102 /* Set the return value of the currently-pending syscall to VALUE. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
103 extern void set_syscall_value (target_register_t value);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
104
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
105 /* Return the Nth argument to the currently-pending syscall (starting from
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
106 0). */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
107 extern target_register_t get_syscall_arg (int n);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
108
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
109 /* Initialize the stub. This will also install any trap handlers needed by
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
110 the stub. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
111 extern void initialize_stub (void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
112
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
113 /* Initialize the hardware. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
114 extern void initHardware (void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
115
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
116 /* Skip the current instruction. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
117 extern void __skipinst (void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
118
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
119 /* If the address in the PC register corresponds to the breakpoint()
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
120 instruction, return a non-zero value. */
112
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
121 #ifndef __is_breakpoint_function
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
122 extern int __is_breakpoint_function (void);
112
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
123 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
124
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
125 /* Execute a breakpoint instruction. Restarting will cause the instruction
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
126 to be skipped. */
112
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
127 #ifndef breakpoint
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
128 extern void breakpoint (void);
112
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
129 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
130
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
131 /* Return the syscall # corresponding to this system call. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
132 extern int __get_syscall_num (void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
133
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
134 /* Transfer exception event processing to the stub. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
135 extern void __switch_to_stub (void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
136
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
137 /* Send an exit packet containing the specified status. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
138 extern void __send_exit_status (int status);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
139
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
140 /* Copy COUNT bytes of memory from ADDR to BUF.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
141 ADDR is assumed to live in the user program's space.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
142 Returns number of bytes successfully read
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
143 (caller must check to see if less than requested). */
34
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 2
diff changeset
144 extern int __read_mem_safe (void *buf,
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 2
diff changeset
145 void *addr,
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
146 int count);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
147
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
148 /* Copy COUNT bytes of memory from BUF to ADDR.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
149 ADDR is assumed to live in the user program's space.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
150 Returns number of bytes successfully read
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
151 (caller must check to see if less than requested). */
112
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
152 #ifndef __write_mem_safe
34
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 2
diff changeset
153 extern int __write_mem_safe (void *buf,
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 2
diff changeset
154 void *addr,
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
155 int count);
112
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
156 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
157
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
158 /* Set to a non-zero value if a memory fault occurs while
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
159 __set_mem_fault_trap () is running. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
160 extern volatile int __mem_fault;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
161
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
162 #ifndef __ECOS__
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
163 #if 1
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
164 #include "stub-tservice.h" /* target dependent stub services */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
165 #else
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
166 /* Flush the instruction cache. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
167 extern void flush_i_cache (void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
168
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
169 /* Flush the data cache. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
170 extern void __flush_d_cache (void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
171
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
172 typedef enum {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
173 CACHE_NOOP, CACHE_ENABLE, CACHE_DISABLE, CACHE_FLUSH
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
174 } cache_control_t;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
175
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
176 /* Perform the specified operation on the instruction cache.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
177 Returns 1 if the cache is enabled, 0 otherwise. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
178 extern int __instruction_cache (cache_control_t request);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
179 /* Perform the specified operation on the data cache.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
180 Returns 1 if the cache is enabled, 0 otherwise. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
181 extern int __data_cache (cache_control_t request);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
182 #endif
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
183 #endif // __ECOS__
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
184
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
185 /* Write the 'T' packet in BUFFER. SIGVAL is the signal the program
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
186 received. */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
187 extern void __build_t_packet (int sigval, char *buffer);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
188
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
189 /* Return 1 when a complete packet has been received, 0 if the packet
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
190 is not yet complete, or -1 if an erroneous packet was NAKed. */
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
191 int __add_char_to_packet (unsigned character, struct gdb_packet *packet);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
192
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
193 typedef int (*__PFI)(int);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
194 typedef void (*__PFV)(void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
195
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
196 /* When an exception occurs, __process_exception_vec will be invoked with
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
197 the signal number corresponding to the trap/exception. The function
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
198 should return zero if it wishes execution to resume from the saved
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
199 register values; a non-zero value indicates that the exception handler
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
200 should be reinvoked. */
112
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
201 #if !defined(PROCESS_EXCEPTION_VEC_PROTOTYPE_EXISTS)
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
202 #define PROCESS_EXCEPTION_VEC_PROTOTYPE_EXISTS
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
203 extern volatile __PFI __process_exception_vec;
112
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
204 #endif
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
205
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
206 /* __process_exit_vec is invoked when a 'k' kill packet is received
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
207 from GDB. */
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
208 extern volatile __PFV __process_exit_vec;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
209
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
210 /* If SIGSYSCALL is defined, and such a signal value is returned from
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
211 __computeSignal (), the function pointed to by this vector will
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
212 be invoked.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
213
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
214 If the return value is negative, the user program is assumed to
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
215 have received the corresponding positive signal value, and an
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
216 exception will be processed. Otherwise, the user program is
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
217 restarted from the next instruction. */
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
218 extern volatile __PFI __process_syscall_vec;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
219
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
220 /* A continue packet was received from GDB with a signal value. The function
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
221 pointed to by __process_signal_vec will be invoked with this signal
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
222 value.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
223
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
224 If a zero value is returned, we will ignore the signal, and proceed
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
225 with the continue request. Otherwise, the program will be killed
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
226 with the signal. */
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
227 extern volatile __PFI __process_signal_vec;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
228
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
229 /* If non-NULL, __init_vec is called right before the user program is
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
230 resumed. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
231 extern volatile __PFV __init_vec;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
232 /* if non-NULL, __cleanup_vec is called after the user program takes
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
233 an exception. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
234 extern volatile __PFV __cleanup_vec;
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
235
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
236 /* Send an 'O' packet to GDB containing STR. */
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
237 extern int __output_gdb_string (target_register_t addr, int string_len);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
238
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
239 /* Request MAXLEN bytes of input from GDB to be stored in DEST. If BLOCK
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
240 is set, GDB should block until MAXLEN bytes are available to be
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
241 read; otherwise, it will return immediately with whatever data is
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
242 available.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
243 The return value is the number of bytes written into DEST. */
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
244 extern int __get_gdb_input (target_register_t dest, int maxlen, int block);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
245
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
246 /* Return the ASCII equivalent of C (C>=0 && C<=15). The result will be
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
247 lower-case. */
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
248 extern char __tohex (int c);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
249
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
250 /* Convert COUNT bytes of the memory region in MEM to a hexadecimal
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
251 string in DEST.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
252 The resulting string will contain 2*COUNT characters.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
253 If MAY_FAULT is non-zero, memory faults are trapped; if a fault occurs,
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
254 a NULL value will be returned.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
255 The value returned is one byte past the end of the string written. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
256 extern char *__mem2hex (char *mem, char *dest, int count, int may_fault);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
257
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
258 /* Given a hexadecimal string in MEM, write the equivalent bytes to DEST.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
259 The string is assumed to contain 2*COUNT characters.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
260 If MAY_FAULT is non-zero, memory faults are trapped; if a fault occurs,
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
261 a NULL value will be returned.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
262 Otherwise, the value returned is one byte past the last byte written. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
263 extern char *__hex2mem (char *buf, char *mem, int count, int may_fault);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
264
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
265 /* Set the program arguments passed into the user program's main */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
266 extern void __set_program_args (int argc, char **argv);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
267
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
268 /* Return the user program arguments passed in from GDB (via an 'A'
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
269 packet). argcPtr is a pointer into the user program, which will hold
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
270 the number of arguments; the strings are returned. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
271 extern char **__get_program_args (target_register_t argcPtr);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
272
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
273 /* Encode PACKET as a remote protocol packet and send it to GDB; this takes
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
274 care of sending the initial '$' character, as well as the trailing '#'
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
275 and checksum, and also waits for an ACK from the remote side, resending
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
276 as necessary. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
277 extern void __putpacket (char *packet);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
278
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
279 /* Convert the hexadecimal string pointed to by *PTR into an integer,
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
280 and store it in the value pointed to by INTVALUE. The number of
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
281 characters read from *PTR will be returned; *PTR will point to the first
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
282 non-hexadecmial character encountered. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
283 extern unsigned int __hexToInt (char **ptr, target_register_t *intValue);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
284
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
285 /* Convert the value in INTVALUE into a string of hexadecimal
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
286 characters stored in PTR. NUMBITS are the number of bits to use
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
287 in INTVALUE. The number of characters written to PTR will be returned. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
288 extern unsigned int __intToHex (char *ptr,
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
289 target_register_t intValue,
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
290 int numBits);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
291
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
292 /* Handle an exception, usually some sort of hardware or software trap.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
293 This is responsible for communicating the exception to GDB. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
294 extern void __handle_exception (void);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
295
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
296 /* Send a 'X' packet with signal SIGVAL to GDB. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
297 extern void __kill_program (int sigval);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
298
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
299 /* Given a packet pointed to by PACKETCONTENTS, decode it and respond to
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
300 GDB appropriately. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
301 extern int __process_packet (char *packetContents);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
302
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
303 /* Write the C-style string pointed to by STR to the GDB comm port.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
304 Used for printing debug messages. */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
305 extern void __putDebugStr (char *str);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
306
112
02ea4320376c Merge from eCos master repository on 2000-07-21-21:01:39-BST
jlarmour
parents: 76
diff changeset
307 #if defined(NO_MALLOC) && !defined(MAX_BP_NUM)
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
308 #define MAX_BP_NUM 64 /* Maximum allowed # of breakpoints */
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
309 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
310
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
311 #endif /* ASM */
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
312
76
435cced73e2f eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents: 66
diff changeset
313 #ifdef __cplusplus
435cced73e2f eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents: 66
diff changeset
314 } /* extern "C" */
435cced73e2f eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents: 66
diff changeset
315 #endif
435cced73e2f eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents: 66
diff changeset
316
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
317 #endif /* GENERIC_STUB_H */