view example/Simple/ppe/Twice.cc @ 1474:b158873485f6 draft

fix simple task
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 16 Jul 2012 11:01:40 +0900
parents ecf056ddd21a
children
line wrap: on
line source

#include <stdio.h>
#include "SchedTask.h"
#include "Twice.h"
#include "Func.h"

/* これは必須 */
SchedDefineTask1(Twice, twice_run);

static int
twice_run(SchedTask *s,void *rbuf, void *wbuf)
{
    int *i_data;
    int *o_data;
    long length;

    i_data = (int*)rbuf;
    o_data = (int*)wbuf;
    length = s->read_size()/sizeof(int);
    
    for (int i = 0; i < length; i++) {
	o_data[i] = i_data[i] * 2;
    }
    s->printf("PPE %d end\n",s->get_cpuid());
    
    return 0;
}