Add iQue support

This commit is contained in:
CrashOveride95
2021-01-02 22:48:12 -05:00
parent 4eb3896bd8
commit d242a07102
179 changed files with 18231 additions and 107 deletions

2
.gitignore vendored
View File

@@ -74,6 +74,8 @@ build/*
# libultra # libultra
!/lib/*.a !/lib/*.a
!/lib/n64/*.a
!/lib/ique/*.a
!/lib/PR/hvqm/*.o !/lib/PR/hvqm/*.o

View File

@@ -18,6 +18,21 @@ DEFINES :=
# Build for the N64 (turn this off for ports) # Build for the N64 (turn this off for ports)
TARGET_N64 ?= 1 TARGET_N64 ?= 1
# Location of official N64 libraries
# CONSOLE - selects the console to target
# jp - builds the 1996 Japanese version
# us - builds the 1996 North American version
CONSOLE ?= n64
$(eval $(call validate-option,CONSOLE,n64 ique))
ifeq ($(CONSOLE),n64)
INCLUDE_DIRS += include/n64
LIBS_DIR := lib/n64
else ifeq ($(CONSOLE),ique)
INCLUDE_DIRS += include/ique
LIBS_DIR := lib/ique
DEFINES += BBPLAYER=1
endif
# COMPILER - selects the C compiler to use # COMPILER - selects the C compiler to use
# ido - uses the SGI IRIS Development Option compiler, which is used to build # ido - uses the SGI IRIS Development Option compiler, which is used to build
@@ -130,7 +145,7 @@ endif
COMPARE ?= 0 COMPARE ?= 0
$(eval $(call validate-option,COMPARE,0 1)) $(eval $(call validate-option,COMPARE,0 1))
TARGET_STRING := sm64.$(VERSION).$(GRUCODE) TARGET_STRING := sm64.$(VERSION).$(CONSOLE).$(GRUCODE)
# If non-default settings were chosen, disable COMPARE # If non-default settings were chosen, disable COMPARE
ifeq ($(filter $(TARGET_STRING), sm64.jp.f3d_old sm64.us.f3d_old sm64.eu.f3d_new sm64.sh.f3d_new),) ifeq ($(filter $(TARGET_STRING), sm64.jp.f3d_old sm64.us.f3d_old sm64.eu.f3d_new sm64.sh.f3d_new),)
COMPARE := 0 COMPARE := 0
@@ -172,6 +187,7 @@ ifeq ($(filter clean distclean,$(MAKECMDGOALS)),)
$(info ==== Build Options ====) $(info ==== Build Options ====)
$(info Version: $(VERSION)) $(info Version: $(VERSION))
$(info Microcode: $(GRUCODE)) $(info Microcode: $(GRUCODE))
$(info Console: $(CONSOLE))
$(info Target: $(TARGET)) $(info Target: $(TARGET))
ifeq ($(COMPARE),1) ifeq ($(COMPARE),1)
$(info Compare ROM: yes) $(info Compare ROM: yes)
@@ -193,8 +209,6 @@ endif
TOOLS_DIR := tools TOOLS_DIR := tools
# Location of official N64 libraries
N64_LIBS_DIR ?= lib
# (This is a bit hacky, but a lot of rules implicitly depend # (This is a bit hacky, but a lot of rules implicitly depend
# on tools and assets, and we use directory globs further down # on tools and assets, and we use directory globs further down
@@ -337,7 +351,7 @@ ifeq ($(TARGET_N64),1)
CC_CFLAGS := -fno-builtin CC_CFLAGS := -fno-builtin
endif endif
INCLUDE_DIRS := include $(BUILD_DIR) $(BUILD_DIR)/include src . include/hvqm INCLUDE_DIRS += include $(BUILD_DIR) $(BUILD_DIR)/include src . include/hvqm
ifeq ($(TARGET_N64),1) ifeq ($(TARGET_N64),1)
INCLUDE_DIRS += include/libc INCLUDE_DIRS += include/libc
endif endif
@@ -752,7 +766,7 @@ $(BUILD_DIR)/libultra.a: $(ULTRA_O_FILES)
# Link SM64 ELF file # Link SM64 ELF file
$(ELF): $(O_FILES) $(YAY0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/$(LD_SCRIPT) undefined_syms.txt $(BUILD_DIR)/libultra.a $(ELF): $(O_FILES) $(YAY0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/$(LD_SCRIPT) undefined_syms.txt $(BUILD_DIR)/libultra.a
@$(PRINT) "$(GREEN)Linking ELF file: $(BLUE)$@ $(NO_COL)\n" @$(PRINT) "$(GREEN)Linking ELF file: $(BLUE)$@ $(NO_COL)\n"
$(V)$(LD) -L $(BUILD_DIR) -T undefined_syms.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(addprefix -R ,$(SEG_FILES)) -o $@ $(O_FILES) -L $(N64_LIBS_DIR) -lultra_rom -lhvqm2 $(V)$(LD) -L $(BUILD_DIR) -T undefined_syms.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(addprefix -R ,$(SEG_FILES)) -o $@ $(O_FILES) -L$(LIBS_DIR) -lultra_rom -Llib -lhvqm2 -lgcc
# Build ROM # Build ROM
$(ROM): $(ELF) $(ROM): $(ELF)

View File

@@ -4,8 +4,9 @@
- Naming and documentation of the source code and data structures are in progress. - Naming and documentation of the source code and data structures are in progress.
- It has been edited to allow for the usage of the final "N64 OS" library, version ``2.0L`` - It has been edited to allow for the usage of the final "N64 OS" library, version ``2.0L``
- Shindou Rumble Pak code is on for all regions. - Shindou Rumble Pak code is on for all regions.
- Targeting the iQue Player is supported.
- It has been patched with someone2639's shiftable segments patch - It has been patched with someone2639's shiftable segments patch
- It will have HVQM full motion video support - Getting HVQM FMV support to work with the game is in progress.
- Getting UNFLoader (flashcart USB library) to work with the game is in progress. - Getting UNFLoader (flashcart USB library) to work with the game is in progress.
## FAQ ## FAQ

View File

@@ -1,100 +0,0 @@
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64
.include "macros.inc"
.section .text, "ax"
/* -------------------------------------------------------------------------------------- */
/* need to asm these functions because lib32gcc-7-dev-mips-cross does not exist so we */
/* cannot naturally link a libgcc variant for this target given this architecture and */
/* compiler. Until we have a good workaround with a gcc target that doesn't involve */
/* assuming a 32-bit to 64-bit change, we have to encode these functions as raw assembly */
/* for it to compile. */
/* -------------------------------------------------------------------------------------- */
/* TODO: Is there a non-insane way to fix this hack that doesn't involve the user compiling */
/* a library themselves? */
glabel __umoddi3
sw $a0, ($sp)
sw $a1, 4($sp)
sw $a2, 8($sp)
sw $a3, 0xc($sp)
ld $t7, 8($sp)
ld $t6, ($sp)
ddivu $zero, $t6, $t7
bnez $t7, .L80324144
nop
break 7
.L80324144:
mfhi $v0
dsll32 $v1, $v0, 0
dsra32 $v1, $v1, 0
jr $ra
dsra32 $v0, $v0, 0
glabel __udivdi3
sw $a0, ($sp)
sw $a1, 4($sp)
sw $a2, 8($sp)
sw $a3, 0xc($sp)
ld $t7, 8($sp)
ld $t6, ($sp)
ddivu $zero, $t6, $t7
bnez $t7, .L80324180
nop
break 7
.L80324180:
mflo $v0
dsll32 $v1, $v0, 0
dsra32 $v1, $v1, 0
jr $ra
dsra32 $v0, $v0, 0
glabel __moddi3
sw $a0, ($sp)
sw $a1, 4($sp)
sw $a2, 8($sp)
sw $a3, 0xc($sp)
ld $t7, 8($sp)
ld $t6, ($sp)
ddivu $zero, $t6, $t7
bnez $t7, .L803241E8
nop
break 7
.L803241E8:
mfhi $v0
dsll32 $v1, $v0, 0
dsra32 $v1, $v1, 0
jr $ra
dsra32 $v0, $v0, 0
glabel __divdi3
sw $a0, ($sp)
sw $a1, 4($sp)
sw $a2, 8($sp)
sw $a3, 0xc($sp)
ld $t7, 8($sp)
ld $t6, ($sp)
ddiv $zero, $t6, $t7
nop
bnez $t7, .L80324228
nop
break 7
.L80324228:
daddiu $at, $zero, -1
bne $t7, $at, .L80324244
daddiu $at, $zero, 1
dsll32 $at, $at, 0x1f
bne $t6, $at, .L80324244
nop
break 6
.L80324244:
mflo $v0
dsll32 $v1, $v0, 0
dsra32 $v1, $v1, 0
jr $ra
dsra32 $v0, $v0, 0

