diff src/video/ps3/SDL_ps3spe.c @ 3150:0cf7bff804ad gsoc2009_ps3

Code reviewed and added SPE API documentation.
author Martin Lowinski <martin@goldtopf.org>
date Sun, 19 Jul 2009 11:31:47 +0000
parents 0d8d1f870964
children cce01ba54174
line wrap: on
line diff
--- a/src/video/ps3/SDL_ps3spe.c	Sun Jun 21 03:55:21 2009 +0000
+++ b/src/video/ps3/SDL_ps3spe.c	Sun Jul 19 11:31:47 2009 +0000
@@ -28,6 +28,30 @@
 #include "SDL_ps3render_c.h"
 
 
+/* This SPE API basically provides 3 ways to run and control a program
+ * on the SPE:
+ * - Start and stop the program (keepalive=0).
+ *   SPE_Start() will implicitly boot up the program, create a thread and run
+ *   the context.
+ *   SPE_Stop() will join the (terminated) thread (may block) and return.
+ * - Boot the program and run it (keepalive=0).
+ *   SPE_Boot() will create a context and load the program and finally start
+ *   the context with SPE_Start().
+ *   SPE_Stop() will savely end the program.
+ * - Boot, Run and send messages to the program (keepalive=1).
+ *   Start the program by using one of the methods described above. When
+ *   received the READY-message the program is in its infinite loop waiting
+ *   for new messages.
+ *   Every time you run the program, send SPU_START and the address of the
+ *   according struct using SPE_SendMsg().
+ *   SPE_WaitForMsg() will than wait for SPU_FIN and is blocking.
+ *   SPE_Shutdown() sends SPU_EXIT and finally stops the program.
+ *
+ * Therefor the SPE program
+ * - either runs once and returns
+ * - or runs in an infinite loop and is controlled by messages.
+ */
+
 /* Start the SPE thread */
 int SPE_Start(spu_data_t * spe_data)
 {
@@ -146,11 +170,11 @@
 
 /* Re-runnable invocation of the spe_context_run call */
 void SPE_RunContext(void *thread_argp)
-{ 
+{
   /* argp is the pointer to argument to be passed to the SPE program */
   spu_data_t *args = (spu_data_t *) thread_argp;
   deprintf(3, "[PS3->SPU] void* argp=0x%x\n", (unsigned int)args->argp);
-  
+
   /* Run it.. */
   deprintf(2, "[PS3->SPU] Run SPE program: %s\n", args->program_name);
   if (spe_context_run