Permalink
Browse files

The SPU thread example is now fully functional.

  • Loading branch information...
zerkman committed Jan 10, 2011
1 parent b5a322c commit 5c883304989834dac4cea785a96cab09ff743ddb
Showing with 13 additions and 5 deletions.
  1. +0 −5 samples/spudma/source/main.c
  2. +6 −0 samples/spudma/spu/source/main.c
  3. +7 −0 samples/spudma/spu/source/spu_thread_exit.S
@@ -61,11 +61,6 @@ int main(int argc, const char* argv[])
printf("Waiting for SPU to return...\n");
while (ret == 0);
-
-
- printf("Terminating SPU thread group... ");
- printf("%08x\n", lv2SpuThreadGroupTerminate(group_id, 42));
-
printf("Joining SPU thread group... ");
printf("%08x\n", lv2SpuThreadGroupJoin(group_id, &cause, &status));
printf("cause=%d status=%d\n", cause, status);
@@ -3,6 +3,8 @@
#define TAG 1
+extern void spu_thread_exit(uint32_t);
+
/* wait for dma transfer to be finished */
static void wait_for_completion(void) {
mfc_write_tag_mask(1<<TAG);
@@ -23,6 +25,8 @@ int main(uint64_t ea, uint64_t outptr, uint64_t arg3, uint64_t arg4)
/* for all small characters, we remove 0x20 to get the corresponding capital*/
vec_uchar16 sub = spu_splats((unsigned char)0x20) & cmp;
+
+ /* convert all small characters to capitals */
v = v - sub;
/* send the updated vector to ppe */
@@ -34,5 +38,7 @@ int main(uint64_t ea, uint64_t outptr, uint64_t arg3, uint64_t arg4)
mfc_put(&ok, outptr, 4, TAG, 0, 0);
wait_for_completion();
+ /* properly exit the thread */
+ spu_thread_exit(0);
return 0;
}
@@ -0,0 +1,7 @@
+ .globl spu_thread_exit
+
+spu_thread_exit:
+ wrch $ch28,$3
+ stop 0x102
+ bi $0
+ lnop

0 comments on commit 5c88330

Please sign in to comment.