126
include/ique/PR/PRimage.h Executable file
View File

@@ -0,0 +1,126 @@
/**************************************************************************
*
* $Revision: 1.1.1.2 $
* $Date: 2002/10/29 08:06:34 $
* $Source: /home/routefree/bb/depot/rf/sw/bbplayer/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__ */

453
include/ique/PR/R4300.h Executable file
View File

@@ -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.1.1.2 $
* $Date: 2002/10/29 08:06:34 $
* $Source: /home/routefree/bb/depot/rf/sw/bbplayer/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 */

69
include/ique/PR/audiotools.h Executable file
View File

@@ -0,0 +1,69 @@
/*====================================================================
* audiotools.h
*
* Copyright 1993, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (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,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
/**************************************************************************
*
* $Revision: 1.1.1.2 $
* $Date: 2002/10/29 08:06:34 $
* $Source: /home/routefree/bb/depot/rf/sw/bbplayer/include/audiotools.h,v $
*
**************************************************************************/
/*-------------------------------------------------------------------
*
* This file contains defines used by the audiotools programs.
*
*-------------------------------------------------------------------*/
#ifndef __AUDIOTOOLS__
#define __AUDIOTOOLS__
#define AL_SYM_FILE_VERSION 'SF01'
typedef struct {
s32 objectId;
s32 objectClass;
s32 bankFileOffset;
s32 stringOffset;
s32 refCount;
} ALSymFileObj;
typedef struct {
s32 revision;
s32 fileSize;
s32 objectCount;
} ALSymFile;
#define AL_NO_CLASS 0
#define AL_BANK_CLASS 1
#define AL_INST_CLASS 2
#define AL_SOUND_CLASS 3
#define AL_KEYMAP_CLASS 4
#define AL_WAVETBL_CLASS 5
#define AL_LOOP_CLASS 6
#define AL_BNKFILE_CLASS 7
#define AL_ENVLP_CLASS 8
#define AL_BOOK_CLASS 9
#define AL_SNDFILE_CLASS 10
#define AL_NUM_CLASSES 11
#endif /* !__AUDIOTOOLS__ */

86
include/ique/PR/bbfs.h Normal file
View File

