boot.c
1.65 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
/*============================================================================
NINTENDO64 TECHNICAL SUPPORT CENTER
NINTENDO64 SAMPLE PROGRAM 1
Copyright (C) 1997, NINTENDO Co,Ltd.
============================================================================*/
#include <ultra64.h>
#include <PR/ramrom.h>
#include <assert.h>
#include "def.h"
#include "vram.h"
#include "segment.h"
#include "message.h"
u64 bootStack[STACKSIZE/sizeof(u64)];
static void idle(void *); /* Idle Thead */
OSPiHandle *handler;
/* スレッド構造体の定義 */
static OSThread idleThread;
static OSThread mainThread;
/* スレッドスタックの定義 */
static u64 idleThreadStack[STACKSIZE/sizeof(u64)];
static u64 mainThreadStack[STACKSIZE/sizeof(u64)];
/* 外部関数 */
extern void mainproc(void *);
/*-----------------------
Boot
Program start here
-----------------------*/
void boot(void)
{
/* initilize software and hardware */
osInitialize();
handler = osCartRomInit();
/* PARTNER-N64用のソース */
/* create and start idle thread */
osCreateThread(&idleThread,IDLE_THREAD_ID, idle, (void *)0,
(idleThreadStack+STACKSIZE/sizeof(u64)), IDLE_THREAD_PRI);
osStartThread(&idleThread);
}
/*--------------------------
Idle Thread
---------------------------*/
static void idle(void *arg)
{
/* create and start PI mangaer thread */
osCreatePiManager((OSPri)OS_PRIORITY_PIMGR, &PiMessageQ, PiMessages,
NUM_PI_MSGS);
/* メインスレッドの起動 */
osCreateThread(&mainThread, MAIN_THREAD_ID, mainproc,arg,
(mainThreadStack+STACKSIZE/sizeof(u64)),MAIN_THREAD_PRI);
osStartThread(&mainThread);
/* Here is idle loop */
for(;;);
}