forked from RipleyTom/SpuTest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_block.c
71 lines (60 loc) · 1.69 KB
/
test_block.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cell/spurs.h>
#include <cell/atomic.h>
#include "spurs_helpers.h"
#include "globals.h"
#define NUM_SPU 6
unsigned char bigbuf[128] __attribute__((aligned(128)));
int test_block(CellSpurs2 *spurs2, const CellSpursTaskBinInfo *program)
{
int ret;
CellSpursTaskset2 *taskset;
ret = initialize_taskset(spurs2, &taskset, (uint64_t)bigbuf);
if (ret != 0)
{
printf("Error initializing taskset: 0x%x\n", ret);
return ret;
}
CellSpursTaskId tids[NUM_SPU];
CellSpursTaskArgument args[NUM_SPU];
void *ctx[NUM_SPU];
for (int index = 0; index < NUM_SPU; index++)
{
ctx[index] = memalign(128, program->sizeContext);
for (int subdex = 0; subdex < 4; subdex++)
{
args[index].u32[subdex] = (index * 10000000) + subdex;
}
ret = cellSpursCreateTask2WithBinInfo(taskset, &tids[index], program, &args[index], ctx[index], NULL, NULL);
if (ret != 0)
{
printf("Error cellSpursCreateTask2WithBinInfo: 0x%x\n", ret);
return ret;
}
}
int exit_code;
for (int index = 0; index < NUM_SPU; index++)
{
ret = cellSpursJoinTask2(taskset, tids[index], &exit_code);
if (ret != 0)
{
printf("Error cellSpursJoinTask2: 0x%x\n", ret);
return ret;
}
free(ctx[index]);
}
if (verbose)
{
printf("BigBuf:");
for (int index = 0; index < 128; index++)
{
printf("%02X", bigbuf[index]);
if ((index % 16) == 0)
printf("\n");
}
}
free_taskset(taskset);
return 0;
}