mirror of
https://github.com/izzy2lost/Starship.git
synced 2026-07-05 15:19:42 -07:00
Libultra headers
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
#ifndef FUNCTIONS_H
|
||||
#define FUNCTIONS_H
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef GLOBAL_H
|
||||
#define GLOBAL_H
|
||||
|
||||
#include "libultra/PR/ultratypes.h"
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
#include "macros.h"
|
||||
|
||||
#endif // GLOBAL_H
|
||||
@@ -0,0 +1,410 @@
|
||||
#ifndef _ABI_H_
|
||||
#define _ABI_H_
|
||||
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1994, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.32 $
|
||||
* $Date: 1997/02/11 08:16:37 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/abi.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Header file for the Audio Binary Interface.
|
||||
* This is included in the Media Binary Interface file
|
||||
* mbi.h.
|
||||
*
|
||||
* This file follows the framework used for graphics.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Audio commands: */
|
||||
#define A_SPNOOP 0
|
||||
#define A_ADPCM 1
|
||||
#define A_CLEARBUFF 2
|
||||
#define A_ENVMIXER 3
|
||||
#define A_LOADBUFF 4
|
||||
#define A_RESAMPLE 5
|
||||
#define A_SAVEBUFF 6
|
||||
#define A_SEGMENT 7
|
||||
#define A_SETBUFF 8
|
||||
#define A_SETVOL 9
|
||||
#define A_DMEMMOVE 10
|
||||
#define A_LOADADPCM 11
|
||||
#define A_MIXER 12
|
||||
#define A_INTERLEAVE 13
|
||||
#define A_POLEF 14
|
||||
#define A_SETLOOP 15
|
||||
|
||||
#define ACMD_SIZE 32
|
||||
/*
|
||||
* Audio flags
|
||||
*/
|
||||
|
||||
#define A_INIT 0x01
|
||||
#define A_CONTINUE 0x00
|
||||
#define A_LOOP 0x02
|
||||
#define A_OUT 0x02
|
||||
#define A_LEFT 0x02
|
||||
#define A_RIGHT 0x00
|
||||
#define A_VOL 0x04
|
||||
#define A_RATE 0x00
|
||||
#define A_AUX 0x08
|
||||
#define A_NOAUX 0x00
|
||||
#define A_MAIN 0x00
|
||||
#define A_MIX 0x10
|
||||
|
||||
/*
|
||||
* BEGIN C-specific section: (typedef's)
|
||||
*/
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/*
|
||||
* Data Structures.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int flags:8;
|
||||
unsigned int gain:16;
|
||||
unsigned int addr;
|
||||
} Aadpcm;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int flags:8;
|
||||
unsigned int gain:16;
|
||||
unsigned int addr;
|
||||
} Apolef;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int flags:8;
|
||||
unsigned int pad1:16;
|
||||
unsigned int addr;
|
||||
} Aenvelope;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int pad1:8;
|
||||
unsigned int dmem:16;
|
||||
unsigned int pad2:16;
|
||||
unsigned int count:16;
|
||||
} Aclearbuff;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int pad1:8;
|
||||
unsigned int pad2:16;
|
||||
unsigned int inL:16;
|
||||
unsigned int inR:16;
|
||||
} Ainterleave;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int pad1:24;
|
||||
unsigned int addr;
|
||||
} Aloadbuff;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int flags:8;
|
||||
unsigned int pad1:16;
|
||||
unsigned int addr;
|
||||
} Aenvmixer;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int flags:8;
|
||||
unsigned int gain:16;
|
||||
unsigned int dmemi:16;
|
||||
unsigned int dmemo:16;
|
||||
} Amixer;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int flags:8;
|
||||
unsigned int dmem2:16;
|
||||
unsigned int addr;
|
||||
} Apan;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int flags:8;
|
||||
unsigned int pitch:16;
|
||||
unsigned int addr;
|
||||
} Aresample;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int flags:8;
|
||||
unsigned int pad1:16;
|
||||
unsigned int addr;
|
||||
} Areverb;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int pad1:24;
|
||||
unsigned int addr;
|
||||
} Asavebuff;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int pad1:24;
|
||||
unsigned int pad2:2;
|
||||
unsigned int number:4;
|
||||
unsigned int base:24;
|
||||
} Asegment;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int flags:8;
|
||||
unsigned int dmemin:16;
|
||||
unsigned int dmemout:16;
|
||||
unsigned int count:16;
|
||||
} Asetbuff;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int flags:8;
|
||||
unsigned int vol:16;
|
||||
unsigned int voltgt:16;
|
||||
unsigned int volrate:16;
|
||||
} Asetvol;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int pad1:8;
|
||||
unsigned int dmemin:16;
|
||||
unsigned int dmemout:16;
|
||||
unsigned int count:16;
|
||||
} Admemmove;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int pad1:8;
|
||||
unsigned int count:16;
|
||||
unsigned int addr;
|
||||
} Aloadadpcm;
|
||||
|
||||
typedef struct {
|
||||
unsigned int cmd:8;
|
||||
unsigned int pad1:8;
|
||||
unsigned int pad2:16;
|
||||
unsigned int addr;
|
||||
} Asetloop;
|
||||
|
||||
/*
|
||||
* Generic Acmd Packet
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned int w0;
|
||||
unsigned int w1;
|
||||
} Awords;
|
||||
|
||||
typedef union {
|
||||
Awords words;
|
||||
Aadpcm adpcm;
|
||||
Apolef polef;
|
||||
Aclearbuff clearbuff;
|
||||
Aenvelope envelope;
|
||||
Ainterleave interleave;
|
||||
Aloadbuff loadbuff;
|
||||
Aenvmixer envmixer;
|
||||
Aresample resample;
|
||||
Areverb reverb;
|
||||
Asavebuff savebuff;
|
||||
Asegment segment;
|
||||
Asetbuff setbuff;
|
||||
Asetvol setvol;
|
||||
Admemmove dmemmove;
|
||||
Aloadadpcm loadadpcm;
|
||||
Amixer mixer;
|
||||
Asetloop setloop;
|
||||
long long int force_union_align; /* dummy, force alignment */
|
||||
} Acmd;
|
||||
|
||||
/*
|
||||
* ADPCM State
|
||||
*/
|
||||
#define ADPCMVSIZE 8
|
||||
#define ADPCMFSIZE 16
|
||||
typedef short ADPCM_STATE[ADPCMFSIZE];
|
||||
|
||||
/*
|
||||
* Pole filter state
|
||||
*/
|
||||
typedef short POLEF_STATE[4];
|
||||
|
||||
/*
|
||||
* Resampler state
|
||||
*/
|
||||
typedef short RESAMPLE_STATE[16];
|
||||
|
||||
/*
|
||||
* Resampler constants
|
||||
*/
|
||||
#define UNITY_PITCH 0x8000
|
||||
#define MAX_RATIO 1.99996 /* within .03 cents of +1 octave */
|
||||
|
||||
/*
|
||||
* Enveloper/Mixer state
|
||||
*/
|
||||
typedef short ENVMIX_STATE[40];
|
||||
|
||||
/*
|
||||
* Macros to assemble the audio command list
|
||||
*/
|
||||
|
||||
#define aADPCMdec(pkt, f, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(f, 16, 8); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aPoleFilter(pkt, f, g, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(g, 0, 16)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aClearBuffer(pkt, d, c) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_CLEARBUFF, 24, 8) | _SHIFTL(d, 0, 24); \
|
||||
_a->words.w1 = (unsigned int)(c); \
|
||||
}
|
||||
|
||||
#define aEnvMixer(pkt, f, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aInterleave(pkt, l, r) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \
|
||||
_a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
|
||||
}
|
||||
|
||||
#define aLoadBuffer(pkt, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aMix(pkt, f, g, i, o) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(g, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(i,16, 16) | _SHIFTL(o, 0, 16); \
|
||||
}
|
||||
|
||||
#define aPan(pkt, f, d, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_PAN, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(d, 0, 16)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aResample(pkt, f, p, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(f, 16, 8) |\
|
||||
_SHIFTL(p, 0, 16)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aSaveBuffer(pkt, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aSegment(pkt, s, b) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_SEGMENT, 24, 8); \
|
||||
_a->words.w1 = _SHIFTL(s, 24, 8) | _SHIFTL(b, 0, 24); \
|
||||
}
|
||||
|
||||
#define aSetBuffer(pkt, f, i, o, c) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_SETBUFF, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(i, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
|
||||
}
|
||||
|
||||
#define aSetVolume(pkt, f, v, t, r) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
|
||||
_SHIFTL(v, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \
|
||||
}
|
||||
|
||||
#define aSetLoop(pkt, a) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
_a->words.w0 = _SHIFTL(A_SETLOOP, 24, 8); \
|
||||
_a->words.w1 = (unsigned int)(a); \
|
||||
}
|
||||
|
||||
#define aDMEMMove(pkt, i, o, c) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_DMEMMOVE, 24, 8) | _SHIFTL(i, 0, 24); \
|
||||
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
|
||||
}
|
||||
|
||||
#define aLoadADPCM(pkt, c, d) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
|
||||
_a->words.w1 = (unsigned int) d; \
|
||||
}
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#endif /* !_ABI_H_ */
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,363 @@
|
||||
|
||||
/*
|
||||
* Copyright 1995, Silicon Graphics, Inc.
|
||||
* ALL RIGHTS RESERVED
|
||||
*
|
||||
* UNPUBLISHED -- Rights reserved under the copyright laws of the United
|
||||
* States. Use of a copyright notice is precautionary only and does not
|
||||
* imply publication or disclosure.
|
||||
*
|
||||
* U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to restrictions
|
||||
* as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
|
||||
* in similar or successor clauses in the FAR, or the DOD or NASA FAR
|
||||
* Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
|
||||
* 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
|
||||
*
|
||||
* THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
|
||||
* INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
|
||||
* DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
|
||||
* PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
|
||||
* GRAPHICS, INC.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: gt.h
|
||||
* Creator: hsa@sgi.com
|
||||
* Create Date: Thu Oct 12 15:48:14 PDT 1995
|
||||
*
|
||||
* This file defines the GBI for the TURBO 3D graphics microcode.
|
||||
* The turbo microcode is a special FEATURE-LIMITED microcode designed
|
||||
* for specific applications. It is not for general use.
|
||||
*
|
||||
* (see XXX for more information)
|
||||
*
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.14 $
|
||||
* $Date: 1997/02/11 08:22:47 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/gt.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _GT_H_
|
||||
#define _GT_H_
|
||||
|
||||
/* this file should be #included AFTER gbi.h */
|
||||
|
||||
#include "sptask.h"
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif /* _LANGUAGE_C_PLUS_PLUS */
|
||||
|
||||
/* the following #defines seem out of order, but we need them
|
||||
* for the microcode.
|
||||
*/
|
||||
|
||||
/*
|
||||
* object state field: rendState
|
||||
*
|
||||
* This flag word is built up out of the bits from a
|
||||
* subset of the G_SETGEOMETRYMODE flags from gbi.h.
|
||||
*
|
||||
* When each of these bits is '1', the comments below explain
|
||||
* the effect on the triangles.
|
||||
*/
|
||||
#define GT_ZBUFFER G_ZBUFFER
|
||||
#define GT_TEXTURE G_TEXTURE_ENABLE /* texture ON */
|
||||
#define GT_CULL_BACK G_CULL_BACK /* reject backfaces */
|
||||
#define GT_SHADING_SMOOTH G_SHADING_SMOOTH /* smooth shade ON */
|
||||
|
||||
/*
|
||||
* object state field: textureState
|
||||
*
|
||||
* The lower 3 bits of this flag word contain the texture tile number
|
||||
* to be used. All triangles of an object are rendered with the same
|
||||
* texture tile.
|
||||
*/
|
||||
|
||||
/*
|
||||
* object state field: flag
|
||||
*
|
||||
* This is a group of what would be pad bits. We use them for some
|
||||
* flag bits.
|
||||
*/
|
||||
#define GT_FLAG_NOMTX 0x01 /* don't load the matrix */
|
||||
#define GT_FLAG_NO_XFM 0x02 /* load vtx, use verbatim */
|
||||
#define GT_FLAG_XFM_ONLY 0x04 /* xform vtx, write to *TriN */
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* turbo 3D ucode: */
|
||||
extern long long int gspTurbo3DTextStart[], gspTurbo3DTextEnd[];
|
||||
extern long long int gspTurbo3DDataStart[], gspTurbo3DDataEnd[];
|
||||
extern long long int gspTurbo3D_dramTextStart[], gspTurbo3D_dramTextEnd[];
|
||||
extern long long int gspTurbo3D_dramDataStart[], gspTurbo3D_dramDataEnd[];
|
||||
extern long long int gspTurbo3D_fifoTextStart[], gspTurbo3D_fifoTextEnd[];
|
||||
extern long long int gspTurbo3D_fifoDataStart[], gspTurbo3D_fifoDataEnd[];
|
||||
|
||||
/*
|
||||
* This is the global state structure. It's definition carefully
|
||||
* matches the ucode, so if this structure changes, you must also change
|
||||
* the ucode.
|
||||
*/
|
||||
typedef struct {
|
||||
u16 perspNorm; /* persp normalization */
|
||||
u16 pad0;
|
||||
u32 flag;
|
||||
Gfx rdpOthermode;
|
||||
u32 segBases[16]; /* table of segment base addrs (SEE NOTE!) */
|
||||
Vp viewport; /* the viewport to use */
|
||||
Gfx *rdpCmds; /* block of RDP data, process if !NULL
|
||||
* block terminated by gDPEndDisplayList()
|
||||
* (This is a segment address)
|
||||
*/
|
||||
} gtGlobState_t;
|
||||
|
||||
/* NOTE:
|
||||
* Although there are 16 segment table entries, the first one (segment 0)
|
||||
* is reserved for physical memory mapping. You should not segment 0
|
||||
* to anything other than 0x0.
|
||||
*/
|
||||
|
||||
typedef union {
|
||||
gtGlobState_t sp;
|
||||
long long int force_structure_alignment;
|
||||
} gtGlobState;
|
||||
|
||||
|
||||
/*
|
||||
* This is the 'state' structure associated with each object
|
||||
* to be rendered. It's definition carefully matches the
|
||||
* ucode, so if this structure changes, you must also change
|
||||
* the gtoff.c tool and the ucode.
|
||||
*/
|
||||
typedef struct {
|
||||
u32 renderState; /* render state */
|
||||
u32 textureState; /* texture state */
|
||||
u8 vtxCount; /* how many verts? */
|
||||
u8 vtxV0; /* where to load verts? */
|
||||
u8 triCount; /* how many tris? */
|
||||
u8 flag;
|
||||
Gfx *rdpCmds; /* ptr (segment address) to RDP DL */
|
||||
Gfx rdpOthermode;
|
||||
Mtx transform; /* the transform matrix to use */
|
||||
} gtState_t;
|
||||
|
||||
typedef union {
|
||||
gtState_t sp;
|
||||
long long int force_structure_alignment;
|
||||
} gtState;
|
||||
|
||||
/* gtStateLite : same as gtState, but no matrix (see flags below) */
|
||||
/* this structure must be identical to gtState! (bad) */
|
||||
typedef struct {
|
||||
u32 renderState; /* render state */
|
||||
u32 textureState; /* texture state */
|
||||
u8 vtxCount; /* how many verts? */
|
||||
u8 vtxV0; /* where to load verts? */
|
||||
u8 triCount; /* how many tris? */
|
||||
u8 flag;
|
||||
Gfx *rdpCmds; /* ptr (segment address) to RDP DL */
|
||||
Gfx rdpOthermode;
|
||||
} gtStateL_t;
|
||||
|
||||
typedef union {
|
||||
gtStateL_t sp;
|
||||
long long int force_structure_alignment;
|
||||
} gtStateL;
|
||||
|
||||
/*
|
||||
* The vertex list for the turbo display list uses the
|
||||
* Vtx struct in gbi.h
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This structure represents a single triangle, part of the
|
||||
* triangle list of the object to be rendered.
|
||||
*
|
||||
* NOTE: The triangle list MUST be aligned to an 8-byte boundary.
|
||||
* Since this structure is only 4 bytes, we are REQUIRING that
|
||||
* this structure only be used as an array of triangles, and we
|
||||
* depend on the MIPS C compiler (which always aligns arrays to
|
||||
* 8-byte boundaries). THIS IS DANGEROUS!!!!
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
u8 v0, v1, v2, flag; /* flag is which one for flat shade */
|
||||
} gtTriN;
|
||||
|
||||
|
||||
/*
|
||||
* This structure represents the transformed points. It is the format
|
||||
* of the points written out when GT_FLAG_XFM_ONLY is set, as well as
|
||||
* the format expected when GT_FLAG_NO_XFM is used.
|
||||
*
|
||||
* NOTE: The size and layout of these points is very similar to Vtx,
|
||||
* except the screen coordinates overwrite the x,y,z,pad fields.
|
||||
* (we could consider adding to the Vtx union, but we want to keep
|
||||
* turbo stuff out of gbi.h)
|
||||
*
|
||||
* NOTE: The z is a special format. It can be used to compare vertices
|
||||
* for sorting, but it should not be used for other purposes. If modified,
|
||||
* the z-buffer hardware might not understand the data.
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
short int xscrn; /* x,y screen coordinates are SSSS10.2 */
|
||||
short int yscrn;
|
||||
int zscrn; /* z screen is S15.16 */
|
||||
|
||||
short int s; /* transformed texture coord, S10.5 */
|
||||
short int t;
|
||||
|
||||
u8 r; /* color (or normal) */
|
||||
u8 g;
|
||||
u8 b;
|
||||
u8 a;
|
||||
} gtVtxOut_t;
|
||||
|
||||
/* see "Data Structure" comment in gbi.h for information about why
|
||||
* we use this union.
|
||||
*/
|
||||
typedef union {
|
||||
gtVtxOut_t v;
|
||||
long long int force_structure_alignment;
|
||||
} gtVtxOut;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* state field: rdpOthermode
|
||||
*
|
||||
* This is one of the trickier state fields. The turbo interface
|
||||
* requires the RDP othermode command to be cached by the host,
|
||||
* therefore we provide a different interface in libultra to help cache
|
||||
* this in the gt state (this word is just bits, you could pack them
|
||||
* on your own).
|
||||
*
|
||||
* gtStateSetOthermode() accomplishs this, taking as arguments
|
||||
* the state, one of the following mode enums, and a piece of data
|
||||
* (othermode parameters from gbi.h).
|
||||
*
|
||||
* By definition, the othermode word from the gt state structure is sent
|
||||
* to the RDP *before* any RDP commands from the rdpCmds[] field. The
|
||||
* othermode is *always* sent.
|
||||
*
|
||||
* Stated another way, NONE of the gbi RDP othermode commands equivalent
|
||||
* to those listed here are allowed in the rdpCmd[] field of the
|
||||
* gt state structure.
|
||||
*
|
||||
* Notice also that many of these commands do not make sense for
|
||||
* the turbo ucode (they control features not supported, like mip-mapping).
|
||||
* They are only included here for completeness.
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
GT_CLEAR, /* special gt mode, clears othermode state */
|
||||
GT_ALPHACOMPARE,
|
||||
GT_ZSRCSEL,
|
||||
GT_RENDERMODE,
|
||||
GT_ALPHADITHER,
|
||||
GT_RGBDITHER,
|
||||
GT_COMBKEY,
|
||||
GT_TEXTCONV,
|
||||
GT_TEXTFILT,
|
||||
GT_TEXTLUT,
|
||||
GT_TEXTLOD,
|
||||
GT_TEXTDETAIL,
|
||||
GT_TEXTPERSP,
|
||||
GT_CYCLETYPE,
|
||||
GT_PIPELINE
|
||||
} gtStateOthermode_t;
|
||||
|
||||
/*
|
||||
* This call builds up an othermode command word. The 'mode' is one of
|
||||
* the above modes, the 'data' field comes from gbi.h, it is the data
|
||||
* field for the equivalent gbi setothermode macro.
|
||||
*/
|
||||
extern void gtStateSetOthermode(Gfx *om, gtStateOthermode_t mode, int data);
|
||||
|
||||
/*
|
||||
* This call dumps a turbo display list for use with gbi2mem and RSPSIM
|
||||
*/
|
||||
#define GT_DUMPTURBO_HANGAFTER 64
|
||||
#define GT_DUMPTURBO_NOTEXTURES 128
|
||||
extern void gtDumpTurbo(OSTask *tp,u8 flags);
|
||||
|
||||
/*
|
||||
* Special macros to init othermode words to all 0's, a good default
|
||||
* value.
|
||||
*/
|
||||
#define gDPClearOtherMode(pkt) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = _SHIFTL(G_RDPSETOTHERMODE, 24, 8); \
|
||||
_g->words.w1 = 0x0; \
|
||||
}
|
||||
|
||||
#define gsDPClearOtherMode() \
|
||||
{ \
|
||||
_SHIFTL(G_RDPSETOTHERMODE, 24, 8), 0x0 \
|
||||
}
|
||||
|
||||
/*
|
||||
* Special macros to end DP blocks (see above). These commands
|
||||
* generate all 0's, which the turbo ucode looks for. They *aren't*
|
||||
* real DP commands!
|
||||
*/
|
||||
#define gDPEndDisplayList(pkt) gSPNoOp(pkt)
|
||||
#define gsDPEndDisplayList() gsSPNoOp()
|
||||
|
||||
/*
|
||||
* This structure is a turbo 'object', the turbo display list is
|
||||
* simply a list of these.
|
||||
*
|
||||
* NOTE: All pointers are segment addresses
|
||||
*
|
||||
* NOTE: If (statep->flag & GT_FLAG_XFM_ONLY), the trip field is
|
||||
* interpreted as a pointer to gtVtxOut[] that can be used to store
|
||||
* the transformed points. (statep->triCount should be 0, else bad
|
||||
* things could happen...)
|
||||
*
|
||||
* NOTE: If (statep->flag & GT_FLAG_NO_XFM), the vtxp field is
|
||||
* interpreted as a pointer to gtVtxOut[] that can be used to load
|
||||
* pre-transformed points.
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
gtGlobState *gstatep; /* global state, usually NULL */
|
||||
gtState *statep; /* if this is NULL, end object processing */
|
||||
Vtx *vtxp; /* if this is NULL, use points in buffer */
|
||||
gtTriN *trip; /* if this is NULL, use tris in buffer */
|
||||
} gtGfx_t;
|
||||
|
||||
typedef union {
|
||||
gtGfx_t obj;
|
||||
long long int force_structure_alignment;
|
||||
} gtGfx;
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_ASSEMBLY
|
||||
#include <PR/gtoff.h>
|
||||
#endif /* _LANGUAGE_ASSEMBLY */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif /* _LANGUAGE_C_PLUS_PLUS */
|
||||
|
||||
#ifdef _LANGUAGE_MAKEROM
|
||||
#endif /* _LANGUAGE_MAKEROM */
|
||||
|
||||
#endif /* _GT_H_ */
|
||||
@@ -0,0 +1,266 @@
|
||||
#ifndef _GU_H_
|
||||
#define _GU_H_
|
||||
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1994, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.45 $
|
||||
* $Date: 1997/02/11 08:23:46 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/gu.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <PR/mbi.h>
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/sptask.h>
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_DTOR (3.14159265358979323846/180.0)
|
||||
|
||||
#define FTOFIX32(x) ((x) * 0x10000)
|
||||
#define FIX32TOF(x) ((float)(((float)x) / (float)(0x10000)))
|
||||
#define FTOFRAC8(x) ((int) MIN(((x) * (128.0)),127.0) & 0xff)
|
||||
|
||||
#define FILTER_WRAP 0
|
||||
#define FILTER_CLAMP 1
|
||||
|
||||
#define RAND(x) (guRandom()%x) /* random number between 0 to x */
|
||||
|
||||
/*
|
||||
* Data Structures
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char *base;
|
||||
int fmt, siz;
|
||||
int xsize, ysize;
|
||||
int lsize;
|
||||
/* current tile info */
|
||||
int addr;
|
||||
int w, h;
|
||||
int s, t;
|
||||
} Image;
|
||||
|
||||
typedef struct {
|
||||
float col[3];
|
||||
float pos[3];
|
||||
float a1, a2; /* actual color = col/(a1*dist + a2) */
|
||||
} PositionalLight;
|
||||
|
||||
|
||||
/*
|
||||
* Function Prototypes
|
||||
*/
|
||||
|
||||
extern int guLoadTextureBlockMipMap(Gfx **glist, unsigned char *tbuf, Image *im,
|
||||
unsigned char startTile, unsigned char pal, unsigned char cms,
|
||||
unsigned char cmt, unsigned char masks, unsigned char maskt,
|
||||
unsigned char shifts, unsigned char shiftt, unsigned char cfs,
|
||||
unsigned char cft);
|
||||
|
||||
extern int guGetDPLoadTextureTileSz (int ult, int lrt);
|
||||
extern void guDPLoadTextureTile (Gfx *glistp, void *timg,
|
||||
int texl_fmt, int texl_size,
|
||||
int img_width, int img_height,
|
||||
int uls, int ult, int lrs, int lrt,
|
||||
int palette,
|
||||
int cms, int cmt,
|
||||
int masks, int maskt,
|
||||
int shifts, int shiftt);
|
||||
|
||||
|
||||
/*
|
||||
* matrix operations:
|
||||
*
|
||||
* The 'F' version is floating point, in case the application wants
|
||||
* to do matrix manipulations and convert to fixed-point at the last
|
||||
* minute.
|
||||
*/
|
||||
extern void guMtxIdent(Mtx *m);
|
||||
extern void guMtxIdentF(float mf[4][4]);
|
||||
extern void guOrtho(Mtx *m, float l, float r, float b, float t,
|
||||
float n, float f, float scale);
|
||||
extern void guOrthoF(float mf[4][4], float l, float r, float b, float t,
|
||||
float n, float f, float scale);
|
||||
extern void guFrustum(Mtx *m, float l, float r, float b, float t,
|
||||
float n, float f, float scale);
|
||||
extern void guFrustumF(float mf[4][4], float l, float r, float b, float t,
|
||||
float n, float f, float scale);
|
||||
extern void guPerspective(Mtx *m, u16 *perspNorm, float fovy,
|
||||
float aspect, float near, float far, float scale);
|
||||
extern void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy,
|
||||
float aspect, float near, float far, float scale);
|
||||
extern void guLookAt(Mtx *m,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp);
|
||||
extern void guLookAtF(float mf[4][4], float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp);
|
||||
extern void guLookAtReflect(Mtx *m, LookAt *l,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp);
|
||||
extern void guLookAtReflectF(float mf[4][4], LookAt *l,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp);
|
||||
extern void guLookAtHilite(Mtx *m, LookAt *l, Hilite *h,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp,
|
||||
float xl1, float yl1, float zl1,
|
||||
float xl2, float yl2, float zl2,
|
||||
int twidth, int theight);
|
||||
extern void guLookAtHiliteF(float mf[4][4], LookAt *l, Hilite *h,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp,
|
||||
float xl1, float yl1, float zl1,
|
||||
float xl2, float yl2, float zl2,
|
||||
int twidth, int theight);
|
||||
extern void guLookAtStereo(Mtx *m,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp,
|
||||
float eyedist);
|
||||
extern void guLookAtStereoF(float mf[4][4],
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp,
|
||||
float eyedist);
|
||||
extern void guRotate(Mtx *m, float a, float x, float y, float z);
|
||||
extern void guRotateF(float mf[4][4], float a, float x, float y, float z);
|
||||
extern void guRotateRPY(Mtx *m, float r, float p, float y);
|
||||
extern void guRotateRPYF(float mf[4][4], float r, float p, float h);
|
||||
extern void guAlign(Mtx *m, float a, float x, float y, float z);
|
||||
extern void guAlignF(float mf[4][4], float a, float x, float y, float z);
|
||||
extern void guScale(Mtx *m, float x, float y, float z);
|
||||
extern void guScaleF(float mf[4][4], float x, float y, float z);
|
||||
extern void guTranslate(Mtx *m, float x, float y, float z);
|
||||
extern void guTranslateF(float mf[4][4], float x, float y, float z);
|
||||
extern void guPosition(Mtx *m, float r, float p, float h, float s,
|
||||
float x, float y, float z);
|
||||
extern void guPositionF(float mf[4][4], float r, float p, float h, float s,
|
||||
float x, float y, float z);
|
||||
extern void guMtxF2L(float mf[4][4], Mtx *m);
|
||||
extern void guMtxL2F(float mf[4][4], Mtx *m);
|
||||
extern void guMtxCatF(float m[4][4], float n[4][4], float r[4][4]);
|
||||
extern void guMtxCatL(Mtx *m, Mtx *n, Mtx *res);
|
||||
extern void guMtxXFMF(float mf[4][4], float x, float y, float z,
|
||||
float *ox, float *oy, float *oz);
|
||||
extern void guMtxXFML(Mtx *m, float x, float y, float z,
|
||||
float *ox, float *oy, float *oz);
|
||||
|
||||
/* vector utility: */
|
||||
extern void guNormalize(float *x, float *y, float *z);
|
||||
|
||||
/* light utilities: */
|
||||
void guPosLight(PositionalLight *pl, Light *l,
|
||||
float xOb, float yOb, float zOb);
|
||||
void guPosLightHilite(PositionalLight *pl1, PositionalLight *pl2,
|
||||
Light *l1, Light *l2,
|
||||
LookAt *l, Hilite *h,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xOb, float yOb, float zOb,
|
||||
float xUp, float yUp, float zUp,
|
||||
int twidth, int theight);
|
||||
extern int guRandom(void);
|
||||
|
||||
/*
|
||||
* Math functions
|
||||
*/
|
||||
extern float sinf(float angle);
|
||||
extern float cosf(float angle);
|
||||
extern signed short sins (unsigned short angle);
|
||||
extern signed short coss (unsigned short angle);
|
||||
extern float sqrtf(float value);
|
||||
|
||||
/*
|
||||
* Dump routines for low-level display lists
|
||||
*/
|
||||
/* flag values for guParseRdpDL() */
|
||||
#define GU_PARSERDP_VERBOSE 1
|
||||
#define GU_PARSERDP_PRAREA 2
|
||||
#define GU_PARSERDP_PRHISTO 4
|
||||
#define GU_PARSERDP_DUMPONLY 32 /* doesn't need to be same as */
|
||||
/* GU_PARSEGBI_DUMPOLNY, but this */
|
||||
/* allows app to use interchangeably */
|
||||
|
||||
extern void guParseRdpDL(u64 *rdp_dl, u64 nbytes, u8 flags);
|
||||
extern void guParseString(char *StringPointer, u64 nbytes);
|
||||
|
||||
/*
|
||||
* NO LONGER SUPPORTED,
|
||||
* use guParseRdpDL with GU_PARSERDP_DUMPONLY flags
|
||||
*/
|
||||
/* extern void guDumpRawRdpDL(u64 *rdp_dl, u64 nbytes); */
|
||||
|
||||
/* flag values for guBlinkRdpDL() */
|
||||
#define GU_BLINKRDP_HILITE 1
|
||||
#define GU_BLINKRDP_EXTRACT 2
|
||||
|
||||
extern void
|
||||
guBlinkRdpDL(u64 *rdp_dl_in, u64 nbytes_in,
|
||||
u64 *rdp_dl_out, u64 *nbytes_out,
|
||||
u32 x, u32 y, u32 radius,
|
||||
u8 red, u8 green, u8 blue,
|
||||
u8 flags);
|
||||
|
||||
/* flag values for guParseGbiDL() */
|
||||
#define GU_PARSEGBI_ROWMAJOR 1
|
||||
#define GU_PARSEGBI_NONEST 2
|
||||
#define GU_PARSEGBI_FLTMTX 4
|
||||
#define GU_PARSEGBI_SHOWDMA 8
|
||||
#define GU_PARSEGBI_ALLMTX 16
|
||||
#define GU_PARSEGBI_DUMPONLY 32
|
||||
/*
|
||||
#define GU_PARSEGBI_HANGAFTER 64
|
||||
#define GU_PARSEGBI_NOTEXTURES 128
|
||||
*/
|
||||
extern void guParseGbiDL(u64 *gbi_dl, u32 nbytes, u8 flags);
|
||||
extern void guDumpGbiDL(OSTask *tp,u8 flags);
|
||||
|
||||
#define GU_PARSE_GBI_TYPE 1
|
||||
#define GU_PARSE_RDP_TYPE 2
|
||||
#define GU_PARSE_READY 3
|
||||
#define GU_PARSE_MEM_BLOCK 4
|
||||
#define GU_PARSE_ABI_TYPE 5
|
||||
#define GU_PARSE_STRING_TYPE 6
|
||||
|
||||
typedef struct {
|
||||
int dataSize;
|
||||
int dlType;
|
||||
int flags;
|
||||
u32 paddr;
|
||||
} guDLPrintCB;
|
||||
|
||||
void guSprite2DInit(uSprite *SpritePointer,
|
||||
void *SourceImagePointer,
|
||||
void *TlutPointer,
|
||||
int Stride,
|
||||
int SubImageWidth,
|
||||
int SubImageHeight,
|
||||
int SourceImageType,
|
||||
int SourceImageBitSize,
|
||||
int SourceImageOffsetS,
|
||||
int SourceImageOffsetT);
|
||||
|
||||
#endif /* !_GU_H_ */
|
||||
@@ -0,0 +1,238 @@
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.8 $
|
||||
* $Date: 1997/02/13 14:54:47 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/leo.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _LEO_H_
|
||||
#define _LEO_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <ultra64.h>
|
||||
#include <PR/leoappli.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
typedef u32 LEOError;
|
||||
|
||||
typedef u8 LEOSpdlMode;
|
||||
|
||||
typedef u8 LEOStatus;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 drive; /* version of hw */
|
||||
u8 driver; /* version of sw */
|
||||
u8 deviceType; /* dev type, always 00 */
|
||||
u8 ndevices; /* # of devices, always 01 */
|
||||
} LEOVersion;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 startLBA;
|
||||
u32 endLBA;
|
||||
u32 nbytes;
|
||||
} LEOCapacity;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 pad;
|
||||
u8 yearhi;
|
||||
u8 yearlo;
|
||||
u8 month;
|
||||
u8 day;
|
||||
u8 hour;
|
||||
u8 minute;
|
||||
u8 second;
|
||||
} LEODiskTime;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u64 lineNumber;
|
||||
LEODiskTime time;
|
||||
} LEOSerialNum;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 gameName[4];
|
||||
u8 gameVersion;
|
||||
u8 diskNumber;
|
||||
u16 diskUsage;
|
||||
LEOSerialNum serialNumber;
|
||||
u64 reserve;
|
||||
} LEODiskID;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LEOCmdHeader header;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 lba;
|
||||
u32 xfer_blks;
|
||||
void *buff_ptr;
|
||||
u32 rw_bytes;
|
||||
} readwrite;
|
||||
struct
|
||||
{
|
||||
u32 lba;
|
||||
} seek;
|
||||
struct
|
||||
{
|
||||
void *buffer_pointer;
|
||||
} readdiskid;
|
||||
LEODiskTime time;
|
||||
} data;
|
||||
|
||||
} LEOCmd;
|
||||
|
||||
#define _nbytes readwrite.rw_bytes
|
||||
#define _result header.status
|
||||
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
#define LEO_SW_VERSION 1 /* This will be returned by */
|
||||
/* LeoInquiry command */
|
||||
|
||||
#define OS_PRIORITY_LEOMGR OS_PRIORITY_PIMGR
|
||||
|
||||
/*
|
||||
* Drive Rom offset address
|
||||
*/
|
||||
#define DDROM_FONT_START 0x000a0000
|
||||
#define DDROM_WAVEDATA_START 0x00140000
|
||||
|
||||
/*
|
||||
* Definition for osLeoSpdlMotor()
|
||||
*/
|
||||
#define ACTIVE 0
|
||||
#define STANDBY 1
|
||||
#define SLEEP 2
|
||||
|
||||
#define LEO_MOTOR_ACTIVE 0
|
||||
#define LEO_MOTOR_STANDBY 1
|
||||
#define LEO_MOTOR_SLEEP 2
|
||||
|
||||
#define NUM_LBAS 4292 /* total number of LBAs */
|
||||
|
||||
#define BLK_SIZE_ZONE0 19720
|
||||
#define BLK_SIZE_ZONE1 18360
|
||||
#define BLK_SIZE_ZONE2 17680
|
||||
#define BLK_SIZE_ZONE3 16320
|
||||
#define BLK_SIZE_ZONE4 14960
|
||||
#define BLK_SIZE_ZONE5 13600
|
||||
#define BLK_SIZE_ZONE6 12240
|
||||
#define BLK_SIZE_ZONE7 10880
|
||||
#define BLK_SIZE_ZONE8 9520
|
||||
|
||||
#define MAX_BLK_SIZE BLK_SIZE_ZONE0
|
||||
#define MIN_BLK_SIZE BLK_SIZE_ZONE8
|
||||
|
||||
/*
|
||||
* Error codes
|
||||
*/
|
||||
#define LEO_ERROR_GOOD 0
|
||||
#define LEO_ERROR_DRIVE_NOT_READY 1
|
||||
#define LEO_ERROR_DIAGNOSTIC_FAILURE 2
|
||||
#define LEO_ERROR_COMMAND_PHASE_ERROR 3
|
||||
#define LEO_ERROR_DATA_PHASE_ERROR 4
|
||||
#define LEO_ERROR_REAL_TIME_CLOCK_FAILURE 5
|
||||
#define LEO_ERROR_BUSY 8
|
||||
#define LEO_ERROR_INCOMPATIBLE_MEDIUM_INSTALLED 11
|
||||
#define LEO_ERROR_UNKNOWN_FORMAT 11
|
||||
#define LEO_ERROR_NO_SEEK_COMPLETE 21
|
||||
#define LEO_ERROR_WRITE_FAULT 22
|
||||
#define LEO_ERROR_UNRECOVERED_READ_ERROR 23
|
||||
#define LEO_ERROR_NO_REFERENCE_POSITION_FOUND 24
|
||||
#define LEO_ERROR_TRACK_FOLLOWING_ERROR 25
|
||||
#define LEO_ERROR_TRACKING_OR_SPDL_SERVO_FAILURE 25
|
||||
#define LEO_ERROR_INVALID_COMMAND_OPERATION_CODE 31
|
||||
#define LEO_ERROR_LBA_OUT_OF_RANGE 32
|
||||
#define LEO_ERROR_WRITE_PROTECT_ERROR 33
|
||||
#define LEO_ERROR_COMMAND_CLEARED_BY_HOST 34
|
||||
#define LEO_ERROR_COMMAND_TERMINATED 34
|
||||
#define LEO_ERROR_QUEUE_FULL 35
|
||||
#define LEO_ERROR_DEVICE_COMMUNICATION_FAILURE 41
|
||||
#define LEO_ERROR_MEDIUM_NOT_PRESENT 42
|
||||
#define LEO_ERROR_POWERONRESET_DEVICERESET_OCCURED 43
|
||||
#define LEO_ERROR_RAMPACK_NOT_CONNECTED 44
|
||||
#define LEO_ERROR_NOT_BOOTED_DISK 45
|
||||
#define LEO_ERROR_DIDNOT_CHANGED_DISK_AS_EXPECTED 46
|
||||
#define LEO_ERROR_MEDIUM_MAY_HAVE_CHANGED 47
|
||||
#define LEO_ERROR_RTC_NOT_SET_CORRECTLY 48
|
||||
#define LEO_ERROR_DISK_EJECTED_WHEN_ACCESSED 49
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
#define GET_ERROR(x) ((x).header.sense)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
extern LEODiskID leoBootID;
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
/* Initialize routine */
|
||||
extern s32 LeoCreateLeoManager(OSPri comPri, OSPri intPri,
|
||||
OSMesg *cmdBuf, s32 cmdMsgCnt);
|
||||
|
||||
/* Synchronous functions */
|
||||
extern s32 LeoClearQueue(void);
|
||||
extern s32 LeoByteToLBA(s32 startLBA, u32 nbytes, s32 *lbas);
|
||||
extern s32 LeoLBAToByte(s32 startLBA, u32 nLBAs, s32 *bytes);
|
||||
extern s32 LeoReadCapacity(LEOCapacity *cap, s32 dir);
|
||||
extern s32 LeoInquiry(LEOVersion *ver);
|
||||
extern s32 LeoTestUnitReady(LEOStatus *status);
|
||||
extern s32 LeoModeSelect(u32 standby, u32 sleep);
|
||||
|
||||
/* Asynchronous functions */
|
||||
extern s32 LeoSpdlMotor(LEOCmd *cmdBlock, LEOSpdlMode mode, OSMesgQueue *mq);
|
||||
extern s32 LeoSeek(LEOCmd *cmdBlock, u32 lba, OSMesgQueue *mq);
|
||||
extern s32 LeoRezero(LEOCmd *cmdBlock, OSMesgQueue *mq);
|
||||
extern s32 LeoReadWrite(LEOCmd *cmdBlock, s32 direction,
|
||||
u32 LBA, void *vAddr, u32 nLBAs, OSMesgQueue *mq);
|
||||
extern s32 LeoReadDiskID(LEOCmd *cmdBlock, LEODiskID *vaddr, OSMesgQueue *mq);
|
||||
extern s32 LeoSetRTC(LEOCmd *cmdBlock, LEODiskTime *RTCdata, OSMesgQueue *mq);
|
||||
extern s32 LeoReadRTC(LEOCmd *cmdBlock, OSMesgQueue *mq);
|
||||
|
||||
/* Font routines */
|
||||
extern int LeoGetKAdr(int sjis);
|
||||
extern int LeoGetAAdr(int code,int *dx,int *dy, int *cy);
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_LEO_H */
|
||||
@@ -0,0 +1,273 @@
|
||||
/*
|
||||
* F i l e N a m e : l e o a p p l i . h
|
||||
*
|
||||
****************************************************************************
|
||||
* (C) Copyright ALPS Electric Co., Ltd. 1995-1996
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 1997/02/11 16:14:19 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/leoappli.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* DRIVE PARAMETER */
|
||||
/*-----------------------------------*/
|
||||
#define LEO_DISK_TYPE_MIN 0
|
||||
#define LEO_DISK_TYPE_MAX 6
|
||||
|
||||
#define LEO_LBA_MIN 0
|
||||
#define LEO_LBA_MAX 4291
|
||||
|
||||
#define LEO_LBA_ROM_TOP LEO_LBA_MIN
|
||||
#define LEO_LBA_ROM_END0 1417
|
||||
#define LEO_LBA_ROM_END1 1965
|
||||
#define LEO_LBA_ROM_END2 2513
|
||||
#define LEO_LBA_ROM_END3 3061
|
||||
#define LEO_LBA_ROM_END4 3609
|
||||
#define LEO_LBA_ROM_END5 4087
|
||||
#define LEO_LBA_ROM_END6 LEO_LBA_MAX
|
||||
#define LEO_LBA_RAM_TOP0 (LEO_LBA_ROM_END0+1)
|
||||
#define LEO_LBA_RAM_TOP1 (LEO_LBA_ROM_END1+1)
|
||||
#define LEO_LBA_RAM_TOP2 (LEO_LBA_ROM_END2+1)
|
||||
#define LEO_LBA_RAM_TOP3 (LEO_LBA_ROM_END3+1)
|
||||
#define LEO_LBA_RAM_TOP4 (LEO_LBA_ROM_END4+1)
|
||||
#define LEO_LBA_RAM_TOP5 (LEO_LBA_ROM_END5+1)
|
||||
#define LEO_LBA_RAM_TOP6 (LEO_LBA_ROM_END6+1)
|
||||
#define LEO_LBA_RAM_END6 LEO_LBA_MAX
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* LEO FUNCTION DEFINITIONS */
|
||||
/*-----------------------------------*/
|
||||
extern void leoInitialize(OSPri PRI_WRK, OSPri PRI_INT, OSMesg *command_que_buf, u32 cmd_buff_size);
|
||||
extern void leoCommand(void *CDB);
|
||||
extern void leoReset(void);
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* THREAD PRIORITY */
|
||||
/*-----------------------------------*/
|
||||
#define LEO_PRIORITY_WRK (OS_PRIORITY_PIMGR-1)
|
||||
#define LEO_PRIORITY_INT OS_PRIORITY_PIMGR
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* COMMAND CODE */
|
||||
/*-----------------------------------*/
|
||||
#define LEO_COMMAND_CLEAR_QUE 0x01
|
||||
#define LEO_COMMAND_INQUIRY 0x02
|
||||
#define LEO_COMMAND_TEST_UNIT_READY 0x03
|
||||
#define LEO_COMMAND_REZERO 0x04
|
||||
#define LEO_COMMAND_READ 0x05
|
||||
#define LEO_COMMAND_WRITE 0x06
|
||||
#define LEO_COMMAND_SEEK 0x07
|
||||
#define LEO_COMMAND_START_STOP 0x08
|
||||
#define LEO_COMMAND_READ_CAPACITY 0x09
|
||||
#define LEO_COMMAND_TRANSLATE 0x0a
|
||||
#define LEO_COMMAND_MODE_SELECT 0x0b
|
||||
#define LEO_COMMAND_READ_DISK_ID 0x0c
|
||||
#define LEO_COMMAND_READ_TIMER 0x0d
|
||||
#define LEO_COMMAND_SET_TIMER 0x0e
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* CONTROL BIT */
|
||||
/*-----------------------------------*/
|
||||
#define LEO_CONTROL_POST 0x80 /* ENABLE POST QUEUE */
|
||||
#define LEO_CONTROL_START 0x01 /* START COMMAND */
|
||||
#define LEO_CONTROL_STBY 0x02 /* STAND-BY MODE(NOT SLEEP MODE) */
|
||||
#define LEO_CONTROL_WRT 0x01 /* READ RE-WRITE-ABLE CAPACITY */
|
||||
#define LEO_CONTROL_TBL 0x01 /* TRANSLATE BYTE TO LBA */
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* BIT FIELD PARAMETER */
|
||||
/*-----------------------------------*/
|
||||
#define LEO_TEST_UNIT_MR 0x01 /* MEDIUM REMOVED */
|
||||
#define LEO_TEST_UNIT_RE 0x02 /* HEAD RETRACTED */
|
||||
#define LEO_TEST_UNIT_SS 0x04 /* SPINDLE STOPPED */
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* STATUS */
|
||||
/*-----------------------------------*/
|
||||
#define LEO_STATUS_GOOD 0x00
|
||||
#define LEO_STATUS_CHECK_CONDITION 0x02
|
||||
#define LEO_STATUS_BUSY 0x08
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* SENSE CODE */
|
||||
/*-----------------------------------*/
|
||||
#define LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION 00
|
||||
#define LEO_SENSE_DRIVE_NOT_READY 01
|
||||
#define LEO_SENSE_DIAGNOSTIC_FAILURE 02
|
||||
#define LEO_SENSE_COMMAND_PHASE_ERROR 03
|
||||
#define LEO_SENSE_DATA_PHASE_ERROR 04
|
||||
#define LEO_SENSE_REAL_TIME_CLOCK_FAILURE 05
|
||||
#define LEO_SENSE_INCOMPATIBLE_MEDIUM_INSTALLED 11
|
||||
#define LEO_SENSE_UNKNOWN_FORMAT 11
|
||||
#define LEO_SENSE_NO_SEEK_COMPLETE 21
|
||||
#define LEO_SENSE_WRITE_FAULT 22
|
||||
#define LEO_SENSE_UNRECOVERED_READ_ERROR 23
|
||||
#define LEO_SENSE_NO_REFERENCE_POSITION_FOUND 24
|
||||
#define LEO_SENSE_TRACK_FOLLOWING_ERROR 25
|
||||
#define LEO_SENSE_TRACKING_OR_SPDL_SERVO_FAILURE 25
|
||||
#define LEO_SENSE_INVALID_COMMAND_OPERATION_CODE 31
|
||||
#define LEO_SENSE_LBA_OUT_OF_RANGE 32
|
||||
#define LEO_SENSE_WRITE_PROTECT_ERROR 33
|
||||
#define LEO_SENSE_COMMAND_TERMINATED 34
|
||||
#define LEO_SENSE_QUEUE_FULL 35
|
||||
#define LEO_SENSE_ILLEGAL_TIMER_VALUE 36
|
||||
#define LEO_SENSE_DEVICE_COMMUNICATION_FAILURE 41
|
||||
#define LEO_SENSE_MEDIUM_NOT_PRESENT 42
|
||||
#define LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED 43
|
||||
#define LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED 47
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* Command Block Header */
|
||||
/*-----------------------------------*/
|
||||
typedef struct{
|
||||
u8 command;
|
||||
u8 reserve1;
|
||||
u8 control;
|
||||
u8 reserve3;
|
||||
u8 status;
|
||||
u8 sense;
|
||||
u8 reserve6;
|
||||
u8 reserve7;
|
||||
OSMesgQueue *post;
|
||||
} LEOCmdHeader;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* CLEAR QUEUE(01H) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
} LEOCmdClearQue;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* INQUIRY(02H) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
u8 dev_type;
|
||||
u8 version;
|
||||
u8 dev_num;
|
||||
u8 leo_bios_ver;
|
||||
u32 reserve5;
|
||||
} LEOCmdInquiry;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* TEST UNIT READY(03H) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
u8 test;
|
||||
u8 reserve2;
|
||||
u8 reserve3;
|
||||
u8 reserve4;
|
||||
} LEOCmdTestUnitReady;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* REZERO(04H) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
} LEOCmdRezero;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* READ(05H) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
u32 lba;
|
||||
u32 xfer_blks;
|
||||
void *buff_ptr;
|
||||
u32 rw_bytes;
|
||||
} LEOCmdRead;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* WRITE(06H) command */
|
||||
/*-----------------------------------*/
|
||||
typedef LEOCmdRead LEOCmdWrite;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* SEEK(07H) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
u32 lba;
|
||||
} LEOCmdSeek;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* START/STOP(08H) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
} LEOCmdStartStop;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* READ CAPACITY(09H) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
u32 start_lba;
|
||||
u32 end_lba;
|
||||
u32 capa_bytes;
|
||||
} LEOCmdReadCapacity;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* TRANSLATE(0AH) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
u32 start_lba;
|
||||
u32 in_param;
|
||||
u32 out_param;
|
||||
} LEOCmdTranslate;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* MODE SELECT(0BH) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
u8 page_code;
|
||||
u8 reserve1;
|
||||
u8 standby_time;
|
||||
u8 sleep_time;
|
||||
u8 led_on_time;
|
||||
u8 led_off_time;
|
||||
u8 reserve18;
|
||||
u8 reserve19;
|
||||
} LEOCmdModeSelect;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* READ DISK ID(0CH) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
void *buffer_pointer;
|
||||
} LEOCmdReadDiskId;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* READ TIMER(0DH) command */
|
||||
/*-----------------------------------*/
|
||||
typedef struct {
|
||||
LEOCmdHeader header;
|
||||
u8 reserve12;
|
||||
u8 reserve13;
|
||||
u8 year;
|
||||
u8 month;
|
||||
u8 day;
|
||||
u8 hour;
|
||||
u8 minute;
|
||||
u8 second;
|
||||
} LEOCmdReadTimer;
|
||||
|
||||
/*-----------------------------------*/
|
||||
/* SET TIMER(0EH) command */
|
||||
/*-----------------------------------*/
|
||||
typedef LEOCmdReadTimer LEOCmdSetTimer;
|
||||
|
||||
/*-------end of leoappli.h--------------------------*/
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
/*---------------------------------------------------------------------
|
||||
File : libnos.h version 1.3
|
||||
|
||||
Coded by Yoshitaka Yasumoto. Apr 13, 1996.
|
||||
|
||||
Copyright by Nintendo, Co., Ltd. 1996.
|
||||
---------------------------------------------------------------------*/
|
||||
#ifndef __libnos_h__
|
||||
#define __libnos_h__
|
||||
|
||||
#define FONTSIZE_E 2112
|
||||
#define FONTSIZE_J 4768
|
||||
|
||||
extern void nosLoadFont(u16 *);
|
||||
extern int nosPakMenu(OSMesgQueue *, OSMesgQueue *);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#ifndef _MBI_H_
|
||||
#define _MBI_H_
|
||||
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1994, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.134 $
|
||||
* $Date: 1997/02/11 08:25:28 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/mbi.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Header file for the Media Binary Interface
|
||||
*
|
||||
* NOTE: This file is included by the RSP microcode, so any C-specific
|
||||
* constructs must be bracketed by #ifdef _LANGUAGE_C
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* the SHIFT macros are used to build display list commands, inserting
|
||||
* bit-fields into a 32-bit word. They take a value, a shift amount,
|
||||
* and a width.
|
||||
*
|
||||
* For the left shift, the lower bits of the value are masked,
|
||||
* then shifted left.
|
||||
*
|
||||
* For the right shift, the value is shifted right, then the lower bits
|
||||
* are masked.
|
||||
*
|
||||
* (NOTE: _SHIFTL(v, 0, 32) won't work, just use an assignment)
|
||||
*
|
||||
*/
|
||||
#define _SHIFTL(v, s, w) \
|
||||
((unsigned int) (((unsigned int)(v) & ((0x01 << (w)) - 1)) << (s)))
|
||||
#define _SHIFTR(v, s, w) \
|
||||
((unsigned int)(((unsigned int)(v) >> (s)) & ((0x01 << (w)) - 1)))
|
||||
|
||||
#define _SHIFT _SHIFTL /* old, for compatibility only */
|
||||
|
||||
#define G_ON (1)
|
||||
#define G_OFF (0)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Graphics Binary Interface
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <PR/gbi.h>
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Audio Binary Interface
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <PR/abi.h>
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Task list
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#define M_GFXTASK 1
|
||||
#define M_AUDTASK 2
|
||||
#define M_VIDTASK 3
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Segment macros and definitions
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#define NUM_SEGMENTS (16)
|
||||
#define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00ffffff)
|
||||
#define SEGMENT_NUMBER(a) ((unsigned int)(a) >> 24)
|
||||
#define SEGMENT_ADDR(num, off) (((num) << 24) + (off))
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#endif /* !_MBI_H_ */
|
||||
@@ -0,0 +1,155 @@
|
||||
/*---------------------------------------------------------------------
|
||||
File : ncode.h
|
||||
|
||||
Coded by Yoshitaka Yasumoto. Feb 14, 1996.
|
||||
Copyright by Nintendo, Co., Ltd. 1996.
|
||||
---------------------------------------------------------------------*/
|
||||
#ifndef __ncode_h__
|
||||
#define __ncode_h__
|
||||
|
||||
//------------------------------------------------------
|
||||
// Nintendo code for letter(upper case) & digit
|
||||
//------------------------------------------------------
|
||||
#define __NUL 0x00
|
||||
#define __SPC 0x0f
|
||||
#define __0 0x10
|
||||
#define __1 0x11
|
||||
#define __2 0x12
|
||||
#define __3 0x13
|
||||
#define __4 0x14
|
||||
#define __5 0x15
|
||||
#define __6 0x16
|
||||
#define __7 0x17
|
||||
#define __8 0x18
|
||||
#define __9 0x19
|
||||
#define __A 0x1a
|
||||
#define __B 0x1b
|
||||
#define __C 0x1c
|
||||
#define __D 0x1d
|
||||
#define __E 0x1e
|
||||
#define __F 0x1f
|
||||
#define __G 0x20
|
||||
#define __H 0x21
|
||||
#define __I 0x22
|
||||
#define __J 0x23
|
||||
#define __K 0x24
|
||||
#define __L 0x25
|
||||
#define __M 0x26
|
||||
#define __N 0x27
|
||||
#define __O 0x28
|
||||
#define __P 0x29
|
||||
#define __Q 0x2a
|
||||
#define __R 0x2b
|
||||
#define __S 0x2c
|
||||
#define __T 0x2d
|
||||
#define __U 0x2e
|
||||
#define __V 0x2f
|
||||
#define __W 0x30
|
||||
#define __X 0x31
|
||||
#define __Y 0x32
|
||||
#define __Z 0x33
|
||||
#define __EXCLAM 0x34 // !
|
||||
#define __2QUOTE 0x35 // "
|
||||
#define __NUMBR 0x36 // #
|
||||
#define __1QUOTE 0x37 // '
|
||||
#define __ASTER 0x38 // *
|
||||
#define __PLUS 0x39 // +
|
||||
#define __COMMA 0x3a // ,
|
||||
#define __MINUS 0x3b // -
|
||||
#define __PERIOD 0x3c // .
|
||||
#define __SLASH 0x3d // /
|
||||
#define __COLON 0x3e // :
|
||||
#define __EQUAL 0x3f // =
|
||||
#define __QUEST 0x40 // ?
|
||||
#define __AT 0x41 // @
|
||||
|
||||
//-----------------------------------------------
|
||||
// Nintendo code for JAPANESE letter
|
||||
//-----------------------------------------------
|
||||
#ifdef LANG_JAPANESE
|
||||
# define j_MARU 0x42
|
||||
# define j_DAKU 0x43
|
||||
# define j_HANDAKU 0x44
|
||||
# define j_XA 0x45
|
||||
# define j_XI 0x46
|
||||
# define j_XU 0x47
|
||||
# define j_XE 0x48
|
||||
# define j_XO 0x49
|
||||
# define j_XTSU 0x4a
|
||||
# define j_XYA 0x4b
|
||||
# define j_XYU 0x4c
|
||||
# define j_XYO 0x4d
|
||||
# define j_WO 0x4e
|
||||
# define j_N 0x4f
|
||||
# define j_A 0x50
|
||||
# define j_I 0x51
|
||||
# define j_U 0x52
|
||||
# define j_E 0x53
|
||||
# define j_O 0x54
|
||||
# define j_KA 0x55
|
||||
# define j_KI 0x56
|
||||
# define j_KU 0x57
|
||||
# define j_KE 0x58
|
||||
# define j_KO 0x59
|
||||
# define j_SA 0x5a
|
||||
# define j_SHI 0x5b
|
||||
# define j_SU 0x5c
|
||||
# define j_SE 0x5d
|
||||
# define j_SO 0x5e
|
||||
# define j_TA 0x5f
|
||||
# define j_CHI 0x60
|
||||
# define j_TSU 0x61
|
||||
# define j_TE 0x62
|
||||
# define j_TO 0x63
|
||||
# define j_NA 0x64
|
||||
# define j_NI 0x65
|
||||
# define j_NU 0x66
|
||||
# define j_NE 0x67
|
||||
# define j_NO 0x68
|
||||
# define j_HA 0x69
|
||||
# define j_HI 0x6a
|
||||
# define j_FU 0x6b
|
||||
# define j_HE 0x6c
|
||||
# define j_HO 0x6d
|
||||
# define j_MA 0x6e
|
||||
# define j_MI 0x6f
|
||||
# define j_MU 0x70
|
||||
# define j_ME 0x71
|
||||
# define j_MO 0x72
|
||||
# define j_YA 0x73
|
||||
# define j_YU 0x74
|
||||
# define j_YO 0x75
|
||||
# define j_RA 0x76
|
||||
# define j_RI 0x77
|
||||
# define j_RU 0x78
|
||||
# define j_RE 0x79
|
||||
# define j_RO 0x7a
|
||||
# define j_WA 0x7b
|
||||
# define j_GA 0x7c
|
||||
# define j_GI 0x7d
|
||||
# define j_GU 0x7e
|
||||
# define j_GE 0x7f
|
||||
# define j_GO 0x80
|
||||
# define j_ZA 0x81
|
||||
# define j_JI 0x82
|
||||
# define j_ZU 0x83
|
||||
# define j_ZE 0x84
|
||||
# define j_ZO 0x85
|
||||
# define j_DA 0x86
|
||||
# define j_DI 0x87
|
||||
# define j_DU 0x88
|
||||
# define j_DE 0x89
|
||||
# define j_DO 0x8a
|
||||
# define j_BA 0x8b
|
||||
# define j_BI 0x8c
|
||||
# define j_BU 0x8d
|
||||
# define j_BE 0x8e
|
||||
# define j_BO 0x8f
|
||||
# define j_PA 0x90
|
||||
# define j_PI 0x91
|
||||
# define j_PU 0x92
|
||||
# define j_PE 0x93
|
||||
# define j_PO 0x94
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,118 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.18 $
|
||||
* $Date: 1997/02/11 08:26:14 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/os_internal.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _OS_INTERNAL_H_
|
||||
#define _OS_INTERNAL_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Routines to get/fetch coprocessor 0 registers */
|
||||
|
||||
extern u32 __osGetCause(void);
|
||||
extern void __osSetCause(u32);
|
||||
extern u32 __osGetCompare(void);
|
||||
extern void __osSetCompare(u32);
|
||||
extern u32 __osGetConfig(void);
|
||||
extern void __osSetConfig(u32);
|
||||
extern void __osSetCount(u32);
|
||||
extern u32 __osGetSR(void);
|
||||
extern void __osSetSR(u32);
|
||||
extern u32 __osDisableInt(void);
|
||||
extern void __osRestoreInt(u32);
|
||||
|
||||
/* Routines to get/set floating-point control and status register */
|
||||
extern u32 __osSetFpcCsr(u32);
|
||||
extern u32 __osGetFpcCsr(void);
|
||||
|
||||
/* Routine for HW interrupt "handler" */
|
||||
extern void __osSetHWIntrRoutine(OSHWIntr, s32 (*handler)(void));
|
||||
|
||||
/* Routine for global interrupt mask */
|
||||
extern void __osSetGlobalIntMask(OSHWIntr);
|
||||
extern void __osResetGlobalIntMask(OSHWIntr);
|
||||
|
||||
/* Routine for global interrupt mask */
|
||||
extern s32 __osLeoInterrupt(void);
|
||||
|
||||
/* Routines for fetch TLB info */
|
||||
|
||||
extern u32 __osGetTLBASID(void);
|
||||
extern u32 __osGetTLBPageMask(s32);
|
||||
extern u32 __osGetTLBHi(s32);
|
||||
extern u32 __osGetTLBLo0(s32);
|
||||
extern u32 __osGetTLBLo1(s32);
|
||||
|
||||
/* Serial interface (Si) */
|
||||
|
||||
extern u32 __osSiGetStatus(void);
|
||||
extern s32 __osSiRawWriteIo(u32, u32);
|
||||
extern s32 __osSiRawReadIo(u32, u32 *);
|
||||
extern s32 __osSiRawStartDma(s32, void *);
|
||||
|
||||
/* Signal processor interface (Sp) */
|
||||
|
||||
extern u32 __osSpGetStatus(void);
|
||||
extern void __osSpSetStatus(u32);
|
||||
extern s32 __osSpSetPc(u32);
|
||||
extern s32 __osSpRawWriteIo(u32, u32);
|
||||
extern s32 __osSpRawReadIo(u32, u32 *);
|
||||
extern s32 __osSpRawStartDma(s32, u32, void *, u32);
|
||||
|
||||
/* Error handling */
|
||||
|
||||
extern void __osError(s16, s16, ...);
|
||||
extern OSThread * __osGetCurrFaultedThread(void);
|
||||
extern OSThread * __osGetNextFaultedThread(OSThread *);
|
||||
|
||||
/* Development board functions */
|
||||
|
||||
extern void __osGIOInit(s32);
|
||||
extern void __osGIOInterrupt(s32);
|
||||
extern void __osGIORawInterrupt(s32);
|
||||
|
||||
/* For debugger use */
|
||||
|
||||
extern OSThread * __osGetActiveQueue(void);
|
||||
|
||||
/* Debug port */
|
||||
extern void __osSyncPutChars(int, int, const char *);
|
||||
extern int __osSyncGetChars(char *);
|
||||
extern void __osAsyncPutChars(int, int, const char *);
|
||||
extern int __osAsyncGetChars(char *);
|
||||
extern int __osAtomicInc(unsigned int *p);
|
||||
extern int __osAtomicDec(unsigned int *p);
|
||||
|
||||
/* routine for rdb port */
|
||||
extern u32 __osRdbSend(u8 *buf, u32 size, u32 type);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_H */
|
||||
@@ -0,0 +1,118 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.18 $
|
||||
* $Date: 1997/02/11 08:26:14 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/os_internal.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _OS_INTERNAL_H_
|
||||
#define _OS_INTERNAL_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Routines to get/fetch coprocessor 0 registers */
|
||||
|
||||
extern u32 __osGetCause(void);
|
||||
extern void __osSetCause(u32);
|
||||
extern u32 __osGetCompare(void);
|
||||
extern void __osSetCompare(u32);
|
||||
extern u32 __osGetConfig(void);
|
||||
extern void __osSetConfig(u32);
|
||||
extern void __osSetCount(u32);
|
||||
extern u32 __osGetSR(void);
|
||||
extern void __osSetSR(u32);
|
||||
extern u32 __osDisableInt(void);
|
||||
extern void __osRestoreInt(u32);
|
||||
|
||||
/* Routines to get/set floating-point control and status register */
|
||||
extern u32 __osSetFpcCsr(u32);
|
||||
extern u32 __osGetFpcCsr(void);
|
||||
|
||||
/* Routine for HW interrupt "handler" */
|
||||
extern void __osSetHWIntrRoutine(OSHWIntr, s32 (*handler)(void));
|
||||
|
||||
/* Routine for global interrupt mask */
|
||||
extern void __osSetGlobalIntMask(OSHWIntr);
|
||||
extern void __osResetGlobalIntMask(OSHWIntr);
|
||||
|
||||
/* Routine for global interrupt mask */
|
||||
extern s32 __osLeoInterrupt(void);
|
||||
|
||||
/* Routines for fetch TLB info */
|
||||
|
||||
extern u32 __osGetTLBASID(void);
|
||||
extern u32 __osGetTLBPageMask(s32);
|
||||
extern u32 __osGetTLBHi(s32);
|
||||
extern u32 __osGetTLBLo0(s32);
|
||||
extern u32 __osGetTLBLo1(s32);
|
||||
|
||||
/* Serial interface (Si) */
|
||||
|
||||
extern u32 __osSiGetStatus(void);
|
||||
extern s32 __osSiRawWriteIo(u32, u32);
|
||||
extern s32 __osSiRawReadIo(u32, u32 *);
|
||||
extern s32 __osSiRawStartDma(s32, void *);
|
||||
|
||||
/* Signal processor interface (Sp) */
|
||||
|
||||
extern u32 __osSpGetStatus(void);
|
||||
extern void __osSpSetStatus(u32);
|
||||
extern s32 __osSpSetPc(u32);
|
||||
extern s32 __osSpRawWriteIo(u32, u32);
|
||||
extern s32 __osSpRawReadIo(u32, u32 *);
|
||||
extern s32 __osSpRawStartDma(s32, u32, void *, u32);
|
||||
|
||||
/* Error handling */
|
||||
|
||||
extern void __osError(s16, s16, ...);
|
||||
extern OSThread * __osGetCurrFaultedThread(void);
|
||||
extern OSThread * __osGetNextFaultedThread(OSThread *);
|
||||
|
||||
/* Development board functions */
|
||||
|
||||
extern void __osGIOInit(s32);
|
||||
extern void __osGIOInterrupt(s32);
|
||||
extern void __osGIORawInterrupt(s32);
|
||||
|
||||
/* For debugger use */
|
||||
|
||||
extern OSThread * __osGetActiveQueue(void);
|
||||
|
||||
/* Debug port */
|
||||
extern void __osSyncPutChars(int, int, const char *);
|
||||
extern int __osSyncGetChars(char *);
|
||||
extern void __osAsyncPutChars(int, int, const char *);
|
||||
extern int __osAsyncGetChars(char *);
|
||||
extern int __osAtomicInc(unsigned int *p);
|
||||
extern int __osAtomicDec(unsigned int *p);
|
||||
|
||||
/* routine for rdb port */
|
||||
extern u32 __osRdbSend(u8 *buf, u32 size, u32 type);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_H */
|
||||
@@ -0,0 +1,126 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 1997/02/11 08:13:08 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/PRimage.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef __GL_IMAGE_H__
|
||||
#define __GL_IMAGE_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Defines for image files . . . .
|
||||
*
|
||||
* Paul Haeberli - 1984
|
||||
* Look in /usr/people/4Dgifts/iristools/imgtools for example code!
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define IMAGIC 0732
|
||||
|
||||
/* colormap of images */
|
||||
#define CM_NORMAL 0 /* file contains rows of values which
|
||||
* are either RGB values (zsize == 3)
|
||||
* or greyramp values (zsize == 1) */
|
||||
#define CM_DITHERED 1
|
||||
#define CM_SCREEN 2 /* file contains data which is a screen
|
||||
* image; getrow returns buffer which
|
||||
* can be displayed directly with
|
||||
* writepixels */
|
||||
#define CM_COLORMAP 3 /* a colormap file */
|
||||
|
||||
#define TYPEMASK 0xff00
|
||||
#define BPPMASK 0x00ff
|
||||
#define ITYPE_VERBATIM 0x0000
|
||||
#define ITYPE_RLE 0x0100
|
||||
#define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE)
|
||||
#define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM)
|
||||
#define BPP(type) ((type) & BPPMASK)
|
||||
#define RLE(bpp) (ITYPE_RLE | (bpp))
|
||||
#define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp))
|
||||
#define IBUFSIZE(pixels) ((pixels+(pixels>>6))<<2)
|
||||
#define RLE_NOP 0x00
|
||||
|
||||
#define ierror(p) (((p)->flags&_IOERR)!=0)
|
||||
#define ifileno(p) ((p)->file)
|
||||
#define getpix(p) (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p))
|
||||
#define putpix(p,x) (--(p)->cnt>=0 \
|
||||
? ((int)(*(p)->ptr++=(unsigned)(x))) \
|
||||
: iflsbuf(p,(unsigned)(x)))
|
||||
|
||||
typedef struct {
|
||||
unsigned short imagic; /* stuff saved on disk . . */
|
||||
unsigned short type;
|
||||
unsigned short dim;
|
||||
unsigned short xsize;
|
||||
unsigned short ysize;
|
||||
unsigned short zsize;
|
||||
unsigned long min;
|
||||
unsigned long max;
|
||||
unsigned long wastebytes;
|
||||
char name[80];
|
||||
unsigned long colormap;
|
||||
|
||||
long file; /* stuff used in core only */
|
||||
unsigned short flags;
|
||||
short dorev;
|
||||
short x;
|
||||
short y;
|
||||
short z;
|
||||
short cnt;
|
||||
unsigned short *ptr;
|
||||
unsigned short *base;
|
||||
unsigned short *tmpbuf;
|
||||
unsigned long offset;
|
||||
unsigned long rleend; /* for rle images */
|
||||
unsigned long *rowstart; /* for rle images */
|
||||
long *rowsize; /* for rle images */
|
||||
} IMAGE;
|
||||
|
||||
IMAGE *icreate();
|
||||
/*
|
||||
* IMAGE *iopen(char *file, char *mode, unsigned int type, unsigned int dim,
|
||||
* unsigned int xsize, unsigned int ysize, unsigned int zsize);
|
||||
* IMAGE *fiopen(int f, char *mode, unsigned int type, unsigned int dim,
|
||||
* unsigned int xsize, unsigned int ysize, unsigned int zsize);
|
||||
*
|
||||
* ...while iopen and fiopen can take an extended set of parameters, the
|
||||
* last five are optional, so a more correct prototype would be:
|
||||
*
|
||||
*/
|
||||
IMAGE *iopen(char *file, char *mode, ...);
|
||||
IMAGE *fiopen(int f, char *mode, ...);
|
||||
|
||||
/*
|
||||
*
|
||||
* unsigned short *ibufalloc(IMAGE *image);
|
||||
* int ifilbuf(IMAGE *image);
|
||||
* int iflush(IMAGE *image);
|
||||
* unsigned int iflsbuf(IMAGE *image, unsigned int c);
|
||||
* void isetname(IMAGE *image, char *name);
|
||||
* void isetcolormap(IMAGE *image, int colormap);
|
||||
*/
|
||||
|
||||
int iclose(IMAGE *image);
|
||||
int putrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z);
|
||||
int getrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z);
|
||||
|
||||
/*
|
||||
IMAGE *iopen();
|
||||
IMAGE *icreate();
|
||||
*/
|
||||
|
||||
unsigned short *ibufalloc();
|
||||
|
||||
#define IMAGEDEF /* for backwards compatibility */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !__GL_IMAGE_H__ */
|
||||
@@ -0,0 +1,453 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.13 $
|
||||
* $Date: 1997/02/11 08:15:34 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/R4300.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef __R4300_H__
|
||||
#define __R4300_H__
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
/*
|
||||
* Segment base addresses and sizes
|
||||
*/
|
||||
#define KUBASE 0
|
||||
#define KUSIZE 0x80000000
|
||||
#define K0BASE 0x80000000
|
||||
#define K0SIZE 0x20000000
|
||||
#define K1BASE 0xA0000000
|
||||
#define K1SIZE 0x20000000
|
||||
#define K2BASE 0xC0000000
|
||||
#define K2SIZE 0x20000000
|
||||
|
||||
/*
|
||||
* Exception vectors
|
||||
*/
|
||||
#define SIZE_EXCVEC 0x80 /* Size of an exc. vec */
|
||||
#define UT_VEC K0BASE /* utlbmiss vector */
|
||||
#define R_VEC (K1BASE+0x1fc00000) /* reset vector */
|
||||
#define XUT_VEC (K0BASE+0x80) /* extended address tlbmiss */
|
||||
#define ECC_VEC (K0BASE+0x100) /* Ecc exception vector */
|
||||
#define E_VEC (K0BASE+0x180) /* Gen. exception vector */
|
||||
|
||||
/*
|
||||
* Address conversion macros
|
||||
*/
|
||||
#ifdef _LANGUAGE_ASSEMBLY
|
||||
|
||||
#define K0_TO_K1(x) ((x)|0xA0000000) /* kseg0 to kseg1 */
|
||||
#define K1_TO_K0(x) ((x)&0x9FFFFFFF) /* kseg1 to kseg0 */
|
||||
#define K0_TO_PHYS(x) ((x)&0x1FFFFFFF) /* kseg0 to physical */
|
||||
#define K1_TO_PHYS(x) ((x)&0x1FFFFFFF) /* kseg1 to physical */
|
||||
#define KDM_TO_PHYS(x) ((x)&0x1FFFFFFF) /* direct mapped to physical */
|
||||
#define PHYS_TO_K0(x) ((x)|0x80000000) /* physical to kseg0 */
|
||||
#define PHYS_TO_K1(x) ((x)|0xA0000000) /* physical to kseg1 */
|
||||
|
||||
#else /* _LANGUAGE_C */
|
||||
|
||||
#define K0_TO_K1(x) ((u32)(x)|0xA0000000) /* kseg0 to kseg1 */
|
||||
#define K1_TO_K0(x) ((u32)(x)&0x9FFFFFFF) /* kseg1 to kseg0 */
|
||||
#define K0_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg0 to physical */
|
||||
#define K1_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg1 to physical */
|
||||
#define KDM_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* direct mapped to physical */
|
||||
#define PHYS_TO_K0(x) ((u32)(x)|0x80000000) /* physical to kseg0 */
|
||||
#define PHYS_TO_K1(x) ((u32)(x)|0xA0000000) /* physical to kseg1 */
|
||||
|
||||
#endif /* _LANGUAGE_ASSEMBLY */
|
||||
|
||||
/*
|
||||
* Address predicates
|
||||
*/
|
||||
#define IS_KSEG0(x) ((u32)(x) >= K0BASE && (u32)(x) < K1BASE)
|
||||
#define IS_KSEG1(x) ((u32)(x) >= K1BASE && (u32)(x) < K2BASE)
|
||||
#define IS_KSEGDM(x) ((u32)(x) >= K0BASE && (u32)(x) < K2BASE)
|
||||
#define IS_KSEG2(x) ((u32)(x) >= K2BASE && (u32)(x) < KPTE_SHDUBASE)
|
||||
#define IS_KPTESEG(x) ((u32)(x) >= KPTE_SHDUBASE)
|
||||
#define IS_KUSEG(x) ((u32)(x) < K0BASE)
|
||||
|
||||
/*
|
||||
* TLB size constants
|
||||
*/
|
||||
|
||||
#define NTLBENTRIES 31 /* entry 31 is reserved by rdb */
|
||||
|
||||
#define TLBHI_VPN2MASK 0xffffe000
|
||||
#define TLBHI_VPN2SHIFT 13
|
||||
#define TLBHI_PIDMASK 0xff
|
||||
#define TLBHI_PIDSHIFT 0
|
||||
#define TLBHI_NPID 255 /* 255 to fit in 8 bits */
|
||||
|
||||
#define TLBLO_PFNMASK 0x3fffffc0
|
||||
#define TLBLO_PFNSHIFT 6
|
||||
#define TLBLO_CACHMASK 0x38 /* cache coherency algorithm */
|
||||
#define TLBLO_CACHSHIFT 3
|
||||
#define TLBLO_UNCACHED 0x10 /* not cached */
|
||||
#define TLBLO_NONCOHRNT 0x18 /* Cacheable non-coherent */
|
||||
#define TLBLO_EXLWR 0x28 /* Exclusive write */
|
||||
#define TLBLO_D 0x4 /* writeable */
|
||||
#define TLBLO_V 0x2 /* valid bit */
|
||||
#define TLBLO_G 0x1 /* global access bit */
|
||||
|
||||
#define TLBINX_PROBE 0x80000000
|
||||
#define TLBINX_INXMASK 0x3f
|
||||
#define TLBINX_INXSHIFT 0
|
||||
|
||||
#define TLBRAND_RANDMASK 0x3f
|
||||
#define TLBRAND_RANDSHIFT 0
|
||||
|
||||
#define TLBWIRED_WIREDMASK 0x3f
|
||||
|
||||
#define TLBCTXT_BASEMASK 0xff800000
|
||||
#define TLBCTXT_BASESHIFT 23
|
||||
#define TLBCTXT_BASEBITS 9
|
||||
|
||||
#define TLBCTXT_VPNMASK 0x7ffff0
|
||||
#define TLBCTXT_VPNSHIFT 4
|
||||
|
||||
#define TLBPGMASK_4K 0x0
|
||||
#define TLBPGMASK_16K 0x6000
|
||||
#define TLBPGMASK_64K 0x1e000
|
||||
|
||||
/*
|
||||
* Status register
|
||||
*/
|
||||
#define SR_CUMASK 0xf0000000 /* coproc usable bits */
|
||||
|
||||
#define SR_CU3 0x80000000 /* Coprocessor 3 usable */
|
||||
#define SR_CU2 0x40000000 /* Coprocessor 2 usable */
|
||||
#define SR_CU1 0x20000000 /* Coprocessor 1 usable */
|
||||
#define SR_CU0 0x10000000 /* Coprocessor 0 usable */
|
||||
#define SR_RP 0x08000000 /* Reduced power (quarter speed) */
|
||||
#define SR_FR 0x04000000 /* MIPS III FP register mode */
|
||||
#define SR_RE 0x02000000 /* Reverse endian */
|
||||
#define SR_ITS 0x01000000 /* Instruction trace support */
|
||||
#define SR_BEV 0x00400000 /* Use boot exception vectors */
|
||||
#define SR_TS 0x00200000 /* TLB shutdown */
|
||||
#define SR_SR 0x00100000 /* Soft reset occured */
|
||||
#define SR_CH 0x00040000 /* Cache hit for last 'cache' op */
|
||||
#define SR_CE 0x00020000 /* Create ECC */
|
||||
#define SR_DE 0x00010000 /* ECC of parity does not cause error */
|
||||
|
||||
/*
|
||||
* Interrupt enable bits
|
||||
* (NOTE: bits set to 1 enable the corresponding level interrupt)
|
||||
*/
|
||||
#define SR_IMASK 0x0000ff00 /* Interrupt mask */
|
||||
#define SR_IMASK8 0x00000000 /* mask level 8 */
|
||||
#define SR_IMASK7 0x00008000 /* mask level 7 */
|
||||
#define SR_IMASK6 0x0000c000 /* mask level 6 */
|
||||
#define SR_IMASK5 0x0000e000 /* mask level 5 */
|
||||
#define SR_IMASK4 0x0000f000 /* mask level 4 */
|
||||
#define SR_IMASK3 0x0000f800 /* mask level 3 */
|
||||
#define SR_IMASK2 0x0000fc00 /* mask level 2 */
|
||||
#define SR_IMASK1 0x0000fe00 /* mask level 1 */
|
||||
#define SR_IMASK0 0x0000ff00 /* mask level 0 */
|
||||
|
||||
#define SR_IBIT8 0x00008000 /* bit level 8 */
|
||||
#define SR_IBIT7 0x00004000 /* bit level 7 */
|
||||
#define SR_IBIT6 0x00002000 /* bit level 6 */
|
||||
#define SR_IBIT5 0x00001000 /* bit level 5 */
|
||||
#define SR_IBIT4 0x00000800 /* bit level 4 */
|
||||
#define SR_IBIT3 0x00000400 /* bit level 3 */
|
||||
#define SR_IBIT2 0x00000200 /* bit level 2 */
|
||||
#define SR_IBIT1 0x00000100 /* bit level 1 */
|
||||
|
||||
#define SR_IMASKSHIFT 8
|
||||
|
||||
#define SR_KX 0x00000080 /* extended-addr TLB vec in kernel */
|
||||
#define SR_SX 0x00000040 /* xtended-addr TLB vec supervisor */
|
||||
#define SR_UX 0x00000020 /* xtended-addr TLB vec in user mode */
|
||||
#define SR_KSU_MASK 0x00000018 /* mode mask */
|
||||
#define SR_KSU_USR 0x00000010 /* user mode */
|
||||
#define SR_KSU_SUP 0x00000008 /* supervisor mode */
|
||||
#define SR_KSU_KER 0x00000000 /* kernel mode */
|
||||
#define SR_ERL 0x00000004 /* Error level, 1=>cache error */
|
||||
#define SR_EXL 0x00000002 /* Exception level, 1=>exception */
|
||||
#define SR_IE 0x00000001 /* interrupt enable, 1=>enable */
|
||||
|
||||
/*
|
||||
* Cause Register
|
||||
*/
|
||||
#define CAUSE_BD 0x80000000 /* Branch delay slot */
|
||||
#define CAUSE_CEMASK 0x30000000 /* coprocessor error */
|
||||
#define CAUSE_CESHIFT 28
|
||||
|
||||
/* Interrupt pending bits */
|
||||
#define CAUSE_IP8 0x00008000 /* External level 8 pending - COMPARE */
|
||||
#define CAUSE_IP7 0x00004000 /* External level 7 pending - INT4 */
|
||||
#define CAUSE_IP6 0x00002000 /* External level 6 pending - INT3 */
|
||||
#define CAUSE_IP5 0x00001000 /* External level 5 pending - INT2 */
|
||||
#define CAUSE_IP4 0x00000800 /* External level 4 pending - INT1 */
|
||||
#define CAUSE_IP3 0x00000400 /* External level 3 pending - INT0 */
|
||||
#define CAUSE_SW2 0x00000200 /* Software level 2 pending */
|
||||
#define CAUSE_SW1 0x00000100 /* Software level 1 pending */
|
||||
|
||||
#define CAUSE_IPMASK 0x0000FF00 /* Pending interrupt mask */
|
||||
#define CAUSE_IPSHIFT 8
|
||||
|
||||
#define CAUSE_EXCMASK 0x0000007C /* Cause code bits */
|
||||
|
||||
#define CAUSE_EXCSHIFT 2
|
||||
|
||||
/* Cause register exception codes */
|
||||
|
||||
#define EXC_CODE(x) ((x)<<2)
|
||||
|
||||
/* Hardware exception codes */
|
||||
#define EXC_INT EXC_CODE(0) /* interrupt */
|
||||
#define EXC_MOD EXC_CODE(1) /* TLB mod */
|
||||
#define EXC_RMISS EXC_CODE(2) /* Read TLB Miss */
|
||||
#define EXC_WMISS EXC_CODE(3) /* Write TLB Miss */
|
||||
#define EXC_RADE EXC_CODE(4) /* Read Address Error */
|
||||
#define EXC_WADE EXC_CODE(5) /* Write Address Error */
|
||||
#define EXC_IBE EXC_CODE(6) /* Instruction Bus Error */
|
||||
#define EXC_DBE EXC_CODE(7) /* Data Bus Error */
|
||||
#define EXC_SYSCALL EXC_CODE(8) /* SYSCALL */
|
||||
#define EXC_BREAK EXC_CODE(9) /* BREAKpoint */
|
||||
#define EXC_II EXC_CODE(10) /* Illegal Instruction */
|
||||
#define EXC_CPU EXC_CODE(11) /* CoProcessor Unusable */
|
||||
#define EXC_OV EXC_CODE(12) /* OVerflow */
|
||||
#define EXC_TRAP EXC_CODE(13) /* Trap exception */
|
||||
#define EXC_VCEI EXC_CODE(14) /* Virt. Coherency on Inst. fetch */
|
||||
#define EXC_FPE EXC_CODE(15) /* Floating Point Exception */
|
||||
#define EXC_WATCH EXC_CODE(23) /* Watchpoint reference */
|
||||
#define EXC_VCED EXC_CODE(31) /* Virt. Coherency on data read */
|
||||
|
||||
/* C0_PRID Defines */
|
||||
#define C0_IMPMASK 0xff00
|
||||
#define C0_IMPSHIFT 8
|
||||
#define C0_REVMASK 0xff
|
||||
#define C0_MAJREVMASK 0xf0
|
||||
#define C0_MAJREVSHIFT 4
|
||||
#define C0_MINREVMASK 0xf
|
||||
|
||||
/*
|
||||
* Coprocessor 0 operations
|
||||
*/
|
||||
#define C0_READI 0x1 /* read ITLB entry addressed by C0_INDEX */
|
||||
#define C0_WRITEI 0x2 /* write ITLB entry addressed by C0_INDEX */
|
||||
#define C0_WRITER 0x6 /* write ITLB entry addressed by C0_RAND */
|
||||
#define C0_PROBE 0x8 /* probe for ITLB entry addressed by TLBHI */
|
||||
#define C0_RFE 0x10 /* restore for exception */
|
||||
|
||||
/*
|
||||
* 'cache' instruction definitions
|
||||
*/
|
||||
|
||||
/* Target cache */
|
||||
#define CACH_PI 0x0 /* specifies primary inst. cache */
|
||||
#define CACH_PD 0x1 /* primary data cache */
|
||||
#define CACH_SI 0x2 /* secondary instruction cache */
|
||||
#define CACH_SD 0x3 /* secondary data cache */
|
||||
|
||||
/* Cache operations */
|
||||
#define C_IINV 0x0 /* index invalidate (inst, 2nd inst) */
|
||||
#define C_IWBINV 0x0 /* index writeback inval (d, sd) */
|
||||
#define C_ILT 0x4 /* index load tag (all) */
|
||||
#define C_IST 0x8 /* index store tag (all) */
|
||||
#define C_CDX 0xc /* create dirty exclusive (d, sd) */
|
||||
#define C_HINV 0x10 /* hit invalidate (all) */
|
||||
#define C_HWBINV 0x14 /* hit writeback inv. (d, sd) */
|
||||
#define C_FILL 0x14 /* fill (i) */
|
||||
#define C_HWB 0x18 /* hit writeback (i, d, sd) */
|
||||
#define C_HSV 0x1c /* hit set virt. (si, sd) */
|
||||
|
||||
/*
|
||||
* Cache size definitions
|
||||
*/
|
||||
#define ICACHE_SIZE 0x4000 /* 16K */
|
||||
#define ICACHE_LINESIZE 32 /* 8 words */
|
||||
#define ICACHE_LINEMASK (ICACHE_LINESIZE-1)
|
||||
|
||||
#define DCACHE_SIZE 0x2000 /* 8K */
|
||||
#define DCACHE_LINESIZE 16 /* 4 words */
|
||||
#define DCACHE_LINEMASK (DCACHE_LINESIZE-1)
|
||||
|
||||
/*
|
||||
* C0_CONFIG register definitions
|
||||
*/
|
||||
#define CONFIG_CM 0x80000000 /* 1 == Master-Checker enabled */
|
||||
#define CONFIG_EC 0x70000000 /* System Clock ratio */
|
||||
#define CONFIG_EC_1_1 0x6 /* System Clock ratio 1 :1 */
|
||||
#define CONFIG_EC_3_2 0x7 /* System Clock ratio 1.5 :1 */
|
||||
#define CONFIG_EC_2_1 0x0 /* System Clock ratio 2 :1 */
|
||||
#define CONFIG_EC_3_1 0x1 /* System Clock ratio 3 :1 */
|
||||
#define CONFIG_EP 0x0f000000 /* Transmit Data Pattern */
|
||||
#define CONFIG_SB 0x00c00000 /* Secondary cache block size */
|
||||
|
||||
#define CONFIG_SS 0x00200000 /* Split scache: 0 == I&D combined */
|
||||
#define CONFIG_SW 0x00100000 /* scache port: 0==128, 1==64 */
|
||||
#define CONFIG_EW 0x000c0000 /* System Port width: 0==64, 1==32 */
|
||||
#define CONFIG_SC 0x00020000 /* 0 -> 2nd cache present */
|
||||
#define CONFIG_SM 0x00010000 /* 0 -> Dirty Shared Coherency enabled*/
|
||||
#define CONFIG_BE 0x00008000 /* Endian-ness: 1 --> BE */
|
||||
#define CONFIG_EM 0x00004000 /* 1 -> ECC mode, 0 -> parity */
|
||||
#define CONFIG_EB 0x00002000 /* Block order:1->sequent,0->subblock */
|
||||
|
||||
#define CONFIG_IC 0x00000e00 /* Primary Icache size */
|
||||
#define CONFIG_DC 0x000001c0 /* Primary Dcache size */
|
||||
#define CONFIG_IB 0x00000020 /* Icache block size */
|
||||
#define CONFIG_DB 0x00000010 /* Dcache block size */
|
||||
#define CONFIG_CU 0x00000008 /* Update on Store-conditional */
|
||||
#define CONFIG_K0 0x00000007 /* K0SEG Coherency algorithm */
|
||||
|
||||
#define CONFIG_UNCACHED 0x00000002 /* K0 is uncached */
|
||||
#define CONFIG_NONCOHRNT 0x00000003
|
||||
#define CONFIG_COHRNT_EXLWR 0x00000005
|
||||
#define CONFIG_SB_SHFT 22 /* shift SB to bit position 0 */
|
||||
#define CONFIG_IC_SHFT 9 /* shift IC to bit position 0 */
|
||||
#define CONFIG_DC_SHFT 6 /* shift DC to bit position 0 */
|
||||
#define CONFIG_BE_SHFT 15 /* shift BE to bit position 0 */
|
||||
|
||||
/*
|
||||
* C0_TAGLO definitions for setting/getting cache states and physaddr bits
|
||||
*/
|
||||
#define SADDRMASK 0xFFFFE000 /* 31..13 -> scache paddr bits 35..17 */
|
||||
#define SVINDEXMASK 0x00000380 /* 9..7: prim virt index bits 14..12 */
|
||||
#define SSTATEMASK 0x00001c00 /* bits 12..10 hold scache line state */
|
||||
#define SINVALID 0x00000000 /* invalid --> 000 == state 0 */
|
||||
#define SCLEANEXCL 0x00001000 /* clean exclusive --> 100 == state 4 */
|
||||
#define SDIRTYEXCL 0x00001400 /* dirty exclusive --> 101 == state 5 */
|
||||
#define SECC_MASK 0x0000007f /* low 7 bits are ecc for the tag */
|
||||
#define SADDR_SHIFT 4 /* shift STagLo (31..13) to 35..17 */
|
||||
|
||||
#define PADDRMASK 0xFFFFFF00 /* PTagLo31..8->prim paddr bits35..12 */
|
||||
#define PADDR_SHIFT 4 /* roll bits 35..12 down to 31..8 */
|
||||
#define PSTATEMASK 0x00C0 /* bits 7..6 hold primary line state */
|
||||
#define PINVALID 0x0000 /* invalid --> 000 == state 0 */
|
||||
#define PCLEANEXCL 0x0080 /* clean exclusive --> 10 == state 2 */
|
||||
#define PDIRTYEXCL 0x00C0 /* dirty exclusive --> 11 == state 3 */
|
||||
#define PPARITY_MASK 0x0001 /* low bit is parity bit (even). */
|
||||
|
||||
/*
|
||||
* C0_CACHE_ERR definitions.
|
||||
*/
|
||||
#define CACHERR_ER 0x80000000 /* 0: inst ref, 1: data ref */
|
||||
#define CACHERR_EC 0x40000000 /* 0: primary, 1: secondary */
|
||||
#define CACHERR_ED 0x20000000 /* 1: data error */
|
||||
#define CACHERR_ET 0x10000000 /* 1: tag error */
|
||||
#define CACHERR_ES 0x08000000 /* 1: external ref, e.g. snoop*/
|
||||
#define CACHERR_EE 0x04000000 /* error on SysAD bus */
|
||||
#define CACHERR_EB 0x02000000 /* complicated, see spec. */
|
||||
#define CACHERR_EI 0x01000000 /* complicated, see spec. */
|
||||
#define CACHERR_SIDX_MASK 0x003ffff8 /* secondary cache index */
|
||||
#define CACHERR_PIDX_MASK 0x00000007 /* primary cache index */
|
||||
#define CACHERR_PIDX_SHIFT 12 /* bits 2..0 are paddr14..12 */
|
||||
|
||||
/* R4000 family supports hardware watchpoints:
|
||||
* C0_WATCHLO:
|
||||
* bits 31..3 are bits 31..3 of physaddr to watch
|
||||
* bit 2: reserved; must be written as 0.
|
||||
* bit 1: when set causes a watchpoint trap on load accesses to paddr.
|
||||
* bit 0: when set traps on stores to paddr;
|
||||
* C0_WATCHHI
|
||||
* bits 31..4 are reserved and must be written as zeros.
|
||||
* bits 3..0 are bits 35..32 of the physaddr to watch
|
||||
*/
|
||||
#define WATCHLO_WTRAP 0x00000001
|
||||
#define WATCHLO_RTRAP 0x00000002
|
||||
#define WATCHLO_ADDRMASK 0xfffffff8
|
||||
#define WATCHLO_VALIDMASK 0xfffffffb
|
||||
#define WATCHHI_VALIDMASK 0x0000000f
|
||||
|
||||
/*
|
||||
* Coprocessor 0 registers
|
||||
*/
|
||||
#ifdef _LANGUAGE_ASSEMBLY
|
||||
#define C0_INX $0
|
||||
#define C0_RAND $1
|
||||
#define C0_ENTRYLO0 $2
|
||||
#define C0_ENTRYLO1 $3
|
||||
#define C0_CONTEXT $4
|
||||
#define C0_PAGEMASK $5 /* page mask */
|
||||
#define C0_WIRED $6 /* # wired entries in tlb */
|
||||
#define C0_BADVADDR $8
|
||||
#define C0_COUNT $9 /* free-running counter */
|
||||
#define C0_ENTRYHI $10
|
||||
#define C0_SR $12
|
||||
#define C0_CAUSE $13
|
||||
#define C0_EPC $14
|
||||
#define C0_PRID $15 /* revision identifier */
|
||||
#define C0_COMPARE $11 /* counter comparison reg. */
|
||||
#define C0_CONFIG $16 /* hardware configuration */
|
||||
#define C0_LLADDR $17 /* load linked address */
|
||||
#define C0_WATCHLO $18 /* watchpoint */
|
||||
#define C0_WATCHHI $19 /* watchpoint */
|
||||
#define C0_ECC $26 /* S-cache ECC and primary parity */
|
||||
#define C0_CACHE_ERR $27 /* cache error status */
|
||||
#define C0_TAGLO $28 /* cache operations */
|
||||
#define C0_TAGHI $29 /* cache operations */
|
||||
#define C0_ERROR_EPC $30 /* ECC error prg. counter */
|
||||
|
||||
# else /* ! _LANGUAGE_ASSEMBLY */
|
||||
|
||||
#define C0_INX 0
|
||||
#define C0_RAND 1
|
||||
#define C0_ENTRYLO0 2
|
||||
#define C0_ENTRYLO1 3
|
||||
#define C0_CONTEXT 4
|
||||
#define C0_PAGEMASK 5 /* page mask */
|
||||
#define C0_WIRED 6 /* # wired entries in tlb */
|
||||
#define C0_BADVADDR 8
|
||||
#define C0_COUNT 9 /* free-running counter */
|
||||
#define C0_ENTRYHI 10
|
||||
#define C0_SR 12
|
||||
#define C0_CAUSE 13
|
||||
#define C0_EPC 14
|
||||
#define C0_PRID 15 /* revision identifier */
|
||||
#define C0_COMPARE 11 /* counter comparison reg. */
|
||||
#define C0_CONFIG 16 /* hardware configuration */
|
||||
#define C0_LLADDR 17 /* load linked address */
|
||||
#define C0_WATCHLO 18 /* watchpoint */
|
||||
#define C0_WATCHHI 19 /* watchpoint */
|
||||
#define C0_ECC 26 /* S-cache ECC and primary parity */
|
||||
#define C0_CACHE_ERR 27 /* cache error status */
|
||||
#define C0_TAGLO 28 /* cache operations */
|
||||
#define C0_TAGHI 29 /* cache operations */
|
||||
#define C0_ERROR_EPC 30 /* ECC error prg. counter */
|
||||
|
||||
#endif /* _LANGUAGE_ASSEMBLY */
|
||||
|
||||
/*
|
||||
* floating-point status register
|
||||
*/
|
||||
#define FPCSR_FS 0x01000000 /* flush denorm to zero */
|
||||
#define FPCSR_C 0x00800000 /* condition bit */
|
||||
#define FPCSR_CE 0x00020000 /* cause: unimplemented operation */
|
||||
#define FPCSR_CV 0x00010000 /* cause: invalid operation */
|
||||
#define FPCSR_CZ 0x00008000 /* cause: division by zero */
|
||||
#define FPCSR_CO 0x00004000 /* cause: overflow */
|
||||
#define FPCSR_CU 0x00002000 /* cause: underflow */
|
||||
#define FPCSR_CI 0x00001000 /* cause: inexact operation */
|
||||
#define FPCSR_EV 0x00000800 /* enable: invalid operation */
|
||||
#define FPCSR_EZ 0x00000400 /* enable: division by zero */
|
||||
#define FPCSR_EO 0x00000200 /* enable: overflow */
|
||||
#define FPCSR_EU 0x00000100 /* enable: underflow */
|
||||
#define FPCSR_EI 0x00000080 /* enable: inexact operation */
|
||||
#define FPCSR_FV 0x00000040 /* flag: invalid operation */
|
||||
#define FPCSR_FZ 0x00000020 /* flag: division by zero */
|
||||
#define FPCSR_FO 0x00000010 /* flag: overflow */
|
||||
#define FPCSR_FU 0x00000008 /* flag: underflow */
|
||||
#define FPCSR_FI 0x00000004 /* flag: inexact operation */
|
||||
#define FPCSR_RM_MASK 0x00000003 /* rounding mode mask */
|
||||
#define FPCSR_RM_RN 0x00000000 /* round to nearest */
|
||||
#define FPCSR_RM_RZ 0x00000001 /* round to zero */
|
||||
#define FPCSR_RM_RP 0x00000002 /* round to positive infinity */
|
||||
#define FPCSR_RM_RM 0x00000003 /* round to negative infinity */
|
||||
|
||||
#endif /* __R4300_H */
|
||||
@@ -0,0 +1,113 @@
|
||||
#ifndef _RAMROM_H
|
||||
#define _RAMROM_H
|
||||
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1994, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.20 $
|
||||
* $Date: 1997/02/11 08:26:47 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/ramrom.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Defines for the GIO card in the Nintendo Development Station
|
||||
*
|
||||
* The RAM on the GIO card acts as ROM for the game
|
||||
* Interrupts available between the game and the Indy host
|
||||
*
|
||||
* The last part of the ramrom is used for communication between
|
||||
* game and host. There are 6 4K buffers defined:
|
||||
* log, printf, rmon to indy, rmon from indy, app to indy, app from indy
|
||||
* The last 8 bytes of the buffer are used in the emulator environment
|
||||
*/
|
||||
|
||||
#define RAMROM_SIZE (0x1000000)
|
||||
|
||||
#define RAMROM_BUF_SIZE (4096)
|
||||
#define RAMROM_MSG_SIZE (RAMROM_BUF_SIZE*6)
|
||||
#define RAMROM_MSG_ADDR (RAMROM_SIZE - RAMROM_MSG_SIZE)
|
||||
#define RAMROM_MSG_HDR_SIZE (3*sizeof(long))
|
||||
#define RAMROM_USER_DATA_SIZE (RAMROM_MSG_SIZE-RAMROM_MSG_HDR_SIZE)
|
||||
|
||||
#define RAMROM_APP_READ_ADDR (RAMROM_MSG_ADDR + (0*RAMROM_BUF_SIZE))
|
||||
#define RAMROM_APP_WRITE_ADDR (RAMROM_MSG_ADDR + (1*RAMROM_BUF_SIZE))
|
||||
#define RAMROM_RMON_READ_ADDR (RAMROM_MSG_ADDR + (2*RAMROM_BUF_SIZE))
|
||||
#define RAMROM_RMON_WRITE_ADDR (RAMROM_MSG_ADDR + (3*RAMROM_BUF_SIZE))
|
||||
#define RAMROM_PRINTF_ADDR (RAMROM_MSG_ADDR + (4*RAMROM_BUF_SIZE))
|
||||
#define RAMROM_LOG_ADDR (RAMROM_MSG_ADDR + (5*RAMROM_BUF_SIZE))
|
||||
|
||||
/*#define RAMROM_GIO_INTERRUPT (RAMROM_MSG_ADDR + RAMROM_MSG_SIZE - 4)*/
|
||||
|
||||
/*
|
||||
* For the initial round of PIF bringup, we will load in a bootstrap loader
|
||||
* 0x400 bytes into the ramrom, and the rom will be loaded at 0x2000
|
||||
*/
|
||||
#ifndef _HW_VERSION_1
|
||||
#define RAMROM_BOOTSTRAP_OFFSET 0x40
|
||||
#define RAMROM_GAME_OFFSET 0x1000
|
||||
#define RAMROM_FONTDATA_OFFSET 0xb70
|
||||
#define RAMROM_FONTDATA_SIZE 1152
|
||||
#else
|
||||
#define RAMROM_BOOTSTRAP_OFFSET 0x400
|
||||
#define RAMROM_GAME_OFFSET 0x2000
|
||||
#endif
|
||||
#define RAMROM_CLOCKRATE_OFFSET 0x4
|
||||
#define RAMROM_CLOCKRATE_MASK 0xfffffff0
|
||||
#define RAMROM_BOOTADDR_OFFSET 0x8
|
||||
#define RAMROM_RELEASE_OFFSET 0xc
|
||||
/*
|
||||
* Second version of the PIF jumps to location 0x1000, and we'll put a jump to
|
||||
* location 0x400 into the ramrom (for backwards compatibility).
|
||||
*/
|
||||
#define RAMROM_PIF2BOOTSTRAP_OFFSET 0x1000
|
||||
|
||||
typedef struct {
|
||||
long type;
|
||||
long length; /* in bytes of userdata */
|
||||
long magic;
|
||||
char userdata[RAMROM_USER_DATA_SIZE];
|
||||
} RamRomBuffer;
|
||||
|
||||
/*
|
||||
* Interrupt values (must fit in 6 bits!)
|
||||
* values are used for both request & response
|
||||
* Transactions initiated by the host start with HOST
|
||||
* and those initiated by the target start with GAME.
|
||||
*/
|
||||
|
||||
#define HOST_PIACCESS_REQ 1
|
||||
#define HOST_DBG_CMD_READY 2
|
||||
#define GAME_DBG_DATA_SEND 3
|
||||
#define HOST_DBG_DATA_ACK 4
|
||||
#define GAME_PRINTF_SEND 5
|
||||
#define HOST_PRINTF_ACK 6
|
||||
#define GAME_LOG_SEND 7
|
||||
#define HOST_LOG_ACK 8
|
||||
#define HOST_APP_CMD_READY 9
|
||||
#define GAME_APP_DATA_READY 10
|
||||
#define HOST_PROF_REQ 11
|
||||
#define GAME_PROF_SEND 12
|
||||
#define HOST_PROF_ACK 13
|
||||
#define GAME_FAULT_SEND 14
|
||||
#define HOST_FAULT_ACK 15
|
||||
#define GAME_EXIT 16
|
||||
#define HOST_DATA_ACK 17
|
||||
|
||||
#ifdef _EMULATOR
|
||||
void __RamRomInit(int key, void *romaddr);
|
||||
void __RamRomDestroy(int key);
|
||||
#endif /* _EMULATOR */
|
||||
|
||||
#endif /* !_RAMROM_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,93 @@
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 1997/02/11 08:29:31 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/rdb.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RDB_H
|
||||
#define _RDB_H
|
||||
|
||||
/* U64 side address */
|
||||
#define RDB_BASE_REG 0xc0000000
|
||||
#define RDB_WRITE_INTR_REG (RDB_BASE_REG + 0x8)
|
||||
#define RDB_READ_INTR_REG (RDB_BASE_REG + 0xc)
|
||||
#define RDB_BASE_VIRTUAL_ADDR 0x80000000
|
||||
|
||||
/* packet type Have six bits, so can have up to 63 types */
|
||||
#define RDB_TYPE_INVALID 0
|
||||
#define RDB_TYPE_GtoH_PRINT 1
|
||||
#define RDB_TYPE_GtoH_FAULT 2
|
||||
#define RDB_TYPE_GtoH_LOG_CT 3
|
||||
#define RDB_TYPE_GtoH_LOG 4
|
||||
#define RDB_TYPE_GtoH_READY_FOR_DATA 5
|
||||
#define RDB_TYPE_GtoH_DATA_CT 6
|
||||
#define RDB_TYPE_GtoH_DATA 7
|
||||
#define RDB_TYPE_GtoH_DEBUG 8
|
||||
#define RDB_TYPE_GtoH_RAMROM 9
|
||||
#define RDB_TYPE_GtoH_DEBUG_DONE 10
|
||||
#define RDB_TYPE_GtoH_DEBUG_READY 11
|
||||
#define RDB_TYPE_GtoH_KDEBUG 12
|
||||
#define RDB_TYPE_GtoH_PROF_DATA 22
|
||||
|
||||
|
||||
#define RDB_TYPE_HtoG_LOG_DONE 13
|
||||
#define RDB_TYPE_HtoG_DEBUG 14
|
||||
#define RDB_TYPE_HtoG_DEBUG_CT 15
|
||||
#define RDB_TYPE_HtoG_DATA 16
|
||||
#define RDB_TYPE_HtoG_DATA_DONE 17
|
||||
#define RDB_TYPE_HtoG_REQ_RAMROM 18
|
||||
#define RDB_TYPE_HtoG_FREE_RAMROM 19
|
||||
#define RDB_TYPE_HtoG_KDEBUG 20
|
||||
#define RDB_TYPE_HtoG_PROF_SIGNAL 21
|
||||
|
||||
|
||||
#define RDB_PROF_ACK_SIG 1
|
||||
#define RDB_PROF_FLUSH_SIG 2
|
||||
#define PROF_BLOCK_SIZE 2048
|
||||
|
||||
#define RDB_LOG_MAX_BLOCK_SIZE 0x8000
|
||||
#define RDB_DATA_MAX_BLOCK_SIZE 0x8000
|
||||
|
||||
|
||||
/* GIO side address */
|
||||
#define GIO_RDB_BASE_REG 0xbf480000
|
||||
#define GIO_RDB_WRITE_INTR_REG (GIO_RDB_BASE_REG + 0x8)
|
||||
#define GIO_RDB_READ_INTR_REG (GIO_RDB_BASE_REG + 0xc)
|
||||
|
||||
/* minor device number */
|
||||
#define GIO_RDB_PRINT_MINOR 1
|
||||
#define GIO_RDB_DEBUG_MINOR 2
|
||||
|
||||
/* interrupt bit */
|
||||
#define GIO_RDB_WRITE_INTR_BIT 0x80000000
|
||||
#define GIO_RDB_READ_INTR_BIT 0x40000000
|
||||
|
||||
/* debug command */
|
||||
#define DEBUG_COMMAND_NULL 0
|
||||
#define DEBUG_COMMAND_MEMORY 1
|
||||
#define DEBUG_COMMAND_REGISTER 2
|
||||
#define DEBUG_COMMAND_INVALID 255
|
||||
|
||||
/* debug state */
|
||||
#define DEBUG_STATE_NULL 0
|
||||
#define DEBUG_STATE_RECEIVE 1
|
||||
#define DEBUG_STATE_INVALID 255
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Structure for debug port */
|
||||
typedef struct {
|
||||
unsigned type : 6; /* 0: invalid, 1: print, 2: debug */
|
||||
unsigned length : 2; /* 1, 2, or 3 */
|
||||
char buf[3]; /* character buffer */
|
||||
} rdbPacket;
|
||||
|
||||
extern unsigned int __osRdbWriteOK;
|
||||
extern unsigned int __osRdbSendMessage;
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#endif /* !_RDB_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user