Mercurial > hg > Game > Cerium
view example/add/main.cc @ 1592:afcb4a3f3526 draft
merge
author | Masa <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 01 Apr 2013 18:00:35 +0900 |
parents | f71632373220 |
children | 4401690b4513 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "TaskManager.h" #include "Func.h" extern void task_init(void); static int task = 1; const char *usr_help_str = "Usage: ./add \n"; void TMend(TaskManager *); float A,B,C; static void print_result() { printf("---\n"); printf("%f + %f = %f \n",A,B,C); printf("---\n"); } void add_init(TaskManager *manager) { HTask *add; A=1.1f, B=2.2f; /** * Create Task * create_task(Task ID); */ add = manager->create_task(ADD_TASK); add->set_cpu(SPE_ANY); /** * Set of Input Data * add_inData(address of input data, size of input data); */ add->set_inData(0,(memaddr)&A, sizeof(float)); add->set_inData(1,(memaddr)&B, sizeof(float)); /** * Set of OutPut area * add_outData(address of output area, size of output area); */ add->set_outData(0,(memaddr)&C, sizeof(float)); /** * Set 32bits parameter * add_param(32bit parameter); */ // add Active Queue add->spawn(); } int TMmain(TaskManager *manager,int argc, char *argv[]) { // Task Register // ppe/task_init.cc task_init(); for (int i = 0; i < task; ++i) { add_init(manager); } manager->set_TMend(TMend); return 0; } void TMend(TaskManager *manager) { print_result(); }