tools.h File Reference

#include <libspe2.h>
#include <stdint.h>

Go to the source code of this file.

Typedefs

typedef struct spe_handle spe_handle_t
 Handle for internal SPE context.

Functions

spe_handle_tinit_spes (spe_program_handle_t *program, uint8_t spe_threads, void *globals, uint16_t globals_size, void *locals, uint16_t locals_size)
 Initialize SPEs.
void start_spes (spe_handle_t *handle)
 Start SPE threads.
void join_spes (spe_handle_t *handle)
 Wait until all SPEs have finished.
void free_spes (spe_handle_t *handle)
 Release resources required for the SPEs.


Detailed Description

Author:
Ruben Niederhagen (ruben@polycephaly.org)

Definition in file ppu/tools.h.


Function Documentation

void free_spes ( spe_handle_t handle  ) 

Release resources required for the SPEs.

Frees all allocated data structures associated with the given handle.

The SPE threads should have finished before their resources are freed. Use join_spes() to wait for running SPE threads.

Parameters:
handle The handle to the SPEs whose resources are to be freed.

spe_handle_t* init_spes ( spe_program_handle_t *  program,
uint8_t  spe_threads,
void *  globals,
uint16_t  globals_size,
void *  locals,
uint16_t  locals_size 
)

Initialize SPEs.

This function initializes a number of SPEs. Global as well as individual parameters can be transfered to the SPEs automatically.

SPEs are only initialized but not yet started.

Parameters:
program Program handle of the SPE binary.
spe_threads Number of SPE threads to be started.
globals This data is passed to all SPEs. It must have correct DMA alignment and size.
globals_size Size of global data (globals).
locals Pointer to an array that contains #spe_threads data elements to be passed to each SPE. Data must be aligned properly in a 16byte grid; to achieve this, the size of each data element should be a multiple of 16.
locals_size Size of one private data element (not the size of the list...).
Returns:
A handle for the created SPE threads.

void join_spes ( spe_handle_t handle  ) 

Wait until all SPEs have finished.

This method pauses execution until all SPE threads have finished. The threads should have been started via start_spes() before.

Parameters:
handle The handle to the SPEs which are to be waited for.

void start_spes ( spe_handle_t handle  ) 

Start SPE threads.

Start a set of SPESs previously initialized via init_spes().

This method is non-blocking! Use join_spes() to wait until all SPE threads have finished.

Parameters:
handle The handle to the SPEs which are to be started.


Generated on Fri Aug 8 14:53:26 2008 for Iolaos by  doxygen 1.5.5