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 /*0x00*/ u32 type;
76 /*0x04*/ u32 flags;
77
78 /*0x08*/ u64* ucode_boot;
79 /*0x0C*/ u32 ucode_boot_size;
80
81 /*0x10*/ u64* ucode;
82 /*0x14*/ u32 ucode_size;
83
84 /*0x18*/ u64* ucode_data;
85 /*0x1C*/ u32 ucode_data_size;
86
87 /*0x20*/ u64* dram_stack;
88 /*0x24*/ u32 dram_stack_size;
89
90 /*0x28*/ u64* output_buff;
91 /*0x2C*/ u64* output_buff_size;
92
93 /*0x30*/ u64* data_ptr;
94 /*0x34*/ u32 data_size;
95
96 /*0x38*/ u64* yield_data_ptr;
97 /*0x3C*/ u32 yield_data_size;
98} OSTask_t; // size = 0x40
99
100typedef union {
101 OSTask_t t;
102 long long int force_structure_alignment;
103} OSTask;
104
105typedef u32 OSYieldResult;
106#endif /* _LANGUAGE_C */
107
108/*
109 * Task Flags field
110 */
111#define OS_TASK_YIELDED 0x0001
112#define OS_TASK_DP_WAIT 0x0002
113#define OS_TASK_LOADABLE 0x0004
114#define OS_TASK_SP_ONLY 0x0008
115#define OS_TASK_USR0 0x0010
116#define OS_TASK_USR1 0x0020
117#define OS_TASK_USR2 0x0040
118#define OS_TASK_USR3 0x0080
119
120/*
121 * Size of Yield buffer. The taskHdrPtr->t.yield_data_ptr must point to a
122 * buffer of this size. (The size is in bytes). ONLY If the task will NEVER
123 * yield it may be a null pointer. The buffer must be aligned to a 64 bit
124 * boundary. The taskHdrPtr->t.yield_data_ptr must be set to point to the
125 * buffer BEFORE the task is started.
126 */
127#if (defined(F3DEX_GBI) || defined(F3DLP_GBI) || defined(F3DEX_GBI_2))
128#ifdef F3D_OLD
129#define OS_YIELD_DATA_SIZE 0xD00
130#else
131#define OS_YIELD_DATA_SIZE 0xC00
132#endif
133#else
134#define OS_YIELD_DATA_SIZE 0x900
135#endif
136
138/* Flags */
139#define M_TASK_FLAG0 1
140#define M_TASK_FLAG1 2
141
142/* SpStatus */
143#define SPSTATUS_CLEAR_HALT 0x00000001
144#define SPSTATUS_SET_HALT 0x00000002
145#define SPSTATUS_CLEAR_BROKE 0x00000004
146#define SPSTATUS_CLEAR_INTR 0x00000008
147#define SPSTATUS_SET_INTR 0x00000010
148#define SPSTATUS_CLEAR_SSTEP 0x00000020
149#define SPSTATUS_SET_SSTEP 0x00000040
150#define SPSTATUS_CLEAR_INTR_ON_BREAK 0x00000080
151#define SPSTATUS_SET_INTR_ON_BREAK 0x00000100
152#define SPSTATUS_CLEAR_SIGNAL0 0x00000200
153#define SPSTATUS_SET_SIGNAL0 0x00000400
154#define SPSTATUS_CLEAR_SIGNAL1 0x00000800
155#define SPSTATUS_SET_SIGNAL1 0x00001000
156#define SPSTATUS_CLEAR_SIGNAL2 0x00002000
157#define SPSTATUS_SET_SIGNAL2 0x00004000
158#define SPSTATUS_CLEAR_SIGNAL3 0x00008000
159#define SPSTATUS_SET_SIGNAL3 0x00010000
160#define SPSTATUS_CLEAR_SIGNAL4 0x00020000
161#define SPSTATUS_SET_SIGNAL4 0x00040000
162#define SPSTATUS_CLEAR_SIGNAL5 0x00080000
163#define SPSTATUS_SET_SIGNAL5 0x00100000
164#define SPSTATUS_CLEAR_SIGNAL6 0x00200000
165#define SPSTATUS_SET_SIGNAL6 0x00800000
166#define SPSTATUS_CLEAR_SIGNAL7 0x01000000
167#define SPSTATUS_SET_SIGNAL7 0x02000000
168
169#define SPSTATUS_HALT 0x0001
170#define SPSTATUS_BROKE 0x0002
171#define SPSTATUS_DMA_BUSY 0x0004
172#define SPSTATUS_DMA_FULL 0x0008
173#define SPSTATUS_IO_FULL 0x0010
174#define SPSTATUS_SINGLE_STEP 0x0020
175#define SPSTATUS_INTERRUPT_ON_BREAK 0x0040
176#define SPSTATUS_SIGNAL0_SET 0x0080
177#define SPSTATUS_SIGNAL1_SET 0x0100
178#define SPSTATUS_SIGNAL2_SET 0x0200
179#define SPSTATUS_SIGNAL3_SET 0x0400
180#define SPSTATUS_SIGNAL4_SET 0x0800
181#define SPSTATUS_SIGNAL5_SET 0x1000
182#define SPSTATUS_SIGNAL6_SET 0x2000
183#define SPSTATUS_SIGNAL7_SET 0x4000
184
185#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
186
187/**************************************************************************
188 *
189 * Macro definitions
190 *
191 */
192
193/*
194 * this macro simulates atomic action.
195 */
196#define osSpTaskStart(p) \
197 osSpTaskLoad(p); \
198 osSpTaskStartGo(p);
199
200/**************************************************************************
201 *
202 * Extern variables
203 *
204 */
205
206/**************************************************************************
207 *
208 * Function prototypes
209 *
210 */
211
212/*
213 * break this up into two steps for debugging.
214 */
215extern void osSpTaskLoad(OSTask* task);
216extern void osSpTaskStartGo(OSTask* task);
217
218extern void osSpTaskYield(void);
219extern OSYieldResult osSpTaskYielded(OSTask* task);
220
221#endif /* _LANGUAGE_C */
222
223#ifdef _LANGUAGE_C_PLUS_PLUS
224}
225#endif
226
227#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:56
void osSpTaskYield(void)
Definition osSpTaskYield.c:3
OSYieldResult osSpTaskYielded(OSTask *task)
Definition osSpTaskYielded.c:3
unsigned int u32
Definition ultratypes.h:16