libspe2 0.9a
|
00001 /* 00002 * libspe2 - A wrapper library to adapt the JSRE SPU usage model to SPUFS 00003 * Copyright (C) 2005 IBM Corp. 00004 * 00005 * This library is free software; you can redistribute it and/or modify it 00006 * under the terms of the GNU Lesser General Public License as published by 00007 * the Free Software Foundation; either version 2.1 of the License, 00008 * or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00013 * License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public License 00016 * along with this library; if not, write to the Free Software Foundation, 00017 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00020 00021 00022 #ifndef _SPEEVENT_H_ 00023 #define _SPEEVENT_H_ 00024 00025 #include "spebase.h" 00026 00027 /* private constants */ 00028 enum __spe_event_types { 00029 __SPE_EVENT_OUT_INTR_MBOX, __SPE_EVENT_IN_MBOX, 00030 __SPE_EVENT_TAG_GROUP, __SPE_EVENT_SPE_STOPPED, 00031 __NUM_SPE_EVENT_TYPES 00032 }; 00033 00034 /* private types */ 00035 typedef struct spe_context_event_priv 00036 { 00037 pthread_mutex_t lock; 00038 pthread_mutex_t stop_event_read_lock; 00039 int stop_event_pipe[2]; 00040 spe_event_unit_t events[__NUM_SPE_EVENT_TYPES]; 00041 } spe_context_event_priv_t, *spe_context_event_priv_ptr_t; 00042 00043 00044 int _event_spe_stop_info_read (spe_context_ptr_t spe, spe_stop_info_t *stopinfo); 00045 00046 /* 00047 * spe_event_handler_create 00048 */ 00049 00050 spe_event_handler_ptr_t _event_spe_event_handler_create(void); 00051 00052 /* 00053 * spe_event_handler_destroy 00054 */ 00055 00056 int _event_spe_event_handler_destroy (spe_event_handler_ptr_t evhandler); 00057 00058 /* 00059 * spe_event_handler_register 00060 */ 00061 00062 int _event_spe_event_handler_register(spe_event_handler_ptr_t evhandler, spe_event_unit_t *event); 00063 00064 /* 00065 * spe_event_handler_deregister 00066 */ 00067 00068 int _event_spe_event_handler_deregister(spe_event_handler_ptr_t evhandler, spe_event_unit_t *event); 00069 00070 /* 00071 * spe_event_wait 00072 */ 00073 00074 int _event_spe_event_wait(spe_event_handler_ptr_t evhandler, spe_event_unit_t *events, int max_events, int timeout); 00075 00076 int _event_spe_context_finalize(spe_context_ptr_t spe); 00077 00078 struct spe_context_event_priv * _event_spe_context_initialize(spe_context_ptr_t spe); 00079 00080 int _event_spe_context_run (spe_context_ptr_t spe, unsigned int *entry, unsigned int runflags, void *argp, void *envp, spe_stop_info_t *stopinfo); 00081 00082 void _event_spe_context_lock(spe_context_ptr_t spe); 00083 void _event_spe_context_unlock(spe_context_ptr_t spe); 00084 00085 #endif /*SPEEVENT_H_*/