view example/mainMem/spe/Hello.cc @ 312:1db2b3dc6a5a draft

memMain tester
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 08 Jun 2009 23:19:11 +0900
parents
children 25dfa7499162
line wrap: on
line source

#include <stdio.h>
#include "Hello.h"
#include "Func.h"

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

#define PP_STORE 3
#define SIZE (4096*sizeof(int))

int
Hello::run(void *rbuf, void *wbuf)
{
    int task_id = get_param(0);
    int *ptr = smanager->allocate(SIZE);

    smanager->mainMem_alloc(0, sizeof(PolygonPack));

    int i;
    for(i=0;i<4096;i++) {
	ptr[i] = i;
    }

    smanager->mainMem_wait();
    void *next = (void *)smanager->mainMem_get(0);

    smanager->dma_wait(PP_STORE);
    smanager->dma_store(ptr, (uint32)next,
		SIZE, PP_STORE);


    printf("[%d] Main Mem %0x len %d\n", task_id, (int*)next,SIZE);

    return 0;
}