@@ -0,0 +1,86 @@
#ifndef __bb_fs_h__
#define __bb_fs_h__
#include <PR/bbtypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/*
* BBplayer file system data structures
*/
#define BB_FL_PAGE_SIZE 512
#define BB_FL_SPARE_SIZE 16
#define BB_FL_BLOCK_SIZE 16384
#define BB_FL_BYTE_TO_BLOCK(x) ((u32)(x)>>14)
#define BB_FL_BLOCK_TO_BYTE(x) ((u32)(x)<<14)
#define BB_FL_KB_TO_BLOCK(x) ((u32)(x)>>4)
#define BB_FL_BLOCK_TO_KB(x) ((u32)(x)<<4)
#define BB_FL_BYTE_TO_PAGE(x) ((u32)(x)>>9)
#define BB_FL_PAGE_TO_BYTE(x) ((u32)(x)<<9)
#define BB_FL_BLOCK_PAGES (BB_FL_BLOCK_SIZE/BB_FL_PAGE_SIZE)
#define BB_FL_ECC0_OFF (525-512)
#define BB_FL_ECC1_OFF (520-512)
#define BB_FL_BLOCK_STATUS_OFF (517-512)
#define BB_FL_BLOCK_LINK_OFF (512-512)
#define BB_FL_BLOCK_LINK_SIZE 2
#define BB_FL_SEQ_OFF (514-512)
/*
* FAT entries are 16-bit block numbers, each pointing to the
* next block in a file or a system-specific code
* Block numbers are relative to the start of the device.
*/
typedef u16 BbFatEntry;
#define BB_FAT_AVAIL 0x0000 /* available block */
#define BB_FAT_LAST 0xFFFF /* last block of a file */
#define BB_FAT_BAD 0xFFFE /* unreadable/writable block */
#define BB_FAT_RESERVED 0xFFFD /* reserved block */
#define BB_FAT16_ENTRIES 4096 /* enough to span 64MB */
#define BB_FAT16_ENTRIES_SHIFT 12 /* enough to span 64MB */
#define BB_INODE16_ENTRIES 409 /* remainder of space in FAT block */
#define BB_INODE16_NAMELEN 11 /* maximum name length */
#define BB_FAT16_MAGIC "BBFS"
#define BB_FAT16_LINK_MAGIC "BBFL"
#define BB_FAT16_CKSUM 0xcad7
#define BB_FAT16_BLOCKS 16 /* number of copies of the fat */
#define BB_SYSTEM_AREA_SIZE 0x100000 /* 384KB reserved for system area */
#define BB_BIG_FILE_THRESHOLD 0x100000 /* allocation hint */
/*
* Inode entries contain the file name, type, first block address
* and file size. There are a fixed number of inodes immediately
* following the FAT entries.
*/
/*
* All fields are big-endian
*/
typedef struct {
u8 name[BB_INODE16_NAMELEN]; /* 8.3 name */
u8 type; /* unused type field */
u16 block; /* address of first block in file */
u16 pad; /* to align on 4-byte boundary */
u32 size; /* size of file in bytes */
} BbInode;
typedef struct { /* FAT for a 16K block size */
BbFatEntry entry[BB_FAT16_ENTRIES];
BbInode inode[BB_INODE16_ENTRIES];
u8 magic[4]; /* 'BBFS' */
u32 seq; /* highest number is current */
u16 link; /* link to another FAT */
u16 cksum; /* mod 2^16 checksum */
} BbFat16;
#define BB_FAT16_NEXT(fat,n) (fat)[(n)>>BB_FAT16_ENTRIES_SHIFT].entry[(n)&(BB_FAT16_ENTRIES-1)]
#endif
#endif

14
include/ique/PR/bbfs_export.h Executable file
View File

@@ -0,0 +1,14 @@
/*---------------------------------------------------------------------*
Copyright (C) 2002 - 2004 BroadOn Communications.
*---------------------------------------------------------------------*/
#ifndef __bb_fs_h__
#define __bb_fs_h__
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
#define BB_FL_BLOCK_SIZE 16384
#define BB_INODE16_NAMELEN 11 /* maximum name length */
#endif
#endif

179
include/ique/PR/bbskapi.h Normal file
View File

@@ -0,0 +1,179 @@
#ifndef __BB_SK_API_HDR__
#define __BB_SK_API_HDR__
/*
* To add an sk api function:
* 1) add SK_API_CALL_ define
* 2) add function prototype in this header
* 3) implement function in lib/SK/skapi.c
* 4) add the function to the array skapi_call_table (lib/SK/skapi.c)
* 5) add entry stub to libultra/bb/sk/skapi.s.
*/
/*
* Function call mapping numbers, must be in order 0..end
*/
#define SK_API_CALL_GET_ID 0
#define SK_API_CALL_LAUNCH_SETUP 1
#define SK_API_CALL_LAUNCH 2
#define SK_API_CALL_LIST_VALID 3
#define SK_API_CALL_RECRYPT_BEGIN 4
#define SK_API_CALL_RECRYPT_DATA 5
#define SK_API_CALL_RECRYPT_STATE 6
#define SK_API_CALL_RECRYPT_END 7
#define SK_API_CALL_SIGN_HASH 8
#define SK_API_CALL_VERIFY_HASH 9
#define SK_API_CALL_GET_CONSUMPTION 10
#define SK_API_CALL_ADVANCE_TICKET_WINDOW 11
#define SK_API_CALL_SET_LIMIT 12
#define SK_API_CALL_EXIT 13
#define SK_API_CALL_KEEP_ALIVE 14
/*
* the calls below are for test purpose, not for default or
* production build
*/
#define SK_API_CALL_GET_RAND 15
#define SK_API_CALL_DUMP_VIRAGE 16
#define SK_API_CALL_TEST2 17
#define SK_API_CALL_TEST3 18
#define SK_API_CALL_RESET_WINDOW 19
#define SK_API_CALL_VALIDATE_RLS 20
/* sk api error and return codes. Negative implies failure. */
#define SK_API_SUCCESS 0
#define SK_API_RECRYPT_NOT_REQUIRED 1
#define SK_API_RECRYPT_COMPLETE 2
#define SK_API_RECRYPT_INCOMPLETE 3
#define SK_API_RECRYPT_NEW 4
#define SK_API_FAIL -1
#define SK_API_INVALID_TSRL -2
#define SK_API_INVALID_CARL -3
#define SK_API_INVALID_CPRL -4
#define SK_API_INVALID_CRL -5
#define SK_API_INVALID_CERT -6
#define SK_API_INVALID_CONT_HASH -7
#define SK_API_SIGNER_MISMATCH -8
#define SK_API_REVOKED_SERVER -9
#define SK_API_REVOKED_CONTENT -10
#define SK_API_NO_ENTRY_FOUND -11
#define SK_IDENTITY (0x06091968)
#define API_IDENTITY (0x00000001)
#define SK_RECRYPT_KEYLIST_SIZE (16*1024)
/*
* Function call declarations.
* NOTE: max number of args is 4, and they must fit into a0-a3.
*/
#if defined(_LANGUAGE_C)
#include <PR/bbticket.h>
#include <PR/bbcert.h>
#include <PR/bbcrl.h>
#include <PR/bbvirage.h>
typedef struct {
BbCrlHead *head;
BbServerSuffix *list; /* the actual names of revoked SNs */
/* each pointer points to a cert object */
BbCertBase *certChain[BB_CERT_CHAIN_MAXLEN];
} BbCrlBundle;
typedef struct {
BbTicket *ticket;
BbCertBase *ticketChain[BB_CERT_CHAIN_MAXLEN];
BbCertBase *cmdChain[BB_CERT_CHAIN_MAXLEN];
} BbTicketBundle;
typedef struct {
BbCrlBundle tsrl; /* ticket server revocation list */
BbCrlBundle carl; /* certificate authority revocation list */
BbCrlBundle cprl; /* content publishing server revocation list */
} BbAppLaunchCrls;
/*
* The actual sk api function declarations. All functions
* return SK_API_ return codes defined above. Any return
* value < 0 is failure.
*/
/* get the bbid */
int skGetId(BbId *id);
/* setup app launch. does not transfer data.
*/
int skLaunchSetup(BbTicketBundle *ticket,
BbAppLaunchCrls *crls,
void *pKeyList);
/* setyp app rights and xfer control to app at addr. */
int skLaunch(u32 addr);
/* primes sk for ensuing skRecrypt*() calls.
* ticket and crls are as in skLaunchSetup().
* pKeyList will obtain list to be stored.
* Maximum key list length is 16KB.
*/
int skRecryptListValid(void *pKeyList);
int skRecryptBegin(BbTicketBundle *ticket,
BbAppLaunchCrls *crls,
void *pKeyList);
int skRecryptData(u8 *data, u32 size);
/* when recovering from aborted recryption attempt, this call must
* be used to feed the already recrypted data before calling
* skRecryptData to finish.
*/
int skRecryptComputeState(u8 *data, u32 size);
/* end recyrption and determine success.
* pKeyList will obtain list to be stored.
* Maximum key list length is 16KB.
*/
int skRecryptEnd(void *pKeyList);
/*sign hash: operates on SHA-1 hash only, add on an optional identity */
int skSignHash(BbShaHash hash, BbEccSig sign);
/*verify hash: operates on SHA-1 hash only, use an optional identity */
int skVerifyHash(BbShaHash hash, BbGenericSig *sign, BbCertBase *certChain[],
BbAppLaunchCrls *crls);
extern int skGetConsumption(u16* tidWindow, u16 cc[BB_MAX_CC]);
extern int skAdvanceTicketWindow(void);
extern int skSetLimit(u16 limit, u16 code);
extern int skExit(void);
extern int skKeepAlive(void);
#ifdef SK_DEVELOP
/* test calls for developement, not for production */
int skGetRandomKeyData(u8 *data, int size); /* max size = 16 bytes */
int skDumpVirage(u8 *virage2data);
int skTest2(int a,int b);
int skTest3(int a,int b);
int skResetWindow(void);
int skValidateRls(BbCrlBundle *carl, BbCrlBundle *cprl,
BbCrlBundle *tsrl, u32 *versions);
#endif
#endif /* _LANGUAGE_C */
#endif

