libspe2 0.9a
libspe2.h
Go to the documentation of this file.
00001 /*
00002  * SPE Runtime Management Library, Version 2.0
00003  * This library constitutes the standardized low-level application 
00004  * programming interface for application access to the Cell Broadband 
00005  * Engineís Synergistic Processing Elements (SPEs).
00006  * 
00007  * The usage of this library requires that the application programmer 
00008  * is familiar with the CBE architecture as described in ìCell 
00009  * Broadband Engine Architecture, Version 1.0î.
00010  * 
00011  * Copyright (C) 2006 IBM Corp. 
00012  *
00013  * This library is free software; you can redistribute it and/or modify it
00014  * under the terms of the GNU Lesser General Public License as published by 
00015  * the Free Software Foundation; either version 2.1 of the License, 
00016  * or (at your option) any later version.
00017  *
00018  *  This library is distributed in the hope that it will be useful, but 
00019  *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
00020  *  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
00021  *  License for more details.
00022  *
00023  *   You should have received a copy of the GNU Lesser General Public License 
00024  *   along with this library; if not, write to the Free Software Foundation, 
00025  *   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00026  */
00027  /* 
00028   * libspe2.h contains the public API funtions
00029   */
00030 
00031 #ifndef libspe2_h
00032 #define libspe2_h
00033 
00034 #ifdef __cplusplus
00035 extern "C"
00036 {
00037 #endif
00038 
00039 #include <errno.h>
00040 #include <stdio.h>
00041 
00042 /*
00043  * GLOBAL SYMBOLS AND STRUCTURES
00044  * libspe2-types header file
00045  */
00046 #include "libspe2-types.h"
00047 
00048 
00049 /*
00050  *---------------------------------------------------------
00051  * 
00052  * API functions
00053  * 
00054  *---------------------------------------------------------
00055  */
00056 
00057 /*
00058  * spe_context_create
00059  */
00060 spe_context_ptr_t spe_context_create(unsigned int flags, spe_gang_context_ptr_t gang);
00061 
00062 /*
00063  * spe_context_create_affinity
00064  */
00065 spe_context_ptr_t spe_context_create_affinity(unsigned int flags, spe_context_ptr_t affinity_neighbor, spe_gang_context_ptr_t gang);
00066 
00067 /*
00068  * spe_context_destroy
00069  */
00070 int spe_context_destroy (spe_context_ptr_t spe);
00071 
00072 /*
00073  * spe_gang_context_create
00074  */
00075 spe_gang_context_ptr_t spe_gang_context_create (unsigned int flags);
00076 
00077 /*
00078  * spe_gang_context_destroy
00079  */
00080 int spe_gang_context_destroy (spe_gang_context_ptr_t gang);
00081 
00082 /*
00083  * spe_image_open
00084  */
00085 spe_program_handle_t * spe_image_open (const char *filename);
00086 
00087 /*
00088  * spe_image_close
00089  */
00090 int spe_image_close (spe_program_handle_t *program);
00091 
00092 /*
00093  * spe_load_program
00094  */
00095 int spe_program_load (spe_context_ptr_t spe, spe_program_handle_t *program);
00096 
00097 /*
00098  * spe_context_run
00099  */
00100 int spe_context_run     (spe_context_ptr_t spe, unsigned int *entry, unsigned int runflags, void *argp, void *envp, spe_stop_info_t *stopinfo);
00101 
00102 /*
00103  * spe_stop_info_read
00104  */
00105 int spe_stop_info_read (spe_context_ptr_t spe, spe_stop_info_t *stopinfo);
00106 
00107 /* 
00108  * spe_event_handler_create
00109  */
00110 spe_event_handler_ptr_t spe_event_handler_create(void);
00111 
00112 /*
00113  * spe_event_handler_destroy
00114  */
00115 int spe_event_handler_destroy (spe_event_handler_ptr_t evhandler);
00116 
00117 /*
00118  * spe_event_handler_register
00119  */
00120 int spe_event_handler_register(spe_event_handler_ptr_t evhandler, spe_event_unit_t *event);
00121 
00122 /*
00123  * spe_event_handler_deregister
00124  */
00125 int spe_event_handler_deregister(spe_event_handler_ptr_t evhandler, spe_event_unit_t *event);
00126 
00127 /*
00128  * spe_event_wait
00129  */
00130 int spe_event_wait(spe_event_handler_ptr_t evhandler, spe_event_unit_t *events, int max_events, int timeout);
00131 
00132 /* 
00133  * MFCIO Proxy Commands
00134  */
00135 int spe_mfcio_put (spe_context_ptr_t spe, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid);
00136 
00137 int spe_mfcio_putb (spe_context_ptr_t spe, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid);
00138 
00139 int spe_mfcio_putf (spe_context_ptr_t spe, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid);
00140 
00141 int spe_mfcio_get (spe_context_ptr_t spe, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid);
00142 
00143 int spe_mfcio_getb (spe_context_ptr_t spe, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid);
00144 
00145 int spe_mfcio_getf (spe_context_ptr_t spe, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid);
00146 
00147 /*
00148  * MFCIO Tag Group Completion
00149  */
00150 int spe_mfcio_tag_status_read(spe_context_ptr_t spe, unsigned int mask, unsigned int behavior, unsigned int *tag_status);
00151 
00152 /*
00153  * SPE Mailbox Facility
00154  */ 
00155 int spe_out_mbox_read (spe_context_ptr_t spe, unsigned int *mbox_data, int count);
00156 
00157 int spe_out_mbox_status (spe_context_ptr_t spe);
00158 
00159 int spe_in_mbox_write (spe_context_ptr_t spe, unsigned int *mbox_data, int count, unsigned int behavior);
00160 
00161 int spe_in_mbox_status (spe_context_ptr_t spe);
00162 
00163 int spe_out_intr_mbox_read (spe_context_ptr_t spe, unsigned int *mbox_data, int count, unsigned int behavior);
00164 
00165 int spe_out_intr_mbox_status (spe_context_ptr_t spe);
00166 
00167 /*
00168  * Multisource Sync Facility
00169  */
00170 int spe_mssync_start(spe_context_ptr_t spe);
00171 
00172 int spe_mssync_status(spe_context_ptr_t spe);
00173 
00174 /*
00175  * SPU SIgnal Notification Facility
00176  */
00177 int spe_signal_write (spe_context_ptr_t spe, unsigned int signal_reg, unsigned int data);
00178 
00179 /*
00180  * spe_ls_area_get
00181  */
00182 void * spe_ls_area_get (spe_context_ptr_t spe);
00183 
00184 /*
00185  * spe_ls_size_get
00186  */
00187 int spe_ls_size_get (spe_context_ptr_t spe);
00188 
00189 /*
00190  * spe_ps_area_get
00191  */
00192 void * spe_ps_area_get (spe_context_ptr_t spe, enum ps_area area);
00193 
00194 /*
00195  * spe_callback_handler_register
00196  */
00197 int spe_callback_handler_register (void *handler, unsigned int callnum, unsigned int mode);
00198 
00199 /*
00200  * spe_callback_handler_deregister
00201  */
00202 int spe_callback_handler_deregister (unsigned int callnum);
00203 
00204 /*
00205  * spe_callback_handler_query
00206  */
00207 void * spe_callback_handler_query(unsigned int callnum);
00208 
00209 /*
00210  * spe_info_get
00211  */
00212 int spe_cpu_info_get(int info_requested, int cpu_node); 
00213 
00214 
00215 #ifdef __cplusplus
00216 }
00217 #endif
00218 
00219 
00220 #endif /*libspe2_h*/