-
Notifications
You must be signed in to change notification settings - Fork 0
/
somador1.c
50 lines (44 loc) · 1.12 KB
/
somador1.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
// FEATURE_CLUSTER
#include "gap_cluster.h"
#include "gap_dmamchan.h"
#include <stdlib.h>
#include <time.h>
#define CORE_NUMBER 8
int soma=0;
//srand(time(NULL));
void Soma(int *data) {
#include <time.h>
for (int i=0;i<
int a=rand();
srand(a);
int microsoma=0;
//printf("Hello World from cluster core %d!\n", __core_ID());
microsoma+=rand()%10*__core_ID();
printf("a soma no core %d sera %d\n",__core_ID(), microsoma);
EU_MutexLock(0);
soma+=microsoma;
EU_MutexUnlock(0);
}
void Master_Entry(void *arg) {
CLUSTER_CoresFork(Soma, arg);
}
int main()
{
printf("Fabric controller code execution for mbed_os Cluster Power On test\n");
/* Cluster Start - Power on */
CLUSTER_Start(0, CORE_NUMBER);
/* FC send a task to Cluster */
CLUSTER_SendTask(0, Master_Entry, 0, 0);
/* Cluster Stop - Power down */
CLUSTER_Stop(0);
printf("o valor total da soma eh: %d\n",soma);
/* Check read values */
int error = 0;
if (error) printf("Test failed with %d errors\n", error);
else printf("Test success\n");
#ifdef JENKINS_TEST_FLAG
exit(error);
#else
return error;
#endif
}