comparison src/video/ps3/SDL_ps3spe_c.h @ 3257:94fb40a4a9a7

Merged Martin's code changes from Google Summer of Code 2009
author Sam Lantinga <slouken@libsdl.org>
date Mon, 07 Sep 2009 04:51:29 +0000
parents
children f7b03b6838cb
comparison
equal deleted inserted replaced
3256:83c87f2b2aab 3257:94fb40a4a9a7
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2009 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21 */
22
23 /* This SPE API basically provides 3 ways to run and control a program
24 * on the SPE:
25 * - Start and stop the program (keepalive=0).
26 * SPE_Start() will implicitly boot up the program, create a thread and run
27 * the context.
28 * SPE_Stop() will join the (terminated) thread (may block) and return.
29 * - Boot the program and run it (keepalive=0).
30 * SPE_Boot() will create a context and load the program and finally start
31 * the context with SPE_Start().
32 * SPE_Stop() will savely end the program.
33 * - Boot, Run and send messages to the program (keepalive=1).
34 * Start the program by using one of the methods described above. When
35 * received the READY-message the program is in its infinite loop waiting
36 * for new messages.
37 * Every time you run the program, send SPU_START and the address of the
38 * according struct using SPE_SendMsg().
39 * SPE_WaitForMsg() will than wait for SPU_FIN and is blocking.
40 * SPE_Shutdown() sends SPU_EXIT and finally stops the program.
41 *
42 * Therefor the SPE program
43 * - either runs once and returns
44 * - or runs in an infinite loop and is controlled by messages.
45 */
46
47 #include "SDL_config.h"
48
49 #include "spulibs/spu_common.h"
50
51 #include <libspe2.h>
52
53 #ifndef _SDL_ps3spe_h
54 #define _SDL_ps3spe_h
55
56 /* SPU handling data */
57 typedef struct spu_data {
58 /* Context to be executed */
59 spe_context_ptr_t ctx;
60 spe_program_handle_t program;
61 /* Thread running the context */
62 pthread_t thread;
63 /* For debugging */
64 char * program_name;
65 /* SPE_Start() or SPE_Boot() called */
66 unsigned int booted;
67 /* Runs the program in an infinite loop? */
68 unsigned int keepalive;
69 unsigned int entry;
70 /* Exit code of the program */
71 int error_code;
72 /* Arguments passed to the program */
73 void * argp;
74 } spu_data_t;
75
76 /* SPU specific API functions */
77 int SPE_Start(spu_data_t * spe_data);
78 int SPE_Stop(spu_data_t * spe_data);
79 int SPE_Boot(spu_data_t * spe_data);
80 int SPE_Shutdown(spu_data_t * spe_data);
81 int SPE_SendMsg(spu_data_t * spe_data, unsigned int msg);
82 int SPE_WaitForMsg(spu_data_t * spe_data, unsigned int msg);
83 void SPE_RunContext(void *thread_argp);
84
85 #endif /* _SDL_ps3spe_h */
86
87 /* vi: set ts=4 sw=4 expandtab: */