view example/share_task/ppe/Load.cc @ 354:81b25e5d5379

add example/get_segment and change spe/DrawSpan.cpp
author koba
date Wed, 15 Jul 2009 17:39:51 +0900
parents 5c194c71eca8
children 44c0bce54dcf
line wrap: on
line source

#include <stdio.h>
#include <string.h>
#include "Load.h"
#include "Func.h"

/* これは必須 */
SchedDefineTask(Load);

int
Load::run(void *rbuf, void *wbuf)
{
    int *idata = (int*)get_input(rbuf, 0);
    int *odata = (int*)global_get(DATA_ID);
    int length = get_param(0);

    // SPU LS 内に領域確保し、データをコピー
    odata = (int*)global_alloc(DATA_ID, sizeof(int)*length);
    memcpy(odata, idata, sizeof(int)*length);

    printf("[TASK_LOAD]    ");
    for (int i = 0; i < length; i++) {
	printf("%03d ", idata[i]);
    }
    printf("\n");

    return 0;
}