00001 /* -*- coding:utf-8 -*- 00002 Copyright (c) 2009, Fixstars Corporation 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without modification, 00006 are permitted provided that the following conditions are met: 00007 00008 * Redistributions of source code must retain the above copyright notice, 00009 this list of conditions and the following disclaimer. 00010 00011 * Redistributions in binary form must reproduce the above copyright notice, 00012 this list of conditions and the following disclaimer in the documentation 00013 and/or other materials provided with the distribution. 00014 00015 * Neither the name of Fixstars Corporation nor the names of its contributors 00016 may be used to endorse or promote products derived from this software 00017 without specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00022 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 00023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00024 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00025 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00026 AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00027 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00028 THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 */ 00030 00036 #ifndef CTRUMP_RUNTIME_CTRUMP_LIBSPE2_H 00037 #define CTRUMP_RUNTIME_CTRUMP_LIBSPE2_H 00038 00039 #include <libspe2.h> 00040 #include <pthread.h> 00041 #include "ctrump/common/dll.h" 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif 00046 00050 struct ctrump_runtime_spe_context { 00051 pthread_t thread; 00052 int dir_fd; 00053 spe_context_ptr_t spe_context; 00054 int enable_debugger; 00055 }; 00056 00057 00058 CTRUMP_EXTDEF extern struct ctrump_runtime_spe_context ctrump_runtime_spes[16]; 00059 CTRUMP_EXTDEF extern int ctrump_spe_num; 00060 00065 CTRUMP_EXTDEF void ctrump_runtime_initialize(int num_spe); 00066 00070 CTRUMP_EXTDEF void ctrump_runtime_finalize(void); 00071 00077 CTRUMP_EXTDEF void ctrump_runtime_spe_start(spe_context_ptr_t spe, void *param); 00078 00084 CTRUMP_EXTDEF void ctrump_runtime_spe_program_load(spe_context_ptr_t spe, const spe_program_handle_t *prog); 00085 00090 CTRUMP_EXTDEF void ctrump_runtime_spe_wait(spe_context_ptr_t spe); 00091 00097 CTRUMP_EXTDEF void ctrump_runtime_append_spe(spe_context_ptr_t spe, int enable_debugger); 00098 00103 CTRUMP_EXTDEF void ctrump_runtime_remove_spe(spe_context_ptr_t spe); 00104 00105 #ifdef __cplusplus 00106 } 00107 #endif 00108 00109 #endif