boot.c
2.09 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
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: boot.c,v $
$Revision: 1.2 $
$Date: 2003/04/15 21:44:11 $
*---------------------------------------------------------------------*/
#include <os.h>
#include <ultra64.h>
#include <string.h>
#ifdef __sgi__
#include <bstring.h>
#endif
/*
#include <setjmp.h>
*/
#include "os_internal.h"
#include "cpu.h"
/*
#define _DUMP_THREAD
*/
/**************************************************************************
*
* Definitions
*
*/
/**************************************************************************
*
* Global variables
*
*/
char bootStack[STACKSIZE];
/**************************************************************************
*
* Local variables
*
*/
static OSThread idleThread;
static char idleThreadStack[STACKSIZE];
static OSThread mainThread;
static char mainThreadStack[STACKSIZE];
/**************************************************************************
*
* Extern references
*
*/
extern u32 CpuErrorCount;
extern s32 CpuTest(void);
/**************************************************************************
*
* Function prototypes
*
*/
static void idle(void *);
static void main(void *);
/**************************************************************************
*
* Boot program
*
*/
boot(void)
{
osInitialize();
osCreateThread(&mainThread, 1, main, (void *)0, mainThreadStack+STACKSIZE,
(OSPri)MAIN_THREAD_PRI);
osStartThread(&mainThread);
}
static void
main(void *arg)
{
OSMesg mesg;
int i;
u32 saveMask;
/*
* Create idle thread
*/
osCreateThread(&idleThread, 2, idle, (void *)0, idleThreadStack+STACKSIZE,
(OSPri)IDLE_THREAD_PRI);
osStartThread(&idleThread);
/* Start VI manager */
osCreateViManager((OSPri)OS_PRIORITY_VIMGR);
XDEBUG(osSyncPrintf("Starting CpuTest\n"));
(void)CpuTest();
XDEBUG(osSyncPrintf("Get control back, errorCount=%d\n", CpuErrorCount));
} /* main */
static void
idle(void *arg)
{
for (;;);
}