00001 #include <malloc_align.h> 00002 #include <free_align.h> 00003 #include <stdlib.h> 00004 #include <string.h> 00005 00006 #include <moc.h> 00007 #include <ppu/moc.h> 00008 #include <internal/imoc.h> 00009 #include <internal/ppu/imoc_core_ppu.h> 00010 00011 int MOC_Add_spu_thread(spe_program_handle_t* phandle, void* argp) 00012 { 00013 if (moc_spu_thread_count >= MOC_SPU_THREAD_MAX) 00014 { 00015 return MOC_ERR_BUFFER_OVERFLOW; 00016 } 00017 /* create the SPE context */ 00018 if ((moc_spu_thread_list[moc_spu_thread_count].speid = spe_context_create( 00019 SPE_MAP_PS, NULL)) == NULL) 00020 { 00021 return MOC_ERR_INTERN; 00022 } 00023 /* load the SPE program into the SPE context */ 00024 if (spe_program_load(moc_spu_thread_list[moc_spu_thread_count].speid, 00025 phandle) != 0) 00026 { 00027 return MOC_ERR_INTERN; 00028 } 00029 /* write thread data into thread-array */ 00030 moc_spu_thread_list[moc_spu_thread_count].spe_entry_adress 00031 = SPE_DEFAULT_ENTRY; 00032 moc_spu_thread_list[moc_spu_thread_count].argp = argp; 00033 moc_spu_thread_count++; 00034 return 0; 00035 } 00036
1.5.6