View File

@@ -0,0 +1,19 @@
/*---------------------------------------------------------------------*
Copyright (C) 2002 - 2004 BroadOn Communications.
*---------------------------------------------------------------------*/
#ifndef __BB_SK_API_HDR__
#define __BB_SK_API_HDR__
#if defined(_LANGUAGE_C)
typedef u32 BbId; /* 32-bit Player identity */
typedef u32 BbContentId; /* 32-bit content identity */
/* get the bbid */
int skGetId(BbId *id);
extern int skExit(void);
#endif /* _LANGUAGE_C */
#endif

38
include/ique/PR/dbgdefs.h Executable file
View File

@@ -0,0 +1,38 @@
/**************************************************************************
* *
* 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.1.1.2 $
* $Date: 2002/10/29 08:06:34 $
* $Source: /home/routefree/bb/depot/rf/sw/bbplayer/include/dbgdefs.h,v $
*
**************************************************************************/
#ifndef _DBGDEFS_H_
#define _DBGDEFS_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
typedef int TVid;
typedef unsigned short TVushort;
typedef unsigned char TVuchar;
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif

609
include/ique/PR/dbgproto.h Executable file

File diff suppressed because it is too large Load Diff

134
include/ique/PR/driverd.h Executable file
View File

@@ -0,0 +1,134 @@
/*
* driverd.h: driver daemon declarations & struct definitions.
*
* Copyright 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (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, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*
*/
/**************************************************************************
*
* $Revision: 1.1.1.2 $
* $Date: 2002/10/29 08:06:34 $
* $Source: /home/routefree/bb/depot/rf/sw/bbplayer/include/driverd.h,v $
*
**************************************************************************/
#define MAXCLIENTS 5
/*
* Same numbers as videod, bumped up by one each.
*/
#define DRIVERD_TCP_PORT 8001
#define DRIVERD_RPC_PORT 391012
/*
* Daemon must keep track of each client which has attached; it does so by
* maintaining an array of 'em.
*/
typedef struct _Client *ClientPtr;
typedef struct _Client {
int fd; /* File descriptor of private socket between daemon/client */
id_t id; /* Process ID of the client (so that we can signal them) */
/*
* Event range (6 bit numbers) that this client is interested in; when
* the game sends the daemon an event via a socket (that the emulator
* opens with the daemon), the daemon checks to see which clients are
* interested in this event, then writes to their sockets to indicate
* that the event came in. The clients then wake up, realize an event
* has occurred, & query the daemon to find out what happened (just as
* they'll have to query the device driver via ioctl to find out what
* happened).
*/
int min_event;
int max_event;
int index;
} ClientRec;
/*
* We need a special one byte header on all writes to the private socket
* between daemon & client to differentiate between the three actions we
* expect the daemon to perform:
*
* Session registration (new clients identify themselves & pass pid to daemon)
*
* Events from Game (emulator writes events on private socket)
*
* Commands to Game (daemon receives commands from host side clients,
* arbitrates for control of ramrom, writes the command into ramrom,
* sends a signal to the game to tell it to read the ramrom arena, then
* waits for an acknowledge to come back from the game indicating that the
* command has been accepted (so that the daemon could begin a new command
* arbitration if needed).
*/
#define DRIVERD_REGISTER_SESSION 101
#define DRIVERD_REGISTER_EMULATOR 102
#define DRIVERD_EVENT_FROM_GAME 103
#define DRIVERD_IOCTL_REQUEST 104
typedef struct _registerSession *registerSessionPtr;
typedef struct _registerSession {
unsigned int dd_header; /* One of the three possible actions for daemon*/
id_t id; /* Process ID of the client (so that we can signal them) */
/*
* Event range (6 bit numbers) that this client is interested in; when
* the game sends the daemon an event via a socket (that the emulator
* opens with the daemon), the daemon checks to see which clients are
* interested in this event, then writes to their sockets to indicate
* that the event came in. The clients then wake up, realize an event
* has occurred, & query the daemon to find out what happened (just as
* they'll have to query the device driver via ioctl to find out what
* happened).
*/
} RegisterSession;
typedef struct _registerEmulator {
unsigned int dd_header; /* One of the possible actions for daemon*/
id_t id; /* Process ID of emulate (so that we can signal them) */
int shmkey; /* Shared memory key */
} RegisterEmulator;
typedef struct _eventFromGame *eventFromGamePtr;
typedef struct _eventFromGame {
unsigned int dd_header; /* One of the possible actions for daemon*/
int event; /* Signed value */
} EventFromGame;
typedef struct _commandToGame *commandToGamePtr;
typedef struct _commandToGame {
unsigned int dd_header; /* One of the possible actions for daemon*/
/*
* XXX
*/
} CommandToGame;
typedef struct _ioctlRequest {
unsigned int dd_header; /* One of the possible actions for daemon*/
int request;
} IoctlRequest;
extern int MakeDriverDConnection(char *phostname, int iserver, int retries, int *familyp); /* RETURN */

