mysched.h
2.89 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
/*
* NINTENDO64 SAMPLE PROGRAM
*
* FILE : mysched.h
*
* Copyright (C) 1997, NINTENDO Co,Ltd.
*/
/*
* $B%9%1%8%e!<%i%9%l%C%I%9%?%C%/%5%$%:(B
*/
#define MY_SC_STACKSIZE 0x2000
/*
* $B%a%C%;!<%8(B
*/
#define MY_SC_RETRACE_MSG 1 /* $B%j%H%l!<%9%a%C%;!<%8(B */
#define MY_SC_PRE_NMI_MSG 3 /* $B#N#M#I%a%C%;!<%8(B */
#define MY_SC_MAX_MESGS 8 /* $B%a%C%;!<%8%P%C%U%!$N%5%$%:(B */
/*
* $B%9%l%C%I$N%W%i%$%*%j%F%#$NDj5A(B
*/
#define MY_SC_PRI 120 /* $B%9%1%8%e!<%i(B */
#define MY_SC_AUDIO_PRI 100 /* $B%*!<%G%#%*(B */
#define MY_SC_GRAPHICS_PRI 110 /* $B%0%i%U%#%C%/%9(B */
/*
* $B%$%Y%s%H%a%C%;!<%8$NDj5A(B
*/
#define VIDEO_MSG 666 /* $B%j%H%l!<%9(B */
#define RSP_DONE_MSG 667 /* RSP $B=*N;(B */
#define RDP_DONE_MSG 668 /* RDP $B=*N;(B */
#define PRE_NMI_MSG 669 /* NMI */
/*
* $B%9%1%8%e!<%i%a%C%;!<%8%?%$%W(B
*/
typedef short MYScMsg;
/*
* $B%?%9%/9=B$BN(B
*/
typedef struct SCTask_s {
void *framebuffer;
OSTask list;
} MYScTask;
/*
* $B%/%i%$%"%s%H%j%9%H9=B$BN(B
*/
typedef struct SCClient_s {
/* $B<!$N%/%i%$%"%s%H$X$N%]%$%s%?(B */
struct SCClient_s *next;
/* $B%/%i%$%"%s%H$KAw?.$9$k%a%C%;!<%8(B */
OSMesgQueue *msgQ;
} MYScClient;
/*
* $B%9%1%8%e!<%i9=B$BN$NDj5A(B
*/
typedef struct {
/* $B%a%C%;!<%8(B */
MYScMsg retraceMsg;
MYScMsg prenmiMsg;
/* $B%a%C%;!<%8%-%e!<$NDj5A(B */
/* $B%j%H%l!<%9(B */
OSMesgQueue retraceMQ;
OSMesg retraceMsgBuf[MY_SC_MAX_MESGS];
/* RSP $B%?%9%/=*N;(B */
OSMesgQueue rspMQ;
OSMesg rspMsgBuf;
/* RDP $B%?%9%/=*N;(B */
OSMesgQueue rdpMQ;
OSMesg rdpMsgBuf;
/* $B%0%i%U%#%C%/%9%?%9%/(B */
OSMesgQueue graphicsRequestMQ;
OSMesg graphicsRequestBuf;
/* $B%*!<%G%#%*%?%9%/(B */
OSMesgQueue audioRequestMQ;
OSMesg audioRequestBuf;
/* $B%0%i%U%#%C%/%9%U%l!<%`(B */
OSMesgQueue graphicsFrameMQ;
OSMesg graphicsFrameBuf;
/* $B%*!<%G%#%*%U%l!<%`(B */
OSMesgQueue audioFrameMQ;
OSMesg audioFrameBuf;
/* $B%9%l%C%I$NDj5A(B */
/* $B%a%$%s%9%l%C%I(B */
OSThread schedulerThread;
/* $B%*!<%G%#%*(B */
OSThread audioThread;
/* $B%0%i%U%#%C%/%9(B */
OSThread graphicsThread;
/* $B%/%i%$%"%s%H%j%9%H(B */
MYScClient *clientList;
/* $B=i4|2hLL@)8fMQ%U%i%0(B */
u32 firstTime;
} MYSched;
/*
* extern $B@k8@(B
*/
extern MYSched sc;
/*
* $B4X?t%W%m%H%?%$%W@k8@(B
*/
extern void myScCreateScheduler(MYSched *sc, u8 videoMode, u8 numFields);
extern void myScEventHandler(MYSched *sc);
extern void myScEventBroadcast(MYSched *sc, MYScMsg *msg);
extern void myScAddClient(MYSched *sc, MYScClient *, OSMesgQueue *mq);
extern void myScExecuteAudio(MYSched *sc);
extern void myScExecuteGraphics(MYSched *sc);