libspe2  0.9a
libspe2-types.h
Go to the documentation of this file.
1 /*
2  * libspe2 - A wrapper to allow direct execution of SPE binaries
3  * Copyright (C) 2005 IBM Corp.
4  *
5  * This library is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation; either version 2.1 of the License,
8  * or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13  * License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation,
17  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 
20 #ifndef libspe2_types_h
21 #define libspe2_types_h
22 
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27 
28 #include <limits.h>
29 #include "cbea_map.h"
30 
31 /*
32  * Data structure declarations for
33  * SPE problem state areas
34  * (part of public API)
35  */
36 
43 typedef struct spe_program_handle {
44  /*
45  * handle_size allows for future extensions of the spe_program_handle
46  * struct by new fields, without breaking compatibility with existing users.
47  * Users of the new field would check whether the size is large enough.
48  */
49  unsigned int handle_size;
50  void *elf_image;
51  void *toe_shadow;
53 
54 
64 struct spe_context
65  {
66  /*
67  * Note: The debugger accesses this data structure, and assumes
68  * it starts out with an spe_program_handle_t identifying the SPE
69  * executable running within this SPE thread. Everything below
70  * is private to libspe.
71  */
73  /*
74  * PRIVATE TO IMPLEMENTATION - DO NOT USE DIRECTLY
75  */
78 };
83 typedef struct spe_context * spe_context_ptr_t;
84 
95 {
96  /*
97  * PRIVATE TO IMPLEMENTATION - DO NOT USE DIRECTLY
98  */
100  struct spe_gang_context_event_priv * event_private;
101 };
107 
108 /*
109  * SPE stop information
110  * This structure is used to return all information available
111  * on the reason why an SPE program stopped execution.
112  * This information is important for some advanced programming
113  * patterns and/or detailed error reporting.
114  */
115 
118 typedef struct spe_stop_info {
119  unsigned int stop_reason;
120  union {
128  /* Reserved fields */
130  unsigned long long __reserved_u64;
131  } result;
134 
135 /*
136  * SPE event structure
137  * This structure is used for SPE event handling
138  */
139 
143 typedef union spe_event_data
144 {
145  void *ptr;
146  unsigned int u32;
147  unsigned long long u64;
149 
152 typedef struct spe_event_unit
153 {
154  unsigned int events;
155  spe_context_ptr_t spe;
158 
161 
162 
163 /*
164  *---------------------------------------------------------
165  *
166  * API symbolic constants
167  *
168  *---------------------------------------------------------
169  */
170 
172 
176 #define SPE_CFG_SIGNOTIFY1_OR 0x00000010
177 #define SPE_CFG_SIGNOTIFY2_OR 0x00000020
178 #define SPE_MAP_PS 0x00000040
179 #define SPE_ISOLATE 0x00000080
180 #define SPE_ISOLATE_EMULATE 0x00000100
181 #define SPE_EVENTS_ENABLE 0x00001000
182 #define SPE_AFFINITY_MEMORY 0x00002000
183 
184 
189 #define SPE_EXIT 1
190 #define SPE_STOP_AND_SIGNAL 2
191 #define SPE_RUNTIME_ERROR 3
192 #define SPE_RUNTIME_EXCEPTION 4
193 #define SPE_RUNTIME_FATAL 5
194 #define SPE_CALLBACK_ERROR 6
195 #define SPE_ISOLATION_ERROR 7
196 
200 #define SPE_SPU_STOPPED_BY_STOP 0x02 /* INTERNAL USE ONLY */
201 #define SPE_SPU_HALT 0x04
202 #define SPE_SPU_WAITING_ON_CHANNEL 0x08 /* INTERNAL USE ONLY */
203 #define SPE_SPU_SINGLE_STEP 0x10
204 #define SPE_SPU_INVALID_INSTR 0x20
205 #define SPE_SPU_INVALID_CHANNEL 0x40
206 
210 #define SPE_DMA_ALIGNMENT 0x0008
211 /* #define SPE_SPE_ERROR 0x0010 */
212 #define SPE_DMA_SEGMENTATION 0x0020
213 #define SPE_DMA_STORAGE 0x0040
214 #define SPE_INVALID_DMA 0x0800
215 
219 #define SIGSPE SIGURG
220 
224 #define SPE_EVENT_OUT_INTR_MBOX 0x00000001
225 #define SPE_EVENT_IN_MBOX 0x00000002
226 #define SPE_EVENT_TAG_GROUP 0x00000004
227 #define SPE_EVENT_SPE_STOPPED 0x00000008
228 
229 #define SPE_EVENT_ALL_EVENTS SPE_EVENT_OUT_INTR_MBOX | \
230  SPE_EVENT_IN_MBOX | \
231  SPE_EVENT_TAG_GROUP | \
232  SPE_EVENT_SPE_STOPPED
233 
237 #define SPE_MBOX_ALL_BLOCKING 1
238 #define SPE_MBOX_ANY_BLOCKING 2
239 #define SPE_MBOX_ANY_NONBLOCKING 3
240 
241 
245 #define SPE_TAG_ALL 1
246 #define SPE_TAG_ANY 2
247 #define SPE_TAG_IMMEDIATE 3
248 
249 
253 #define SPE_DEFAULT_ENTRY UINT_MAX
254 #define SPE_RUN_USER_REGS 0x00000001 /* 128b user data for r3-5. */
255 #define SPE_NO_CALLBACKS 0x00000002
256 
257 /*
258  *
259  */
260 #define SPE_CALLBACK_NEW 1
261 #define SPE_CALLBACK_UPDATE 2
262 
263 
264 
265 #define SPE_COUNT_PHYSICAL_CPU_NODES 1
266 #define SPE_COUNT_PHYSICAL_SPES 2
267 #define SPE_COUNT_USABLE_SPES 3
268 
272 #define SPE_SIG_NOTIFY_REG_1 0x0001
273 #define SPE_SIG_NOTIFY_REG_2 0x0002
274 
275 #ifdef __cplusplus
276 }
277 #endif
278 
279 #endif /*libspe2_types_h*/