102
include/ique/PR/em.h Executable file
View File

@@ -0,0 +1,102 @@
#ifndef _EM_H_
#define _EM_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.1.1.2 $
* $Date: 2002/10/29 08:06:34 $
* $Source: /home/routefree/bb/depot/rf/sw/bbplayer/include/em.h,v $
*
**************************************************************************/
#include <PR/mbi.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
typedef struct {
int x;
int y;
unsigned int buttons;
} MouseState;
#define BUTTON_LEFT 0x4
#define BUTTON_MIDDLE 0x2
#define BUTTON_RIGHT 0x1
typedef struct {
unsigned short button; /* all of the 14 buttons */
unsigned char stick_x;
unsigned char stick_y;
} GamePad;
/* Simulate interrupts with signals */
#define SIGSW1 (SIGRTMIN + OS_EVENT_SW1)
#define SIGSW2 (SIGRTMIN + OS_EVENT_SW2)
#define SIGCART (SIGRTMIN + OS_EVENT_CART)
#define SIGCOUNTER (SIGRTMIN + OS_EVENT_COUNTER)
#define SIGSP (SIGRTMIN + OS_EVENT_SP)
#define SIGSI (SIGRTMIN + OS_EVENT_SI)
#define SIGAI (SIGRTMIN + OS_EVENT_AI)
#define SIGVI (SIGRTMIN + OS_EVENT_VI)
#define SIGPI (SIGRTMIN + OS_EVENT_PI)
#define SIGDI (SIGRTMIN + OS_EVENT_DP)
#define SIGBREAK (SIGRTMIN + OS_EVENT_CPU_BREAK)
#define SIGSPBREAK (SIGRTMIN + OS_EVENT_SP_BREAK)
/*
* Function Prototypes
*/
extern void emDisplayBuffer(unsigned int);
extern void emGetMouseState(MouseState *);
extern int emInitController(int);
extern int emGetController(int, GamePad *);
extern int emMemoryDump(const char *);
extern int emMemoryLoad(const char *);
extern int emPrintf(const char *, ...);
extern void emGIOInit( void );
extern void emInitSocket( void );
extern void emWriteSocket( char );
extern void emRomToHost( int, int );
/* connect to RSP: */
extern int emRSPFrame(char *prefix, int fid, int keepMem, int DRAMoutput, int RDPin);
extern int emRSPAudioFrame(char *prefix, int fid, int keepMem);
extern int emRSPQuit(void);
/* audio support */
extern void emAudioInit(char *filename);
extern void emAudioWrite(short *out, int count);
extern void emAudioFlush(void);
extern void emPause(void);
/* DRAM definites */
#define KSEG0_BASE 0x20000000
#define DRAM_SIZE 0x200000
/* locations for shared ROM in emulator */
#define ROM_BASE (KSEG0_BASE + DRAM_SIZE + 0x2000)
#define GIO_CART_INT_REGISTER (ROM_BASE + RAMROM_SIZE - 4)
#define SHM_CART_INT_REGISTER (RAMROM_MSG_SIZE - 4)
#define SHM_MSG_BUFFER_ADDRESS (RAMROM_MSG_SIZE - 8)
#endif /* _LANGUAGE_C */
#endif /* !_EM_H_ */

0
include/PR/gbi.h → include/ique/PR/gbi.h Normal file → Executable file
View File

393
include/ique/PR/gs2dex.h Executable file
View File

