Files
2017-10-26 19:57:24 +02:00

133 lines
2.9 KiB
C
Executable File

#ifndef MOC_INTERNAL_CORE_PPU_H_
#define MOC_INTERNAL_CORE_PPU_H_
#include <stdint.h>
#include <libspe2.h>
#include <pthread.h>
#include "../imoc_core.h"
#include "../../ppu/moc.h"
/**
* \addtogroup internal_core
**/
//@{
/**
* @name PPU only
**/
//@{
/**
* Node-handle structure.
*
* \note PPU only
*
* Information each node knowns about himself and the world.
**/
typedef struct moc_node_handle_ppu_struct
{
uint8_t rank; /**< rank of node */
uint8_t comm_size; /**< number of overall processes */
uint8_t queue_size; /**< Size of a message-queue */
volatile moc_message_envelope_t* message_queue_base; /**< base-address of own message-queues */
volatile moc_message_status_t* status_array_base; /**< base-address of own message-status-array */
void* buffer_base; /**< base-address of own buffer */
uint32_t buffer_size; /**< size of own buffer */
volatile uint32_t* signal_area; /**< address of own signal-area */
volatile moc_process_t* moc_process_list; /**< list of all other MOC-processes
(index is rank of process) */
} moc_node_handle_ppu_t; /**< typedef of \ref moc_node_handle_ppu_struct */
/**
* Information each node knowns about himself and the world.
*
* \note PPU only
*
**/
moc_node_handle_ppu_t node_handle;
//@}
//@}
/**
* \addtogroup internal_spu_thread SPU-Thread Management
*
* \note PPU only
**/
//@{
/**
* SPU-Thread structure.
*
* \note PPU only
*
* Stores information about the SPU-Threads the managing PPU-Process
* needs to know.
**/
typedef struct moc_spu_thread_struct
{
uint8_t rank; /**< rank of SPU-thread */
pthread_t pthread; /**< PThread-handle <*/
spe_context_ptr_t speid; /**< SPE-Context */
spe_stop_info_t stop_info; /**< Error-Information */
uint32_t spe_entry_adress; /**< Spe-entry-address */
void *argp; /**< effective address of user-defined information
in main-memory */
void *envp; /**< Pointer to environment information */
void* buffer_base; /**< base-address of the SPU-Thread's buffer */
uint32_t buffer_size; /**< size of the SPU-Thread's buffer */
uint64_t ls_base; /**< Effective Basis-Address of SPU's local-storage */
uint32_t queue_base_in_ls; /**< Address of message-queue in SPU's local-storage */
uint32_t status_base_in_ls; /**< Address of status-array in SPU's local-storage */
} moc_spu_thread_t; /**< typedef of \ref moc_spu_thread_struct */
/**
* actual number of SPU-Threads.
*
* \note PPU only
**/
uint8_t moc_spu_thread_count;
/**
* actual number of PPU-Threads.
*
* \note PPU only
**/
uint8_t moc_ppu_thread_count;
/**
* init buffer size
**/
uint32_t moc_spu_buffer_size;
/**
* init message-queue size
**/
uint8_t moc_spu_queue_size;
/**
* array of SPU-Threads.
*
* \note PPU only
**/
moc_spu_thread_t moc_spu_thread_list[MOC_SPU_THREAD_MAX];
/**
* PThread-function for creating SPU-Threads
**/
void* moc_spe_pthread_func(void *arg);
//@}
#endif /*MOC_INTERNAL_CORE_PPU_H_*/