00001 #ifndef MOC_H_PPU 00002 #define MOC_H_PPU 00003 00004 00005 #include "moc_dma_ppu.h" 00006 #include "moc_datatype_ppu.h" 00007 #include "../moc.h" 00008 00009 #include <stdint.h> 00010 #include <libspe2.h> 00011 00012 00013 00014 /** 00015 * Maximum number of possible SPU-threads. 00016 **/ 00017 #define MOC_SPU_THREAD_MAX 8 00018 00019 00020 00021 00022 00023 /** 00024 * \addtogroup environment_startup 00025 **/ 00026 //@{ 00027 /** 00028 * @name PPU-only 00029 **/ 00030 //@{ 00031 00032 /** 00033 * Returns the number of available SPUs. 00034 * 00035 * \attention PPU-only 00036 * 00037 * \note Must be called before \ref MOC_Init 00038 * 00039 * \note This function should return the count of free SPUs. But this 00040 * doesn't really works. To get the available SPU-count the 00041 * function spe_cpu_info_get() from libspe2 with 00042 * SPE_COUNT_USABLE_SPES-flag is used. However this function can only 00043 * detect if a SPU-thread is used by the calling function. There seems 00044 * to be no means to detect SPU-thread used by other applications. 00045 * 00046 * 00047 * \param count \b out number of available SPUs 00048 * \retval MOC_SUCCESS No error; MPI routine completed successfully. 00049 * \retval ... error-code 00050 **/ 00051 int MOC_Get_avail_spu_count(int* count); 00052 00053 /** 00054 * Returns the number of SPUs. 00055 * 00056 * \attention PPU-only 00057 * 00058 * \note Must be called before \ref MOC_Init 00059 * 00060 * \param count \b out SPU-count 00061 * \retval MOC_SUCCESS No error; MPI routine completed successfully. 00062 * \retval ... error-code 00063 **/ 00064 int MOC_Get_max_spu_count(int* count); 00065 00066 /** 00067 * Adds a SPU-Thread. 00068 * 00069 * \attention PPU-only 00070 * 00071 * \note Must be called before calling \ref MOC_Init 00072 * 00073 * \note The order of executions defines the order of the ranks of the SPU-Threads 00074 * 00075 * \param phandle \b in Handle of the SPE-Program 00076 * \param argp \b in Pointer to some user-defined information in the main-memory 00077 * \retval MOC_SUCCESS No error; MPI routine completed successfully. 00078 * \retval MOC_ERR_BUFFER_OVERFLOW A Buffer-Overflow occured. Mosst likely you tried to add more 00079 * SPU-threads than defined by \ref MOC_SPU_THREAD_MAX. 00080 * \retval MOC_ERR_INTERN Internal Error 00081 **/ 00082 int MOC_Add_spu_thread ( spe_program_handle_t* phandle, void* argp ); 00083 00084 /** 00085 * Sets the size of the buffer used for buffered communication. 00086 * 00087 * \attention PPU-only 00088 * 00089 * \note Must be called before \ref MOC_Init 00090 * 00091 * \param size buffer-size 00092 * \return 0 if success, otherwise error-code 00093 **/ 00094 int MOC_Set_buffer_size ( uint32_t size ); 00095 00096 /** 00097 * Sets the size of the message-queues. 00098 * 00099 * \attention PPU-only 00100 * 00101 * \note Must be called before \ref MOC_Init 00102 * 00103 * \param size queue-size 00104 * \return 0 if success, otherwise error-code 00105 **/ 00106 int MOC_Set_queue_size ( uint8_t size ); 00107 00108 /** 00109 * Initialize the MPI execution environment. 00110 * 00111 * \attention PPU-only function 00112 * 00113 * \note All processes must call this routine before executing any MOC-routine. 00114 * 00115 * \param argc \b in Pointer to the number of arguments 00116 * \param argv \b in Pointer to the argument vector 00117 * \retval MOC_SUCCESS No error; MPI routine completed successfully. 00118 * \retval MOC_ERR_NO_MEMORY Insufficient Memory. 00119 * \retval MOC_ERR_INTERN Internal Error 00120 **/ 00121 int MOC_Init ( int *argc, char ***argv ); 00122 00123 //@} 00124 //@} 00125 00126 00127 00128 #endif /*MOC_H_*/ 00129
1.5.6