@@ -0,0 +1,393 @@
/*---------------------------------------------------------------------
Copyright (C) 1997, Nintendo.
File gs2dex.h
Coded by Yoshitaka Yasumoto. Jul 31, 1997.
Modified by
Comments Header file for S2DEX ucode.
$Id: gs2dex.h,v 1.1.1.1 2002/05/02 03:28:24 blythe Exp $
---------------------------------------------------------------------*/
#ifndef _GS2DEX_H_
#define _GS2DEX_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
/*===========================================================================*
* Macro
*===========================================================================*/
#define GS_CALC_DXT(line) (((1<< G_TX_DXT_FRAC)-1)/(line)+1)
#define GS_PIX2TMEM(pix, siz) ((pix)>>(4-(siz)))
#define GS_PIX2DXT(pix, siz) GS_CALC_DXT(GS_PIX2TMEM((pix), (siz)))
/*===========================================================================*
* Data structures for S2DEX microcode
*===========================================================================*/
/*---------------------------------------------------------------------------*
* Background
*---------------------------------------------------------------------------*/
#define G_BGLT_LOADBLOCK 0x0033
#define G_BGLT_LOADTILE 0xfff4
#define G_BG_FLAG_FLIPS 0x01
#define G_BG_FLAG_FLIPT 0x10
/* Non scalable background plane */
typedef struct {
u16 imageX; /* テクスチャの左上位置 X 座標 (u10.5) */
u16 imageW; /* テクスチャの幅 (u10.2) */
s16 frameX; /* 転送されるフレームの左上位置(s10.2) */
u16 frameW; /* 転送されるフレームの幅 (u10.2) */
u16 imageY; /* テクスチャの左上位置 Y 座標 (u10.5) */
u16 imageH; /* テクスチャの高さ (u10.2) */
s16 frameY; /* 転送されるフレームの左上位置(s10.2) */
u16 frameH; /* 転送されるフレームの高さ (u10.2) */
u64 *imagePtr; /* DRAM 上のテクスチャソースアドレス */
u16 imageLoad; /* LoadBlock, LoadTile のどちらを使用するか */
u8 imageFmt; /* テクセルのフォーマット G_IM_FMT_* */
u8 imageSiz; /* テクセルのサイズ G_IM_SIZ_* */
u16 imagePal; /* パレット番号 */
u16 imageFlip; /* イメージの左右反転 G_BG_FLAG_FLIPS で反転 */
/* 以下は初期化ルーチン guS2DInitBg() 内で設定されるのでユーザが設
定する必要はない */
u16 tmemW; /* frame 1 ラインの TMEM 幅 Word サイズ
LoadBlock の時 GS_PIX2TMEM(imageW/4,imageSiz)
LoadTile の時 GS_PIX2TMEM(frameW/4,imageSiz)+1 */
u16 tmemH; /* 一度にロードできる TMEM 高さ (s13.2) 4倍値
通常テクスチャの時 512/tmemW*4
CI テクスチャの時 256/tmemW*4 */
u16 tmemLoadSH; /* SH 値
LoadBlock の時 tmemSize/2-1
LoadTile の時 tmemW*16-1 */
u16 tmemLoadTH; /* TH 値 or Stride 値
LoadBlock の時 GS_CALC_DXT(tmemW)
LoadTile の時 tmemH-1 */
u16 tmemSizeW; /* image 1 ライン分の imagePtr のスキップ値
LoadBlock の時 tmemW*2
LoadTile の時 GS_PIX2TMEM(imageW/4,imageSiz)*2 */
u16 tmemSize; /* ロード一回分の imagePtr のスキップ値
= tmemSizeW*tmemH */
} uObjBg_t; /* 40 bytes */
/* Scalable background plane */
typedef struct {
u16 imageX; /* テクスチャの左上位置 X 座標 (u10.5) */
u16 imageW; /* テクスチャの幅 (u10.2) */
s16 frameX; /* 転送されるフレームの左上位置(s10.2) */
u16 frameW; /* 転送されるフレームの幅 (u10.2) */
u16 imageY; /* テクスチャの左上位置 Y 座標 (u10.5) */
u16 imageH; /* テクスチャの高さ (u10.2) */
s16 frameY; /* 転送されるフレームの左上位置(s10.2) */
u16 frameH; /* 転送されるフレームの高さ (u10.2) */
u64 *imagePtr; /* DRAM 上のテクスチャソースアドレス */
u16 imageLoad; /* LoadBlock, LoadTile のどちらを使用するか */
u8 imageFmt; /* テクセルのフォーマット G_IM_FMT_* */
u8 imageSiz; /* テクセルのサイズ G_IM_SIZ_* */
u16 imagePal; /* パレット番号 */
u16 imageFlip; /* イメージの左右反転 G_BG_FLAG_FLIPS で反転 */
u16 scaleW; /* X 方向スケール値 (u5.10) */
u16 scaleH; /* Y 方向スケール値 (u5.10) */
s32 imageYorig; /* image における描画始点 (s20.5) */
u8 padding[4];
} uObjScaleBg_t; /* 40 bytes */
typedef union {
uObjBg_t b;
uObjScaleBg_t s;
long long int force_structure_alignment;
} uObjBg;
/*---------------------------------------------------------------------------*
* 2D Objects
*---------------------------------------------------------------------------*/
#define G_OBJ_FLAG_FLIPS 1<<0 /* S 方向反転 */
#define G_OBJ_FLAG_FLIPT 1<<4 /* T 方向反転 */
typedef struct {
s16 objX; /* s10.2 OBJ 左上端 X 座標 */
u16 scaleW; /* u5.10 幅方向スケーリング */
u16 imageW; /* u10.5 テクスチャの幅 (S 方向の長さ) */
u16 paddingX; /* 未使用 常に 0 */
s16 objY; /* s10.2 OBJ 左上端 Y 座標 */
u16 scaleH; /* u5.10 高さ方向スケーリング */
u16 imageH; /* u10.5 テクスチャの高さ (T 方向の長さ) */
u16 paddingY; /* 未使用 常に 0 */
u16 imageStride; /* テクセルの折り返し幅 (64bit word 単位) */
u16 imageAdrs; /* TMEM 内のテクスチャ先頭位置 (64bit word 単位) */
u8 imageFmt; /* テクセルのフォーマット G_IM_FMT_* */
u8 imageSiz; /* テクセルのサイズ G_IM_SIZ_* */
u8 imagePal; /* パレット番号 0-7 */
u8 imageFlags; /* 表示フラグ G_OBJ_FLAG_FLIP* */
} uObjSprite_t; /* 24 bytes */
typedef union {
uObjSprite_t s;
long long int force_structure_alignment;
} uObjSprite;
/*---------------------------------------------------------------------------*
* 2D Matrix
*---------------------------------------------------------------------------*/
typedef struct {
s32 A, B, C, D; /* s15.16 */
s16 X, Y; /* s10.2 */
u16 BaseScaleX; /* u5.10 */
u16 BaseScaleY; /* u5.10 */
} uObjMtx_t; /* 24 bytes */
typedef union {
uObjMtx_t m;
long long int force_structure_alignment;
} uObjMtx;
typedef struct {
s16 X, Y; /* s10.2 */
u16 BaseScaleX; /* u5.10 */
u16 BaseScaleY; /* u5.10 */
} uObjSubMtx_t; /* 8 bytes */
typedef union {
uObjSubMtx_t m;
long long int force_structure_alignment;
} uObjSubMtx;
/*---------------------------------------------------------------------------*
* Loading into TMEM
*---------------------------------------------------------------------------*/
#define G_OBJLT_TXTRBLOCK 0x00001033
#define G_OBJLT_TXTRTILE 0x00fc1034
#define G_OBJLT_TLUT 0x00000030
#define GS_TB_TSIZE(pix,siz) (GS_PIX2TMEM((pix),(siz))-1)
#define GS_TB_TLINE(pix,siz) (GS_CALC_DXT(GS_PIX2TMEM((pix),(siz))))
typedef struct {
u32 type; /* Type 種別 G_OBJLT_TXTRBLOCK */
u64 *image; /* DRAM 上のテクスチャソースアドレス */
u16 tmem; /* ロード先の TMEM ワードアドレス (8byteWORD) */
u16 tsize; /* Texture サイズ マクロ GS_TB_TSIZE() で指定 */
u16 tline; /* Texture 1 ライン幅 マクロ GS_TB_TLINE() で指定 */
u16 sid; /* STATE ID 4 の倍数で 0,4,8,12 のどれか */
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrBlock_t; /* 24 bytes */
#define GS_TT_TWIDTH(pix,siz) ((GS_PIX2TMEM((pix), (siz))<<2)-1)
#define GS_TT_THEIGHT(pix,siz) (((pix)<<2)-1)
typedef struct {
u32 type; /* Type 種別 G_OBJLT_TXTRTILE */
u64 *image; /* DRAM 上のテクスチャソースアドレス */
u16 tmem; /* ロード先の TMEM ワードアドレス (8byteWORD) */
u16 twidth; /* Texture 幅 マクロ GS_TT_TWIDTH() で指定 */
u16 theight; /* Texture 高さ マクロ GS_TT_THEIGHT() で指定 */
u16 sid; /* STATE ID 4 の倍数で 0,4,8,12 のどれか */
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrTile_t; /* 24 bytes */
#define GS_PAL_HEAD(head) ((head)+256)
#define GS_PAL_NUM(num) ((num)-1)
typedef struct {
u32 type; /* Type 種別 G_OBJLT_TLUT */
u64 *image; /* DRAM 上のテクスチャソースアドレス */
u16 phead; /* ロード先頭のパレット番号 256 以上 511 以下 */
u16 pnum; /* ロードするパレット数 - 1 */
u16 zero; /* 常に 0 を代入する */
u16 sid; /* STATE ID 4 の倍数で 0,4,8,12 のどれか */
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrTLUT_t; /* 24 bytes */
typedef union {
uObjTxtrBlock_t block;
uObjTxtrTile_t tile;
uObjTxtrTLUT_t tlut;
long long int force_structure_alignment;
} uObjTxtr;
/*---------------------------------------------------------------------------*
* Loading into TMEM & 2D Objects
*---------------------------------------------------------------------------*/
typedef struct {
uObjTxtr txtr;
uObjSprite sprite;
} uObjTxSprite; /* 48 bytes */
/*===========================================================================*
* GBI Commands for S2DEX microcode
*===========================================================================*/
/* GBI Header */
#ifdef F3DEX_GBI_2
#define G_OBJ_RECTANGLE_R 0xda
#define G_OBJ_MOVEMEM 0xdc
#define G_RDPHALF_0 0xe4
#define G_OBJ_RECTANGLE 0x01
#define G_OBJ_SPRITE 0x02
#define G_SELECT_DL 0x04
#define G_OBJ_LOADTXTR 0x05
#define G_OBJ_LDTX_SPRITE 0x06
#define G_OBJ_LDTX_RECT 0x07
#define G_OBJ_LDTX_RECT_R 0x08
#define G_BG_1CYC 0x09
#define G_BG_COPY 0x0a
#define G_OBJ_RENDERMODE 0x0b
#else
#define G_BG_1CYC 0x01
#define G_BG_COPY 0x02
#define G_OBJ_RECTANGLE 0x03
#define G_OBJ_SPRITE 0x04
#define G_OBJ_MOVEMEM 0x05
#define G_SELECT_DL 0xb0
#define G_OBJ_RENDERMODE 0xb1
#define G_OBJ_RECTANGLE_R 0xb2
#define G_OBJ_LOADTXTR 0xc1
#define G_OBJ_LDTX_SPRITE 0xc2
#define G_OBJ_LDTX_RECT 0xc3
#define G_OBJ_LDTX_RECT_R 0xc4
#define G_RDPHALF_0 0xe4
#endif
/*---------------------------------------------------------------------------*
* Background wrapped screen
*---------------------------------------------------------------------------*/
#define gSPBgRectangle(pkt, m, mptr) gDma0p((pkt),(m),(mptr),0)
#define gsSPBgRectangle(m, mptr) gsDma0p( (m),(mptr),0)
#define gSPBgRectCopy(pkt, mptr) gSPBgRectangle((pkt), G_BG_COPY, (mptr))
#define gsSPBgRectCopy(mptr) gsSPBgRectangle( G_BG_COPY, (mptr))
#define gSPBgRect1Cyc(pkt, mptr) gSPBgRectangle((pkt), G_BG_1CYC, (mptr))
#define gsSPBgRect1Cyc(mptr) gsSPBgRectangle( G_BG_1CYC, (mptr))
/*---------------------------------------------------------------------------*
* 2D Objects
*---------------------------------------------------------------------------*/
#define gSPObjSprite(pkt, mptr) gDma0p((pkt),G_OBJ_SPRITE, (mptr),0)
#define gsSPObjSprite(mptr) gsDma0p( G_OBJ_SPRITE, (mptr),0)
#define gSPObjRectangle(pkt, mptr) gDma0p((pkt),G_OBJ_RECTANGLE, (mptr),0)
#define gsSPObjRectangle(mptr) gsDma0p( G_OBJ_RECTANGLE, (mptr),0)
#define gSPObjRectangleR(pkt, mptr) gDma0p((pkt),G_OBJ_RECTANGLE_R,(mptr),0)
#define gsSPObjRectangleR(mptr) gsDma0p( G_OBJ_RECTANGLE_R,(mptr),0)
/*---------------------------------------------------------------------------*
* 2D Matrix
*---------------------------------------------------------------------------*/
#define gSPObjMatrix(pkt, mptr) gDma1p((pkt),G_OBJ_MOVEMEM,(mptr),0,23)
#define gsSPObjMatrix(mptr) gsDma1p( G_OBJ_MOVEMEM,(mptr),0,23)
#define gSPObjSubMatrix(pkt, mptr) gDma1p((pkt),G_OBJ_MOVEMEM,(mptr),2, 7)
#define gsSPObjSubMatrix(mptr) gsDma1p( G_OBJ_MOVEMEM,(mptr),2, 7)
/*---------------------------------------------------------------------------*
* Loading into TMEM
*---------------------------------------------------------------------------*/
#define gSPObjLoadTxtr(pkt, tptr) gDma0p((pkt),G_OBJ_LOADTXTR, (tptr),23)
#define gsSPObjLoadTxtr(tptr) gsDma0p( G_OBJ_LOADTXTR, (tptr),23)
#define gSPObjLoadTxSprite(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_SPRITE,(tptr),47)
#define gsSPObjLoadTxSprite(tptr) gsDma0p( G_OBJ_LDTX_SPRITE,(tptr),47)
#define gSPObjLoadTxRect(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_RECT, (tptr),47)
#define gsSPObjLoadTxRect(tptr) gsDma0p( G_OBJ_LDTX_RECT, (tptr),47)
#define gSPObjLoadTxRectR(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_RECT_R,(tptr),47)
#define gsSPObjLoadTxRectR(tptr) gsDma0p( G_OBJ_LDTX_RECT_R,(tptr),47)
/*---------------------------------------------------------------------------*
* Select Display List
*---------------------------------------------------------------------------*/
#define gSPSelectDL(pkt, mptr, sid, flag, mask) \
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); }
#define gsSPSelectDL(mptr, sid, flag, mask) \
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); }
#define gSPSelectBranchDL(pkt, mptr, sid, flag, mask) \
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); }
#define gsSPSelectBranchDL(mptr, sid, flag, mask) \
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); }
/*---------------------------------------------------------------------------*
* Set general status
*---------------------------------------------------------------------------*/
#define G_MW_GENSTAT 0x08 /* G_MW_FOG と同じ値なので注意 */
#define gSPSetStatus(pkt, sid, val) \
gMoveWd((pkt), G_MW_GENSTAT, (sid), (val))
#define gsSPSetStatus(sid, val) \
gsMoveWd( G_MW_GENSTAT, (sid), (val))
/*---------------------------------------------------------------------------*
* Set Object Render Mode
*---------------------------------------------------------------------------*/
#define G_OBJRM_NOTXCLAMP 0x01
#define G_OBJRM_XLU 0x02 /* Ignored */
#define G_OBJRM_ANTIALIAS 0x04 /* Ignored */
#define G_OBJRM_BILERP 0x08
#define G_OBJRM_SHRINKSIZE_1 0x10
#define G_OBJRM_SHRINKSIZE_2 0x20
#define G_OBJRM_WIDEN 0x40
#define gSPObjRenderMode(pkt, mode) gImmp1((pkt),G_OBJ_RENDERMODE,(mode))
#define gsSPObjRenderMode(mode) gsImmp1( G_OBJ_RENDERMODE,(mode))
/*===========================================================================*
* Render Mode Macro
*===========================================================================*/
#define RM_RA_SPRITE(clk) \
AA_EN | CVG_DST_CLAMP | \
CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define G_RM_SPRITE G_RM_OPA_SURF
#define G_RM_SPRITE2 G_RM_OPA_SURF2
#define G_RM_RA_SPRITE RM_RA_SPRITE(1)
#define G_RM_RA_SPRITE2 RM_RA_SPRITE(2)
#define G_RM_AA_SPRITE G_RM_AA_TEX_TERR
#define G_RM_AA_SPRITE2 G_RM_AA_TEX_TERR2
#define G_RM_XLU_SPRITE G_RM_XLU_SURF
#define G_RM_XLU_SPRITE2 G_RM_XLU_SURF2
#define G_RM_AA_XLU_SPRITE G_RM_AA_XLU_SURF
#define G_RM_AA_XLU_SPRITE2 G_RM_AA_XLU_SURF2
/*===========================================================================*
* External functions
*===========================================================================*/
extern u64 gspS2DEX_fifoTextStart[], gspS2DEX_fifoTextEnd[];
extern u64 gspS2DEX_fifoDataStart[], gspS2DEX_fifoDataEnd[];
extern u64 gspS2DEX_fifo_dTextStart[], gspS2DEX_fifo_dTextEnd[];
extern u64 gspS2DEX_fifo_dDataStart[], gspS2DEX_fifo_dDataEnd[];
extern u64 gspS2DEX2_fifoTextStart[], gspS2DEX2_fifoTextEnd[];
extern u64 gspS2DEX2_fifoDataStart[], gspS2DEX2_fifoDataEnd[];
extern u64 gspS2DEX2_xbusTextStart[], gspS2DEX2_xbusTextEnd[];
extern u64 gspS2DEX2_xbusDataStart[], gspS2DEX2_xbusDataEnd[];
extern void guS2DInitBg(uObjBg *);
#ifdef F3DEX_GBI_2
# define guS2DEmuBgRect1Cyc guS2D2EmuBgRect1Cyc /*Wrapper*/
# define guS2DEmuSetScissor guS2D2EmuSetScissor /*Wrapper*/
extern void guS2D2EmuSetScissor(u32, u32, u32, u32, u8);
extern void guS2D2EmuBgRect1Cyc(Gfx **, uObjBg *);
#else
extern void guS2DEmuSetScissor(u32, u32, u32, u32, u8);
extern void guS2DEmuBgRect1Cyc(Gfx **, uObjBg *);
#endif
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* _GS2DEX_H_ */
/*======== End of gs2dex.h ========*/

365
include/ique/PR/gt.h Executable file
View File

@@ -0,0 +1,365 @@
/*
* 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.1.1.2 $
* $Date: 2002/10/29 08:06:34 $
* $Source: /home/routefree/bb/depot/rf/sw/bbplayer/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 */
#include <PR/ultratypes.h>
/* 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_ */

Some files were not shown because too many files have changed in this diff Show More