Mario Kart 64
Loading...
Searching...
No Matches
sptask.h
Go to the documentation of this file.
1/**************************************************************************
2 * *
3 * Copyright (C) 1995, Silicon Graphics, Inc. *
4 * *
5 * These coded instructions, statements, and computer programs contain *
6 * unpublished proprietary information of Silicon Graphics, Inc., and *
7 * are protected by Federal copyright law. They may not be disclosed *
8 * to third parties or copied or duplicated in any form, in whole or *
9 * in part, without the prior written consent of Silicon Graphics, Inc. *
10 * *
11 **************************************************************************/
12
13/**************************************************************************
14 *
15 * $Revision: 1.9 $
16 * $Date: 1998/03/05 06:40:29 $
17 * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sptask.h,v $
18 *
19 **************************************************************************/
20
21#ifndef _SPTASK_H_
22#define _SPTASK_H_
23
24#ifdef _LANGUAGE_C_PLUS_PLUS
25extern "C" {
26#endif
27
28#include <PR/ultratypes.h>
29
30#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
31
32/**************************************************************************
33 *
34 * Type definitions
35 *
36 */
37
38/*
39 * Task List Structure.
40 *
41 * Things an app might pass to the SP via the task list.
42 * Not every task ucode would need/use every field, but
43 *
44 * - type (audio, gfx, video, ...)
45 * - flags
46 * - wait for DP to drain before running new task
47 * - SEE BIT DEFINITIONS UNDER "Task Flags field"
48 * - pointer to boot ucode
49 * - size of boot ucode
50 * - pointer to ucode
51 * - size of ucode
52 * - pointer to initial DMEM data
53 * - size of initial DMEM data
54 * - pointer to DRAM stack
55 * - size of DRAM stack (max)
56 * - pointer to output buffer
57 * - pointer to store output buffer length
58 * - generic data pointer (for display list, etc.)
59 * - generic data length (for display list, etc.)
60 * - pointer to buffer where to store saved DMEM (in yield case)
61 * - size of buffer to store saved DMEM.
62 *
63 * IMPORTANT!!! Watch alignment issues.
64 *
65 * IMPORTANT!!! Watch data cache issues. The RCP may write data into the
66 * dram_stack, output_buff, output_buff_size, and the yield_data_ptr areas.
67 * These buffers should be cache aligned and use the entire line (16 bytes) to
68 * avoid corruption by writebacks by the CPU (cache tearing).
69 *
70 * IMPORTANT!!! all addresses are virtual addresses. Library does
71 * any necessary translation.
72 *
73 */
74typedef struct
75{
76 /*0x00*/ u32 type;
77 /*0x04*/ u32 flags;
78
79 /*0x08*/ u64 *ucode_boot;
80 /*0x0C*/ u32 ucode_boot_size;
81
82 /*0x10*/ u64 *ucode;
83 /*0x14*/ u32 ucode_size;
84
85 /*0x18*/ u64 *ucode_data;
86 /*0x1C*/ u32 ucode_data_size;
87
88 /*0x20*/ u64 *dram_stack;
89 /*0x24*/ u32 dram_stack_size;
90
91 /*0x28*/ u64 *output_buff;
92 /*0x2C*/ u64 *output_buff_size;
93
94 /*0x30*/ u64 *data_ptr;
95 /*0x34*/ u32 data_size;
96
97 /*0x38*/ u64 *yield_data_ptr;
98 /*0x3C*/ u32 yield_data_size;
99} OSTask_t; // size = 0x40
100
101typedef union {
102 OSTask_t t;
103 long long int force_structure_alignment;
104} OSTask;
105
106typedef u32 OSYieldResult;
107#endif /* _LANGUAGE_C */
108
109
110/*
111 * Task Flags field
112 */
113#define OS_TASK_YIELDED 0x0001
114#define OS_TASK_DP_WAIT 0x0002
115#define OS_TASK_LOADABLE 0x0004
116#define OS_TASK_SP_ONLY 0x0008
117#define OS_TASK_USR0 0x0010
118#define OS_TASK_USR1 0x0020
119#define OS_TASK_USR2 0x0040
120#define OS_TASK_USR3 0x0080
121
122/*
123 * Size of Yield buffer. The taskHdrPtr->t.yield_data_ptr must point to a
124 * buffer of this size. (The size is in bytes). ONLY If the task will NEVER
125 * yield it may be a null pointer. The buffer must be aligned to a 64 bit
126 * boundary. The taskHdrPtr->t.yield_data_ptr must be set to point to the
127 * buffer BEFORE the task is started.
128 */
129#if (defined(F3DEX_GBI) || defined(F3DLP_GBI) || defined(F3DEX_GBI_2))
130#ifdef F3D_OLD
131#define OS_YIELD_DATA_SIZE 0xD00
132#else
133#define OS_YIELD_DATA_SIZE 0xC00
134#endif
135#else
136#define OS_YIELD_DATA_SIZE 0x900
137#endif
138
140/* Flags */
141#define M_TASK_FLAG0 1
142#define M_TASK_FLAG1 2
143
144/* SpStatus */
145#define SPSTATUS_CLEAR_HALT 0x00000001
146#define SPSTATUS_SET_HALT 0x00000002
147#define SPSTATUS_CLEAR_BROKE 0x00000004
148#define SPSTATUS_CLEAR_INTR 0x00000008
149#define SPSTATUS_SET_INTR 0x00000010
150#define SPSTATUS_CLEAR_SSTEP 0x00000020
151#define SPSTATUS_SET_SSTEP 0x00000040
152#define SPSTATUS_CLEAR_INTR_ON_BREAK 0x00000080
153#define SPSTATUS_SET_INTR_ON_BREAK 0x00000100
154#define SPSTATUS_CLEAR_SIGNAL0 0x00000200
155#define SPSTATUS_SET_SIGNAL0 0x00000400
156#define SPSTATUS_CLEAR_SIGNAL1 0x00000800
157#define SPSTATUS_SET_SIGNAL1 0x00001000
158#define SPSTATUS_CLEAR_SIGNAL2 0x00002000
159#define SPSTATUS_SET_SIGNAL2 0x00004000
160#define SPSTATUS_CLEAR_SIGNAL3 0x00008000
161#define SPSTATUS_SET_SIGNAL3 0x00010000
162#define SPSTATUS_CLEAR_SIGNAL4 0x00020000
163#define SPSTATUS_SET_SIGNAL4 0x00040000
164#define SPSTATUS_CLEAR_SIGNAL5 0x00080000
165#define SPSTATUS_SET_SIGNAL5 0x00100000
166#define SPSTATUS_CLEAR_SIGNAL6 0x00200000
167#define SPSTATUS_SET_SIGNAL6 0x00800000
168#define SPSTATUS_CLEAR_SIGNAL7 0x01000000
169#define SPSTATUS_SET_SIGNAL7 0x02000000
170
171#define SPSTATUS_HALT 0x0001
172#define SPSTATUS_BROKE 0x0002
173#define SPSTATUS_DMA_BUSY 0x0004
174#define SPSTATUS_DMA_FULL 0x0008
175#define SPSTATUS_IO_FULL 0x0010
176#define SPSTATUS_SINGLE_STEP 0x0020
177#define SPSTATUS_INTERRUPT_ON_BREAK 0x0040
178#define SPSTATUS_SIGNAL0_SET 0x0080
179#define SPSTATUS_SIGNAL1_SET 0x0100
180#define SPSTATUS_SIGNAL2_SET 0x0200
181#define SPSTATUS_SIGNAL3_SET 0x0400
182#define SPSTATUS_SIGNAL4_SET 0x0800
183#define SPSTATUS_SIGNAL5_SET 0x1000
184#define SPSTATUS_SIGNAL6_SET 0x2000
185#define SPSTATUS_SIGNAL7_SET 0x4000
186
187#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
188
189/**************************************************************************
190 *
191 * Macro definitions
192 *
193 */
194
195/*
196 * this macro simulates atomic action.
197 */
198#define osSpTaskStart(p) \
199 osSpTaskLoad(p); \
200 osSpTaskStartGo(p);
201
202/**************************************************************************
203 *
204 * Extern variables
205 *
206 */
207
208
209/**************************************************************************
210 *
211 * Function prototypes
212 *
213 */
214
215/*
216 * break this up into two steps for debugging.
217 */
218extern void osSpTaskLoad(OSTask *task);
219extern void osSpTaskStartGo(OSTask *task);
220
221extern void osSpTaskYield(void);
222extern OSYieldResult osSpTaskYielded(OSTask *task);
223
224#endif /* _LANGUAGE_C */
225
226#ifdef _LANGUAGE_C_PLUS_PLUS
227}
228#endif
229
230#endif /* !_SPTASK_H */
unsigned long long int u64
Definition llconv.c:2
void osSpTaskLoad(OSTask *task)
Definition osSpTaskLoadGo.c:25
void osSpTaskStartGo(UNUSED OSTask *task)
Definition osSpTaskLoadGo.c:59
void osSpTaskYield(void)
Definition osSpTaskYield.c:3
OSYieldResult osSpTaskYielded(OSTask *task)
Definition osSpTaskYielded.c:3
unsigned int u32
Definition ultratypes.h:16