main.c
3.93 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#include <os.h>
#include <rmon.h>
#include "corefunc.h"
char bootStack[STACKSIZE];
static void idle(void *);
static void main(void *);
static OSThread idleThread;
static char idleThreadStack[STACKSIZE];
static OSThread mainThread;
static char mainThreadStack[STACKSIZE];
static OSThread rmonThread;
static char rmonThreadStack[RMON_STACKSIZE];
boot(void)
{
osInitialize();
osCreateThread(&idleThread, 1, idle, (void *)0,
idleThreadStack+STACKSIZE, 10);
osStartThread(&idleThread);
}
static void
idle(void *arg)
{
/*
* Create rmon thread
*/
osCreateThread(&rmonThread, 0, rmonMain, (void *)0,
rmonThreadStack+RMON_STACKSIZE, OS_PRIORITY_RMON);
osStartThread(&rmonThread);
/*
* Create main thread
*/
osCreateThread(&mainThread, 2, main, (void *)0,
mainThreadStack+STACKSIZE, 10);
osStartThread(&mainThread);
/*
* Go dormant
*/
osSetThreadPri(NULL, 0);
for (;;);
}
static void
main(void *arg)
{
int totalFailures = 0;
/*
* Tests are ordered so that succeeding tests
* use functionality verified by preceding tests.
*/
osSyncPrintf("mesg0\n");
totalFailures += mesg0(); /* non blocking message passing */
osSyncPrintf("thread0\n");
totalFailures += thread0(); /* thread creation */
osSyncPrintf("mesg1\n");
totalFailures += mesg1(); /* blocking message receives */
osSyncPrintf("mesg2\n");
totalFailures += mesg2(); /* blocking message sends */
osSyncPrintf("thread1\n");
totalFailures += thread1(); /* stop runnable threads */
osSyncPrintf("thread2\n");
totalFailures += thread2(); /* destroy runnable threads */
osSyncPrintf("thread3\n");
totalFailures += thread3(); /* set priority of runnable threads */
osSyncPrintf("mesg3\n");
totalFailures += mesg3(); /* message/priority interaction */
osSyncPrintf("int0\n");
totalFailures += int0(); /* nonblocking interrupt messages */
osSyncPrintf("int1\n");
totalFailures += int1(); /* blocking interrupt messages */
osSyncPrintf("thread4\n");
totalFailures += thread4(); /* context switching */
osSyncPrintf("int2\n");
totalFailures += int2(); /* multiple pending interrupts */
osSyncPrintf("event0\n");
totalFailures += event0(); /* break event messages */
osSyncPrintf("mesg4\n");
totalFailures += mesg4(); /* non blocking message jamming */
osSyncPrintf("mesg5\n");
totalFailures += mesg5(); /* blocking message receives (w/jam) */
osSyncPrintf("mesg6\n");
totalFailures += mesg6(); /* blocking message jams */
osSyncPrintf("thread5\n");
totalFailures += thread5(); /* stop waiting threads */
osSyncPrintf("thread6\n");
totalFailures += thread6(); /* destroy waiting threads */
osSyncPrintf("thread7\n");
totalFailures += thread7(); /* set priority of waiting threads */
osSyncPrintf("thread8\n");
totalFailures += thread8(); /* destroy stopped threads */
osSyncPrintf("thread9\n");
totalFailures += thread9(); /* set priority of stopped threads */
osSyncPrintf("tlb0\n");
totalFailures += tlb0(); /* TLB functionality - all indexes */
osSyncPrintf("tlb1\n");
totalFailures += tlb1(); /* TLB functionality - ASIDS */
osSyncPrintf("int3\n");
totalFailures += int3(); /* rcp interrupt messages */
osSyncPrintf("int4\n");
totalFailures += int4(); /* multiple rcp interrupts */
osSyncPrintf("bitfll\n");
totalFailures += bitfll(); /* long long operations */
osSyncPrintf("cconst\n");
totalFailures += cconst(); /* long long operations */
osSyncPrintf("lltest\n");
totalFailures += lltest(); /* long long operations */
osSyncPrintf("longlong\n");
totalFailures += longlong(); /* long long operations */
osSyncPrintf("div\n");
totalFailures += div(); /* long long operations */
osSyncPrintf("corefunc: total number of failures: %d\n", totalFailures);
}