mirror of
https://github.com/pret/pokestadium.git
synced 2026-09-14 06:16:09 -05:00
4
.gitignore
vendored
4
.gitignore
vendored
@@ -16,3 +16,7 @@ __pycache__/
|
||||
|
||||
undefined_funcs_auto.txt
|
||||
undefined_syms_auto.txt
|
||||
|
||||
# qemu-irix compilers
|
||||
tools/ido5.3_compiler/
|
||||
tools/ido7.1_compiler/
|
||||
|
||||
157
Makefile
157
Makefile
@@ -42,25 +42,154 @@ CPP := cpp
|
||||
CC = tools/ido_recomp/linux/7.1/cc
|
||||
CC_OLD = tools/ido_recomp/linux/5.3/cc
|
||||
|
||||
ASFLAGS = -EB -mtune=vr4300 -march=vr4300 -Iinclude
|
||||
|
||||
# we support Microsoft extensions such as anonymous structs, which the compiler does support but warns for their usage. Surpress the warnings with -woff.
|
||||
CFLAGS = -G 0 -non_shared -Xfullwarn -Xcpluscomm -Iinclude -Wab,-r4300_mul -D _LANGUAGE_C -D F3DEX_GBI -woff 649,838,712 -mips2
|
||||
|
||||
LDFLAGS = -T undefined_syms.txt -T undefined_syms_auto.txt -T undefined_funcs_auto.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/$(TARGET).map --no-check-sections
|
||||
MIPS_VERSION := -mips2
|
||||
|
||||
OPTFLAGS := -O2
|
||||
|
||||
OBJDUMP_FLAGS := -d -r -z -Mreg-names=32
|
||||
|
||||
######################## Targets #############################
|
||||
|
||||
$(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(DATA_DIRS) $(COMPRESSED_DIRS) $(MAP_DIRS) $(BGM_DIRS),$(shell mkdir -p build/$(dir)))
|
||||
|
||||
# Libultra O1 files
|
||||
build/src/libultra/os/osSendMesg.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/osStopThread.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/osRecvMesg.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/sendmesg.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/stopthread.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/recvmesg.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/destroythread.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/dequeuethread.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/createthread.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/virtualtophysical.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/initialize.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/epilinkhandle.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/getmemsize.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/seteventmesg.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/createmesgqueue.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/jammesg.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/setthreadpri.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/gettime.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/timerintr.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/setglobalintmask.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/resetglobalintmask.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/settime.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/yieldthread.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/settimer.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/startthread.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/sethwinterrupt.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/pigetcmdq.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/sptask.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/controller.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/conteeplongread.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/viblack.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/visetmode.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/virepeatline.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/pfsisplug.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/epidma.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/dpctr.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/conteeplongwrite.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/si.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/sp.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/viswapbuf.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/sptaskyielded.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/vi.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/visetevent.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/aisetnextbuf.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/ai.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/vigetcurrframebuf.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/spsetpc.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/libc/ll.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/libc/ll.c.o: MIPS_VERSION := -mips3 -32
|
||||
build/src/libultra/libc/llcvt.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/libc/llcvt.c.o: MIPS_VERSION := -mips3 -32
|
||||
|
||||
# cheap hack. TODO: Make the override better
|
||||
build/src/libultra/io/gbpakpower.c.o: OPTFLAGS += -Wo,-loopunroll,0
|
||||
build/src/libultra/io/gbpakinit.c.o: OPTFLAGS += -Wo,-loopunroll,0
|
||||
build/src/libultra/io/gbpakselectbank.c.o: OPTFLAGS += -Wo,-loopunroll,0
|
||||
|
||||
# Libultra misc
|
||||
build/src/libultra/gu/scale.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/gu/scale.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/gu/translate.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/gu/translate.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/gu/mtxcatf.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/gu/mtxcatf.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/gu/mtxcatl.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/gu/mtxcatl.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/gu/rotateRPY.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/gu/rotateRPY.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/gu/rotate.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/gu/rotate.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/gu/ortho.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/gu/ortho.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/gu/sinf.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/gu/cosf.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/gu/random.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/libc/xprintf.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/libc/xprintf.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/libc/xldtob.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/libc/xldtob.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/libc/xlitob.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/libc/xlitob.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/libc/string.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/libc/string.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/io/controller.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/contreaddata.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/devmgr.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/os/initialize.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/pfsgetstatus.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/epiread.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/reverb.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/bnkf.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/bnkf.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/al/load.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/load.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/al/synthesizer.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/drvrNew.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/mainbus.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/mainbus.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/al/auxbus.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/auxbus.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/al/env.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/resample.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/resample.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/al/save.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/heapalloc.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/gu/mtxutil.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/gu/mtxutil.c.o: OPTFLAGS := -O3
|
||||
build/src/libultra/io/pfsisplug.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/conteepprobe.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/conteepwrite.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/conteepread.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/contpfs.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/viswapcontext.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/contramwrite.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/contramread.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/crc.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/libc/ldiv.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/vimgr.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/visetxscale.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/visetxscale.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/visetyscale.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/visetyscale.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/al/synallocfx.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/al/synallocfx.c.o: OPTFLAGS := -O3
|
||||
|
||||
build/src/libultra/io/gbpakcheckconnector.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/gbpakreadid.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/gbpakreadwrite.c.o: CC := $(CC_OLD)
|
||||
build/src/libultra/io/gbpakselectbank.c.o: CC := $(CC_OLD)
|
||||
|
||||
######################## Flags #############################
|
||||
|
||||
ASFLAGS = -EB -mtune=vr4300 -march=vr4300 -Iinclude -Iinclude/PR -Iinclude/audio -32
|
||||
|
||||
# we support Microsoft extensions such as anonymous structs, which the compiler does support but warns for their usage. Surpress the warnings with -woff.
|
||||
CFLAGS = -G 0 -non_shared -Xfullwarn -Xcpluscomm -Iinclude -Iinclude/PR -Iinclude/audio -Wab,-r4300_mul -D_LANGUAGE_C -DF3DEX_GBI -DNDEBUG -woff 649,838,712 $(MIPS_VERSION)
|
||||
|
||||
LDFLAGS = -T undefined_syms.txt -T undefined_syms_auto.txt -T undefined_funcs_auto.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/$(TARGET).map --no-check-sections
|
||||
|
||||
######################## Build #############################
|
||||
|
||||
default: all
|
||||
|
||||
@@ -96,6 +225,16 @@ $(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT)
|
||||
$(BUILD_DIR)/%.c.o: %.c
|
||||
$(CC) -c $(CFLAGS) $(OPTFLAGS) -o $@ $^
|
||||
|
||||
$(BUILD_DIR)/src/libultra/libc/ll.c.o: src/libultra/libc/ll.c
|
||||
$(CC) -c $(CFLAGS) $(OPTFLAGS) -o $@ $^
|
||||
python3 tools/set_o32abi_bit.py $@
|
||||
@$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s)
|
||||
|
||||
$(BUILD_DIR)/src/libultra/libc/llcvt.c.o: src/libultra/libc/llcvt.c
|
||||
$(CC) -c $(CFLAGS) $(OPTFLAGS) -o $@ $^
|
||||
python3 tools/set_o32abi_bit.py $@
|
||||
@$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s)
|
||||
|
||||
$(BUILD_DIR)/%.s.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 1997/11/26 00:30:50 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/PRimage.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/PRimage.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*
|
||||
* $Revision: 1.13 $
|
||||
* $Date: 1997/02/11 08:15:34 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/R4300.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/R4300.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
* $Revision: 1.32 $
|
||||
* $Date: 1997/02/11 08:16:37 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/abi.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/abi.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
569
include/PR/gbi.h
569
include/PR/gbi.h
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
Modified by
|
||||
Comments Header file for S2DEX ucode.
|
||||
|
||||
$Id: gs2dex.h,v 1.15 1997/10/17 08:19:07 yasu Exp $
|
||||
$Id: gs2dex.h,v 1.21 1998/05/28 00:14:49 has Exp $
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _GS2DEX_H_
|
||||
@@ -16,6 +16,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
/*===========================================================================*
|
||||
* Macro
|
||||
*===========================================================================*/
|
||||
@@ -38,66 +40,66 @@ extern "C" {
|
||||
|
||||
/* Non scalable background plane */
|
||||
typedef struct {
|
||||
u16 imageX; /* The x-coordinate of the upper-left position of the texture. (u11.5)*/
|
||||
u16 imageW; /* The width of the texture. (u10.2)*/
|
||||
s16 frameX; /* The upper-left position of the transferred frame. (s10.2)*/
|
||||
u16 frameW; /* The width of the transferred frame. (u10.2)*/
|
||||
u16 imageX; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> X <20><>ɸ (u10.5) */
|
||||
u16 imageW; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (u10.2) */
|
||||
s16 frameX; /* ž<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ե졼<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(s10.2) */
|
||||
u16 frameW; /* ž<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ե졼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (u10.2) */
|
||||
|
||||
u16 imageY; /* The y-coordinate of the upper-left position of the texture. (u11.5)*/
|
||||
u16 imageH; /* The height of the texture. (u10.2)*/
|
||||
s16 frameY; /* The upper-left position of the transferred frame. (s10.2)*/
|
||||
u16 frameH; /* The height of the transferred frame. (u10.2)*/
|
||||
u16 imageY; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Y <20><>ɸ (u10.5) */
|
||||
u16 imageH; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ι⤵ (u10.2) */
|
||||
s16 frameY; /* ž<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ե졼<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(s10.2) */
|
||||
u16 frameH; /* ž<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ե졼<EFBFBD><EFBFBD><EFBFBD>ι⤵ (u10.2) */
|
||||
|
||||
u64 *imagePtr; /* The texture source address on DRAM. */
|
||||
u16 imageLoad; /* Which to use, LoadBlock or LoadTile? */
|
||||
u8 imageFmt; /* The format of the texel. G_IM_FMT_* */
|
||||
u8 imageSiz; /* The size of the texel G_IM_SIZ_* */
|
||||
u16 imagePal; /* The pallet number. */
|
||||
u16 imageFlip; /* The right & left inversion of the image. Inverted by G_BG_FLAG_FLIPS*/
|
||||
u64 *imagePtr; /* DRAM <20><><EFBFBD>Υƥ<CEA5><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㥽<EFBFBD><E3A5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ쥹 */
|
||||
u16 imageLoad; /* LoadBlock, LoadTile <20>Τɤ<CEA4><C9A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѥ<EFBFBD><D1A4>뤫 */
|
||||
u8 imageFmt; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υե<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޥå<EFBFBD> G_IM_FMT_* */
|
||||
u8 imageSiz; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> G_IM_SIZ_* */
|
||||
u16 imagePal; /* <EFBFBD>ѥ<EFBFBD><EFBFBD>å<EFBFBD><EFBFBD>ֹ<EFBFBD> */
|
||||
u16 imageFlip; /* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD>ȿž G_BG_FLAG_FLIPS <20><>ȿž */
|
||||
|
||||
/* Because the following are set in the initialization routine guS2DInitBg(), the user doesn't
|
||||
have to set it.*/
|
||||
u16 tmemW; /* The TMEM width and Work size of the frame 1 line.
|
||||
At LoadBlock, GS_PIX2TMEM(imageW/4,imageSiz)
|
||||
At LoadTile GS_PIX2TMEM(frameW/4,imageSiz)+1 */
|
||||
u16 tmemH; /* The height of TMEM loadable at a time. (s13.2) The 4 times value.
|
||||
When the normal texture, 512/tmemW*4
|
||||
When the CI texture, 256/tmemW*4 */
|
||||
u16 tmemLoadSH; /* The SH value
|
||||
At LoadBlock, tmemSize/2-1
|
||||
At LoadTile, tmemW*16-1 */
|
||||
u16 tmemLoadTH; /* The TH value or the Stride value
|
||||
At LoadBlock, GS_CALC_DXT(tmemW)
|
||||
At LoadTile, tmemH-1 */
|
||||
u16 tmemSizeW; /* The skip value of imagePtr for image 1-line.
|
||||
At LoadBlock, tmemW*2
|
||||
At LoadTile, GS_PIX2TMEM(imageW/4,imageSiz)*2 */
|
||||
u16 tmemSize; /* The skip value of imagePtr for 1-loading.
|
||||
= tmemSizeW*tmemH */
|
||||
/* <EFBFBD>ʲ<EFBFBD><EFBFBD>Ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롼<EFBFBD><EFBFBD><EFBFBD><EFBFBD> guS2DInitBg() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꤵ<EFBFBD><EAA4B5><EFBFBD><EFBFBD><EFBFBD>Τǥ桼<C7A5><E6A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD>ꤹ<EFBFBD><EFBFBD>ɬ<EFBFBD>פϤʤ<EFBFBD> */
|
||||
u16 tmemW; /* frame 1 <20>饤<EFBFBD><E9A5A4><EFBFBD><EFBFBD> TMEM <20><> Word <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
LoadBlock <20>λ<EFBFBD> GS_PIX2TMEM(imageW/4,imageSiz)
|
||||
LoadTile <20>λ<EFBFBD> GS_PIX2TMEM(frameW/4,imageSiz)+1 */
|
||||
u16 tmemH; /* <EFBFBD><EFBFBD><EFBFBD>٤˥<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɤǤ<EFBFBD><EFBFBD><EFBFBD> TMEM <20>⤵ (s13.2) 4<><34><EFBFBD><EFBFBD>
|
||||
<EFBFBD>̾<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD> 512/tmemW*4
|
||||
CI <20>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD> 256/tmemW*4 */
|
||||
u16 tmemLoadSH; /* SH <20><>
|
||||
LoadBlock <EFBFBD>λ<EFBFBD> tmemSize/2-1
|
||||
LoadTile <20>λ<EFBFBD> tmemW*16-1 */
|
||||
u16 tmemLoadTH; /* TH <20><> or Stride <EFBFBD><EFBFBD>
|
||||
LoadBlock <EFBFBD>λ<EFBFBD> GS_CALC_DXT(tmemW)
|
||||
LoadTile <20>λ<EFBFBD> tmemH-1 */
|
||||
u16 tmemSizeW; /* image 1 <20>饤<EFBFBD><E9A5A4>ʬ<EFBFBD><CAAC> imagePtr <20>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD>å<EFBFBD><C3A5><EFBFBD>
|
||||
LoadBlock <20>λ<EFBFBD> tmemW*2
|
||||
LoadTile <20>λ<EFBFBD> GS_PIX2TMEM(imageW/4,imageSiz)*2 */
|
||||
u16 tmemSize; /* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɰ<EFBFBD><EFBFBD><EFBFBD>ʬ<EFBFBD><EFBFBD> imagePtr <20>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD>å<EFBFBD><C3A5><EFBFBD>
|
||||
= tmemSizeW*tmemH */
|
||||
} uObjBg_t; /* 40 bytes */
|
||||
|
||||
/* Scalable background plane */
|
||||
typedef struct {
|
||||
u16 imageX; /* The x-coordinate of the upper-left position of the texture. (u11.5)*/
|
||||
u16 imageW; /* The width of the texture. (u10.2)*/
|
||||
s16 frameX; /* The upper-left position of the transferred frame. (s10.2)*/
|
||||
u16 frameW; /* The width of the transferred frame. (u10.2)*/
|
||||
u16 imageX; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> X <20><>ɸ (u10.5) */
|
||||
u16 imageW; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (u10.2) */
|
||||
s16 frameX; /* ž<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ե졼<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(s10.2) */
|
||||
u16 frameW; /* ž<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ե졼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (u10.2) */
|
||||
|
||||
u16 imageY; /* The y-coordinate of the upper-left position of the texture. (u11.5)*/
|
||||
u16 imageH; /* The height of the texture. (u10.2)*/
|
||||
s16 frameY; /* The upper-left position of the transferred frame. (s10.2)*/
|
||||
u16 frameH; /* The height of the transferred frame. (u10.2)*/
|
||||
u16 imageY; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Y <20><>ɸ (u10.5) */
|
||||
u16 imageH; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ι⤵ (u10.2) */
|
||||
s16 frameY; /* ž<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ե졼<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(s10.2) */
|
||||
u16 frameH; /* ž<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ե졼<EFBFBD><EFBFBD><EFBFBD>ι⤵ (u10.2) */
|
||||
|
||||
u64 *imagePtr; /* The texture source address on DRAM. */
|
||||
u16 imageLoad; /* Which to use, LoadBlock or LoadTile? */
|
||||
u8 imageFmt; /* The format of the texel. G_IM_FMT_* */
|
||||
u8 imageSiz; /* The size of the texel G_IM_SIZ_* */
|
||||
u16 imagePal; /* The pallet number. */
|
||||
u16 imageFlip; /* The right & left inversion of the image. Inverted by G_BG_FLAG_FLIPS*/
|
||||
u64 *imagePtr; /* DRAM <20><><EFBFBD>Υƥ<CEA5><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㥽<EFBFBD><E3A5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ쥹 */
|
||||
u16 imageLoad; /* LoadBlock, LoadTile <EFBFBD>Τɤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѥ<EFBFBD><EFBFBD>뤫 */
|
||||
u8 imageFmt; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υե<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޥå<EFBFBD> G_IM_FMT_* */
|
||||
u8 imageSiz; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> G_IM_SIZ_* */
|
||||
u16 imagePal; /* <EFBFBD>ѥ<EFBFBD><EFBFBD>å<EFBFBD><EFBFBD>ֹ<EFBFBD> */
|
||||
u16 imageFlip; /* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD>ȿž G_BG_FLAG_FLIPS <20><>ȿž */
|
||||
|
||||
u16 scaleW; /* The scale value of the X-direction. (u5.10)*/
|
||||
u16 scaleH; /* The scale value of the Y-direction. (u5.10)*/
|
||||
s32 imageYorig; /* The start point of drawing on the image. (s20.5)*/
|
||||
u16 scaleW; /* X <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (u5.10) */
|
||||
u16 scaleH; /* Y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (u5.10) */
|
||||
s32 imageYorig; /* image <20>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (s20.5) */
|
||||
|
||||
u8 padding[4];
|
||||
|
||||
@@ -112,24 +114,24 @@ typedef union {
|
||||
/*---------------------------------------------------------------------------*
|
||||
* 2D Objects
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define G_OBJ_FLAG_FLIPS 1<<0 /* The inversion to the S-direction. */
|
||||
#define G_OBJ_FLAG_FLIPT 1<<4 /* The inversion to the T-direction. */
|
||||
#define G_OBJ_FLAG_FLIPS 1<<0 /* S <20><><EFBFBD><EFBFBD>ȿž */
|
||||
#define G_OBJ_FLAG_FLIPT 1<<4 /* T <20><><EFBFBD><EFBFBD>ȿž */
|
||||
|
||||
typedef struct {
|
||||
s16 objX; /* The x-coordinate of the upper-left end. s10.2 OBJ */
|
||||
u16 scaleW; /* Scaling of the u5.10 width direction. */
|
||||
u16 imageW; /* The width of the u10.5 texture. (The length of the S-direction.) */
|
||||
u16 paddingX; /* Unused. Always 0. */
|
||||
s16 objY; /* The y-coordinate of the s10.2 OBJ upper-left end. */
|
||||
u16 scaleH; /* Scaling of the u5.10 height direction. */
|
||||
u16 imageH; /* The height of the u10.5 texture. (The length of the T-direction.)*/
|
||||
u16 paddingY; /* Unused. Always 0. */
|
||||
u16 imageStride; /* The folding width of the texel. (In units of 64bit word.) */
|
||||
u16 imageAdrs; /* The texture header position in TMEM. (In units of 64bit word.) */
|
||||
u8 imageFmt; /* The format of the texel. G_IM_FMT_* */
|
||||
u8 imageSiz; /* The size of the texel. G_IM_SIZ_* */
|
||||
u8 imagePal; /*The pallet number. 0-7 */
|
||||
u8 imageFlags; /* The display flag. G_OBJ_FLAG_FLIP* */
|
||||
s16 objX; /* s10.2 OBJ <20><><EFBFBD><EFBFBD>ü X <20><>ɸ */
|
||||
u16 scaleW; /* u5.10 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
u16 imageW; /* u10.5 <20>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (S <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9>) */
|
||||
u16 paddingX; /* ̤<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> 0 */
|
||||
s16 objY; /* s10.2 OBJ <20><><EFBFBD><EFBFBD>ü Y <20><>ɸ */
|
||||
u16 scaleH; /* u5.10 <20>⤵<EFBFBD><E2A4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
u16 imageH; /* u10.5 <20>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ι⤵ (T <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9>) */
|
||||
u16 paddingY; /* ̤<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> 0 */
|
||||
u16 imageStride; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD> (64bit word ñ<><C3B1>) */
|
||||
u16 imageAdrs; /* TMEM <20><><EFBFBD>Υƥ<CEA5><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD> (64bit word ñ<><C3B1>) */
|
||||
u8 imageFmt; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υե<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޥå<EFBFBD> G_IM_FMT_* */
|
||||
u8 imageSiz; /* <EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> G_IM_SIZ_* */
|
||||
u8 imagePal; /* <20>ѥ<EFBFBD><D1A5>å<EFBFBD><C3A5>ֹ<EFBFBD> 0-7 */
|
||||
u8 imageFlags; /* ɽ<EFBFBD><EFBFBD><EFBFBD>ե饰 G_OBJ_FLAG_FLIP* */
|
||||
} uObjSprite_t; /* 24 bytes */
|
||||
|
||||
typedef union {
|
||||
@@ -174,12 +176,12 @@ typedef union {
|
||||
#define GS_TB_TLINE(pix,siz) (GS_CALC_DXT(GS_PIX2TMEM((pix),(siz))))
|
||||
|
||||
typedef struct {
|
||||
u32 type; /* G_OBJLT_TXTRBLOCK divided into types. */
|
||||
u64 *image; /* The texture source address on DRAM. */
|
||||
u16 tmem; /* The transferred TMEM word address. (8byteWORD) */
|
||||
u16 tsize; /* The Texture size. Specified by the macro GS_TB_TSIZE(). */
|
||||
u16 tline; /* The width of the Texture 1-line. Specified by the macro GS_TB_TLINE()*/
|
||||
u16 sid; /* STATE ID Multipled by 4. Either one of 0,4,8 and 12. */
|
||||
u32 type; /* Type <20><><EFBFBD><EFBFBD> G_OBJLT_TXTRBLOCK */
|
||||
u64 *image; /* DRAM <20><><EFBFBD>Υƥ<CEA5><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㥽<EFBFBD><E3A5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ쥹 */
|
||||
u16 tmem; /* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TMEM <20><EFBFBD>ɥ<EFBFBD><C9A5>ɥ쥹 (8byteWORD) */
|
||||
u16 tsize; /* Texture <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ޥ<EFBFBD><DEA5><EFBFBD> GS_TB_TSIZE() <20>ǻ<EFBFBD><C7BB><EFBFBD> */
|
||||
u16 tline; /* Texture 1 <20>饤<EFBFBD><E9A5A4><EFBFBD><EFBFBD> <20>ޥ<EFBFBD><DEA5><EFBFBD> GS_TB_TLINE() <20>ǻ<EFBFBD><C7BB><EFBFBD> */
|
||||
u16 sid; /* STATE ID 4 <20><><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> 0,4,8,12 <20>Τɤ줫 */
|
||||
u32 flag; /* STATE flag */
|
||||
u32 mask; /* STATE mask */
|
||||
} uObjTxtrBlock_t; /* 24 bytes */
|
||||
@@ -188,12 +190,12 @@ typedef struct {
|
||||
#define GS_TT_THEIGHT(pix,siz) (((pix)<<2)-1)
|
||||
|
||||
typedef struct {
|
||||
u32 type; /* G_OBJLT_TXTRTILE divided into types. */
|
||||
u64 *image; /* The texture source address on DRAM. */
|
||||
u16 tmem; /* The loaded texture source address on DRAM. (8byteWORD) */
|
||||
u16 twidth; /* The width of the Texture. Specified by the macro GS_TT_TWIDTH() */
|
||||
u16 theight; /* The height of the Texture. Specified by the macro GS_TT_THEIGHT()*/
|
||||
u16 sid; /* STATE ID Multiplied by 4. Either one of 0,4,8 and 12. */
|
||||
u32 type; /* Type <20><><EFBFBD><EFBFBD> G_OBJLT_TXTRTILE */
|
||||
u64 *image; /* DRAM <20><><EFBFBD>Υƥ<CEA5><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㥽<EFBFBD><E3A5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ쥹 */
|
||||
u16 tmem; /* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TMEM <20><EFBFBD>ɥ<EFBFBD><C9A5>ɥ쥹 (8byteWORD) */
|
||||
u16 twidth; /* Texture <20><> <20>ޥ<EFBFBD><DEA5><EFBFBD> GS_TT_TWIDTH() <20>ǻ<EFBFBD><C7BB><EFBFBD> */
|
||||
u16 theight; /* Texture <20>⤵ <20>ޥ<EFBFBD><DEA5><EFBFBD> GS_TT_THEIGHT() <20>ǻ<EFBFBD><C7BB><EFBFBD> */
|
||||
u16 sid; /* STATE ID 4 <20><><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> 0,4,8,12 <20>Τɤ줫 */
|
||||
u32 flag; /* STATE flag */
|
||||
u32 mask; /* STATE mask */
|
||||
} uObjTxtrTile_t; /* 24 bytes */
|
||||
@@ -202,12 +204,12 @@ typedef struct {
|
||||
#define GS_PAL_NUM(num) ((num)-1)
|
||||
|
||||
typedef struct {
|
||||
u32 type; /* G_OBJLT_TLUT divided into types. */
|
||||
u64 *image; /* the texture source address on DRAM. */
|
||||
u16 phead; /* The pallet number of the load header. Between 256 and 511. */
|
||||
u16 pnum; /* The loading pallet number -1. */
|
||||
u16 zero; /* Assign 0 all the time. */
|
||||
u16 sid; /* STATE ID Multiplied by 4. Either one of 0,4,8 and 12. */
|
||||
u32 type; /* Type <20><><EFBFBD><EFBFBD> G_OBJLT_TLUT */
|
||||
u64 *image; /* DRAM <20><><EFBFBD>Υƥ<CEA5><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㥽<EFBFBD><E3A5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ쥹 */
|
||||
u16 phead; /* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD>Υѥ<EFBFBD><EFBFBD>å<EFBFBD><EFBFBD>ֹ<EFBFBD> 256 <EFBFBD>ʾ<EFBFBD> 511 <20>ʲ<EFBFBD> */
|
||||
u16 pnum; /* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѥ<EFBFBD><EFBFBD>åȿ<EFBFBD> - 1 */
|
||||
u16 zero; /* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
u16 sid; /* STATE ID 4 <20><><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> 0,4,8,12 <20>Τɤ줫 */
|
||||
u32 flag; /* STATE flag */
|
||||
u32 mask; /* STATE mask */
|
||||
} uObjTxtrTLUT_t; /* 24 bytes */
|
||||
@@ -231,6 +233,21 @@ typedef struct {
|
||||
* 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
|
||||
@@ -244,7 +261,7 @@ typedef struct {
|
||||
#define G_OBJ_LDTX_RECT 0xc3
|
||||
#define G_OBJ_LDTX_RECT_R 0xc4
|
||||
#define G_RDPHALF_0 0xe4
|
||||
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Background wrapped screen
|
||||
@@ -305,7 +322,7 @@ typedef struct {
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Set general status
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define G_MW_GENSTAT 0x08 /* Note that it is the same value of G_MW_FOG. */
|
||||
#define G_MW_GENSTAT 0x08 /* G_MW_FOG <20><>Ʊ<EFBFBD><C6B1><EFBFBD>ͤʤΤ<CAA4><CEA4><EFBFBD><EFBFBD><EFBFBD> */
|
||||
|
||||
#define gSPSetStatus(pkt, sid, val) \
|
||||
gMoveWd((pkt), G_MW_GENSTAT, (sid), (val))
|
||||
@@ -352,9 +369,21 @@ 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 *);
|
||||
extern void guS2DEmuSetScissor(u32, u32, u32, u32, u8);
|
||||
extern void guS2DEmuBgRect1Cyc(Gfx **, 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
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.14 $
|
||||
* $Date: 1997/02/11 08:22:47 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/gt.h,v $
|
||||
* $Revision: 1.16 $
|
||||
* $Date: 1998/05/28 00:14:50 $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/gt.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
@@ -55,6 +55,8 @@
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
* $Revision: 1.46 $
|
||||
* $Date: 1997/11/26 00:30:53 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/gu.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/gu.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*
|
||||
* $Revision: 1.173 $
|
||||
* $Date: 1997/12/01 12:42:21 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/libaudio.h,v $
|
||||
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/libaudio.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.135 $
|
||||
* $Date: 1997/11/26 00:30:54 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/mbi.h,v $
|
||||
* $Revision: 1.136 $
|
||||
* $Date: 1999/01/05 13:04:00 $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/mbi.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
@@ -79,6 +79,8 @@
|
||||
#define M_GFXTASK 1
|
||||
#define M_AUDTASK 2
|
||||
#define M_VIDTASK 3
|
||||
#define M_HVQTASK 6
|
||||
#define M_HVQMTASK 7
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
|
||||
410
include/PR/n_libaudio.h
Normal file
410
include/PR/n_libaudio.h
Normal file
@@ -0,0 +1,410 @@
|
||||
/*====================================================================
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#ifndef __N_LIBAUDIO__
|
||||
#define __N_LIBAUDIO__
|
||||
|
||||
#include <PR/libaudio.h>
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/mbi.h>
|
||||
|
||||
struct var8009c340 {
|
||||
u8 surround;
|
||||
u8 mono;
|
||||
u8 headphone;
|
||||
u8 unk03;
|
||||
};
|
||||
|
||||
extern struct var8009c340 var8009c340;
|
||||
extern u8 var8009c344[2];
|
||||
extern u8 var8009c346[2];
|
||||
extern u8 var8009c348[4];
|
||||
|
||||
/*
|
||||
* Synthesis driver stuff
|
||||
*/
|
||||
typedef struct N_ALVoice_s {
|
||||
ALLink node;
|
||||
struct N_PVoice_s *pvoice;
|
||||
ALWaveTable *table;
|
||||
void *clientPrivate;
|
||||
s16 state;
|
||||
s16 priority;
|
||||
s16 fxBus;
|
||||
s16 unityPitch;
|
||||
} N_ALVoice;
|
||||
|
||||
typedef struct {
|
||||
ALPlayer *head; /* client list head */
|
||||
ALLink pFreeList; /* list of free physical voices */
|
||||
ALLink pAllocList; /* list of allocated physical voices */
|
||||
ALLink pLameList; /* list of voices ready to be freed */
|
||||
s32 paramSamples;
|
||||
s32 curSamples; /* samples from start of game */
|
||||
ALDMANew dma;
|
||||
ALHeap *heap;
|
||||
struct ALParam_s *paramList;
|
||||
struct N_ALMainBus_s *mainBus;
|
||||
struct N_ALAuxBus_s *auxBus;
|
||||
s32 numPVoices;
|
||||
s32 maxAuxBusses;
|
||||
s32 outputRate;
|
||||
s32 maxOutSamples;
|
||||
s32 sv_dramout;
|
||||
s32 sv_first;
|
||||
} N_ALSynth;
|
||||
|
||||
|
||||
void n_alSynAddPlayer(ALPlayer *client);
|
||||
void n_alSynAddSndPlayer(ALPlayer *client);
|
||||
void n_alSynAddSeqPlayer(ALPlayer *client);
|
||||
|
||||
ALFxRef n_alSynAllocFX( s16 bus,ALSynConfig *c, ALHeap *hp);
|
||||
s32 n_alSynAllocVoice( N_ALVoice *voice, ALVoiceConfig *vc);
|
||||
|
||||
|
||||
void n_alSynFreeVoice(N_ALVoice *voice);
|
||||
ALFxRef n_alSynGetFXRef( s16 bus, s16 index);
|
||||
s16 n_alSynGetPriority( N_ALVoice *voice);
|
||||
void n_alSynRemovePlayer( ALPlayer *client);
|
||||
void n_alSynSetFXMix(N_ALVoice *v, u8 fxmix);
|
||||
void n_alSynSetFXParam(ALFxRef fx, s16 paramID, void *param);
|
||||
void n_alSynFreeFX(ALFxRef *fx);
|
||||
void n_alSynSetPan(N_ALVoice *v, u8 pan);
|
||||
void n_alSynSetPitch( N_ALVoice *v, f32 pitch);
|
||||
void n_alSynSetPriority( N_ALVoice *voice, s16 priority);
|
||||
void n_alSynSetVol( N_ALVoice *v, s16 volume, ALMicroTime t);
|
||||
void n_alSynStartVoice(N_ALVoice *v, ALWaveTable *table);
|
||||
void n_alSynStartVoiceParams(N_ALVoice *v, ALWaveTable *w,f32 pitch, s16 vol,
|
||||
ALPan pan, u8 fxmix, u8 arg6, f32 arg7, u8 arg8, ALMicroTime t);
|
||||
void n_alSynStopVoice( N_ALVoice *v);
|
||||
|
||||
void n_alSynFilter11(N_ALVoice *v, u8 channel);
|
||||
void n_alSynFilter12(N_ALVoice *v, u8 arg1);
|
||||
void n_alSynFilter13(N_ALVoice *v, f32 arg1);
|
||||
|
||||
void n_alSynNew(ALSynConfig *c);
|
||||
void n_alSynDelete(void);
|
||||
|
||||
|
||||
/*
|
||||
* Audio Library (AL) stuff
|
||||
*/
|
||||
typedef struct {
|
||||
N_ALSynth drvr;
|
||||
} N_ALGlobals;
|
||||
|
||||
extern N_ALGlobals *n_alGlobals;
|
||||
extern N_ALSynth *n_syn;
|
||||
|
||||
void n_alInit(N_ALGlobals *g, ALSynConfig *c);
|
||||
void n_alClose(N_ALGlobals *glob);
|
||||
Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen,
|
||||
s16 *outBuf, s32 outLen);
|
||||
|
||||
|
||||
/*
|
||||
* Sequence Player stuff
|
||||
*/
|
||||
typedef struct {
|
||||
struct N_ALVoice_s *voice;
|
||||
} N_ALNoteEvent;
|
||||
|
||||
|
||||
typedef struct {
|
||||
struct N_ALVoice_s *voice;
|
||||
ALMicroTime delta;
|
||||
u8 vol;
|
||||
} N_ALVolumeEvent;
|
||||
|
||||
|
||||
typedef struct {
|
||||
struct N_ALVoiceState_s *vs;
|
||||
void *oscState;
|
||||
u8 chan;
|
||||
} N_ALOscEvent;
|
||||
|
||||
typedef struct {
|
||||
f32 unk00;
|
||||
f32 unk04;
|
||||
} N_AL18Event;
|
||||
|
||||
typedef struct {
|
||||
u8 unk00;
|
||||
u8 unk01;
|
||||
u8 unk02;
|
||||
u8 unk03;
|
||||
u8 param;
|
||||
} N_AL19Event;
|
||||
|
||||
typedef struct {
|
||||
struct sndstate *sndstate;
|
||||
s32 data;
|
||||
s32 data2;
|
||||
} N_ALGenericEvent;
|
||||
|
||||
typedef struct {
|
||||
s16 type;
|
||||
union {
|
||||
ALMIDIEvent midi;
|
||||
ALTempoEvent tempo;
|
||||
ALEndEvent end;
|
||||
N_ALNoteEvent note;
|
||||
N_ALVolumeEvent vol;
|
||||
ALSeqpLoopEvent loop;
|
||||
ALSeqpVolEvent spvol;
|
||||
ALSeqpPriorityEvent sppriority;
|
||||
ALSeqpSeqEvent spseq;
|
||||
ALSeqpBankEvent spbank;
|
||||
N_ALOscEvent osc;
|
||||
N_AL18Event evt18;
|
||||
N_AL19Event evt19;
|
||||
N_ALGenericEvent generic;
|
||||
} msg;
|
||||
} N_ALEvent;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ALLink node;
|
||||
ALMicroTime delta;
|
||||
N_ALEvent evt;
|
||||
} N_ALEventListItem;
|
||||
|
||||
void n_alEvtqNew(ALEventQueue *evtq, N_ALEventListItem *items, s32 itemCount);
|
||||
ALMicroTime n_alEvtqNextEvent(ALEventQueue *evtq, N_ALEvent *evt);
|
||||
void n_alEvtqPostEvent(ALEventQueue *evtq, N_ALEvent *evt, ALMicroTime delta, s32 arg3);
|
||||
void n_alEvtqFlushType(ALEventQueue *evtq, s16 type);
|
||||
|
||||
struct oscstate {
|
||||
u32 unk00;
|
||||
u8 unk04;
|
||||
u32 unk08;
|
||||
f32 unk0c;
|
||||
f32 unk10;
|
||||
};
|
||||
|
||||
struct fx {
|
||||
s16 unk00;
|
||||
s16 unk02;
|
||||
s32 unk04;
|
||||
s16 unk08[8];
|
||||
};
|
||||
|
||||
typedef struct N_ALVoiceState_s {
|
||||
struct N_ALVoiceState_s *next;/* MUST be first */
|
||||
N_ALVoice voice;
|
||||
ALSound *sound;
|
||||
ALMicroTime envEndTime; /* time of envelope segment end */
|
||||
f32 pitch; /* currect pitch ratio */
|
||||
f32 vibrato; /* current value of the vibrato */
|
||||
u8 envGain; /* current envelope gain */
|
||||
u8 channel; /* channel assignment */
|
||||
u8 key; /* note on key number */
|
||||
u8 velocity; /* note on velocity */
|
||||
u8 envPhase; /* what envelope phase */
|
||||
u8 phase;
|
||||
u8 tremelo; /* current value of the tremelo */
|
||||
u8 flags; /* bit 0 tremelo flag
|
||||
bit 1 vibrato flag */
|
||||
void *oscState;
|
||||
struct oscstate *oscState2;
|
||||
} N_ALVoiceState;
|
||||
|
||||
typedef struct {
|
||||
ALPlayer node; /* note: must be first in structure */
|
||||
N_ALSynth *drvr; /* reference to the client driver */
|
||||
ALSeq *target; /* current sequence */
|
||||
ALMicroTime curTime;
|
||||
ALBank *bank; /* current ALBank */
|
||||
s32 uspt; /* microseconds per tick */
|
||||
s32 nextDelta; /* microseconds to next callback */
|
||||
s32 state;
|
||||
u16 chanMask; /* active channels */
|
||||
s16 vol; /* overall sequence volume */
|
||||
u8 maxChannels; /* number of MIDI channels */
|
||||
u8 debugFlags; /* control which error get reported */
|
||||
N_ALEvent nextEvent;
|
||||
ALEventQueue evtq;
|
||||
ALMicroTime frameTime;
|
||||
ALChanState *chanState; /* 16 channels for MIDI */
|
||||
N_ALVoiceState *vAllocHead; /* list head for allocated voices */
|
||||
N_ALVoiceState *vAllocTail; /* list tail for allocated voices */
|
||||
N_ALVoiceState *vFreeList; /* list of free voice state structs */
|
||||
ALOscInit initOsc;
|
||||
ALOscUpdate updateOsc;
|
||||
ALOscStop stopOsc;
|
||||
ALSeqMarker *loopStart;
|
||||
ALSeqMarker *loopEnd;
|
||||
s32 loopCount; /* -1 = loop forever, 0 = no loop */
|
||||
u8 unk88;
|
||||
u8 unk89;
|
||||
} N_ALSeqPlayer;
|
||||
|
||||
typedef struct {
|
||||
ALPlayer node; /* note: must be first in structure */
|
||||
N_ALSynth *drvr; /* reference to the client driver */
|
||||
ALCSeq *target; /* current sequence */
|
||||
ALMicroTime curTime;
|
||||
ALBank *bank; /* current ALBank */
|
||||
s32 uspt; /* microseconds per tick */
|
||||
s32 nextDelta; /* microseconds to next callback */
|
||||
s32 state;
|
||||
u16 chanMask; /* active channels */
|
||||
s16 vol; /* overall sequence volume */
|
||||
u8 maxChannels; /* number of MIDI channels */
|
||||
u8 debugFlags; /* control which error get reported */
|
||||
N_ALEvent nextEvent;
|
||||
ALEventQueue evtq;
|
||||
ALMicroTime frameTime;
|
||||
ALChanState *chanState; /* 16 channels for MIDI */
|
||||
N_ALVoiceState *vAllocHead; /* list head for allocated voices */
|
||||
N_ALVoiceState *vAllocTail; /* list tail for allocated voices */
|
||||
N_ALVoiceState *vFreeList; /* list of free voice state structs */
|
||||
ALOscInit initOsc;
|
||||
ALOscUpdate updateOsc;
|
||||
ALOscStop stopOsc;
|
||||
f32 unk7c;
|
||||
f32 unk80;
|
||||
void *queue;
|
||||
u8 unk88;
|
||||
u8 unk89;
|
||||
} N_ALCSPlayer;
|
||||
|
||||
|
||||
/*
|
||||
* Sequence data representation routines
|
||||
*/
|
||||
void n_alSeqNextEvent(ALSeq *seq, N_ALEvent *event);
|
||||
void n_alSeqNewMarker(ALSeq *seq, ALSeqMarker *m, u32 ticks);
|
||||
|
||||
void n_alCSeqNew(ALCSeq *seq, u8 *ptr);
|
||||
void n_alCSeqNextEvent(ALCSeq *seq, N_ALEvent *evt, s32 arg2);
|
||||
void n_alCSeqNewMarker(ALCSeq *seq, ALCSeqMarker *m, u32 ticks);
|
||||
|
||||
|
||||
/*
|
||||
* Sequence Player routines
|
||||
*/
|
||||
void n_alSeqpNew(N_ALSeqPlayer *seqp, ALSeqpConfig *config);
|
||||
void n_alSeqpDelete(N_ALSeqPlayer *seqp);
|
||||
u8 n_alSeqpGetChlVol(N_ALSeqPlayer *seqp, u8 chan);
|
||||
u8 n_alSeqpGetChlFXMix(N_ALSeqPlayer *seqp, u8 chan);
|
||||
ALPan n_alSeqpGetChlPan(N_ALSeqPlayer *seqp, u8 chan);
|
||||
u8 n_alSeqpGetChlPriority(N_ALSeqPlayer *seqp, u8 chan);
|
||||
s32 n_alSeqpGetChlProgram(N_ALSeqPlayer *seqp, u8 chan);
|
||||
ALSeq *n_alSeqpGetSeq(N_ALSeqPlayer *seqp);
|
||||
s32 n_alSeqpGetState(N_ALSeqPlayer *seqp);
|
||||
s32 n_alSeqpGetTempo(N_ALSeqPlayer *seqp);
|
||||
s16 n_alSeqpGetVol(N_ALSeqPlayer *seqp); /* Master volume control */
|
||||
void n_alSeqpPlay(N_ALSeqPlayer *seqp);
|
||||
void n_alSeqpSendMidi(N_ALSeqPlayer *seqp, s32 ticks, u8 status, u8 byte1, u8 byte2);
|
||||
void n_alSeqpSetBank(N_ALSeqPlayer *seqp, ALBank *b);
|
||||
void n_alSeqpSetChlVol(N_ALSeqPlayer *seqp, u8 chan, u8 vol);
|
||||
void n_alSeqpSetChlFXMix(N_ALSeqPlayer *seqp, u8 chan, u8 fxmix);
|
||||
void n_alSeqpSetChlPan(N_ALSeqPlayer *seqp, u8 chan, ALPan pan);
|
||||
void n_alSeqpSetChlPriority(N_ALSeqPlayer *seqp, u8 chan, u8 priority);
|
||||
void n_alSeqpSetChlProgram(N_ALSeqPlayer *seqp, u8 chan, u8 prog);
|
||||
void n_alSeqpSetSeq(N_ALSeqPlayer *seqp, ALSeq *seq);
|
||||
void n_alSeqpSetTempo(N_ALSeqPlayer *seqp, s32 tempo);
|
||||
void n_alSeqpSetVol(N_ALSeqPlayer *seqp, s16 vol);
|
||||
void n_alSeqpStop(N_ALSeqPlayer *seqp);
|
||||
void n_alSeqpLoop(N_ALSeqPlayer *seqp, ALSeqMarker *start, ALSeqMarker *end, s32 count);
|
||||
void n_alSeqpSetFilter11(N_ALSeqPlayer *seqp);
|
||||
|
||||
|
||||
/*
|
||||
* Compressed Sequence Player routines
|
||||
*/
|
||||
void n_alCSPNew(N_ALCSPlayer *seqp, ALSeqpConfig *config);
|
||||
void n_alCSPDelete(N_ALCSPlayer *seqp);
|
||||
u8 n_alCSPGetChlVol(N_ALCSPlayer *seqp, u8 chan);
|
||||
u8 n_alCSPGetChlFXMix(N_ALCSPlayer *seqp, u8 chan);
|
||||
ALPan n_alCSPGetChlPan(N_ALCSPlayer *seqp, u8 chan);
|
||||
u8 n_alCSPGetChlPriority(N_ALCSPlayer *seqp, u8 chan);
|
||||
s32 n_alCSPGetChlProgram(N_ALCSPlayer *seqp, u8 chan);
|
||||
ALCSeq *n_alCSPGetSeq(N_ALCSPlayer *seqp);
|
||||
s32 n_alCSPGetState(N_ALCSPlayer *seqp);
|
||||
s32 n_alCSPGetTempo(N_ALCSPlayer *seqp);
|
||||
s16 n_alCSPGetVol(N_ALCSPlayer *seqp);
|
||||
void n_alCSPPlay(N_ALCSPlayer *seqp);
|
||||
void n_alCSPSendMidi(N_ALCSPlayer *seqp, s32 ticks, u8 status, u8 byte1, u8 byte2);
|
||||
void n_alCSPSetBank(N_ALCSPlayer *seqp, ALBank *b);
|
||||
void n_alCSPSetChlVol(N_ALCSPlayer *seqp, u8 chan, u8 vol);
|
||||
void n_alCSPSetChlFXMix(N_ALCSPlayer *seqp, u8 chan, u8 fxmix);
|
||||
void n_alCSPSetChlPan(N_ALCSPlayer *seqp, u8 chan, ALPan pan);
|
||||
void n_alCSPSetChlPriority(N_ALCSPlayer *seqp, u8 chan, u8 priority);
|
||||
void n_alCSPSetChlProgram(N_ALCSPlayer *seqp, u8 chan, u8 prog);
|
||||
void n_alCSPSetSeq(N_ALCSPlayer *seqp, ALCSeq *seq);
|
||||
void n_alCSPSetTempo(N_ALCSPlayer *seqp, s32 tempo);
|
||||
void n_alCSPSetVol(N_ALCSPlayer *seqp, s16 vol);
|
||||
void n_alCSPStop(N_ALCSPlayer *seqp);
|
||||
|
||||
|
||||
/*
|
||||
* Sound Player stuff
|
||||
*/
|
||||
typedef struct {
|
||||
ALPlayer node; /* note: must be first in structure */
|
||||
ALEventQueue evtq;
|
||||
N_ALEvent nextEvent;
|
||||
N_ALSynth *drvr; /* reference to the client driver */
|
||||
struct sndstate *target;
|
||||
void *sndState;
|
||||
s32 maxSounds;
|
||||
ALMicroTime frameTime;
|
||||
ALMicroTime nextDelta; /* microseconds to next callback */
|
||||
ALMicroTime curTime;
|
||||
} N_ALSndPlayer;
|
||||
|
||||
void n_alSndpNew(ALSndpConfig *c);
|
||||
void n_alSndpDelete(void);
|
||||
ALSndId n_alSndpAllocate(ALSound *sound);
|
||||
void n_alSndpDeallocate(ALSndId id);
|
||||
s32 n_alSndpGetState(void);
|
||||
void n_alSndpPlay(void);
|
||||
void n_alSndpPlayAt(ALMicroTime delta);
|
||||
void n_alSndpSetFXMix(u8 mix);
|
||||
void n_alSndpSetPan(ALPan pan);
|
||||
void n_alSndpSetPitch(f32 pitch);
|
||||
void n_alSndpSetPriority(ALSndId id, u8 priority);
|
||||
void n_alSndpSetVol(s16 vol);
|
||||
void n_alSndpStop(void);
|
||||
ALSndId n_alSndpGetSound(void);
|
||||
void n_alSndpSetSound(ALSndId id);
|
||||
|
||||
|
||||
/*
|
||||
* for n_audio micro code
|
||||
*/
|
||||
extern long long int n_aspMainTextStart[], n_aspMainTextEnd[];
|
||||
extern long long int n_aspMainDataStart[], n_aspMainDataEnd[];
|
||||
|
||||
f32 func0003b9d4(s32 arg0);
|
||||
void func0003ba64(struct fx *fx, f32 outputrate);
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __N_LIBAUDIO__ */
|
||||
120
include/PR/n_libaudio_s_to_n.h
Normal file
120
include/PR/n_libaudio_s_to_n.h
Normal file
@@ -0,0 +1,120 @@
|
||||
#define ALVoice N_ALVoice
|
||||
#define ALSynth N_ALSynth
|
||||
#define ALGlobals N_ALGlobals
|
||||
|
||||
#define alSynAddPlayer( a, b) n_alSynAddPlayer( b)
|
||||
#define alSynAllocFX( a, b, c, d) n_alSynAllocFX( b, c, d)
|
||||
#define alSynAllocVoice( a, b, c) n_alSynAllocVoice( b, c)
|
||||
#define alSynDelete( a) n_alSynDelete()
|
||||
#define alSynFreeVoice( a, b) n_alSynFreeVoice( b)
|
||||
#define alSynGetFXRef( a, b, c) n_alSynGetFXRef( b, c)
|
||||
#define alSynGetPriority( a, b) n_alSynGetPriority( b)
|
||||
#define alSynRemovePlayer( a, b) n_alSynRemovePlayer( b)
|
||||
#define alSynSetFXMix( a, b, c) n_alSynSetFXMix( b, c)
|
||||
#define alSynSetFXParam( a, b, c, d) n_alSynSetFXParam( b, c, d)
|
||||
#define alSynFreeFX( a, b) n_alSynFreeFX( b)
|
||||
#define alSynSetPan( a, b, c) n_alSynSetPan( b, c)
|
||||
#define alSynSetPitch( a, b, c) n_alSynSetPitch( b, c)
|
||||
#define alSynSetPriority( a, b, c) n_alSynSetPriority( b, c)
|
||||
#define alSynSetVol( a, b, c, d) n_alSynSetVol( b, c, d)
|
||||
#define alSynStartVoice( a, b, c) n_alSynStartVoice( b, c)
|
||||
#define alSynStartVoiceParams( a, b, c, d, e, f, g, h) \
|
||||
n_alSynStartVoiceParams( b, c, d, e, f, g, h)
|
||||
#define alSynStopVoice( a, b) n_alSynStopVoice( b)
|
||||
#define alSynNew( a, b) n_alSynNew( b)
|
||||
|
||||
#define alInit n_alInit
|
||||
#define alClose n_alClose
|
||||
#define alAudioFrame n_alAudioFrame
|
||||
|
||||
#define ALVoiceState N_ALVoiceState
|
||||
#define ALSeqPlayer N_ALSeqPlayer
|
||||
#define ALCSPlayer N_ALCSPlayer
|
||||
|
||||
#define alSeqNextEvent n_alSeqNextEvent
|
||||
#define alSeqNewMarker n_alSeqNewMarker
|
||||
|
||||
#define alCSeqNew n_alCSeqNew
|
||||
#define alCSeqNextEvent n_alCSeqNextEvent
|
||||
#define alCSeqNewMarker n_alCSeqNewMarker
|
||||
|
||||
#define alSeqpNew n_alSeqpNew
|
||||
#define alSeqpDelete n_alSeqpDelete
|
||||
#define alSeqpGetChlVol n_alSeqpGetChlVol
|
||||
#define alSeqpGetChlFXMix n_alSeqpGetChlFXMix
|
||||
#define alSeqpGetChlPan n_alSeqpGetChlPan
|
||||
#define alSeqpGetChlPriority n_alSeqpGetChlPriority
|
||||
#define alSeqpGetChlProgram n_alSeqpGetChlProgram
|
||||
#define alSeqpGetSeq n_alSeqpGetSeq
|
||||
#define alSeqpGetState n_alSeqpGetState
|
||||
#define alSeqpGetTempo n_alSeqpGetTempo
|
||||
#define alSeqpGetVol n_alSeqpGetVol
|
||||
#define alSeqpPlay n_alSeqpPlay
|
||||
#define alSeqpSendMidi n_alSeqpSendMidi
|
||||
#define alSeqpSetBank n_alSeqpSetBank
|
||||
#define alSeqpSetChlVol n_alSeqpSetChlVol
|
||||
#define alSeqpSetChlFXMix n_alSeqpSetChlFXMix
|
||||
#define alSeqpSetChlPan n_alSeqpSetChlPan
|
||||
#define alSeqpSetChlPriority n_alSeqpSetChlPriority
|
||||
#define alSeqpSetChlProgram n_alSeqpSetChlProgram
|
||||
#define alSeqpSetSeq n_alSeqpSetSeq
|
||||
#define alSeqpSetTempo n_alSeqpSetTempo
|
||||
#define alSeqpSetVol n_alSeqpSetVol
|
||||
#define alSeqpStop n_alSeqpStop
|
||||
#define alSeqpLoop n_alSeqpLoop
|
||||
|
||||
#define alCSPNew n_alCSPNew
|
||||
#define alCSPDelete n_alCSPDelete
|
||||
#define alCSPGetChlVol n_alCSPGetChlVol
|
||||
#define alCSPGetChlFXMix n_alCSPGetChlFXMix
|
||||
#define alCSPGetChlPan n_alCSPGetChlPan
|
||||
#define alCSPGetChlPriority n_alCSPGetChlPriority
|
||||
#define alCSPGetChlProgram n_alCSPGetChlProgram
|
||||
#define alCSPGetSeq n_alCSPGetSeq
|
||||
#define alCSPGetState n_alCSPGetState
|
||||
#define alCSPGetTempo n_alCSPGetTempo
|
||||
#define alCSPGetVol n_alCSPGetVol
|
||||
#define alCSPPlay n_alCSPPlay
|
||||
#define alCSPSendMidi n_alCSPSendMidi
|
||||
#define alCSPSetBank n_alCSPSetBank
|
||||
#define alCSPSetChlVol n_alCSPSetChlVol
|
||||
#define alCSPSetChlFXMix n_alCSPSetChlFXMix
|
||||
#define alCSPSetChlPan n_alCSPSetChlPan
|
||||
#define alCSPSetChlPriority n_alCSPSetChlPriority
|
||||
#define alCSPSetChlProgram n_alCSPSetChlProgram
|
||||
#define alCSPSetSeq n_alCSPSetSeq
|
||||
#define alCSPSetTempo n_alCSPSetTempo
|
||||
#define alCSPSetVol n_alCSPSetVol
|
||||
#define alCSPStop n_alCSPStop
|
||||
|
||||
#define ALSoundState N_ALSoundState
|
||||
#define ALSndpEvent N_ALSndpEvent
|
||||
#define ALSndPlayer N_ALSndPlayer
|
||||
|
||||
#define alSndpNew( a, b) n_alSndpNew( a, b)
|
||||
#define alSndpDelete( a) n_alSndpDelete()
|
||||
#define alSndpAllocate( a, b) n_alSndpAllocate( b)
|
||||
#define alSndpDeallocate( a, b) n_alSndpDeallocate( b)
|
||||
#define alSndpGetState( a) n_alSndpGetState()
|
||||
#define alSndpPlay( a) n_alSndpPlay()
|
||||
#define alSndpPlayAt( a, b) n_alSndpPlayAt( b)
|
||||
#define alSndpSetFXMix( a, b) n_alSndpSetFXMix( b)
|
||||
#define alSndpSetPan( a, b) n_alSndpSetPan( b)
|
||||
#define alSndpSetPitch( a, b) n_alSndpSetPitch( b)
|
||||
#define alSndpSetPriority( a, b, c) n_alSndpSetPriority( b, c)
|
||||
#define alSndpSetVol( a, b) n_alSndpSetVol( b)
|
||||
#define alSndpStop( a) n_alSndpStop()
|
||||
#define alSndpGetSound( a) n_alSndpGetSound()
|
||||
#define alSndpSetSound( a, b) n_alSndpSetSound( b)
|
||||
|
||||
#define alEvtqNew n_alEvtqNew
|
||||
#define alEvtqNextEvent n_alEvtqNextEvent
|
||||
#define alEvtqPostEvent n_alEvtqPostEvent
|
||||
#define alEvtqFlushType n_alEvtqFlushType
|
||||
#define alEvtqPrintEvtQueue n_alEvtqPrintEvtQueue
|
||||
#define alEvtqPrintAllocEvts n_alEvtqPrintAllocEvts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
963
include/PR/os.h
963
include/PR/os.h
File diff suppressed because it is too large
Load Diff
92
include/PR/os_ai.h
Normal file
92
include/PR/os_ai.h
Normal file
@@ -0,0 +1,92 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_ai.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_ai.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:04 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_AI_H_
|
||||
#define _OS_AI_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Audio interface (Ai) */
|
||||
extern u32 osAiGetStatus(void);
|
||||
extern u32 osAiGetLength(void);
|
||||
extern s32 osAiSetFrequency(u32);
|
||||
extern s32 osAiSetNextBuffer(void *, u32);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_AI_H_ */
|
||||
96
include/PR/os_cache.h
Normal file
96
include/PR/os_cache.h
Normal file
@@ -0,0 +1,96 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_cache.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_cache.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:04 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_CACHE_H_
|
||||
#define _OS_CACHE_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#define OS_DCACHE_ROUNDUP_ADDR(x) (void *)(((((u32)(x)+0xf)/0x10)*0x10))
|
||||
#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x)+0xf)/0x10)*0x10))
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Cache operations and macros */
|
||||
|
||||
extern void osInvalDCache(void *, s32);
|
||||
extern void osInvalICache(void *, s32);
|
||||
extern void osWritebackDCache(void *, s32);
|
||||
extern void osWritebackDCacheAll(void);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_CACHE_H_ */
|
||||
207
include/PR/os_cont.h
Normal file
207
include/PR/os_cont.h
Normal file
@@ -0,0 +1,207 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_cont.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_cont.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:05 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_CONT_H_
|
||||
#define _OS_CONT_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_message.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure for controllers
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u16 type; /* Controller Type */
|
||||
u8 status; /* Controller status */
|
||||
u8 errno;
|
||||
}OSContStatus;
|
||||
|
||||
typedef struct {
|
||||
u16 button;
|
||||
s8 stick_x; /* -80 <= stick_x <= 80 */
|
||||
s8 stick_y; /* -80 <= stick_y <= 80 */
|
||||
u8 errno;
|
||||
} OSContPad;
|
||||
|
||||
typedef struct {
|
||||
void *address; /* Ram pad Address: 11 bits */
|
||||
u8 databuffer[32]; /* address of the data buffer */
|
||||
u8 addressCrc; /* CRC code for address */
|
||||
u8 dataCrc; /* CRC code for data */
|
||||
u8 errno;
|
||||
} OSContRamIo;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Controllers number
|
||||
*/
|
||||
|
||||
#ifndef _HW_VERSION_1
|
||||
#define MAXCONTROLLERS 4
|
||||
#else
|
||||
#define MAXCONTROLLERS 6
|
||||
#endif
|
||||
|
||||
/* controller errors */
|
||||
#define CONT_NO_RESPONSE_ERROR 0x8
|
||||
#define CONT_OVERRUN_ERROR 0x4
|
||||
#ifdef _HW_VERSION_1
|
||||
#define CONT_FRAME_ERROR 0x2
|
||||
#define CONT_COLLISION_ERROR 0x1
|
||||
#endif
|
||||
|
||||
/* Controller type */
|
||||
|
||||
#define CONT_ABSOLUTE 0x0001
|
||||
#define CONT_RELATIVE 0x0002
|
||||
#define CONT_JOYPORT 0x0004
|
||||
#define CONT_EEPROM 0x8000
|
||||
#define CONT_EEP16K 0x4000
|
||||
#define CONT_TYPE_MASK 0x1f07
|
||||
#define CONT_TYPE_NORMAL 0x0005
|
||||
#define CONT_TYPE_MOUSE 0x0002
|
||||
#define CONT_TYPE_VOICE 0x0100
|
||||
|
||||
/* Controller status */
|
||||
|
||||
#define CONT_CARD_ON 0x01
|
||||
#define CONT_CARD_PULL 0x02
|
||||
#define CONT_ADDR_CRC_ER 0x04
|
||||
#define CONT_EEPROM_BUSY 0x80
|
||||
|
||||
/* Buttons */
|
||||
|
||||
#define CONT_A 0x8000
|
||||
#define CONT_B 0x4000
|
||||
#define CONT_G 0x2000
|
||||
#define CONT_START 0x1000
|
||||
#define CONT_UP 0x0800
|
||||
#define CONT_DOWN 0x0400
|
||||
#define CONT_LEFT 0x0200
|
||||
#define CONT_RIGHT 0x0100
|
||||
#define CONT_L 0x0020
|
||||
#define CONT_R 0x0010
|
||||
#define CONT_E 0x0008
|
||||
#define CONT_D 0x0004
|
||||
#define CONT_C 0x0002
|
||||
#define CONT_F 0x0001
|
||||
|
||||
/* Nintendo's official button names */
|
||||
|
||||
#define A_BUTTON CONT_A
|
||||
#define B_BUTTON CONT_B
|
||||
#define L_TRIG CONT_L
|
||||
#define R_TRIG CONT_R
|
||||
#define Z_TRIG CONT_G
|
||||
#define START_BUTTON CONT_START
|
||||
#define U_JPAD CONT_UP
|
||||
#define L_JPAD CONT_LEFT
|
||||
#define R_JPAD CONT_RIGHT
|
||||
#define D_JPAD CONT_DOWN
|
||||
#define U_CBUTTONS CONT_E
|
||||
#define L_CBUTTONS CONT_C
|
||||
#define R_CBUTTONS CONT_F
|
||||
#define D_CBUTTONS CONT_D
|
||||
|
||||
/* Controller error number */
|
||||
|
||||
#define CONT_ERR_NO_CONTROLLER PFS_ERR_NOPACK /* 1 */
|
||||
#define CONT_ERR_CONTRFAIL CONT_OVERRUN_ERROR /* 4 */
|
||||
#define CONT_ERR_INVALID PFS_ERR_INVALID /* 5 */
|
||||
#define CONT_ERR_DEVICE PFS_ERR_DEVICE /* 11 */
|
||||
#define CONT_ERR_NOT_READY 12
|
||||
#define CONT_ERR_VOICE_MEMORY 13
|
||||
#define CONT_ERR_VOICE_WORD 14
|
||||
#define CONT_ERR_VOICE_NO_RESPONSE 15
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Controller interface */
|
||||
|
||||
extern s32 osContInit(OSMesgQueue *, u8 *, OSContStatus *);
|
||||
extern s32 osContReset(OSMesgQueue *, OSContStatus *);
|
||||
extern s32 osContStartQuery(OSMesgQueue *);
|
||||
extern s32 osContStartReadData(OSMesgQueue *);
|
||||
#ifndef _HW_VERSION_1
|
||||
extern s32 osContSetCh(u8);
|
||||
#endif
|
||||
extern void osContGetQuery(OSContStatus *);
|
||||
extern void osContGetReadData(OSContPad *);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_CONT_H_ */
|
||||
105
include/PR/os_convert.h
Normal file
105
include/PR/os_convert.h
Normal file
@@ -0,0 +1,105 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_convert.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_convert.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:05 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_CONVERT_H_
|
||||
#define _OS_CONVERT_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#define OS_CLOCK_RATE 62500000LL
|
||||
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#define OS_NSEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625000LL))/(1000000000LL/15625000LL))
|
||||
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL))
|
||||
#define OS_CYCLES_TO_NSEC(c) (((u64)(c)*(1000000000LL/15625000LL))/(OS_CPU_COUNTER/15625000LL))
|
||||
#define OS_CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL/15625LL))/(OS_CPU_COUNTER/15625LL))
|
||||
|
||||
#define OS_K0_TO_PHYSICAL(x) (u32)(((char *)(x)-0x80000000))
|
||||
#define OS_K1_TO_PHYSICAL(x) (u32)(((char *)(x)-0xa0000000))
|
||||
|
||||
#define OS_PHYSICAL_TO_K0(x) (void *)(((u32)(x)+0x80000000))
|
||||
#define OS_PHYSICAL_TO_K1(x) (void *)(((u32)(x)+0xa0000000))
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Address translation routines and macros */
|
||||
|
||||
extern u32 osVirtualToPhysical(void *);
|
||||
extern void * osPhysicalToVirtual(u32);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_CONVERT_H_ */
|
||||
108
include/PR/os_debug.h
Normal file
108
include/PR/os_debug.h
Normal file
@@ -0,0 +1,108 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_debug.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_debug.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:06 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_DEBUG_H_
|
||||
#define _OS_DEBUG_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure for Profiler
|
||||
*/
|
||||
typedef struct {
|
||||
u16 *histo_base; /* histogram base */
|
||||
u32 histo_size; /* histogram size */
|
||||
u32 *text_start; /* start of text segment */
|
||||
u32 *text_end; /* end of text segment */
|
||||
} OSProf;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Profiler constants
|
||||
*/
|
||||
#define PROF_MIN_INTERVAL 50 /* microseconds */
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Profiler Interface */
|
||||
|
||||
extern void osProfileInit(OSProf *, u32 profcnt);
|
||||
extern void osProfileStart(u32);
|
||||
extern void osProfileFlush(void);
|
||||
extern void osProfileStop(void);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_DEBUG_H_ */
|
||||
107
include/PR/os_eeprom.h
Normal file
107
include/PR/os_eeprom.h
Normal file
@@ -0,0 +1,107 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_eeprom.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_eeprom.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:06 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_EEPROM_H_
|
||||
#define _OS_EEPROM_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_message.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* EEPROM TYPE */
|
||||
|
||||
#define EEPROM_TYPE_4K 0x01
|
||||
#define EEPROM_TYPE_16K 0x02
|
||||
|
||||
/* definition for EEPROM */
|
||||
|
||||
#define EEPROM_MAXBLOCKS 64
|
||||
#define EEP16K_MAXBLOCKS 256
|
||||
#define EEPROM_BLOCK_SIZE 8
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* EEPROM interface */
|
||||
|
||||
extern s32 osEepromProbe(OSMesgQueue *);
|
||||
extern s32 osEepromRead(OSMesgQueue *, u8, u8 *);
|
||||
extern s32 osEepromWrite(OSMesgQueue *, u8, u8 *);
|
||||
extern s32 osEepromLongRead(OSMesgQueue *, u8, u8 *, int);
|
||||
extern s32 osEepromLongWrite(OSMesgQueue *, u8, u8 *, int);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_EEPROM_H_ */
|
||||
86
include/PR/os_error.h
Normal file
86
include/PR/os_error.h
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_error.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_error.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:06 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_ERROR_H_
|
||||
#define _OS_ERROR_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_ERROR_H_ */
|
||||
86
include/PR/os_exception.h
Normal file
86
include/PR/os_exception.h
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_exception.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_exception.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:07 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_EXCEPTION_H_
|
||||
#define _OS_EXCEPTION_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ultratypes.h"
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
typedef u32 OSIntMask;
|
||||
typedef u32 OSHWIntr;
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/* Flags for debugging purpose */
|
||||
|
||||
#define OS_FLAG_CPU_BREAK 1 /* Break exception has occurred */
|
||||
#define OS_FLAG_FAULT 2 /* CPU fault has occurred */
|
||||
|
||||
/* Interrupt masks */
|
||||
|
||||
#define OS_IM_NONE 0x00000001
|
||||
#define OS_IM_RCP 0x00000401
|
||||
#define OS_IM_SW1 0x00000501
|
||||
#define OS_IM_SW2 0x00000601
|
||||
#define OS_IM_CART 0x00000c01
|
||||
#define OS_IM_PRENMI 0x00001401
|
||||
#define OS_IM_RDBWRITE 0x00002401
|
||||
#define OS_IM_RDBREAD 0x00004401
|
||||
#define OS_IM_COUNTER 0x00008401
|
||||
#define OS_IM_CPU 0x0000ff01
|
||||
#define OS_IM_SP 0x00010401
|
||||
#define OS_IM_SI 0x00020401
|
||||
#define OS_IM_AI 0x00040401
|
||||
#define OS_IM_VI 0x00080401
|
||||
#define OS_IM_PI 0x00100401
|
||||
#define OS_IM_DP 0x00200401
|
||||
#define OS_IM_ALL 0x003fff01
|
||||
#define RCP_IMASK 0x003f0000
|
||||
#define RCP_IMASKSHIFT 16
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Interrupt operations */
|
||||
|
||||
extern OSIntMask osGetIntMask(void);
|
||||
extern OSIntMask osSetIntMask(OSIntMask);
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_EXCEPTION_H_ */
|
||||
107
include/PR/os_gbpak.h
Normal file
107
include/PR/os_gbpak.h
Normal file
@@ -0,0 +1,107 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo.
|
||||
|
||||
$RCSfile: os_gbpak.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:07 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_GBPAK_H_
|
||||
#define _OS_GBPAK_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_message.h"
|
||||
#include "os_pfs.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u16 fixed1;
|
||||
u16 start_address;
|
||||
u8 nintendo_chr[0x30];
|
||||
u8 game_title[16];
|
||||
u16 company_code;
|
||||
u8 body_code;
|
||||
u8 cart_type;
|
||||
u8 rom_size;
|
||||
u8 ram_size;
|
||||
u8 country_code;
|
||||
u8 fixed2;
|
||||
u8 version;
|
||||
u8 isum;
|
||||
u16 sum;
|
||||
} OSGbpakId;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* definition for 64GB-PAK */
|
||||
|
||||
#define OS_GBPAK_POWER 0x01
|
||||
#define OS_GBPAK_RSTB_DETECTION 0x04
|
||||
#define OS_GBPAK_RSTB_STATUS 0x08
|
||||
#define OS_GBPAK_GBCART_PULL 0x40
|
||||
#define OS_GBPAK_GBCART_ON 0x80
|
||||
|
||||
#define OS_GBPAK_POWER_OFF 0x00 /* power of 64GB-PAK */
|
||||
#define OS_GBPAK_POWER_ON 0x01
|
||||
|
||||
#define OS_GBPAK_ROM_ID_SIZE 0x50 /* ID size of GB cartridge */
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* 64GB-PAK */
|
||||
extern s32 osGbpakInit(OSMesgQueue *, OSPfs *, int);
|
||||
extern s32 osGbpakPower(OSPfs *, s32);
|
||||
extern s32 osGbpakGetStatus(OSPfs *, u8 *);
|
||||
extern s32 osGbpakReadWrite(OSPfs *, u16, u16, u8 *, u16);
|
||||
extern s32 osGbpakReadId(OSPfs *, OSGbpakId *, u8 *);
|
||||
extern s32 osGbpakCheckConnector(OSPfs *, u8 *);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_GBPAK_H_ */
|
||||
86
include/PR/os_gio.h
Normal file
86
include/PR/os_gio.h
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_gio.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_gio.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:08 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_GIO_H_
|
||||
#define _OS_GIO_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_GIO_H_ */
|
||||
104
include/PR/os_host.h
Normal file
104
include/PR/os_host.h
Normal file
@@ -0,0 +1,104 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_host.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_host.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:08 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_HOST_H_
|
||||
#define _OS_HOST_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* PARTNER-N64 */
|
||||
#ifdef PTN64
|
||||
#define osReadHost osReadHost_pt
|
||||
#define osWriteHost osWriteHost_pt
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Game <> Host data transfer functions */
|
||||
|
||||
extern s32 osTestHost(void);
|
||||
extern void osReadHost(void *, u32);
|
||||
extern void osWriteHost(void *, u32);
|
||||
extern void osAckRamromRead(void);
|
||||
extern void osAckRamromWrite(void);
|
||||
|
||||
/* RDB port operations */
|
||||
|
||||
extern void osInitRdb(u8 *sendBuf, u32 sendSize);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_HOST_H_ */
|
||||
@@ -10,13 +10,13 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.18 $
|
||||
* $Date: 1997/02/11 08:26:14 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/os_internal.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_internal.h,v $
|
||||
$Revision: 1.20 $
|
||||
$Date: 1998/10/09 08:01:09 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_INTERNAL_H_
|
||||
#define _OS_INTERNAL_H_
|
||||
@@ -29,85 +29,16 @@ extern "C" {
|
||||
|
||||
#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);
|
||||
|
||||
#include "os_internal_reg.h"
|
||||
#include "os_internal_exception.h"
|
||||
#include "os_internal_tlb.h"
|
||||
#include "os_internal_si.h"
|
||||
#include "os_internal_rsp.h"
|
||||
#include "os_internal_error.h"
|
||||
#include "os_internal_gio.h"
|
||||
#include "os_internal_thread.h"
|
||||
#include "os_internal_debug.h"
|
||||
#include "os_internal_host.h"
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
|
||||
43
include/PR/os_internal_debug.h
Normal file
43
include/PR/os_internal_debug.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_internal_debug.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:09 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_INTERNAL_DEBUG_H_
|
||||
#define _OS_INTERNAL_DEBUG_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Debug port */
|
||||
extern void __osSyncPutChars(int, int, const char *);
|
||||
extern int __osAtomicDec(unsigned int *p);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_DEBUG_H */
|
||||
45
include/PR/os_internal_error.h
Normal file
45
include/PR/os_internal_error.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_internal_error.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:10 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_INTERNAL_ERROR_H_
|
||||
#define _OS_INTERNAL_ERROR_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Error handling */
|
||||
|
||||
extern void __osError(s16, s16, ...);
|
||||
extern OSThread * __osGetCurrFaultedThread(void);
|
||||
extern OSThread * __osGetNextFaultedThread(OSThread *);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_ERROR_H */
|
||||
49
include/PR/os_internal_exception.h
Normal file
49
include/PR/os_internal_exception.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_internal_exception.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:10 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_INTERNAL_EXCEPTION_H_
|
||||
#define _OS_INTERNAL_EXCEPTION_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Routine for HW interrupt "handler" */
|
||||
extern void __osSetHWIntrRoutine(OSHWIntr interrupt,
|
||||
s32 (*handler)(void), void *stackEnd);
|
||||
extern void __osGetHWIntrRoutine(OSHWIntr interrupt,
|
||||
s32 (**handler)(void), void **stackEnd);
|
||||
|
||||
/* Routine for global interrupt mask */
|
||||
extern void __osSetGlobalIntMask(OSHWIntr);
|
||||
extern void __osResetGlobalIntMask(OSHWIntr);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_EXCEPTION_H */
|
||||
45
include/PR/os_internal_gio.h
Normal file
45
include/PR/os_internal_gio.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_internal_gio.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:11 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_INTERNAL_GIO_H_
|
||||
#define _OS_INTERNAL_GIO_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Development board functions */
|
||||
|
||||
extern void __osGIOInit(s32);
|
||||
extern void __osGIOInterrupt(s32);
|
||||
extern void __osGIORawInterrupt(s32);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_GIO_H */
|
||||
42
include/PR/os_internal_host.h
Normal file
42
include/PR/os_internal_host.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_internal_host.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:11 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_INTERNAL_HOST_H_
|
||||
#define _OS_INTERNAL_HOST_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* 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_HOST_H */
|
||||
57
include/PR/os_internal_reg.h
Normal file
57
include/PR/os_internal_reg.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_internal_reg.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:12 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_INTERNAL_REG_H_
|
||||
#define _OS_INTERNAL_REG_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);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_REG_H */
|
||||
48
include/PR/os_internal_rsp.h
Normal file
48
include/PR/os_internal_rsp.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_internal_rsp.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:12 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_INTERNAL_RSP_H_
|
||||
#define _OS_INTERNAL_RSP_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* 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);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_RSP_H */
|
||||
46
include/PR/os_internal_si.h
Normal file
46
include/PR/os_internal_si.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_internal_si.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:13 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_INTERNAL_SI_H_
|
||||
#define _OS_INTERNAL_SI_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Serial interface (Si) */
|
||||
|
||||
extern u32 __osSiGetStatus(void);
|
||||
extern s32 __osSiRawWriteIo(u32, u32);
|
||||
extern s32 __osSiRawReadIo(u32, u32 *);
|
||||
extern s32 __osSiRawStartDma(s32, void *);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_SI_H */
|
||||
43
include/PR/os_internal_thread.h
Normal file
43
include/PR/os_internal_thread.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_internal_thread.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:13 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_INTERNAL_THREAD_H_
|
||||
#define _OS_INTERNAL_THREAD_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* For debugger use */
|
||||
|
||||
extern OSThread * __osGetActiveQueue(void);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_THREAD_H */
|
||||
47
include/PR/os_internal_tlb.h
Normal file
47
include/PR/os_internal_tlb.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_internal_tlb.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:14 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_INTERNAL_TLB_H_
|
||||
#define _OS_INTERNAL_TLB_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* 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);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_TLB_H */
|
||||
99
include/PR/os_libc.h
Normal file
99
include/PR/os_libc.h
Normal file
@@ -0,0 +1,99 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_libc.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_libc.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:14 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_LIBC_H_
|
||||
#define _OS_LIBC_H_
|
||||
|
||||
#include "os_pfs.h"
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* byte string operations */
|
||||
|
||||
extern void bcopy(const void *, void *, int);
|
||||
extern int bcmp(const void *, const void *, int);
|
||||
extern void bzero(void *, int);
|
||||
|
||||
/* Printf */
|
||||
|
||||
extern int sprintf(char *s, const char *fmt, ...);
|
||||
extern void osSyncPrintf(const char *fmt, ...);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_LIBC_H_ */
|
||||
163
include/PR/os_message.h
Normal file
163
include/PR/os_message.h
Normal file
@@ -0,0 +1,163 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_message.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_message.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:15 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_MESSAGE_H_
|
||||
#define _OS_MESSAGE_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
typedef u32 OSEvent;
|
||||
|
||||
/*
|
||||
* Structure for message
|
||||
*/
|
||||
typedef void * OSMesg;
|
||||
|
||||
/*
|
||||
* Structure for message queue
|
||||
*/
|
||||
typedef struct OSMesgQueue_s {
|
||||
OSThread *mtqueue; /* Queue to store threads blocked
|
||||
on empty mailboxes (receive) */
|
||||
OSThread *fullqueue; /* Queue to store threads blocked
|
||||
on full mailboxes (send) */
|
||||
s32 validCount; /* Contains number of valid message */
|
||||
s32 first; /* Points to first valid message */
|
||||
s32 msgCount; /* Contains total # of messages */
|
||||
OSMesg *msg; /* Points to message buffer array */
|
||||
} OSMesgQueue;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* Events */
|
||||
#ifdef _FINALROM
|
||||
#define OS_NUM_EVENTS 15
|
||||
#else
|
||||
#define OS_NUM_EVENTS 23
|
||||
#endif
|
||||
|
||||
#define OS_EVENT_SW1 0 /* CPU SW1 interrupt */
|
||||
#define OS_EVENT_SW2 1 /* CPU SW2 interrupt */
|
||||
#define OS_EVENT_CART 2 /* Cartridge interrupt: used by rmon */
|
||||
#define OS_EVENT_COUNTER 3 /* Counter int: used by VI/Timer Mgr */
|
||||
#define OS_EVENT_SP 4 /* SP task done interrupt */
|
||||
#define OS_EVENT_SI 5 /* SI (controller) interrupt */
|
||||
#define OS_EVENT_AI 6 /* AI interrupt */
|
||||
#define OS_EVENT_VI 7 /* VI interrupt: used by VI/Timer Mgr */
|
||||
#define OS_EVENT_PI 8 /* PI interrupt: used by PI Manager */
|
||||
#define OS_EVENT_DP 9 /* DP full sync interrupt */
|
||||
#define OS_EVENT_CPU_BREAK 10 /* CPU breakpoint: used by rmon */
|
||||
#define OS_EVENT_SP_BREAK 11 /* SP breakpoint: used by rmon */
|
||||
#define OS_EVENT_FAULT 12 /* CPU fault event: used by rmon */
|
||||
#define OS_EVENT_THREADSTATUS 13 /* CPU thread status: used by rmon */
|
||||
#define OS_EVENT_PRENMI 14 /* Pre NMI interrupt */
|
||||
#ifndef _FINALROM
|
||||
#define OS_EVENT_RDB_READ_DONE 15 /* RDB read ok event: used by rmon */
|
||||
#define OS_EVENT_RDB_LOG_DONE 16 /* read of log data complete */
|
||||
#define OS_EVENT_RDB_DATA_DONE 17 /* read of hostio data complete */
|
||||
#define OS_EVENT_RDB_REQ_RAMROM 18 /* host needs ramrom access */
|
||||
#define OS_EVENT_RDB_FREE_RAMROM 19 /* host is done with ramrom access */
|
||||
#define OS_EVENT_RDB_DBG_DONE 20
|
||||
#define OS_EVENT_RDB_FLUSH_PROF 21
|
||||
#define OS_EVENT_RDB_ACK_PROF 22
|
||||
#endif
|
||||
|
||||
/* Flags to turn blocking on/off when sending/receiving message */
|
||||
|
||||
#define OS_MESG_NOBLOCK 0
|
||||
#define OS_MESG_BLOCK 1
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* Get count of valid messages in queue */
|
||||
#define MQ_GET_COUNT(mq) ((mq)->validCount)
|
||||
|
||||
/* Figure out if message queue is empty or full */
|
||||
#define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0)
|
||||
#define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount)
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Message operations */
|
||||
|
||||
extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
|
||||
extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
|
||||
extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
|
||||
extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
|
||||
|
||||
/* Event operations */
|
||||
|
||||
extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_MESSAGE_H_ */
|
||||
83
include/PR/os_motor.h
Normal file
83
include/PR/os_motor.h
Normal file
@@ -0,0 +1,83 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo.
|
||||
|
||||
$RCSfile: os_motor.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:15 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_MOTOR_H_
|
||||
#define _OS_MOTOR_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_message.h"
|
||||
#include "os_pfs.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Rumble PAK interface */
|
||||
|
||||
extern s32 osMotorInit(OSMesgQueue *, OSPfs *, int);
|
||||
#if 1
|
||||
#define MOTOR_START 1
|
||||
#define MOTOR_STOP 0
|
||||
#define osMotorStart(x) __osMotorAccess((x), MOTOR_START)
|
||||
#define osMotorStop(x) __osMotorAccess((x), MOTOR_STOP)
|
||||
extern s32 __osMotorAccess(OSPfs *, s32);
|
||||
#else
|
||||
extern s32 osMotorStop(OSPfs *);
|
||||
extern s32 osMotorStart(OSPfs *);
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_MOTOR_H_ */
|
||||
199
include/PR/os_pfs.h
Normal file
199
include/PR/os_pfs.h
Normal file
@@ -0,0 +1,199 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_pfs.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_pfs.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:16 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_PFS_H_
|
||||
#define _OS_PFS_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_message.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure for file system
|
||||
*/
|
||||
typedef struct {
|
||||
int status;
|
||||
OSMesgQueue *queue;
|
||||
int channel;
|
||||
u8 id[32];
|
||||
u8 label[32];
|
||||
int version;
|
||||
int dir_size;
|
||||
int inode_table; /* block location */
|
||||
int minode_table; /* mirrioring inode_table */
|
||||
int dir_table; /* block location */
|
||||
int inode_start_page; /* page # */
|
||||
u8 banks;
|
||||
u8 activebank;
|
||||
} OSPfs;
|
||||
|
||||
typedef struct {
|
||||
u32 file_size; /* bytes */
|
||||
u32 game_code;
|
||||
u16 company_code;
|
||||
char ext_name[4];
|
||||
char game_name[16];
|
||||
} OSPfsState;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* File System size */
|
||||
#define OS_PFS_VERSION 0x0200
|
||||
#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8)
|
||||
#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 255)
|
||||
|
||||
#define PFS_FILE_NAME_LEN 16
|
||||
#define PFS_FILE_EXT_LEN 4
|
||||
#define BLOCKSIZE 32 /* bytes */
|
||||
#define PFS_ONE_PAGE 8 /* blocks */
|
||||
#define PFS_MAX_BANKS 62
|
||||
|
||||
/* File System flag */
|
||||
|
||||
#define PFS_READ 0
|
||||
#define PFS_WRITE 1
|
||||
#define PFS_CREATE 2
|
||||
|
||||
/* File System status */
|
||||
#define PFS_INITIALIZED 0x1
|
||||
#define PFS_CORRUPTED 0x2 /* File system was corrupted */
|
||||
#define PFS_ID_BROKEN 0x4
|
||||
#define PFS_MOTOR_INITIALIZED 0x8
|
||||
#define PFS_GBPAK_INITIALIZED 0x10
|
||||
|
||||
/* File System error number */
|
||||
|
||||
#define PFS_ERR_NOPACK 1 /* no memory card is plugged or */
|
||||
#define PFS_ERR_NEW_PACK 2 /* ram pack has been changed to a */
|
||||
/* different one */
|
||||
#define PFS_ERR_INCONSISTENT 3 /* need to run Pfschecker */
|
||||
#define PFS_ERR_CONTRFAIL CONT_OVERRUN_ERROR
|
||||
#define PFS_ERR_INVALID 5 /* invalid parameter or file not exist*/
|
||||
#define PFS_ERR_BAD_DATA 6 /* the data read from pack are bad*/
|
||||
#define PFS_DATA_FULL 7 /* no free pages on ram pack */
|
||||
#define PFS_DIR_FULL 8 /* no free directories on ram pack*/
|
||||
#define PFS_ERR_EXIST 9 /* file exists */
|
||||
#define PFS_ERR_ID_FATAL 10 /* dead ram pack */
|
||||
#define PFS_ERR_DEVICE 11 /* wrong device type*/
|
||||
#define PFS_ERR_NO_GBCART 12 /* no gb cartridge (64GB-PAK) */
|
||||
#define PFS_ERR_NEW_GBCART 13 /* gb cartridge may be changed */
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* Definition for bank */
|
||||
#define PFS_ID_BANK_256K 0
|
||||
#define PFS_ID_BANK_1M 4
|
||||
#define PFS_BANKS_256K 1
|
||||
|
||||
#define PFS_WRITTEN 2
|
||||
#define DEF_DIR_PAGES 2
|
||||
|
||||
#define PFS_ID_0AREA 1
|
||||
#define PFS_ID_1AREA 3
|
||||
#define PFS_ID_2AREA 4
|
||||
#define PFS_ID_3AREA 6
|
||||
#define PFS_LABEL_AREA 7
|
||||
#define PFS_ID_PAGE PFS_ONE_PAGE * 0
|
||||
|
||||
#define PFS_BANK_LAPPED_BY 8 /* => u8 */
|
||||
#define PFS_SECTOR_PER_BANK 32
|
||||
#define PFS_INODE_DIST_MAP (PFS_BANK_LAPPED_BY * PFS_SECTOR_PER_BANK)
|
||||
#define PFS_SECTOR_SIZE (PFS_INODE_SIZE_PER_PAGE/PFS_SECTOR_PER_BANK)
|
||||
|
||||
#define PFS_FORCE 1
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* file system interface */
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
s32 osPfsInitPak(OSMesgQueue *queue, OSPfs *pfs, s32 channel, s32 *arg3);
|
||||
#else
|
||||
s32 osPfsInitPak(OSMesgQueue *queue, OSPfs *pfs, s32 channel);
|
||||
#endif
|
||||
extern s32 osPfsRepairId(OSPfs *);
|
||||
extern s32 osPfsInit(OSMesgQueue *, OSPfs *, int);
|
||||
extern s32 osPfsReFormat(OSPfs *, OSMesgQueue *, int);
|
||||
extern s32 osPfsChecker(OSPfs *);
|
||||
extern s32 osPfsAllocateFile(OSPfs *, u16, u32, u8 *, u8 *, int, s32 *);
|
||||
extern s32 osPfsFindFile(OSPfs *, u16, u32, u8 *, u8 *, s32 *);
|
||||
extern s32 osPfsDeleteFile(OSPfs *, u16, u32, u8 *, u8 *);
|
||||
extern s32 osPfsReadWriteFile(OSPfs *, s32, u8, int, int, u8 *);
|
||||
extern s32 osPfsFileState(OSPfs *, s32, OSPfsState *);
|
||||
extern s32 osPfsGetLabel(OSPfs *, u8 *, int *);
|
||||
extern s32 osPfsSetLabel(OSPfs *, u8 *);
|
||||
extern s32 osPfsIsPlug(OSMesgQueue *, u8 *);
|
||||
extern s32 osPfsFreeBlocks(OSPfs *, s32 *);
|
||||
extern s32 osPfsNumFiles(OSPfs *, s32 *, s32 *);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_PFS_H_ */
|
||||
224
include/PR/os_pi.h
Normal file
224
include/PR/os_pi.h
Normal file
@@ -0,0 +1,224 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_pi.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_pi.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:16 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_PI_H_
|
||||
#define _OS_PI_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_thread.h"
|
||||
#include "os_message.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure for Enhanced PI interface
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSTranxInfo is set up for Leo Disk DMA. This info will be maintained
|
||||
* by exception handler. This is how the PIMGR and the ISR communicate.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u32 errStatus; /* error status */
|
||||
void *dramAddr; /* RDRAM buffer address (DMA) */
|
||||
void *C2Addr; /* C2 buffer address */
|
||||
u32 sectorSize; /* size of transfering sector */
|
||||
u32 C1ErrNum; /* total # of C1 errors */
|
||||
u32 C1ErrSector[4]; /* error sectors */
|
||||
} __OSBlockInfo;
|
||||
|
||||
typedef struct {
|
||||
u32 cmdType; /* for disk only */
|
||||
u16 transferMode; /* Block, Track, or sector? */
|
||||
u16 blockNum; /* which block is transfering */
|
||||
s32 sectorNum; /* which sector is transfering */
|
||||
u32 devAddr; /* Device buffer address */
|
||||
u32 bmCtlShadow; /* asic bm_ctl(510) register shadow ram */
|
||||
u32 seqCtlShadow; /* asic seq_ctl(518) register shadow ram */
|
||||
__OSBlockInfo block[2]; /* bolck transfer info */
|
||||
} __OSTranxInfo;
|
||||
|
||||
|
||||
typedef struct OSPiHandle_s {
|
||||
struct OSPiHandle_s *next; /* point to next handle on the table */
|
||||
u8 type; /* DEVICE_TYPE_BULK for disk */
|
||||
u8 latency; /* domain latency */
|
||||
u8 pageSize; /* domain page size */
|
||||
u8 relDuration; /* domain release duration */
|
||||
u8 pulse; /* domain pulse width */
|
||||
u8 domain; /* which domain */
|
||||
u32 baseAddress; /* Domain address */
|
||||
u32 speed; /* for roms only */
|
||||
/* The following are "private" elements" */
|
||||
__OSTranxInfo transferInfo; /* for disk only */
|
||||
} OSPiHandle;
|
||||
|
||||
typedef struct {
|
||||
u8 type;
|
||||
u32 address;
|
||||
} OSPiInfo;
|
||||
|
||||
/*
|
||||
* Structure for I/O message block
|
||||
*/
|
||||
typedef struct {
|
||||
u16 type; /* Message type */
|
||||
u8 pri; /* Message priority (High or Normal) */
|
||||
u8 status; /* Return status */
|
||||
OSMesgQueue *retQueue; /* Return message queue to notify I/O
|
||||
* completion */
|
||||
} OSIoMesgHdr;
|
||||
|
||||
typedef struct {
|
||||
OSIoMesgHdr hdr; /* Message header */
|
||||
void * dramAddr; /* RDRAM buffer address (DMA) */
|
||||
u32 devAddr; /* Device buffer address (DMA) */
|
||||
u32 size; /* DMA transfer size in bytes */
|
||||
OSPiHandle *piHandle; /* PI device handle */
|
||||
} OSIoMesg;
|
||||
|
||||
/*
|
||||
* Structure for device manager block
|
||||
*/
|
||||
typedef struct {
|
||||
s32 active; /* Status flag */
|
||||
OSThread *thread; /* Calling thread */
|
||||
OSMesgQueue *cmdQueue; /* Command queue */
|
||||
OSMesgQueue *evtQueue; /* Event queue */
|
||||
OSMesgQueue *acsQueue; /* Access queue */
|
||||
/* Raw DMA routine */
|
||||
s32 (*dma)(s32, u32, void *, u32);
|
||||
s32 (*edma)(OSPiHandle *, s32, u32, void *, u32);
|
||||
} OSDevMgr;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* Flags to indicate direction of data transfer */
|
||||
|
||||
#define OS_READ 0 /* device -> RDRAM */
|
||||
#define OS_WRITE 1 /* device <- RDRAM */
|
||||
#define OS_OTHERS 2 /* for Leo disk only */
|
||||
|
||||
/*
|
||||
* I/O message types
|
||||
*/
|
||||
#define OS_MESG_TYPE_BASE (10)
|
||||
#define OS_MESG_TYPE_LOOPBACK (OS_MESG_TYPE_BASE+0)
|
||||
#define OS_MESG_TYPE_DMAREAD (OS_MESG_TYPE_BASE+1)
|
||||
#define OS_MESG_TYPE_DMAWRITE (OS_MESG_TYPE_BASE+2)
|
||||
#define OS_MESG_TYPE_VRETRACE (OS_MESG_TYPE_BASE+3)
|
||||
#define OS_MESG_TYPE_COUNTER (OS_MESG_TYPE_BASE+4)
|
||||
#define OS_MESG_TYPE_EDMAREAD (OS_MESG_TYPE_BASE+5)
|
||||
#define OS_MESG_TYPE_EDMAWRITE (OS_MESG_TYPE_BASE+6)
|
||||
|
||||
/*
|
||||
* I/O message priority
|
||||
*/
|
||||
#define OS_MESG_PRI_NORMAL 0
|
||||
#define OS_MESG_PRI_HIGH 1
|
||||
|
||||
/*
|
||||
* PI/EPI
|
||||
*/
|
||||
#define PI_DOMAIN1 0
|
||||
#define PI_DOMAIN2 1
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
extern OSPiHandle *__osPiTable; /* The head of OSPiHandle link list */
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Peripheral interface (Pi) */
|
||||
extern u32 osPiGetStatus(void);
|
||||
extern s32 osPiGetDeviceType(void);
|
||||
extern s32 osPiWriteIo(u32, u32);
|
||||
extern s32 osPiReadIo(u32, u32 *);
|
||||
extern s32 osPiStartDma(OSIoMesg *, s32, s32, u32, void *, u32,
|
||||
OSMesgQueue *);
|
||||
extern void osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32);
|
||||
|
||||
/* Enhanced PI interface */
|
||||
|
||||
extern OSPiHandle *osCartRomInit(void);
|
||||
extern OSPiHandle *osLeoDiskInit(void);
|
||||
extern OSPiHandle *osDriveRomInit(void);
|
||||
|
||||
extern s32 osEPiDeviceType(OSPiHandle *, OSPiInfo *);
|
||||
extern s32 osEPiWriteIo(OSPiHandle *, u32 , u32 );
|
||||
extern s32 osEPiReadIo(OSPiHandle *, u32 , u32 *);
|
||||
extern s32 osEPiStartDma(OSPiHandle *, OSIoMesg *, s32);
|
||||
extern s32 osEPiLinkHandle(OSPiHandle *);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_PI_H_ */
|
||||
92
include/PR/os_rdp.h
Normal file
92
include/PR/os_rdp.h
Normal file
@@ -0,0 +1,92 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_rdp.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_rdp.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:16 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_RDP_H_
|
||||
#define _OS_RDP_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Display processor interface (Dp) */
|
||||
extern u32 osDpGetStatus(void);
|
||||
extern void osDpSetStatus(u32);
|
||||
extern void osDpGetCounters(u32 *);
|
||||
extern s32 osDpSetNextBuffer(void *, u64);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_RDP_H_ */
|
||||
90
include/PR/os_reg.h
Normal file
90
include/PR/os_reg.h
Normal file
@@ -0,0 +1,90 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_reg.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_reg.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:17 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_REG_H_
|
||||
#define _OS_REG_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Miscellaneous operations */
|
||||
|
||||
extern u32 osGetCount(void);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_REG_H_ */
|
||||
86
include/PR/os_rsp.h
Normal file
86
include/PR/os_rsp.h
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_rsp.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_rsp.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:17 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_RSP_H_
|
||||
#define _OS_RSP_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_RSP_H_ */
|
||||
86
include/PR/os_si.h
Normal file
86
include/PR/os_si.h
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_si.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_si.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:18 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_SI_H_
|
||||
#define _OS_SI_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_SI_H_ */
|
||||
118
include/PR/os_system.h
Normal file
118
include/PR/os_system.h
Normal file
@@ -0,0 +1,118 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_system.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_system.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:18 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_SYSTEM_H_
|
||||
#define _OS_SYSTEM_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Values for osTvType
|
||||
*/
|
||||
#define OS_TV_PAL 0
|
||||
#define OS_TV_NTSC 1
|
||||
#define OS_TV_MPAL 2
|
||||
|
||||
/*
|
||||
* Size of buffer the retains contents after NMI
|
||||
*/
|
||||
#define OS_APP_NMI_BUFSIZE 64
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
extern s32 osRomType; /* Bulk or cartridge ROM. 0=cartridge 1=bulk */
|
||||
extern void *osRomBase; /* Rom base address of the game image */
|
||||
extern s32 osTvType; /* 0 = PAL, 1 = NTSC, 2 = MPAL */
|
||||
extern s32 osResetType; /* 0 = cold reset, 1 = NMI */
|
||||
extern s32 osCicId;
|
||||
extern s32 osVersion;
|
||||
extern u32 osMemSize; /* Memory Size */
|
||||
extern s32 osAppNMIBuffer[];
|
||||
|
||||
extern u64 osClockRate;
|
||||
|
||||
extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
extern void osInitialize(void);
|
||||
extern void osExit(void);
|
||||
extern u32 osGetMemSize(void);
|
||||
|
||||
/* pre-NMI */
|
||||
extern s32 osAfterPreNMI(void);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_SYSTEM_H_ */
|
||||
143
include/PR/os_thread.h
Normal file
143
include/PR/os_thread.h
Normal file
@@ -0,0 +1,143 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_thread.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_thread.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:19 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_THREAD_H_
|
||||
#define _OS_THREAD_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
typedef s32 OSPri;
|
||||
typedef s32 OSId;
|
||||
typedef union { struct { f32 f_odd; f32 f_even; } f; f64 d; } __OSfp;
|
||||
|
||||
typedef struct {
|
||||
u64 at, v0, v1, a0, a1, a2, a3;
|
||||
u64 t0, t1, t2, t3, t4, t5, t6, t7;
|
||||
u64 s0, s1, s2, s3, s4, s5, s6, s7;
|
||||
u64 t8, t9, gp, sp, s8, ra;
|
||||
u64 lo, hi;
|
||||
u32 sr, pc, cause, badvaddr, rcp;
|
||||
u32 fpcsr;
|
||||
__OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
|
||||
__OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30;
|
||||
} __OSThreadContext;
|
||||
|
||||
typedef struct OSThread_s {
|
||||
struct OSThread_s *next; /* run/mesg queue link */
|
||||
OSPri priority; /* run/mesg queue priority */
|
||||
struct OSThread_s **queue; /* queue thread is on */
|
||||
struct OSThread_s *tlnext; /* all threads queue link */
|
||||
u16 state; /* OS_STATE_* */
|
||||
u16 flags; /* flags for rmon */
|
||||
OSId id; /* id for debugging */
|
||||
int fp; /* thread has used fp unit */
|
||||
__OSThreadContext context; /* register/interrupt mask */
|
||||
} OSThread;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* Thread states */
|
||||
|
||||
#define OS_STATE_STOPPED 1
|
||||
#define OS_STATE_RUNNABLE 2
|
||||
#define OS_STATE_RUNNING 4
|
||||
#define OS_STATE_WAITING 8
|
||||
|
||||
/* Recommended thread priorities for the system threads */
|
||||
|
||||
#define OS_PRIORITY_MAX 255
|
||||
#define OS_PRIORITY_VIMGR 254
|
||||
#define OS_PRIORITY_RMON 250
|
||||
#define OS_PRIORITY_RMONSPIN 200
|
||||
#define OS_PRIORITY_PIMGR 150
|
||||
#define OS_PRIORITY_SIMGR 140
|
||||
#define OS_PRIORITY_APPMAX 127
|
||||
#define OS_PRIORITY_IDLE 0 /* Must be 0 */
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Thread operations */
|
||||
|
||||
extern void osCreateThread(OSThread *, OSId, void (*)(void *), void *, void *, OSPri);
|
||||
extern void osDestroyThread(OSThread *);
|
||||
extern void osYieldThread(void);
|
||||
extern void osStartThread(OSThread *);
|
||||
extern void osStopThread(OSThread *);
|
||||
extern OSId osGetThreadId(OSThread *);
|
||||
extern void osSetThreadPri(OSThread *, OSPri);
|
||||
extern OSPri osGetThreadPri(OSThread *);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_THREAD_H_ */
|
||||
114
include/PR/os_time.h
Normal file
114
include/PR/os_time.h
Normal file
@@ -0,0 +1,114 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_time.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_time.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:19 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_TIME_H_
|
||||
#define _OS_TIME_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_message.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure for time value
|
||||
*/
|
||||
typedef u64 OSTime;
|
||||
|
||||
/*
|
||||
* Structure for interval timer
|
||||
*/
|
||||
typedef struct OSTimer_s {
|
||||
struct OSTimer_s *next; /* point to next timer in list */
|
||||
struct OSTimer_s *prev; /* point to previous timer in list */
|
||||
OSTime interval; /* duration set by user */
|
||||
OSTime value; /* time remaining before */
|
||||
/* timer fires */
|
||||
OSMesgQueue *mq; /* Message Queue */
|
||||
OSMesg msg; /* Message to send */
|
||||
} OSTimer;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Timer interface */
|
||||
|
||||
extern OSTime osGetTime(void);
|
||||
extern void osSetTime(OSTime);
|
||||
extern int osSetTimer(OSTimer *, OSTime, OSTime,
|
||||
OSMesgQueue *, OSMesg);
|
||||
extern int osStopTimer(OSTimer *);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_TIME_H_ */
|
||||
107
include/PR/os_tlb.h
Normal file
107
include/PR/os_tlb.h
Normal file
@@ -0,0 +1,107 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_tlb.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_tlb.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:20 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_TLB_H_
|
||||
#define _OS_TLB_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
typedef u32 OSPageMask;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Page size argument for TLB routines
|
||||
*/
|
||||
#define OS_PM_4K 0x0000000
|
||||
#define OS_PM_16K 0x0006000
|
||||
#define OS_PM_64K 0x001e000
|
||||
#define OS_PM_256K 0x007e000
|
||||
#define OS_PM_1M 0x01fe000
|
||||
#define OS_PM_4M 0x07fe000
|
||||
#define OS_PM_16M 0x1ffe000
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* TLB management routines */
|
||||
|
||||
extern void osMapTLB(s32, OSPageMask, void *, u32, u32, s32);
|
||||
extern void osMapTLBRdb(void);
|
||||
extern void osUnmapTLB(s32);
|
||||
extern void osUnmapTLBAll(void);
|
||||
extern void osSetTLBASID(s32);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_TLB_H_ */
|
||||
16
include/PR/os_version.h
Normal file
16
include/PR/os_version.h
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo.
|
||||
|
||||
$RCSfile: os_version.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1999/01/18 13:17:45 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_VERSION_H_
|
||||
#define _OS_VERSION_H_
|
||||
|
||||
#define OS_MAJOR_VERSION "2.0J" /* major version */
|
||||
#define OS_MINOR_VERSION 0 /* patch level */
|
||||
|
||||
#endif /* !_OS_VERSION_H_ */
|
||||
298
include/PR/os_vi.h
Normal file
298
include/PR/os_vi.h
Normal file
@@ -0,0 +1,298 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_vi.h
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_vi.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:20 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_VI_H_
|
||||
#define _OS_VI_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_thread.h"
|
||||
#include "os_message.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure to store VI register values that remain the same between 2 fields
|
||||
*/
|
||||
typedef struct {
|
||||
u32 ctrl;
|
||||
u32 width;
|
||||
u32 burst;
|
||||
u32 vSync;
|
||||
u32 hSync;
|
||||
u32 leap;
|
||||
u32 hStart;
|
||||
u32 xScale;
|
||||
u32 vCurrent;
|
||||
} OSViCommonRegs;
|
||||
|
||||
|
||||
/*
|
||||
* Structure to store VI register values that change between fields
|
||||
*/
|
||||
typedef struct {
|
||||
u32 origin;
|
||||
u32 yScale;
|
||||
u32 vStart;
|
||||
u32 vBurst;
|
||||
u32 vIntr;
|
||||
} OSViFieldRegs;
|
||||
|
||||
|
||||
/*
|
||||
* Structure for VI mode
|
||||
*/
|
||||
typedef struct {
|
||||
u8 type; /* Mode type */
|
||||
OSViCommonRegs comRegs; /* Common registers for both fields */
|
||||
OSViFieldRegs fldRegs[2]; /* Registers for Field 1 & 2 */
|
||||
} OSViMode;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Video Interface (VI) mode type
|
||||
*/
|
||||
#define OS_VI_NTSC_LPN1 0 /* NTSC */
|
||||
#define OS_VI_NTSC_LPF1 1
|
||||
#define OS_VI_NTSC_LAN1 2
|
||||
#define OS_VI_NTSC_LAF1 3
|
||||
#define OS_VI_NTSC_LPN2 4
|
||||
#define OS_VI_NTSC_LPF2 5
|
||||
#define OS_VI_NTSC_LAN2 6
|
||||
#define OS_VI_NTSC_LAF2 7
|
||||
#define OS_VI_NTSC_HPN1 8
|
||||
#define OS_VI_NTSC_HPF1 9
|
||||
#define OS_VI_NTSC_HAN1 10
|
||||
#define OS_VI_NTSC_HAF1 11
|
||||
#define OS_VI_NTSC_HPN2 12
|
||||
#define OS_VI_NTSC_HPF2 13
|
||||
|
||||
#define OS_VI_PAL_LPN1 14 /* PAL */
|
||||
#define OS_VI_PAL_LPF1 15
|
||||
#define OS_VI_PAL_LAN1 16
|
||||
#define OS_VI_PAL_LAF1 17
|
||||
#define OS_VI_PAL_LPN2 18
|
||||
#define OS_VI_PAL_LPF2 19
|
||||
#define OS_VI_PAL_LAN2 20
|
||||
#define OS_VI_PAL_LAF2 21
|
||||
#define OS_VI_PAL_HPN1 22
|
||||
#define OS_VI_PAL_HPF1 23
|
||||
#define OS_VI_PAL_HAN1 24
|
||||
#define OS_VI_PAL_HAF1 25
|
||||
#define OS_VI_PAL_HPN2 26
|
||||
#define OS_VI_PAL_HPF2 27
|
||||
|
||||
#define OS_VI_MPAL_LPN1 28 /* MPAL - mainly Brazil */
|
||||
#define OS_VI_MPAL_LPF1 29
|
||||
#define OS_VI_MPAL_LAN1 30
|
||||
#define OS_VI_MPAL_LAF1 31
|
||||
#define OS_VI_MPAL_LPN2 32
|
||||
#define OS_VI_MPAL_LPF2 33
|
||||
#define OS_VI_MPAL_LAN2 34
|
||||
#define OS_VI_MPAL_LAF2 35
|
||||
#define OS_VI_MPAL_HPN1 36
|
||||
#define OS_VI_MPAL_HPF1 37
|
||||
#define OS_VI_MPAL_HAN1 38
|
||||
#define OS_VI_MPAL_HAF1 39
|
||||
#define OS_VI_MPAL_HPN2 40
|
||||
#define OS_VI_MPAL_HPF2 41
|
||||
|
||||
#define OS_VI_FPAL_LPN1 42 /* FPAL - Full screen PAL */
|
||||
#define OS_VI_FPAL_LPF1 43
|
||||
#define OS_VI_FPAL_LAN1 44
|
||||
#define OS_VI_FPAL_LAF1 45
|
||||
#define OS_VI_FPAL_LPN2 46
|
||||
#define OS_VI_FPAL_LPF2 47
|
||||
#define OS_VI_FPAL_LAN2 48
|
||||
#define OS_VI_FPAL_LAF2 49
|
||||
#define OS_VI_FPAL_HPN1 50
|
||||
#define OS_VI_FPAL_HPF1 51
|
||||
#define OS_VI_FPAL_HAN1 52
|
||||
#define OS_VI_FPAL_HAF1 53
|
||||
#define OS_VI_FPAL_HPN2 54
|
||||
#define OS_VI_FPAL_HPF2 55
|
||||
|
||||
/*
|
||||
* Video Interface (VI) special features
|
||||
*/
|
||||
#define OS_VI_GAMMA_ON 0x0001
|
||||
#define OS_VI_GAMMA_OFF 0x0002
|
||||
#define OS_VI_GAMMA_DITHER_ON 0x0004
|
||||
#define OS_VI_GAMMA_DITHER_OFF 0x0008
|
||||
#define OS_VI_DIVOT_ON 0x0010
|
||||
#define OS_VI_DIVOT_OFF 0x0020
|
||||
#define OS_VI_DITHER_FILTER_ON 0x0040
|
||||
#define OS_VI_DITHER_FILTER_OFF 0x0080
|
||||
|
||||
/*
|
||||
* Video Interface (VI) mode attribute bit
|
||||
*/
|
||||
#define OS_VI_BIT_NONINTERLACE 0x0001 /* lo-res */
|
||||
#define OS_VI_BIT_INTERLACE 0x0002 /* lo-res */
|
||||
#define OS_VI_BIT_NORMALINTERLACE 0x0004 /* hi-res */
|
||||
#define OS_VI_BIT_DEFLICKINTERLACE 0x0008 /* hi-res */
|
||||
#define OS_VI_BIT_ANTIALIAS 0x0010
|
||||
#define OS_VI_BIT_POINTSAMPLE 0x0020
|
||||
#define OS_VI_BIT_16PIXEL 0x0040
|
||||
#define OS_VI_BIT_32PIXEL 0x0080
|
||||
#define OS_VI_BIT_LORES 0x0100
|
||||
#define OS_VI_BIT_HIRES 0x0200
|
||||
#define OS_VI_BIT_NTSC 0x0400
|
||||
#define OS_VI_BIT_PAL 0x0800
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
extern OSViMode osViModeTable[]; /* Global VI mode table */
|
||||
|
||||
extern OSViMode osViModeNtscLpn1; /* Individual VI NTSC modes */
|
||||
extern OSViMode osViModeNtscLpf1;
|
||||
extern OSViMode osViModeNtscLan1;
|
||||
extern OSViMode osViModeNtscLaf1;
|
||||
extern OSViMode osViModeNtscLpn2;
|
||||
extern OSViMode osViModeNtscLpf2;
|
||||
extern OSViMode osViModeNtscLan2;
|
||||
extern OSViMode osViModeNtscLaf2;
|
||||
extern OSViMode osViModeNtscHpn1;
|
||||
extern OSViMode osViModeNtscHpf1;
|
||||
extern OSViMode osViModeNtscHan1;
|
||||
extern OSViMode osViModeNtscHaf1;
|
||||
extern OSViMode osViModeNtscHpn2;
|
||||
extern OSViMode osViModeNtscHpf2;
|
||||
|
||||
extern OSViMode osViModePalLpn1; /* Individual VI PAL modes */
|
||||
extern OSViMode osViModePalLpf1;
|
||||
extern OSViMode osViModePalLan1;
|
||||
extern OSViMode osViModePalLaf1;
|
||||
extern OSViMode osViModePalLpn2;
|
||||
extern OSViMode osViModePalLpf2;
|
||||
extern OSViMode osViModePalLan2;
|
||||
extern OSViMode osViModePalLaf2;
|
||||
extern OSViMode osViModePalHpn1;
|
||||
extern OSViMode osViModePalHpf1;
|
||||
extern OSViMode osViModePalHan1;
|
||||
extern OSViMode osViModePalHaf1;
|
||||
extern OSViMode osViModePalHpn2;
|
||||
extern OSViMode osViModePalHpf2;
|
||||
|
||||
extern OSViMode osViModeMpalLpn1; /* Individual VI MPAL modes */
|
||||
extern OSViMode osViModeMpalLpf1;
|
||||
extern OSViMode osViModeMpalLan1;
|
||||
extern OSViMode osViModeMpalLaf1;
|
||||
extern OSViMode osViModeMpalLpn2;
|
||||
extern OSViMode osViModeMpalLpf2;
|
||||
extern OSViMode osViModeMpalLan2;
|
||||
extern OSViMode osViModeMpalLaf2;
|
||||
extern OSViMode osViModeMpalHpn1;
|
||||
extern OSViMode osViModeMpalHpf1;
|
||||
extern OSViMode osViModeMpalHan1;
|
||||
extern OSViMode osViModeMpalHaf1;
|
||||
extern OSViMode osViModeMpalHpn2;
|
||||
extern OSViMode osViModeMpalHpf2;
|
||||
|
||||
extern OSViMode osViModeFpalLpn1; /* Individual VI FPAL modes */
|
||||
extern OSViMode osViModeFpalLpf1;
|
||||
extern OSViMode osViModeFpalLan1;
|
||||
extern OSViMode osViModeFpalLaf1;
|
||||
extern OSViMode osViModeFpalLpn2;
|
||||
extern OSViMode osViModeFpalLpf2;
|
||||
extern OSViMode osViModeFpalLan2;
|
||||
extern OSViMode osViModeFpalLaf2;
|
||||
extern OSViMode osViModeFpalHpn1;
|
||||
extern OSViMode osViModeFpalHpf1;
|
||||
extern OSViMode osViModeFpalHan1;
|
||||
extern OSViMode osViModeFpalHaf1;
|
||||
extern OSViMode osViModeFpalHpn2;
|
||||
extern OSViMode osViModeFpalHpf2;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Video interface (Vi) */
|
||||
extern u32 osViGetStatus(void);
|
||||
extern u32 osViGetCurrentMode(void);
|
||||
extern u32 osViGetCurrentLine(void);
|
||||
extern u32 osViGetCurrentField(void);
|
||||
extern void *osViGetCurrentFramebuffer(void);
|
||||
extern void *osViGetNextFramebuffer(void);
|
||||
extern void osViSetXScale(f32);
|
||||
extern void osViSetYScale(f32);
|
||||
extern void osViExtendVStart(u32);
|
||||
extern void osViSetSpecialFeatures(u32);
|
||||
extern void osViSetMode(OSViMode *);
|
||||
extern void osViSetEvent(OSMesgQueue *, OSMesg, u32);
|
||||
extern void osViSwapBuffer(void *);
|
||||
extern void osViBlack(u8);
|
||||
extern void osViFade(u8, u16);
|
||||
extern void osViRepeatLine(u8);
|
||||
extern void osCreateViManager(OSPri);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_VI_H_ */
|
||||
108
include/PR/os_voice.h
Normal file
108
include/PR/os_voice.h
Normal file
@@ -0,0 +1,108 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo.
|
||||
|
||||
$RCSfile: os_voice.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:21 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_VOICE_H_
|
||||
#define _OS_VOICE_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct { /* Voice Recognition System */
|
||||
OSMesgQueue *__mq; /* SI Message Queue */
|
||||
int __channel; /* Controller Port # */
|
||||
s32 __mode;
|
||||
u8 cmd_status; /* Command Status */
|
||||
} OSVoiceHandle;
|
||||
|
||||
typedef struct { /* Voice Recognition System */
|
||||
u16 warning;
|
||||
u16 answer_num; /* 0<><30>5 */
|
||||
u16 voice_level;
|
||||
u16 voice_sn;
|
||||
u16 voice_time;
|
||||
u16 answer[5];
|
||||
u16 distance[5];
|
||||
} OSVoiceData;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* definition for Voice Recognition System */
|
||||
|
||||
#define VOICE_WARN_TOO_SMALL 0x0400
|
||||
#define VOICE_WARN_TOO_LARGE 0x0800
|
||||
#define VOICE_WARN_NOT_FIT 0x4000
|
||||
#define VOICE_WARN_TOO_NOISY 0x8000
|
||||
|
||||
#define VOICE_STATUS_READY 0
|
||||
#define VOICE_STATUS_START 1
|
||||
#define VOICE_STATUS_CANCEL 3
|
||||
#define VOICE_STATUS_BUSY 5
|
||||
#define VOICE_STATUS_END 7
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Voice Recognition System */
|
||||
extern s32 osVoiceInit(OSMesgQueue *, OSVoiceHandle *, int);
|
||||
extern s32 osVoiceCheckWord(u8 *data);
|
||||
extern s32 osVoiceClearDictionary(OSVoiceHandle *, u8);
|
||||
extern s32 osVoiceControlGain(OSVoiceHandle *, s32, s32);
|
||||
extern s32 osVoiceSetWord(OSVoiceHandle *, u8 *);
|
||||
extern s32 osVoiceStartReadData(OSVoiceHandle *);
|
||||
extern s32 osVoiceStopReadData(OSVoiceHandle *);
|
||||
extern s32 osVoiceGetReadData(OSVoiceHandle *, OSVoiceData *);
|
||||
extern s32 osVoiceMaskDictionary(OSVoiceHandle *, u8 *, int);
|
||||
extern void osVoiceCountSyllables(u8 *, u32 *);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_VOICE_H_ */
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
* $Revision: 1.20 $
|
||||
* $Date: 1997/02/11 08:26:47 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/ramrom.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ramrom.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#ifndef _RCP_H_
|
||||
#define _RCP_H_
|
||||
|
||||
#ifdef _LANGUAGE_C
|
||||
#define HW_REG(reg, type) *(volatile type*)((reg) | 0xA0000000)
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||
@@ -22,9 +18,9 @@
|
||||
* File: rcp.h
|
||||
*
|
||||
* This file contains register and bit definitions for RCP memory map.
|
||||
* $Revision: 1.20 $
|
||||
* $Date: 1997/07/23 08:35:21 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/rcp.h,v $
|
||||
* $Revision: 1.21 $
|
||||
* $Date: 1998/07/31 11:08:29 $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rcp.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
@@ -165,6 +161,8 @@ The Indy development board use cartridge domain 1:
|
||||
#define DEVICE_TYPE_BULK 1 /* ROM bulk */
|
||||
#define DEVICE_TYPE_64DD 2 /* 64 Disk Drive */
|
||||
#define DEVICE_TYPE_SRAM 3 /* SRAM */
|
||||
/* 4-6 are reserved */
|
||||
#define DEVICE_TYPE_INIT 7 /* initial value */
|
||||
|
||||
/*************************************************************************
|
||||
* SP Memory
|
||||
@@ -604,6 +602,7 @@ The Indy development board use cartridge domain 1:
|
||||
#define VI_PAL_CLOCK 49656530 /* Hz = 49.656530 MHz */
|
||||
#define VI_MPAL_CLOCK 48628316 /* Hz = 48.628316 MHz */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Audio Interface (AI) Registers
|
||||
*
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 1997/02/11 08:29:31 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/rdb.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rdb.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* $Revision: 1.8 $
|
||||
* $Date: 1997/11/26 00:30:56 $
|
||||
* $Author: mitu $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/region.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/region.h,v $
|
||||
*
|
||||
* Description:
|
||||
* This file contains macros and structure definitions for the region
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 1997/02/11 08:30:08 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/rmon.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rmon.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*
|
||||
* $Revision: 1.7 $
|
||||
* $Date: 1997/02/11 08:32:02 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/sched.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sched.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
@@ -38,8 +38,11 @@
|
||||
#define OS_SC_RETRACE_MSG 1
|
||||
#define OS_SC_DONE_MSG 2
|
||||
#define OS_SC_RDP_DONE_MSG 3
|
||||
#define OS_SC_PRE_NMI_MSG 4
|
||||
#define OS_SC_LAST_MSG 4 /* this should have highest number */
|
||||
#define OS_SC_RSP_MSG 4 // custom - tells audiomgr it's time to do an audio frame
|
||||
#define OS_SC_PRE_NMI_MSG 5
|
||||
#define OS_SC_QUIT_MSG 10
|
||||
#define OS_SC_LAST_MSG 10 /* this should have highest number */
|
||||
|
||||
#define OS_SC_MAX_MESGS 8
|
||||
|
||||
typedef struct {
|
||||
@@ -56,11 +59,7 @@ typedef struct OSScTask_s {
|
||||
OSTask list;
|
||||
OSMesgQueue *msgQ;
|
||||
OSMesg msg;
|
||||
#ifndef _FINALROM /* all #ifdef items should */
|
||||
OSTime startTime; /* remain at the end!!, or */
|
||||
OSTime totalTime; /* possible conflict if */
|
||||
#endif /* FINALROM library used with */
|
||||
} OSScTask; /* non FINALROM code */
|
||||
} OSScTask;
|
||||
|
||||
/*
|
||||
* OSScTask flags:
|
||||
@@ -84,6 +83,7 @@ typedef struct OSScTask_s {
|
||||
typedef struct SCClient_s {
|
||||
struct SCClient_s *next; /* next client in the list */
|
||||
OSMesgQueue *msgQ; /* where to send the frame msg */
|
||||
s32 is8mb;
|
||||
} OSScClient;
|
||||
|
||||
typedef struct {
|
||||
@@ -93,7 +93,7 @@ typedef struct {
|
||||
OSMesg intBuf[OS_SC_MAX_MESGS];
|
||||
OSMesgQueue cmdQ;
|
||||
OSMesg cmdMsgBuf[OS_SC_MAX_MESGS];
|
||||
OSThread thread;
|
||||
OSThread *thread;
|
||||
OSScClient *clientList;
|
||||
OSScTask *audioListHead;
|
||||
OSScTask *gfxListHead;
|
||||
@@ -105,9 +105,8 @@ typedef struct {
|
||||
s32 doAudio;
|
||||
} OSSched;
|
||||
|
||||
void osCreateScheduler(OSSched *s, void *stack, OSPri priority,
|
||||
u8 mode, u8 numFields);
|
||||
void osScAddClient(OSSched *s, OSScClient *c, OSMesgQueue *msgQ);
|
||||
void osCreateScheduler(OSSched *s, OSThread *thread, u8 mode, u32 numFields);
|
||||
void osScAddClient(OSSched *s, OSScClient *c, OSMesgQueue *msgQ, int is8mb);
|
||||
void osScRemoveClient(OSSched *s, OSScClient *c);
|
||||
OSMesgQueue *osScGetCmdQ(OSSched *s);
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
*
|
||||
* Sprite library include file
|
||||
*
|
||||
* $Revision: 1.15 $
|
||||
* $Date: 1997/02/11 08:33:02 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/sp.h,v $
|
||||
* $Revision: 1.16 $
|
||||
* $Date: 1998/04/17 05:03:46 $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sp.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
@@ -155,6 +155,25 @@ typedef struct sprite Sprite;
|
||||
#define SP_TEXSHUF 0x00000200
|
||||
#define SP_EXTERN 0x00000400
|
||||
|
||||
/*
|
||||
* Function wrapper
|
||||
*/
|
||||
#if defined(F3DEX_GBI_2)
|
||||
#define spMove spX2Move
|
||||
#define spSetZ spX2SetZ
|
||||
#define spScissor spX2Scissor
|
||||
#define spDraw spX2Draw
|
||||
#define spInit spX2Init
|
||||
#define spFinish spX2Finish
|
||||
#elif defined(F3DEX_GBI)
|
||||
#define spMove spXMove
|
||||
#define spSetZ spXSetZ
|
||||
#define spScissor spXScissor
|
||||
#define spDraw spXDraw
|
||||
#define spInit spXInit
|
||||
#define spFinish spXFinish
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.8 $
|
||||
* $Date: 1997/11/10 10:48:35 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/sptask.h,v $
|
||||
* $Revision: 1.9 $
|
||||
* $Date: 1998/03/05 06:40:29 $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sptask.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
@@ -50,7 +50,7 @@ extern "C" {
|
||||
* - pointer to ucode
|
||||
* - size of ucode
|
||||
* - pointer to initial DMEM data
|
||||
* - size of initial DMEM data
|
||||
* - size of initial DMEM data
|
||||
* - pointer to DRAM stack
|
||||
* - size of DRAM stack (max)
|
||||
* - pointer to output buffer
|
||||
@@ -131,13 +131,14 @@ typedef u32 OSYieldResult;
|
||||
#define OS_TASK_USR3 0x0080
|
||||
|
||||
/*
|
||||
* Size of Yield buffer. The taskHdrPtr->t.yield_data_ptr must point to a
|
||||
* Size of Yield buffer. The taskHdrPtr->t.yield_data_ptr must point to a
|
||||
* buffer of this size. (The size is in bytes). ONLY If the task will NEVER
|
||||
* yield it may be a null pointer. The buffer must be aligned to a 64 bit
|
||||
* boundary. The taskHdrPtr->t.yield_data_ptr must be set to point to the
|
||||
* buffer BEFORE the task is started.
|
||||
*/
|
||||
#if (defined(F3DEX_GBI)||defined(F3DLP_GBI))
|
||||
// @todo: Remove this || 1 hack
|
||||
#if (defined(F3DEX_GBI)||defined(F3DLP_GBI)||defined(F3DEX_GBI_2) || 1)
|
||||
#define OS_YIELD_DATA_SIZE 0xc00
|
||||
#else
|
||||
#define OS_YIELD_DATA_SIZE 0x900
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.13 $
|
||||
* $Date: 1997/11/07 04:55:12 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/ucode.h,v $
|
||||
* $Revision: 1.15 $
|
||||
* $Date: 1998/03/31 07:58:57 $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ucode.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
@@ -153,24 +153,30 @@ extern long long int gspL3DEX_fifoTextStart[], gspL3DEX_fifoTextEnd[];
|
||||
extern long long int gspL3DEX_fifoDataStart[], gspL3DEX_fifoDataEnd[];
|
||||
|
||||
/*========== F3DEX2/F3DLX2/F3DLP2/L3DEX2 ==========*/
|
||||
/* FIFO version only */
|
||||
/* FIFO version */
|
||||
extern long long int gspF3DEX2_fifoTextStart[], gspF3DEX2_fifoTextEnd[];
|
||||
extern long long int gspF3DEX2_fifoDataStart[], gspF3DEX2_fifoDataEnd[];
|
||||
extern long long int gspF3DEX2_NoN_fifoTextStart[],gspF3DEX2_NoN_fifoTextEnd[];
|
||||
extern long long int gspF3DEX2_NoN_fifoDataStart[],gspF3DEX2_NoN_fifoDataEnd[];
|
||||
|
||||
extern long long int gspF3DLX2_fifoTextStart[], gspF3DLX2_fifoTextEnd[];
|
||||
extern long long int gspF3DLX2_fifoDataStart[], gspF3DLX2_fifoDataEnd[];
|
||||
extern long long int gspF3DLX2_NoN_fifoTextStart[],gspF3DLX2_NoN_fifoTextEnd[];
|
||||
extern long long int gspF3DLX2_NoN_fifoDataStart[],gspF3DLX2_NoN_fifoDataEnd[];
|
||||
extern long long int gspF3DEX2_Rej_fifoTextStart[],gspF3DEX2_Rej_fifoTextEnd[];
|
||||
extern long long int gspF3DEX2_Rej_fifoDataStart[],gspF3DEX2_Rej_fifoDataEnd[];
|
||||
extern long long int gspF3DLX2_Rej_fifoTextStart[],gspF3DLX2_Rej_fifoTextEnd[];
|
||||
extern long long int gspF3DLX2_Rej_fifoDataStart[],gspF3DLX2_Rej_fifoDataEnd[];
|
||||
|
||||
extern long long int gspF3DLP2_Rej_fifoTextStart[],gspF3DLP2_Rej_fifoTextEnd[];
|
||||
extern long long int gspF3DLP2_Rej_fifoDataStart[],gspF3DLP2_Rej_fifoDataEnd[];
|
||||
extern long long int gspL3DEX2_fifoTextStart[], gspL3DEX2_fifoTextEnd[];
|
||||
extern long long int gspL3DEX2_fifoDataStart[], gspL3DEX2_fifoDataEnd[];
|
||||
|
||||
/* XBUS version */
|
||||
extern long long int gspF3DEX2_xbusTextStart[], gspF3DEX2_xbusTextEnd[];
|
||||
extern long long int gspF3DEX2_xbusDataStart[], gspF3DEX2_xbusDataEnd[];
|
||||
extern long long int gspF3DEX2_NoN_xbusTextStart[],gspF3DEX2_NoN_xbusTextEnd[];
|
||||
extern long long int gspF3DEX2_NoN_xbusDataStart[],gspF3DEX2_NoN_xbusDataEnd[];
|
||||
extern long long int gspF3DEX2_Rej_xbusTextStart[],gspF3DEX2_Rej_xbusTextEnd[];
|
||||
extern long long int gspF3DEX2_Rej_xbusDataStart[],gspF3DEX2_Rej_xbusDataEnd[];
|
||||
extern long long int gspF3DLX2_Rej_xbusTextStart[],gspF3DLX2_Rej_xbusTextEnd[];
|
||||
extern long long int gspF3DLX2_Rej_xbusDataStart[],gspF3DLX2_Rej_xbusDataEnd[];
|
||||
extern long long int gspL3DEX2_xbusTextStart[], gspL3DEX2_xbusTextEnd[];
|
||||
extern long long int gspL3DEX2_xbusDataStart[], gspL3DEX2_xbusDataEnd[];
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
|
||||
54
include/PR/ucode_debug.h
Normal file
54
include/PR/ucode_debug.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998, Nintendo.
|
||||
|
||||
File ucode_debug.h
|
||||
Coded by Yoshitaka Yasumoto. Nov 15, 1998.
|
||||
|
||||
$Id: ucode_debug.h,v 1.1 1998/12/25 01:06:21 has Exp $
|
||||
*---------------------------------------------------------------------*/
|
||||
#ifndef _UCODE_DEBUG_H_
|
||||
#define _UCODE_DEBUG_H_
|
||||
|
||||
#define DEBUG_DL_PTR() IO_READ(SP_DMEM_START+0xfc0)
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
/*========== F3DEX2/F3DLX2/L3DEX2/S2DEX2 ==========*/
|
||||
/* FIFO version */
|
||||
extern long long int gspF3DEX2d_fifoTextStart[], gspF3DEX2d_fifoTextEnd[];
|
||||
extern long long int gspF3DEX2d_fifoDataStart[], gspF3DEX2d_fifoDataEnd[];
|
||||
extern long long int gspF3DEX2d_NoN_fifoTextStart[],gspF3DEX2d_NoN_fifoTextEnd[];
|
||||
extern long long int gspF3DEX2d_NoN_fifoDataStart[],gspF3DEX2d_NoN_fifoDataEnd[];
|
||||
extern long long int gspF3DEX2d_Rej_fifoTextStart[],gspF3DEX2d_Rej_fifoTextEnd[];
|
||||
extern long long int gspF3DEX2d_Rej_fifoDataStart[],gspF3DEX2d_Rej_fifoDataEnd[];
|
||||
extern long long int gspF3DLX2d_Rej_fifoTextStart[],gspF3DLX2d_Rej_fifoTextEnd[];
|
||||
extern long long int gspF3DLX2d_Rej_fifoDataStart[],gspF3DLX2d_Rej_fifoDataEnd[];
|
||||
extern long long int gspL3DEX2d_fifoTextStart[], gspL3DEX2d_fifoTextEnd[];
|
||||
extern long long int gspL3DEX2d_fifoDataStart[], gspL3DEX2d_fifoDataEnd[];
|
||||
extern long long int gspS2DEX2d_fifoTextStart[], gspS2DEX2d_fifoTextEnd[];
|
||||
extern long long int gspS2DEX2d_fifoDataStart[], gspS2DEX2d_fifoDataEnd[];
|
||||
|
||||
/* XBUS version */
|
||||
extern long long int gspF3DEX2d_xbusTextStart[], gspF3DEX2d_xbusTextEnd[];
|
||||
extern long long int gspF3DEX2d_xbusDataStart[], gspF3DEX2d_xbusDataEnd[];
|
||||
extern long long int gspF3DEX2d_NoN_xbusTextStart[],gspF3DEX2d_NoN_xbusTextEnd[];
|
||||
extern long long int gspF3DEX2d_NoN_xbusDataStart[],gspF3DEX2d_NoN_xbusDataEnd[];
|
||||
extern long long int gspF3DEX2d_Rej_xbusTextStart[],gspF3DEX2d_Rej_xbusTextEnd[];
|
||||
extern long long int gspF3DEX2d_Rej_xbusDataStart[],gspF3DEX2d_Rej_xbusDataEnd[];
|
||||
extern long long int gspF3DLX2d_Rej_xbusTextStart[],gspF3DLX2d_Rej_xbusTextEnd[];
|
||||
extern long long int gspF3DLX2d_Rej_xbusDataStart[],gspF3DLX2d_Rej_xbusDataEnd[];
|
||||
extern long long int gspL3DEX2d_xbusTextStart[], gspL3DEX2d_xbusTextEnd[];
|
||||
extern long long int gspL3DEX2d_xbusDataStart[], gspL3DEX2d_xbusDataEnd[];
|
||||
extern long long int gspS2DEX2d_xbusTextStart[], gspS2DEX2d_xbusTextEnd[];
|
||||
extern long long int gspS2DEX2d_xbusDataStart[], gspS2DEX2d_xbusDataEnd[];
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
#endif /* !_UCODE_DEBUG_H */
|
||||
|
||||
/*======== End of ucode_debug.h ========*/
|
||||
@@ -20,9 +20,9 @@
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.23 $
|
||||
* $Date: 1997/02/11 08:38:08 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/ultraerror.h,v $
|
||||
* $Revision: 1.24 $
|
||||
* $Date: 1998/01/27 23:52:11 $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultraerror.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
@@ -150,7 +150,9 @@ extern "C" {
|
||||
#define ERR_ALCSPVNOTFREE 130
|
||||
#define ERR_ALSEQOVERRUN 131
|
||||
#define ERR_OSAISETNEXTBUFFER_ENDADDR 132
|
||||
#define ERR_ALMODDELAYOVERFLOW 133
|
||||
#define ERR_ALMODDELAYOVERFLOW 133
|
||||
#define ERR_OSVIEXTENDVSTART_VIMGR 134
|
||||
#define ERR_OSVIEXTENDVSTART_VALUE 135
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
typedef void (*OSErrorHandler)(s16, s16, ...);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 1997/02/11 08:39:05 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/ultralog.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultralog.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 1997/12/17 04:02:06 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/ultratypes.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultratypes.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
@@ -34,15 +34,15 @@
|
||||
*/
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
typedef unsigned char u8; /* unsigned 8-bit */
|
||||
typedef unsigned short u16; /* unsigned 16-bit */
|
||||
typedef unsigned long u32; /* unsigned 32-bit */
|
||||
typedef unsigned long long u64; /* unsigned 64-bit */
|
||||
typedef unsigned char u8; /* unsigned 8-bit */
|
||||
typedef unsigned short int u16; /* unsigned 16-bit */
|
||||
typedef unsigned int u32; /* unsigned 32-bit */
|
||||
typedef unsigned long long int u64; /* unsigned 64-bit */
|
||||
|
||||
typedef signed char s8; /* signed 8-bit */
|
||||
typedef short s16; /* signed 16-bit */
|
||||
typedef long s32; /* signed 32-bit */
|
||||
typedef long long s64; /* signed 64-bit */
|
||||
typedef signed char s8; /* signed 8-bit */
|
||||
typedef signed short int s16; /* signed 16-bit */
|
||||
typedef signed int s32; /* signed 32-bit */
|
||||
typedef signed long long int s64; /* signed 64-bit */
|
||||
|
||||
typedef volatile unsigned char vu8; /* unsigned 8-bit */
|
||||
typedef volatile unsigned short vu16; /* unsigned 16-bit */
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*
|
||||
* $Revision: 1.12 $
|
||||
* $Date: 1997/02/11 08:40:49 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/uportals.h,v $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/uportals.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
58
include/PR/xstdio.h
Normal file
58
include/PR/xstdio.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef _XSTDIO_H
|
||||
#define _XSTDIO_H
|
||||
#include <ultratypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
union {
|
||||
/* 00 */ long long s64;
|
||||
double f64;
|
||||
} value;
|
||||
/* 08 */ char *buff;
|
||||
/* 0c */ int n0;
|
||||
/* 10 */ int num_leading_zeros;
|
||||
/* 14 */ int part2_len;
|
||||
/* 18 */ int num_mid_zeros;
|
||||
/* 1c */ int part3_len;
|
||||
/* 20 */ int num_trailing_zeros;
|
||||
/* 24 */ int precision;
|
||||
/* 28 */ int width;
|
||||
/* 2c */ unsigned int size;
|
||||
/* 30 */ unsigned int flags;
|
||||
/* 34 */ char length;
|
||||
} printf_struct;
|
||||
|
||||
// these are the same struct. TODO: Merge
|
||||
typedef struct {
|
||||
/* 0x0 */ union {
|
||||
/* 0x0 */ long long ll;
|
||||
/* 0x0 */ double ld;
|
||||
} v;
|
||||
/* 0x8 */ unsigned char* s;
|
||||
/* 0xC */ int n0;
|
||||
/* 0x10 */ int nz0;
|
||||
/* 0x14 */ int n1;
|
||||
/* 0x18 */ int nz1;
|
||||
/* 0x1C */ int n2;
|
||||
/* 0x20 */ int nz2;
|
||||
/* 0x24 */ int prec;
|
||||
/* 0x28 */ int width;
|
||||
/* 0x2C */ size_t nchar;
|
||||
/* 0x30 */ unsigned int flags;
|
||||
/* 0x34 */ char qual;
|
||||
} _Pft;
|
||||
|
||||
#define FLAGS_SPACE 1
|
||||
#define FLAGS_PLUS 2
|
||||
#define FLAGS_MINUS 4
|
||||
#define FLAGS_HASH 8
|
||||
#define FLAGS_ZERO 16
|
||||
typedef char *outfun(char*,const char*,size_t);
|
||||
|
||||
int _Printf(outfun prout, char *arg, const char *fmt, va_list args);
|
||||
void _Litob(_Pft *args, char type);
|
||||
void _Ldtob(_Pft *args, char type);
|
||||
|
||||
#endif
|
||||
54
include/assert.h
Normal file
54
include/assert.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef __ASSERT_H__
|
||||
#define __ASSERT_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1984, 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
/* Copyright (c) 1984 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "$Revision: 1.17 $"
|
||||
|
||||
/* ANSI C Notes:
|
||||
*
|
||||
* - THE IDENTIFIERS APPEARING OUTSIDE OF #ifdef __EXTENSIONS__ IN THIS
|
||||
* standard header ARE SPECIFIED BY ANSI! CONFORMANCE WILL BE ALTERED
|
||||
* IF ANY NEW IDENTIFIERS ARE ADDED TO THIS AREA UNLESS THEY ARE IN ANSI's
|
||||
* RESERVED NAMESPACE. (i.e., unless they are prefixed by __[a-z] or
|
||||
* _[A-Z]. For external objects, identifiers with the prefix _[a-z]
|
||||
* are also reserved.)
|
||||
*/
|
||||
|
||||
#ifdef NDEBUG
|
||||
#undef assert
|
||||
#define assert(EX) ((void)0)
|
||||
|
||||
#else
|
||||
|
||||
extern void __assert(const char *, const char *, int);
|
||||
#ifdef __ANSI_CPP__
|
||||
#define assert(EX) ((EX)?((void)0):__assert( # EX , __FILE__, __LINE__))
|
||||
#else
|
||||
#define assert(EX) ((EX)?((void)0):__assert("EX", __FILE__, __LINE__))
|
||||
#endif
|
||||
#endif /* NDEBUG */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !__ASSERT_H__ */
|
||||
59
include/audio/initfx.h
Normal file
59
include/audio/initfx.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*====================================================================
|
||||
* initfx.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.
|
||||
*====================================================================*/
|
||||
|
||||
#ifndef __initfx__
|
||||
#define __initfx__
|
||||
|
||||
#define MAX_L0 AL_FX_BUFFER_SIZE/4
|
||||
#define MAX_L1 AL_FX_BUFFER_SIZE/4
|
||||
#define MAX_L2 AL_FX_BUFFER_SIZE/2
|
||||
|
||||
#define L0_INC MAX_L0/128
|
||||
#define L1_INC MAX_L1/128
|
||||
#define L2_INC MAX_L2/128
|
||||
|
||||
#define SMALLROOM_SECT_CNT 3
|
||||
#define SMALLROOM_SIZE AL_FX_BUFFER_SIZE
|
||||
#define SMALLROOM_L0 880 /* 22 ms */
|
||||
#define SMALLROOM_C0 9830
|
||||
#define SMALLROOM_L1 1400 /* 35 ms */
|
||||
#define SMALLROOM_C1 3276
|
||||
#define SMALLROOM_L2 2640 /* 66 ms */
|
||||
#define SMALLROOM_C2 10000
|
||||
#define SMALLROOM_FILT_CNT 1
|
||||
#define SMALLROOM_FC0 0x4000 /* .25 */
|
||||
|
||||
#define BIGROOM_SECT_CNT 3
|
||||
#define BIGROOM_SIZE AL_FX_BUFFER_SIZE
|
||||
#define BIGROOM_L0 1408 /* 32 ms */
|
||||
#define BIGROOM_C0 9830
|
||||
#define BIGROOM_L1 1984 /* 45 ms */
|
||||
#define BIGROOM_C1 9830
|
||||
#define BIGROOM_L2 3792 /* 86 ms */
|
||||
#define BIGROOM_C2 12000
|
||||
#define BIGROOM_FILT_CNT 1
|
||||
#define BIGROOM_FC0 0x4000 /* .25 */
|
||||
|
||||
#define ECHO_SIZE AL_FX_BUFFER_SIZE
|
||||
#define ECHO_SECT_CNT 1
|
||||
#define ECHO_L0 7936 /* 180 ms */
|
||||
#define ECHO_C0 0x6000
|
||||
|
||||
#endif
|
||||
338
include/audio/synthInternals.h
Normal file
338
include/audio/synthInternals.h
Normal file
@@ -0,0 +1,338 @@
|
||||
/*====================================================================
|
||||
* audioInternals.h
|
||||
*
|
||||
* Synopsis:
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#ifndef __audioInternals__
|
||||
#define __audioInternals__
|
||||
|
||||
#include <libaudio.h>
|
||||
|
||||
/*
|
||||
* filter message ids
|
||||
*/
|
||||
enum {
|
||||
AL_FILTER_FREE_VOICE,
|
||||
AL_FILTER_SET_SOURCE,
|
||||
AL_FILTER_ADD_SOURCE,
|
||||
AL_FILTER_ADD_UPDATE,
|
||||
AL_FILTER_RESET,
|
||||
AL_FILTER_SET_WAVETABLE,
|
||||
/* AL_FILTER_SET_DMA_PROC,*/
|
||||
/* AL_FILTER_SKIP_LOOP,*/
|
||||
AL_FILTER_SET_DRAM,
|
||||
AL_FILTER_SET_PITCH,
|
||||
AL_FILTER_SET_UNITY_PITCH,
|
||||
AL_FILTER_START,
|
||||
/* AL_FILTER_SET_DECAY,*/
|
||||
/* AL_FILTER_SET_FC,*/
|
||||
AL_FILTER_SET_STATE,
|
||||
AL_FILTER_SET_VOLUME,
|
||||
AL_FILTER_SET_PAN,
|
||||
AL_FILTER_START_VOICE_ALT,
|
||||
AL_FILTER_START_VOICE,
|
||||
AL_FILTER_STOP_VOICE,
|
||||
AL_FILTER_SET_FXAMT
|
||||
};
|
||||
|
||||
#define AL_MAX_RSP_SAMPLES 160
|
||||
|
||||
/*
|
||||
* buffer locations based on AL_MAX_RSP_SAMPLES
|
||||
*/
|
||||
#define AL_DECODER_IN 0
|
||||
#define AL_RESAMPLER_OUT 0
|
||||
#define AL_TEMP_0 0
|
||||
#define AL_DECODER_OUT 320
|
||||
#define AL_TEMP_1 320
|
||||
#define AL_TEMP_2 640
|
||||
#define AL_MAIN_L_OUT 1088
|
||||
#define AL_MAIN_R_OUT 1408
|
||||
#define AL_AUX_L_OUT 1728
|
||||
#define AL_AUX_R_OUT 2048
|
||||
|
||||
/*
|
||||
* filter types
|
||||
*/
|
||||
enum {
|
||||
AL_ADPCM,
|
||||
AL_RESAMPLE,
|
||||
AL_BUFFER,
|
||||
AL_SAVE,
|
||||
AL_ENVMIX,
|
||||
AL_FX,
|
||||
AL_AUXBUS,
|
||||
AL_MAINBUS
|
||||
};
|
||||
|
||||
typedef struct ALParam_s {
|
||||
struct ALParam_s *next;
|
||||
s32 delta;
|
||||
s16 type;
|
||||
union {
|
||||
f32 f;
|
||||
s32 i;
|
||||
} data;
|
||||
union {
|
||||
f32 f;
|
||||
s32 i;
|
||||
} moredata;
|
||||
union {
|
||||
f32 f;
|
||||
s32 i;
|
||||
} stillmoredata;
|
||||
union {
|
||||
f32 f;
|
||||
s32 i;
|
||||
} yetstillmoredata;
|
||||
} ALParam;
|
||||
|
||||
typedef struct {
|
||||
struct ALParam_s *next;
|
||||
s32 delta;
|
||||
s16 type;
|
||||
s16 unity; /* disable resampler */
|
||||
f32 pitch;
|
||||
s16 volume;
|
||||
ALPan pan;
|
||||
u8 fxMix;
|
||||
s32 samples;
|
||||
struct ALWaveTable_s *wave;
|
||||
} ALStartParamAlt;
|
||||
|
||||
typedef struct {
|
||||
struct ALParam_s *next;
|
||||
s32 delta;
|
||||
s16 type;
|
||||
s16 unity; /* disable resampler */
|
||||
struct ALWaveTable_s *wave;
|
||||
} ALStartParam;
|
||||
|
||||
typedef struct {
|
||||
struct ALParam_s *next;
|
||||
s32 delta;
|
||||
s16 type;
|
||||
struct PVoice_s *pvoice;
|
||||
} ALFreeParam;
|
||||
|
||||
typedef Acmd *(*ALCmdHandler)(void *, s16 *, s32, s32, Acmd *);
|
||||
typedef s32 (*ALSetParam)(void *, s32, void *);
|
||||
|
||||
typedef struct ALFilter_s {
|
||||
struct ALFilter_s *source;
|
||||
ALCmdHandler handler;
|
||||
ALSetParam setParam;
|
||||
s16 inp;
|
||||
s16 outp;
|
||||
s32 type;
|
||||
} ALFilter;
|
||||
|
||||
void alFilterNew(ALFilter *f, ALCmdHandler h, ALSetParam s, s32 type);
|
||||
|
||||
#define AL_MAX_ADPCM_STATES 3 /* Depends on number of subframes
|
||||
* per frame and loop length
|
||||
*/
|
||||
typedef struct {
|
||||
ALFilter filter;
|
||||
ADPCM_STATE *state;
|
||||
ADPCM_STATE *lstate;
|
||||
ALRawLoop loop;
|
||||
struct ALWaveTable_s *table;
|
||||
s32 bookSize;
|
||||
ALDMAproc dma;
|
||||
void *dmaState;
|
||||
s32 sample;
|
||||
s32 lastsam;
|
||||
s32 first;
|
||||
s32 memin;
|
||||
} ALLoadFilter;
|
||||
|
||||
void alLoadNew(ALLoadFilter *f, ALDMANew dma, ALHeap *hp);
|
||||
Acmd *alAdpcmPull(void *f, s16 *outp, s32 byteCount, s32 sampleOffset, Acmd *p);
|
||||
Acmd *alRaw16Pull(void *f, s16 *outp, s32 byteCount, s32 sampleOffset, Acmd *p);
|
||||
s32 alLoadParam(void *filter, s32 paramID, void *param);
|
||||
|
||||
typedef struct ALResampler_s {
|
||||
ALFilter filter;
|
||||
RESAMPLE_STATE *state;
|
||||
f32 ratio;
|
||||
s32 upitch;
|
||||
f32 delta;
|
||||
s32 first;
|
||||
ALParam *ctrlList;
|
||||
ALParam *ctrlTail;
|
||||
s32 motion;
|
||||
} ALResampler;
|
||||
|
||||
typedef struct {
|
||||
s16 fc;
|
||||
s16 fgain;
|
||||
union {
|
||||
s16 fccoef[16];
|
||||
s64 force_aligned;
|
||||
} fcvec;
|
||||
POLEF_STATE *fstate;
|
||||
s32 first;
|
||||
} ALLowPass;
|
||||
|
||||
typedef struct {
|
||||
u32 input;
|
||||
u32 output;
|
||||
s16 ffcoef;
|
||||
s16 fbcoef;
|
||||
s16 gain;
|
||||
f32 rsinc;
|
||||
f32 rsval;
|
||||
s32 rsdelta;
|
||||
f32 rsgain;
|
||||
ALLowPass *lp;
|
||||
ALResampler *rs;
|
||||
} ALDelay;
|
||||
|
||||
typedef s32 (*ALSetFXParam)(void *, s32, void *);
|
||||
typedef struct {
|
||||
struct ALFilter_s filter;
|
||||
s16 *base;
|
||||
s16 *input;
|
||||
u32 length;
|
||||
ALDelay *delay;
|
||||
u8 section_count;
|
||||
ALSetFXParam paramHdl;
|
||||
} ALFx;
|
||||
|
||||
void alFxNew(ALFx *r, ALSynConfig *c, ALHeap *hp);
|
||||
Acmd *alFxPull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
|
||||
s32 alFxParam(void *filter, s32 paramID, void *param);
|
||||
s32 alFxParamHdl(void *filter, s32 paramID, void *param);
|
||||
|
||||
#define AL_MAX_MAIN_BUS_SOURCES 1
|
||||
typedef struct ALMainBus_s {
|
||||
ALFilter filter;
|
||||
s32 sourceCount;
|
||||
s32 maxSources;
|
||||
ALFilter **sources;
|
||||
} ALMainBus;
|
||||
|
||||
void alMainBusNew(ALMainBus *m, void *ptr, s32 len);
|
||||
Acmd *alMainBusPull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
|
||||
s32 alMainBusParam(void *filter, s32 paramID, void *param);
|
||||
|
||||
#define AL_MAX_AUX_BUS_SOURCES 8
|
||||
#define AL_MAX_AUX_BUS_FX 1
|
||||
typedef struct ALAuxBus_s {
|
||||
ALFilter filter;
|
||||
s32 sourceCount;
|
||||
s32 maxSources;
|
||||
ALFilter **sources;
|
||||
ALFx fx[AL_MAX_AUX_BUS_FX];
|
||||
} ALAuxBus;
|
||||
|
||||
void alAuxBusNew(ALAuxBus *m, void *ptr, s32 len);
|
||||
Acmd *alAuxBusPull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
|
||||
s32 alAuxBusParam(void *filter, s32 paramID, void *param);
|
||||
|
||||
void alResampleNew(ALResampler *r, ALHeap *hp);
|
||||
Acmd *alResamplePull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
|
||||
s32 alResampleParam(void *f, s32 paramID, void *param);
|
||||
|
||||
typedef struct ALSave_s {
|
||||
ALFilter filter;
|
||||
s32 dramout;
|
||||
s32 first;
|
||||
} ALSave;
|
||||
|
||||
void alSaveNew(ALSave *r);
|
||||
Acmd *alSavePull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
|
||||
s32 alSaveParam(void *f, s32 paramID, void *param);
|
||||
|
||||
typedef struct ALEnvMixer_s {
|
||||
ALFilter filter;
|
||||
ENVMIX_STATE *state;
|
||||
s16 pan;
|
||||
s16 volume;
|
||||
s16 cvolL;
|
||||
s16 cvolR;
|
||||
s16 dryamt;
|
||||
s16 wetamt;
|
||||
u16 lratl;
|
||||
s16 lratm;
|
||||
s16 ltgt;
|
||||
u16 rratl;
|
||||
s16 rratm;
|
||||
s16 rtgt;
|
||||
s32 delta;
|
||||
s32 segEnd;
|
||||
s32 first;
|
||||
ALParam *ctrlList;
|
||||
ALParam *ctrlTail;
|
||||
ALFilter **sources;
|
||||
s32 motion;
|
||||
} ALEnvMixer;
|
||||
|
||||
void alEnvmixerNew(ALEnvMixer *e, ALHeap *hp);
|
||||
Acmd *alEnvmixerPull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
|
||||
s32 alEnvmixerParam(void *filter, s32 paramID, void *param);
|
||||
|
||||
|
||||
/*
|
||||
* heap stuff
|
||||
*/
|
||||
typedef struct {
|
||||
s32 magic; /* check structure integrety */
|
||||
s32 size; /* size of this allocated block */
|
||||
u8 *file; /* file that this alloc was called from */
|
||||
s32 line; /* line that it was called from */
|
||||
s32 count; /* heap call number */
|
||||
s32 pad0;
|
||||
s32 pad1;
|
||||
s32 pad2; /* Make it 32 bytes */
|
||||
} HeapInfo;
|
||||
|
||||
#define AL_CACHE_ALIGN 15
|
||||
|
||||
/*
|
||||
* synth stuff
|
||||
*/
|
||||
|
||||
typedef struct PVoice_s {
|
||||
ALLink node;
|
||||
struct ALVoice_s *vvoice;
|
||||
ALFilter *channelKnob;
|
||||
ALLoadFilter decoder;
|
||||
ALResampler resampler;
|
||||
ALEnvMixer envmixer;
|
||||
s32 offset;
|
||||
} PVoice;
|
||||
|
||||
/*
|
||||
* prototypes for private driver functions
|
||||
*/
|
||||
ALParam *__allocParam(void);
|
||||
void __freeParam(ALParam *param);
|
||||
void _freePVoice(ALSynth *drvr, PVoice *pvoice);
|
||||
void _collectPVoices(ALSynth *drvr);
|
||||
|
||||
s32 _timeToSamples(ALSynth *ALSynth, s32 micros);
|
||||
ALMicroTime _samplesToTime(ALSynth *synth, s32 samples);
|
||||
|
||||
void _init_lpfilter(ALLowPass *lp);
|
||||
|
||||
#endif
|
||||
|
||||
35
include/libc/math.h
Normal file
35
include/libc/math.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef MATH_H
|
||||
#define MATH_H
|
||||
|
||||
#include "PR/ultratypes.h"
|
||||
|
||||
#define M_PI 3.14159265358979323846f
|
||||
#define M_SQRT2 1.41421356237309504880f
|
||||
#define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */
|
||||
#define FLT_MAX 340282346638528859811704183484516925440.0f
|
||||
#define SHT_MAX 32767.0f
|
||||
#define SHT_MINV (1.0f / SHT_MAX)
|
||||
|
||||
typedef union {
|
||||
f64 d;
|
||||
struct {
|
||||
u32 hi;
|
||||
u32 lo;
|
||||
} word;
|
||||
} du;
|
||||
|
||||
typedef union {
|
||||
u32 i;
|
||||
f32 f;
|
||||
} fu;
|
||||
|
||||
extern f32 __libm_qnan_f;
|
||||
|
||||
float fabsf(float f);
|
||||
#pragma intrinsic(fabsf)
|
||||
float sqrtf(float f);
|
||||
#pragma intrinsic(sqrtf)
|
||||
double sqrt(double d);
|
||||
#pragma intrinsic(sqrt)
|
||||
|
||||
#endif
|
||||
@@ -1,12 +1,22 @@
|
||||
#ifndef _MACROS_H_
|
||||
#define _MACROS_H_
|
||||
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#ifndef __sgi
|
||||
#define GLOBAL_ASM(...)
|
||||
#endif
|
||||
|
||||
#ifdef _LANGUAGE_C
|
||||
#define HW_REG(reg, type) *(volatile type*)((reg) | 0xA0000000)
|
||||
#endif
|
||||
|
||||
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
#define SQ(x) ((x) * (x))
|
||||
#define ROUND(x) (s32)(((x) >= 0.0) ? ((x) + 0.5) : ((x) - 0.5))
|
||||
|
||||
#define assert
|
||||
|
||||
#endif
|
||||
|
||||
46
include/math.h
Normal file
46
include/math.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef MATH_H
|
||||
#define MATH_H
|
||||
|
||||
#include "PR/ultratypes.h"
|
||||
|
||||
#define M_PI 3.14159265358979323846f
|
||||
#define M_SQRT2 1.41421356237309504880f
|
||||
#define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */
|
||||
#define FLT_MAX 340282346638528859811704183484516925440.0f
|
||||
#define SHT_MAX 32767.0f
|
||||
#define SHT_MINV (1.0f / SHT_MAX)
|
||||
|
||||
typedef float MtxF_t[4][4];
|
||||
typedef union {
|
||||
MtxF_t mf;
|
||||
struct {
|
||||
float xx, yx, zx, wx,
|
||||
xy, yy, zy, wy,
|
||||
xz, yz, zz, wz,
|
||||
xw, yw, zw, ww;
|
||||
};
|
||||
} MtxF;
|
||||
|
||||
typedef union {
|
||||
f64 d;
|
||||
struct {
|
||||
u32 hi;
|
||||
u32 lo;
|
||||
} word;
|
||||
} du;
|
||||
|
||||
typedef union {
|
||||
u32 i;
|
||||
f32 f;
|
||||
} fu;
|
||||
|
||||
extern f32 __libm_qnan_f;
|
||||
|
||||
float fabsf(float f);
|
||||
#pragma intrinsic(fabsf)
|
||||
float sqrtf(float f);
|
||||
#pragma intrinsic(sqrtf)
|
||||
double sqrt(double d);
|
||||
#pragma intrinsic(sqrt)
|
||||
|
||||
#endif
|
||||
42
include/stdarg.h
Normal file
42
include/stdarg.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef STDARG_H
|
||||
#define STDARG_H
|
||||
|
||||
// When not building with IDO, use the builtin vaarg macros for portability.
|
||||
#ifndef __sgi
|
||||
#define va_list __builtin_va_list
|
||||
#define va_start __builtin_va_start
|
||||
#define va_arg __builtin_va_arg
|
||||
#define va_end __builtin_va_end
|
||||
#else
|
||||
|
||||
typedef char *va_list;
|
||||
#define _FP 1
|
||||
#define _INT 0
|
||||
#define _STRUCT 2
|
||||
|
||||
#define _VA_FP_SAVE_AREA 0x10
|
||||
#define _VA_ALIGN(p, a) (((unsigned int)(((char *)p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4))
|
||||
#define va_start(vp, parmN) (vp = ((va_list)&parmN + sizeof(parmN)))
|
||||
|
||||
#define __va_stack_arg(list, mode) \
|
||||
( \
|
||||
((list) = (char *)_VA_ALIGN(list, __builtin_alignof(mode)) + \
|
||||
_VA_ALIGN(sizeof(mode), 4)), \
|
||||
(((char *)list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode))))
|
||||
|
||||
#define __va_double_arg(list, mode) \
|
||||
( \
|
||||
(((long)list & 0x1) /* 1 byte aligned? */ \
|
||||
? (list = (char *)((long)list + 7), (char *)((long)list - 6 - _VA_FP_SAVE_AREA)) \
|
||||
: (((long)list & 0x2) /* 2 byte aligned? */ \
|
||||
? (list = (char *)((long)list + 10), (char *)((long)list - 24 - _VA_FP_SAVE_AREA)) \
|
||||
: __va_stack_arg(list, mode))))
|
||||
|
||||
#define va_arg(list, mode) ((mode *)(((__builtin_classof(mode) == _FP && \
|
||||
__builtin_alignof(mode) == sizeof(double)) \
|
||||
? __va_double_arg(list, mode) \
|
||||
: __va_stack_arg(list, mode))))[-1]
|
||||
#define va_end(__list)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
21
include/stdlib.h
Normal file
21
include/stdlib.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef __STDLIB_H__
|
||||
#define __STDLIB_H__
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
typedef struct lldiv_t
|
||||
{
|
||||
long long quot;
|
||||
long long rem;
|
||||
} lldiv_t;
|
||||
|
||||
typedef struct ldiv_t
|
||||
{
|
||||
long quot;
|
||||
long rem;
|
||||
} ldiv_t;
|
||||
|
||||
lldiv_t lldiv(long long num, long long denom);
|
||||
ldiv_t ldiv(long num, long denom);
|
||||
#endif /* !__STDLIB_H__ */
|
||||
55
include/string.h
Normal file
55
include/string.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifndef __STRING_H__
|
||||
#define __STRING_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ident "$Revision: 1.23 $"
|
||||
/*
|
||||
*
|
||||
* Copyright 1992, 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.
|
||||
*/
|
||||
/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
|
||||
/* Copyright (c) 1988 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
|
||||
/* UNIX System Laboratories, Inc. */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
|
||||
#if !defined(_SIZE_T) && !defined(_SIZE_T_)
|
||||
#define _SIZE_T
|
||||
#if (_MIPS_SZLONG == 32)
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
#if (_MIPS_SZLONG == 64)
|
||||
typedef unsigned long size_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
extern void *memcpy(void *, const void *, size_t);
|
||||
extern const char *strchr(const char *, int);
|
||||
extern size_t strlen(const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !__STRING_H__ */
|
||||
@@ -38,4 +38,10 @@
|
||||
#include <PR/ultralog.h>
|
||||
#include <PR/leo.h>
|
||||
|
||||
#include "ultra64/thread.h"
|
||||
|
||||
#include "functions.h"
|
||||
#include "macros.h"
|
||||
#include "variables.h"
|
||||
|
||||
#endif
|
||||
|
||||
207
include/ultra64/controller.h
Normal file
207
include/ultra64/controller.h
Normal file
@@ -0,0 +1,207 @@
|
||||
#ifndef _CONTROLLER_H
|
||||
#define _CONTROLLER_H
|
||||
|
||||
//should go somewhere else but
|
||||
#define ARRLEN(x) ((s32)(sizeof(x) / sizeof(x[0])))
|
||||
#define CHNL_ERR(format) ((format.rxsize & CHNL_ERR_MASK) >> 4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x0 */ u32 ramarray[15];
|
||||
/* 0x3C */ u32 pifstatus;
|
||||
} OSPifRam;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x0 */ u8 dummy;
|
||||
/* 0x1 */ u8 txsize;
|
||||
/* 0x2 */ u8 rxsize;
|
||||
/* 0x3 */ u8 cmd;
|
||||
/* 0x4 */ u16 button;
|
||||
/* 0x6 */ s8 stick_x;
|
||||
/* 0x7 */ s8 stick_y;
|
||||
} __OSContReadFormat;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x0 */ u8 dummy;
|
||||
/* 0x1 */ u8 txsize;
|
||||
/* 0x2 */ u8 rxsize;
|
||||
/* 0x3 */ u8 cmd;
|
||||
/* 0x4 */ u8 typeh;
|
||||
/* 0x5 */ u8 typel;
|
||||
/* 0x6 */ u8 status;
|
||||
/* 0x7 */ u8 dummy1;
|
||||
} __OSContRequestFormat;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x0 */ u8 txsize;
|
||||
/* 0x1 */ u8 rxsize;
|
||||
/* 0x2 */ u8 cmd;
|
||||
/* 0x3 */ u8 typeh;
|
||||
/* 0x4 */ u8 typel;
|
||||
/* 0x5 */ u8 status;
|
||||
} __OSContRequestFormatShort;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x0 */ u8 dummy;
|
||||
/* 0x1 */ u8 txsize;
|
||||
/* 0x2 */ u8 rxsize;
|
||||
/* 0x3 */ u8 cmd;
|
||||
/* 0x4 */ u8 hi;
|
||||
/* 0x5 */ u8 lo;
|
||||
/* 0x6 */ u8 data[BLOCKSIZE];
|
||||
/* 0x26 */ u8 datacrc;
|
||||
} __OSContRamReadFormat;
|
||||
|
||||
typedef union {
|
||||
/* 0x0 */ struct
|
||||
{
|
||||
/* 0x0 */ u8 bank;
|
||||
/* 0x1 */ u8 page;
|
||||
} inode_t;
|
||||
/* 0x0 */ u16 ipage;
|
||||
} __OSInodeUnit;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x0 */ u32 game_code;
|
||||
/* 0x4 */ u16 company_code;
|
||||
/* 0x6 */ __OSInodeUnit start_page;
|
||||
/* 0x8 */ u8 status;
|
||||
/* 0x9 */ s8 reserved;
|
||||
/* 0xA */ u16 data_sum;
|
||||
/* 0xC */ u8 ext_name[PFS_FILE_EXT_LEN];
|
||||
/* 0x10 */ u8 game_name[PFS_FILE_NAME_LEN];
|
||||
} __OSDir;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x0 */ __OSInodeUnit inode_page[128];
|
||||
} __OSInode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x0 */ u32 repaired;
|
||||
/* 0x4 */ u32 random;
|
||||
/* 0x8 */ u64 serial_mid;
|
||||
/* 0x10 */ u64 serial_low;
|
||||
/* 0x18 */ u16 deviceid;
|
||||
/* 0x1A */ u8 banks;
|
||||
/* 0x1B */ u8 version;
|
||||
/* 0x1C */ u16 checksum;
|
||||
/* 0x1E */ u16 inverted_checksum;
|
||||
} __OSPackId;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x0 */ u8 txsize;
|
||||
/* 0x1 */ u8 rxsize;
|
||||
/* 0x2 */ u8 cmd;
|
||||
/* 0x3 */ u8 address;
|
||||
/* 0x4 */ u8 data[EEPROM_BLOCK_SIZE];
|
||||
} __OSContEepromFormat;
|
||||
|
||||
//from: http://en64.shoutwiki.com/wiki/SI_Registers_Detailed#CONT_CMD_Usage
|
||||
#define CONT_CMD_REQUEST_STATUS 0
|
||||
#define CONT_CMD_READ_BUTTON 1
|
||||
#define CONT_CMD_READ_MEMPACK 2
|
||||
#define CONT_CMD_WRITE_MEMPACK 3
|
||||
#define CONT_CMD_READ_EEPROM 4
|
||||
#define CONT_CMD_WRITE_EEPROM 5
|
||||
#define CONT_CMD_RESET 0xff
|
||||
|
||||
#define CONT_CMD_REQUEST_STATUS_TX 1
|
||||
#define CONT_CMD_READ_BUTTON_TX 1
|
||||
#define CONT_CMD_READ_MEMPACK_TX 3
|
||||
#define CONT_CMD_WRITE_MEMPACK_TX 35
|
||||
#define CONT_CMD_READ_EEPROM_TX 2
|
||||
#define CONT_CMD_WRITE_EEPROM_TX 10
|
||||
#define CONT_CMD_RESET_TX 1
|
||||
|
||||
#define CONT_CMD_REQUEST_STATUS_RX 3
|
||||
#define CONT_CMD_READ_BUTTON_RX 4
|
||||
#define CONT_CMD_READ_MEMPACK_RX 33
|
||||
#define CONT_CMD_WRITE_MEMPACK_RX 1
|
||||
#define CONT_CMD_READ_EEPROM_RX 8
|
||||
#define CONT_CMD_WRITE_EEPROM_RX 1
|
||||
#define CONT_CMD_RESET_RX 3
|
||||
|
||||
#define CONT_CMD_NOP 0xff
|
||||
#define CONT_CMD_END 0xfe //indicates end of a command
|
||||
#define CONT_CMD_EXE 1 //set pif ram status byte to this to do a command
|
||||
|
||||
#define DIR_STATUS_EMPTY 0
|
||||
#define DIR_STATUS_UNKNOWN 1
|
||||
#define DIR_STATUS_OCCUPIED 2
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x0 */ __OSInode inode;
|
||||
/* 0x100 */ u8 bank;
|
||||
/* 0x101 */ u8 map[256];
|
||||
} __OSInodeCache;
|
||||
|
||||
extern s32 __osEepStatus(OSMesgQueue *, OSContStatus *);
|
||||
u16 __osSumcalc(u8 *ptr, int length);
|
||||
s32 __osIdCheckSum(u16 *ptr, u16 *csum, u16 *icsum);
|
||||
s32 __osRepairPackId(OSPfs *pfs, __OSPackId *badid, __OSPackId *newid);
|
||||
s32 __osCheckPackId(OSPfs *pfs, __OSPackId *temp);
|
||||
s32 __osGetId(OSPfs *pfs);
|
||||
s32 __osCheckId(OSPfs *pfs);
|
||||
s32 __osPfsRWInode(OSPfs *pfs, __OSInode *inode, u8 flag, u8 bank);
|
||||
s32 __osPfsSelectBank(OSPfs *pfs, u8 bank);
|
||||
s32 __osPfsDeclearPage(OSPfs *pfs, __OSInode *inode, int file_size_in_pages, int *first_page, u8 bank, int *decleared, int *last_page);
|
||||
s32 __osPfsReleasePages(OSPfs *pfs, __OSInode *inode, u8 start_page, u8 bank, __OSInodeUnit *last_page);
|
||||
s32 __osBlockSum(OSPfs *pfs, u8 page_no, u16 *sum, u8 bank);
|
||||
s32 __osContRamRead(OSMesgQueue *mq, int channel, u16 address, u8 *buffer);
|
||||
s32 __osContRamWrite(OSMesgQueue *mq, int channel, u16 address, u8 *buffer, int force);
|
||||
void __osContGetInitData(u8 *pattern, OSContStatus *data);
|
||||
void __osPackRequestData(u8 cmd);
|
||||
void __osPfsRequestData(u8 cmd);
|
||||
void __osPfsGetInitData(u8* pattern, OSContStatus* data);
|
||||
u8 __osContAddressCrc(u16 addr);
|
||||
u8 __osContDataCrc(u8 *data);
|
||||
s32 __osPfsGetStatus(OSMesgQueue *queue, int channel);
|
||||
s32 __osGbpakSelectBank(OSPfs *pfs, u8 bank);
|
||||
|
||||
extern u8 __osContLastCmd;
|
||||
extern OSTimer __osEepromTimer;
|
||||
extern OSMesg __osEepromTimerMsg;
|
||||
extern OSMesgQueue __osEepromTimerQ;
|
||||
extern OSPifRam __osEepPifRam;
|
||||
extern OSPifRam __osContPifRam;
|
||||
extern OSPifRam __osPfsPifRam;
|
||||
extern u8 __osMaxControllers;
|
||||
|
||||
//some version of this almost certainly existed since there's plenty of times where it's used right before a return 0
|
||||
#define ERRCK(fn) \
|
||||
ret = fn; \
|
||||
if (ret != 0) \
|
||||
return ret;
|
||||
|
||||
#define SET_ACTIVEBANK_TO_ZERO \
|
||||
if (pfs->activebank != 0) \
|
||||
{ \
|
||||
pfs->activebank = 0; \
|
||||
ERRCK(__osPfsSelectBank(pfs)) \
|
||||
}
|
||||
|
||||
#define PFS_CHECK_ID \
|
||||
if (__osCheckId(pfs) == PFS_ERR_NEW_PACK) \
|
||||
return PFS_ERR_NEW_PACK;
|
||||
#endif
|
||||
|
||||
#define PFS_CHECK_STATUS \
|
||||
if ((pfs->status & PFS_INITIALIZED) == 0) \
|
||||
return PFS_ERR_INVALID;
|
||||
|
||||
#define PFS_GET_STATUS \
|
||||
__osSiGetAccess(); \
|
||||
ret = __osPfsGetStatus(queue, channel); \
|
||||
__osSiRelAccess(); \
|
||||
if (ret != 0) \
|
||||
return ret;
|
||||
22
include/ultra64/internal.h
Normal file
22
include/ultra64/internal.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef ULTRA64_INTERNAL_H
|
||||
#define ULTRA64_INTERNAL_H
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 initialized;
|
||||
/* 0x04 */ OSThread* mgrThread;
|
||||
/* 0x08 */ OSMesgQueue* cmdQueue;
|
||||
/* 0x0C */ OSMesgQueue* eventQueue;
|
||||
/* 0x10 */ OSMesgQueue* acccessQueue;
|
||||
/* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, size_t);
|
||||
/* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, size_t);
|
||||
} OSMgrArgs; // size = 0x1C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ OSMesgQueue* queue;
|
||||
/* 0x04 */ OSMesg msg;
|
||||
} __OSEventState; // size = 0x08
|
||||
|
||||
extern OSMgrArgs __osPiDevMgr;
|
||||
extern __OSEventState __osEventStateTab[];
|
||||
|
||||
#endif
|
||||
87
include/ultra64/thread.h
Normal file
87
include/ultra64/thread.h
Normal file
@@ -0,0 +1,87 @@
|
||||
#ifndef ULTRA64_THREAD_H
|
||||
#define ULTRA64_THREAD_H
|
||||
|
||||
#define OS_PRIORITY_MAX 255
|
||||
#define OS_PRIORITY_VIMGR 254
|
||||
#define OS_PRIORITY_RMON 250
|
||||
#define OS_PRIORITY_RMONSPIN 200
|
||||
#define OS_PRIORITY_PIMGR 150
|
||||
#define OS_PRIORITY_SIMGR 140
|
||||
#define OS_PRIORITY_APPMAX 127
|
||||
#define OS_PRIORITY_IDLE 0
|
||||
|
||||
#define OS_PRIORITY_THREADTAIL -1
|
||||
|
||||
#define OS_STATE_STOPPED 1
|
||||
#define OS_STATE_RUNNABLE 2
|
||||
#define OS_STATE_RUNNING 4
|
||||
#define OS_STATE_WAITING 8
|
||||
|
||||
#define OS_FLAG_CPU_BREAK 1
|
||||
#define OS_FLAG_FAULT 2
|
||||
|
||||
#define THREAD_NEXT 0x00
|
||||
#define THREAD_PRI 0x04
|
||||
#define THREAD_QUEUE 0x08
|
||||
#define THREAD_TLNEXT 0x0C
|
||||
#define THREAD_STATE 0x10
|
||||
#define THREAD_FLAGS 0x12
|
||||
#define THREAD_ID 0x14
|
||||
#define THREAD_FP 0x18
|
||||
#define THREAD_PROFILE 0x1C
|
||||
#define THREAD_CONTEXT 0x20
|
||||
#define THREAD_AT (THREAD_CONTEXT + 0x000)
|
||||
#define THREAD_V0 (THREAD_CONTEXT + 0x008)
|
||||
#define THREAD_V1 (THREAD_CONTEXT + 0x010)
|
||||
#define THREAD_A0 (THREAD_CONTEXT + 0x018)
|
||||
#define THREAD_A1 (THREAD_CONTEXT + 0x020)
|
||||
#define THREAD_A2 (THREAD_CONTEXT + 0x028)
|
||||
#define THREAD_A3 (THREAD_CONTEXT + 0x030)
|
||||
#define THREAD_T0 (THREAD_CONTEXT + 0x038)
|
||||
#define THREAD_T1 (THREAD_CONTEXT + 0x040)
|
||||
#define THREAD_T2 (THREAD_CONTEXT + 0x048)
|
||||
#define THREAD_T3 (THREAD_CONTEXT + 0x050)
|
||||
#define THREAD_T4 (THREAD_CONTEXT + 0x058)
|
||||
#define THREAD_T5 (THREAD_CONTEXT + 0x060)
|
||||
#define THREAD_T6 (THREAD_CONTEXT + 0x068)
|
||||
#define THREAD_T7 (THREAD_CONTEXT + 0x070)
|
||||
#define THREAD_S0 (THREAD_CONTEXT + 0x078)
|
||||
#define THREAD_S1 (THREAD_CONTEXT + 0x080)
|
||||
#define THREAD_S2 (THREAD_CONTEXT + 0x088)
|
||||
#define THREAD_S3 (THREAD_CONTEXT + 0x090)
|
||||
#define THREAD_S4 (THREAD_CONTEXT + 0x098)
|
||||
#define THREAD_S5 (THREAD_CONTEXT + 0x0A0)
|
||||
#define THREAD_S6 (THREAD_CONTEXT + 0x0A8)
|
||||
#define THREAD_S7 (THREAD_CONTEXT + 0x0B0)
|
||||
#define THREAD_T8 (THREAD_CONTEXT + 0x0B8)
|
||||
#define THREAD_T9 (THREAD_CONTEXT + 0x0C0)
|
||||
#define THREAD_GP (THREAD_CONTEXT + 0x0C8)
|
||||
#define THREAD_SP (THREAD_CONTEXT + 0x0D0)
|
||||
#define THREAD_S8 (THREAD_CONTEXT + 0x0D8)
|
||||
#define THREAD_RA (THREAD_CONTEXT + 0x0E0)
|
||||
#define THREAD_LO (THREAD_CONTEXT + 0x0E8)
|
||||
#define THREAD_HI (THREAD_CONTEXT + 0x0F0)
|
||||
#define THREAD_SR (THREAD_CONTEXT + 0x0F8)
|
||||
#define THREAD_PC (THREAD_CONTEXT + 0x0FC)
|
||||
#define THREAD_CAUSE (THREAD_CONTEXT + 0x100)
|
||||
#define THREAD_BADVADDR (THREAD_CONTEXT + 0x104)
|
||||
#define THREAD_RCP (THREAD_CONTEXT + 0x108)
|
||||
#define THREAD_FPCSR (THREAD_CONTEXT + 0x10C)
|
||||
#define THREAD_FP0 (THREAD_CONTEXT + 0x110)
|
||||
#define THREAD_FP2 (THREAD_CONTEXT + 0x118)
|
||||
#define THREAD_FP4 (THREAD_CONTEXT + 0x120)
|
||||
#define THREAD_FP6 (THREAD_CONTEXT + 0x128)
|
||||
#define THREAD_FP8 (THREAD_CONTEXT + 0x130)
|
||||
#define THREAD_FP10 (THREAD_CONTEXT + 0x138)
|
||||
#define THREAD_FP12 (THREAD_CONTEXT + 0x140)
|
||||
#define THREAD_FP14 (THREAD_CONTEXT + 0x148)
|
||||
#define THREAD_FP16 (THREAD_CONTEXT + 0x150)
|
||||
#define THREAD_FP18 (THREAD_CONTEXT + 0x158)
|
||||
#define THREAD_FP20 (THREAD_CONTEXT + 0x160)
|
||||
#define THREAD_FP22 (THREAD_CONTEXT + 0x168)
|
||||
#define THREAD_FP24 (THREAD_CONTEXT + 0x170)
|
||||
#define THREAD_FP26 (THREAD_CONTEXT + 0x178)
|
||||
#define THREAD_FP28 (THREAD_CONTEXT + 0x180)
|
||||
#define THREAD_FP30 (THREAD_CONTEXT + 0x188)
|
||||
|
||||
#endif
|
||||
357
splat.yaml
357
splat.yaml
@@ -24,6 +24,7 @@ segments:
|
||||
- [0x0B70, bin, bootcode_font]
|
||||
- name: text
|
||||
type: code
|
||||
bss_size: 0x85E30
|
||||
start: 0x1000
|
||||
vram: 0x80000400
|
||||
subsegments:
|
||||
@@ -156,164 +157,216 @@ segments:
|
||||
- [0x57270, asm, libleo/readrtc]
|
||||
- [0x572D0, asm, libleo/leoseek]
|
||||
- [0x57390, asm, libleo/seek]
|
||||
- [0x573F0, asm, libultra/io/piacs]
|
||||
- [0x574B0, asm, libultra/os/setcause]
|
||||
- [0x574C0, c, libultra/os/osSendMesg]
|
||||
- [0x57610, c, libultra/os/osStopThread]
|
||||
- [0x576D0, c, libultra/os/osRecvMesg]
|
||||
- [0x57810, asm, libultra/os/setintmask]
|
||||
- [0x578B0, asm, libultra/os/thread]
|
||||
- [0x578F0, asm, libultra/gu/scale]
|
||||
- [0x57990, asm, libultra/gu/sinf]
|
||||
- [0x57B50, asm, libultra/al/sl]
|
||||
- [0x573F0, c, libultra/io/piacs]
|
||||
- [0x574B0, hasm, libultra/os/setcause]
|
||||
- [0x574C0, c, libultra/os/sendmesg]
|
||||
- [0x57610, c, libultra/os/stopthread]
|
||||
- [0x576D0, c, libultra/os/recvmesg]
|
||||
- [0x57810, hasm, libultra/os/setintmask]
|
||||
- [0x578B0, c, libultra/os/dequeuethread]
|
||||
- [0x578F0, c, libultra/gu/scale]
|
||||
- [0x57990, c, libultra/gu/sinf]
|
||||
- [0x57B50, c, libultra/al/sl]
|
||||
- [0x57C10, c, libultra/io/sptask]
|
||||
- [0x57F00, asm, libultra/os/destroythread]
|
||||
- [0x58010, asm, libultra/libc/ll]
|
||||
- [0x582D0, asm, libultra/os/exceptasm]
|
||||
- [0x58BD0, asm, libultra/libc/bzero]
|
||||
- [0x58C70, asm] # unknown file(s)
|
||||
- [0x58EC0, asm, libultra/io/gbpakcheckconnector]
|
||||
- [0x59350, asm, libultra/io/gbpakpower]
|
||||
- [0x59460, asm, libultra/io/controller]
|
||||
- [0x597A0, asm, libultra/io/siacs]
|
||||
- [0x598C0, asm, libultra/os/createthread]
|
||||
- [0x59A10, asm, libultra/io/contreaddata]
|
||||
- [0x59BF0, asm, libultra/os/setcount]
|
||||
- [0x59C00, asm, libultra/io/conteeplongread]
|
||||
- [0x59C90, asm, libultra/os/virtualtophysical]
|
||||
- [0x59D10, asm, libultra/os/setsr]
|
||||
- [0x59D20, asm, libultra/os/writebackdcache]
|
||||
- [0x59DA0, asm, libultra/os/initialize]
|
||||
- [0x5A0F0, asm, libultra/os/getsr]
|
||||
- [0x5A100, asm, libultra/io/gbpakinit]
|
||||
- [0x5A330, asm, libultra/io/pfsgetstatus]
|
||||
- [0x5A560, asm, libultra/al/reverb]
|
||||
- [0x5B1C0, asm, libultra/gu/perspective]
|
||||
- [0x5B450, asm, libultra/io/sprawdma]
|
||||
- [0x5B4E0, asm, libultra/io/sirawdma]
|
||||
- [0x5B590, asm] # unknown file(s)
|
||||
- [0x5B5E0, asm, libultra/io/viblack]
|
||||
- [0x5B650, asm, libultra/io/sirawread]
|
||||
- [0x5B6A0, asm, libultra/io/sptaskyield]
|
||||
- [0x5B6C0, asm, libultra/gu/lookatref]
|
||||
- [0x5BB50, asm, libultra/gu/mtxutil]
|
||||
- [0x5BDC0, asm, libultra/io/visetmode]
|
||||
- [0x5BE30, asm] # unknown file(s)
|
||||
- [0x5C1E0, asm, libultra/os/probetlb]
|
||||
- [0x5C2A0, asm] # unknown file(s)
|
||||
- [0x5C420, asm, libultra/io/devmgr]
|
||||
- [0x5C830, asm, libultra/io/pirawdma]
|
||||
- [0x5C900, hasm, libultra/os/osGetCount] # RNG
|
||||
- [0x5C910, asm, libultra/io/conteepprobe]
|
||||
- [0x5C980, asm, libultra/io/conteepwrite]
|
||||
- [0x5CD50, asm, libultra/os/getmemsize]
|
||||
- [0x5CE70, asm, libultra/io/contpfs]
|
||||
- [0x5D9F0, asm, libultra/os/seteventmesg]
|
||||
- [0x5DAB0, asm, libultra/gu/sqrtf]
|
||||
- [0x5DAC0, asm, libultra/os/afterprenmi]
|
||||
- [0x5DAE0, asm, libultra/gu/mtxcatf]
|
||||
- [0x5DCF0, asm, libultra/gu/mtxcatl]
|
||||
- [0x5DDB0, asm, libultra/gu/random]
|
||||
- [0x5DDE0, asm, libultra/libc/xprintf]
|
||||
- [0x5EAA0, asm, libultra/io/gbpakgetstatus]
|
||||
- [0x5EC20, asm, libultra/libc/sprintf]
|
||||
- [0x5ECA0, asm, libultra/os/unmaptlball]
|
||||
- [0x5ECF0, asm] # unknown file(s)
|
||||
- [0x5EDD0, asm, libultra/al/heapinit]
|
||||
- [0x5EE10, asm, libultra/os/syncprintf]
|
||||
- [0x5EE50, asm, libultra/libc/string]
|
||||
- [0x5EEF0, asm, libultra/os/invalidcache]
|
||||
- [0x5EFA0, asm, libultra/os/createmesgqueue]
|
||||
- [0x5EFD0, asm, libultra/os/invalicache]
|
||||
- [0x5F050, asm] # unknown file(s)
|
||||
- [0x5F140, asm, libultra/io/sp]
|
||||
- [0x5F170, asm, libultra/io/si]
|
||||
- [0x5F1A0, asm, libultra/gu/translate]
|
||||
- [0x5F240, asm, libultra/os/jammesg]
|
||||
- [0x5F390, asm, libultra/os/setthreadpri]
|
||||
- [0x5F470, asm, libultra/os/getthreadpri]
|
||||
- [0x5F490, asm, libultra/io/epirawread]
|
||||
- [0x5F5F0, asm, libultra/io/viswapbuf]
|
||||
- [0x5F640, asm, libultra/io/epirawdma]
|
||||
- [0x5F820, asm, libultra/io/sptaskyielded]
|
||||
- [0x5F8A0, asm] # unknown file(s)
|
||||
- [0x5FA40, asm, libultra/libc/bcmp]
|
||||
- [0x5FB60, asm] # unknown file(s)
|
||||
- [0x5FD50, asm, libultra/os/gettime]
|
||||
- [0x5FDE0, asm, libultra/os/timerintr]
|
||||
- [0x601E0, asm, libultra/al/synthesizer]
|
||||
- [0x60860, asm, libultra/al/drvrNew]
|
||||
- [0x61010, asm, libultra/al/mainbus]
|
||||
- [0x61160, asm, libultra/al/auxbus]
|
||||
- [0x61270, asm, libultra/al/env]
|
||||
- [0x61EF0, asm, libultra/al/resample]
|
||||
- [0x621F0, asm] # unknown file(s). might be load.o from AL library, but it's too different to tell.
|
||||
- [0x62D40, asm, libultra/al/filter]
|
||||
- [0x62D60, asm, libultra/al/save]
|
||||
- [0x62E20, asm, libultra/os/setglobalintmask]
|
||||
- [0x62E70, asm, libultra/io/aisetfreq]
|
||||
- [0x62FC0, asm, libultra/io/dpctr]
|
||||
- [0x63010, asm, libultra/os/getactivequeue]
|
||||
- [0x63020, asm, libultra/gu/normalize]
|
||||
- [0x630B0, asm, libultra/os/setcompare]
|
||||
- [0x630C0, asm, libultra/io/aigetstat]
|
||||
- [0x630D0, asm, libultra/io/dpsetstat]
|
||||
- [0x630E0, asm, libultra/al/copy]
|
||||
- [0x63160, asm, libultra/libc/bcopy]
|
||||
- [0x63470, asm, libultra/os/resetglobalintmask]
|
||||
- [0x634D0, asm, libultra/gu/ortho]
|
||||
- [0x63690, asm, libultra/os/interrupt]
|
||||
- [0x63720, asm, libultra/io/vi]
|
||||
- [0x63860, asm, libultra/io/viswapcontext]
|
||||
- [0x57F00, c, libultra/os/destroythread]
|
||||
- [0x58010, c, libultra/libc/ll]
|
||||
- [0x582D0, hasm, libultra/os/exceptasm]
|
||||
- [0x58BD0, hasm, libultra/libc/bzero]
|
||||
- [0x58C70, c, libultra/al/bnkf]
|
||||
- [0x58EC0, c, libultra/io/gbpakcheckconnector]
|
||||
- [0x59350, c, libultra/io/gbpakpower]
|
||||
- [0x59460, c, libultra/io/controller]
|
||||
- [0x597A0, c, libultra/io/siacs]
|
||||
- [0x59860, bin, noppad_59860] # again with the weird nop padding.
|
||||
- [0x598C0, c, libultra/os/createthread]
|
||||
- [0x59A10, c, libultra/io/contreaddata]
|
||||
- [0x59BF0, hasm, libultra/os/setcount]
|
||||
- [0x59C00, c, libultra/io/conteeplongread]
|
||||
- [0x59C90, c, libultra/os/virtualtophysical]
|
||||
- [0x59D10, hasm, libultra/os/setsr]
|
||||
- [0x59D20, hasm, libultra/os/writebackdcache]
|
||||
- [0x59DA0, c, libultra/os/initialize]
|
||||
- [0x5A0F0, hasm, libultra/os/getsr]
|
||||
- [0x5A100, c, libultra/io/gbpakinit]
|
||||
- [0x5A330, c, libultra/io/pfsgetstatus]
|
||||
- [0x5A560, c, libultra/al/reverb]
|
||||
- [0x5B1C0, c, libultra/gu/perspective]
|
||||
- [0x5B450, c, libultra/io/sprawdma]
|
||||
- [0x5B4E0, c, libultra/io/sirawdma]
|
||||
- [0x5B590, c, libultra/os/epilinkhandle]
|
||||
- [0x5B5E0, c, libultra/io/viblack]
|
||||
- [0x5B650, c, libultra/io/sirawread]
|
||||
- [0x5B6A0, c, libultra/io/sptaskyield]
|
||||
- [0x5B6C0, c, libultra/gu/lookatref]
|
||||
- [0x5BB50, c, libultra/gu/mtxutil]
|
||||
- [0x5BDC0, c, libultra/io/visetmode]
|
||||
- [0x5BE30, c, libultra/io/virepeatline]
|
||||
- [0x5BEA0, c, libultra/io/pfsisplug]
|
||||
- [0x5C1E0, hasm, libultra/os/probetlb]
|
||||
- [0x5C2A0, c, libultra/io/pimgr]
|
||||
- [0x5C410, bin, noppad_5C410]
|
||||
- [0x5C420, c, libultra/io/devmgr]
|
||||
- [0x5C830, c, libultra/io/pirawdma]
|
||||
- [0x5C900, hasm, libultra/os/osGetCount]
|
||||
- [0x5C910, c, libultra/io/conteepprobe]
|
||||
- [0x5C980, c, libultra/io/conteepwrite]
|
||||
- [0x5CD50, c, libultra/os/getmemsize]
|
||||
- [0x5CE70, c, libultra/io/contpfs]
|
||||
- [0x5D9F0, c, libultra/os/seteventmesg]
|
||||
- [0x5DAB0, c, libultra/gu/sqrtf]
|
||||
- [0x5DAC0, c, libultra/os/afterprenmi]
|
||||
- [0x5DAE0, c, libultra/gu/mtxcatf]
|
||||
- [0x5DCF0, c, libultra/gu/mtxcatl]
|
||||
- [0x5DDB0, c, libultra/gu/random]
|
||||
- [0x5DDE0, c, libultra/libc/xprintf]
|
||||
- [0x5EAA0, c, libultra/io/gbpakgetstatus]
|
||||
- [0x5EC20, c, libultra/libc/sprintf]
|
||||
- [0x5ECA0, hasm, libultra/os/unmaptlball]
|
||||
- [0x5ECF0, c, libultra/io/epidma]
|
||||
- [0x5EDD0, c, libultra/al/heapinit]
|
||||
- [0x5EE10, c, libultra/libc/syncprintf]
|
||||
- [0x5EE50, c, libultra/libc/string]
|
||||
- [0x5EEF0, hasm, libultra/os/invalidcache]
|
||||
- [0x5EFA0, c, libultra/os/createmesgqueue]
|
||||
- [0x5EFD0, hasm, libultra/os/invalicache]
|
||||
- [0x5F050, c, libultra/io/conteeplongwrite]
|
||||
- [0x5F140, c, libultra/io/sp]
|
||||
- [0x5F170, c, libultra/io/si]
|
||||
- [0x5F1A0, c, libultra/gu/translate]
|
||||
- [0x5F240, c, libultra/os/jammesg]
|
||||
- [0x5F390, c, libultra/os/setthreadpri]
|
||||
- [0x5F470, c, libultra/os/getthreadpri]
|
||||
- [0x5F490, c, libultra/io/epirawread]
|
||||
- [0x5F5F0, c, libultra/io/viswapbuf]
|
||||
- [0x5F640, c, libultra/io/epirawdma]
|
||||
- [0x5F820, c, libultra/io/sptaskyielded]
|
||||
- [0x5F8A0, c, libultra/gu/rotateRPY]
|
||||
- [0x5FA40, hasm, libultra/libc/bcmp]
|
||||
- [0x5FB60, c, libultra/gu/rotate]
|
||||
- [0x5FD50, c, libultra/os/gettime]
|
||||
- [0x5FDE0, c, libultra/os/timerintr]
|
||||
- [0x601E0, c, libultra/al/synthesizer]
|
||||
- [0x60860, c, libultra/al/drvrNew]
|
||||
- [0x61010, c, libultra/al/mainbus]
|
||||
- [0x61160, c, libultra/al/auxbus]
|
||||
- [0x61270, c, libultra/al/env]
|
||||
- [0x61EF0, c, libultra/al/resample]
|
||||
- [0x621F0, c, libultra/al/load]
|
||||
- [0x62D40, c, libultra/al/filter]
|
||||
- [0x62D60, c, libultra/al/save]
|
||||
- [0x62E20, c, libultra/os/setglobalintmask]
|
||||
- [0x62E70, c, libultra/io/aisetfreq]
|
||||
- [0x62FC0, c, libultra/io/dpctr]
|
||||
- [0x63010, c, libultra/os/getactivequeue]
|
||||
- [0x63020, c, libultra/gu/normalize]
|
||||
- [0x630B0, hasm, libultra/os/setcompare]
|
||||
- [0x630C0, c, libultra/io/aigetstat]
|
||||
- [0x630D0, c, libultra/io/dpsetstat]
|
||||
- [0x630E0, c, libultra/al/copy]
|
||||
- [0x63160, hasm, libultra/libc/bcopy]
|
||||
- [0x63470, c, libultra/os/resetglobalintmask]
|
||||
- [0x634D0, c, libultra/gu/ortho]
|
||||
- [0x63690, hasm, libultra/os/interrupt]
|
||||
- [0x63720, c, libultra/io/vi]
|
||||
- [0x63860, c, libultra/io/viswapcontext]
|
||||
- [0x63B60, c, libultra/io/pigetcmdq]
|
||||
- [0x63B90, asm, libultra/gu/cosf]
|
||||
- [0x63D00, asm, libultra/io/epiread]
|
||||
- [0x63D50, asm, libultra/io/visetspecial]
|
||||
- [0x63EB0, asm, libultra/os/settime]
|
||||
- [0x63EE0, asm, libultra/io/visetevent]
|
||||
- [0x63F50, asm, libultra/io/gbpakreadid]
|
||||
- [0x64110, asm, libultra/io/cartrominit]
|
||||
- [0x64270, asm, libultra/io/pfsselectbank]
|
||||
- [0x642F0, asm, libultra/os/setfpccsr]
|
||||
- [0x64300, asm, libultra/io/aigetlen]
|
||||
- [0x64310, asm, libultra/io/epiwrite]
|
||||
- [0x64360, asm, libultra/os/maptlbrdb]
|
||||
- [0x643C0, asm, libultra/os/yieldthread]
|
||||
- [0x64410, asm, libultra/io/contramwrite]
|
||||
- [0x64660, asm, libultra/io/contramread]
|
||||
- [0x64890, asm, libultra/io/crc]
|
||||
- [0x63B90, c, libultra/gu/cosf]
|
||||
- [0x63D00, c, libultra/io/epiread]
|
||||
- [0x63D50, c, libultra/io/visetspecial]
|
||||
- [0x63EB0, c, libultra/os/settime]
|
||||
- [0x63EE0, c, libultra/io/visetevent]
|
||||
- [0x63F50, c, libultra/io/gbpakreadid]
|
||||
- [0x64110, c, libultra/io/cartrominit]
|
||||
- [0x64270, c, libultra/io/pfsselectbank]
|
||||
- [0x642F0, hasm, libultra/os/setfpccsr]
|
||||
- [0x64300, c, libultra/io/aigetlen]
|
||||
- [0x64310, c, libultra/io/epiwrite]
|
||||
- [0x64360, hasm, libultra/os/maptlbrdb]
|
||||
- [0x643C0, c, libultra/os/yieldthread]
|
||||
- [0x64410, c, libultra/io/contramwrite]
|
||||
- [0x64660, c, libultra/io/contramread]
|
||||
- [0x64890, c, libultra/io/crc]
|
||||
- [0x64A00, hasm, libultra/os/__osGetCause]
|
||||
- [0x64A10, asm, libultra/io/epirawwrite]
|
||||
- [0x64B70, asm, libultra/os/settimer]
|
||||
- [0x64C50, asm] # unknown file(s)
|
||||
- [0x65710, asm, libultra/libc/ldiv]
|
||||
- [0x658A0, asm, libultra/libc/xlitob]
|
||||
- [0x65B40, asm, libultra/io/sirawwrite]
|
||||
- [0x65B90, asm, libultra/io/spsetstat]
|
||||
- [0x65BA0, asm, libultra/io/spgetstat]
|
||||
- [0x65BC0, asm, libultra/io/vimgr]
|
||||
- [0x65ED0, asm, libultra/io/vigetcurrcontext]
|
||||
- [0x65EE0, asm, libultra/os/writebackdcacheall]
|
||||
- [0x65F10, asm, libultra/al/heapalloc]
|
||||
- [0x65F70, asm, libultra/os/startthread]
|
||||
- [0x660C0, asm, libultra/io/visetxscale]
|
||||
- [0x661F0, asm, libultra/io/visetyscale]
|
||||
- [0x66250, asm, libultra/libc/llcvt]
|
||||
- [0x66460, asm, libultra/al/synallocfx]
|
||||
- [0x66500, asm, libultra/al/syndelete]
|
||||
- [0x66510, asm, libultra/io/gbpakreadwrite]
|
||||
- [0x666D0, asm, libultra/io/gbpakselectbank]
|
||||
- [0x667A0, asm, libultra/io/aisetnextbuf]
|
||||
- [0x66850, asm, libultra/io/ai]
|
||||
- [0x66880, asm, libultra/io/conteepread]
|
||||
- [0x66AD0, asm, libultra/io/vigetcurrframebuf]
|
||||
- [0x66B10, asm, libultra/io/spsetpc]
|
||||
- [0x66B50, asm, libultra/os/sethwinterrupt]
|
||||
- [0x64A10, c, libultra/io/epirawwrite]
|
||||
- [0x64B70, c, libultra/os/settimer]
|
||||
- [0x64C50, c, libultra/libc/xldtob]
|
||||
- [0x65710, c, libultra/libc/ldiv]
|
||||
- [0x658A0, c, libultra/libc/xlitob]
|
||||
- [0x65B40, c, libultra/io/sirawwrite]
|
||||
- [0x65B90, c, libultra/io/spsetstat]
|
||||
- [0x65BA0, c, libultra/io/spgetstat]
|
||||
- [0x65BB0, bin, noppad_65BB0]
|
||||
- [0x65BC0, c, libultra/io/vimgr]
|
||||
- [0x65ED0, c, libultra/io/vigetcurrcontext]
|
||||
- [0x65EE0, hasm, libultra/os/writebackdcacheall]
|
||||
- [0x65F10, c, libultra/al/heapalloc]
|
||||
- [0x65F70, c, libultra/os/startthread]
|
||||
- [0x660C0, c, libultra/io/visetxscale]
|
||||
- [0x661F0, c, libultra/io/visetyscale]
|
||||
- [0x66250, c, libultra/libc/llcvt]
|
||||
- [0x66460, c, libultra/al/synallocfx]
|
||||
- [0x66500, c, libultra/al/syndelete]
|
||||
- [0x66510, c, libultra/io/gbpakreadwrite]
|
||||
- [0x666D0, c, libultra/io/gbpakselectbank]
|
||||
- [0x667A0, c, libultra/io/aisetnextbuf]
|
||||
- [0x66850, c, libultra/io/ai]
|
||||
- [0x66880, c, libultra/io/conteepread]
|
||||
- [0x66AD0, c, libultra/io/vigetcurrframebuf]
|
||||
- [0x66B10, c, libultra/io/spsetpc]
|
||||
- [0x66B50, c, libultra/os/sethwinterrupt]
|
||||
#- [0x66BC0, asm]
|
||||
- [0x66BC0, bin] # rest of rom part 1
|
||||
|
||||
# .data is somewhere in here
|
||||
- [0x7A2A0, .data, libultra/os/initialize]
|
||||
- [0x7A2C0, .data, libultra/al/reverb]
|
||||
- [0x7A2E0, bin, rom_data_7A2E0]
|
||||
- [0x7B550, .data, libultra/gu/random]
|
||||
- [0x7B560, .data, libultra/libc/xprintf]
|
||||
- [0x7B5B0, .data, libultra/os/timerintr]
|
||||
- [0x7B5C0, .data, libultra/al/drvrNew]
|
||||
- [0x7B750, .data, libultra/al/env]
|
||||
- [0x7B890, .data, libultra/io/vi]
|
||||
- [0x7B900, bin, rom_data_7B900]
|
||||
- [0x7B9F0, .data, libultra/io/gbpakreadid]
|
||||
- [0x7BA40, .data, libultra/io/cartrominit]
|
||||
- [0x7BA50, bin, rom_data_7BA50]
|
||||
- [0x7BA60, .data, libultra/libc/xlitob]
|
||||
- [0x7BA90, .data, libultra/io/vimgr]
|
||||
- [0x7BAB0, .data, libultra/io/aisetnextbuf]
|
||||
- [0x7BAC0, bin, rom_data_7BAC0]
|
||||
|
||||
# Start of .rodata
|
||||
- [0x7BAC0, .rodata, rsp] # rsp.c rodata
|
||||
- [0x7BB10, bin, rom_rodata] # rest of rodata
|
||||
- [0x7F980, bin] # rest of rom part 2
|
||||
- [0x7BB10, bin, rom_rodata_7BB10]
|
||||
- [0x7EE90, .rodata, libultra/gu/sinf]
|
||||
- [0x7EEE0, bin, rom_rodata_7EEE0]
|
||||
- [0x7EF30, .rodata, libultra/al/reverb]
|
||||
- [0x7EF60, .rodata, libultra/gu/perspective]
|
||||
- [0x7EF70, .rodata, libultra/io/devmgr]
|
||||
- [0x7EF90, .rodata, libultra/libc/xprintf]
|
||||
- [0x7F090, .rodata, libultra/gu/rotateRPY]
|
||||
- [0x7F0A0, .rodata, libultra/gu/rotate]
|
||||
- [0x7F0B0, .rodata, libultra/al/synthesizer]
|
||||
- [0x7F0C0, .rodata, libultra/al/drvrNew]
|
||||
- [0x7F0E0, .rodata, libultra/al/env]
|
||||
- [0x7F130, .rodata, libultra/al/resample]
|
||||
- [0x7F180, .rodata, libultra/gu/cosf]
|
||||
- [0x7F1D0, bin, rom_rodata_7F1D0]
|
||||
- [0x7F1E0, .rodata, libultra/libc/xldtob]
|
||||
- [0x7F240, .rodata, libultra/libc/llcvt]
|
||||
- [0x7F250, bin, rom_rodata_7F250]
|
||||
- [0x7F980]
|
||||
|
||||
# .bss
|
||||
- {vram: 0x8007F190, type: .bss, name: main}
|
||||
- {vram: 0x80081900, type: .bss, name: rsp}
|
||||
- {vram: 0x80083CA0, type: .bss, name: unk_bss}
|
||||
- {vram: 0x80103880, type: .bss, name: libultra/gu/rotate}
|
||||
- {vram: 0x80103890, type: .bss, name: libultra/os/timerintr}
|
||||
- {vram: 0x801038E4, type: .bss, name: libultra/io/cartrominit}
|
||||
- {vram: 0x80103950, type: .bss, name: libultra/io/vimgr}
|
||||
|
||||
# rest of the ROM
|
||||
- [0x7F980, bin]
|
||||
- [0x2000000]
|
||||
|
||||
@@ -76,7 +76,7 @@ extern u64 D_80084C68[0x1];
|
||||
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
|
||||
extern s32 D_80000300;
|
||||
extern s32 osTvType;
|
||||
extern char D_80068B74[];
|
||||
extern f32 D_8007AF10;
|
||||
|
||||
@@ -132,7 +132,7 @@ void func_80001444(struct UnkStruct80001380* arg0, struct UnkArray4* arg1, s32 a
|
||||
void func_80001474(s8 arg0, s8 arg1) {
|
||||
s32 var_v0;
|
||||
|
||||
if (D_80000300 == 2) {
|
||||
if (osTvType == 2) {
|
||||
var_v0 = (arg0 * 2) + arg1 + 8;
|
||||
} else {
|
||||
var_v0 = (arg0 * 2) + arg1 + 4;
|
||||
@@ -142,7 +142,7 @@ void func_80001474(s8 arg0, s8 arg1) {
|
||||
osViSetSpecialFeatures(0x40U);
|
||||
osViSetSpecialFeatures(2U);
|
||||
osViSetSpecialFeatures(0x10U);
|
||||
if (D_80000300 == 0) {
|
||||
if (osTvType == 0) {
|
||||
osViSetYScale(D_8007AF10);
|
||||
}
|
||||
}
|
||||
@@ -191,7 +191,7 @@ void func_800015A8(void) {
|
||||
}
|
||||
if (D_80083CA0.unkAA8 != NULL) {
|
||||
osViSwapBuffer(D_80083CA0.unkAA8->unk8);
|
||||
func_8005B230(0);
|
||||
osViRepeatLine(0);
|
||||
if ((D_80083CA0.unkA9D != D_80083CA0.unkAAD) || (D_80083CA0.unkA9E != D_80083CA0.unkAAE)) {
|
||||
func_80001474((s8) D_80083CA0.unkA9D, (s8) D_80083CA0.unkA9E);
|
||||
}
|
||||
@@ -202,7 +202,7 @@ void func_800015A8(void) {
|
||||
}
|
||||
func_80008F54(D_80083CA0.unkAA8->unk8, *(u16 *)&D_80083CA0.unkAA8->unk4, 0x10);
|
||||
} else {
|
||||
func_8005B230(1);
|
||||
osViRepeatLine(1);
|
||||
osViSwapBuffer(D_80083CA0.unk9E0->unk8);
|
||||
if ((D_80083CA0.unkA9D != D_80083CA0.unkAAD) || (D_80083CA0.unkA9E != D_80083CA0.unkAAE)) {
|
||||
func_80001474((s8) D_80083CA0.unkA9D, (s8) D_80083CA0.unkA9E);
|
||||
@@ -253,7 +253,7 @@ void func_8000183C(void* arg) {
|
||||
}
|
||||
|
||||
void func_800019C8(void) {
|
||||
s32 temp_v0 = D_80000300;
|
||||
s32 temp_v0 = osTvType;
|
||||
|
||||
if ((temp_v0 != 1) && (temp_v0 != 2)) {
|
||||
osViBlack(1U);
|
||||
|
||||
65
src/libultra/al/auxbus.c
Normal file
65
src/libultra/al/auxbus.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/*====================================================================
|
||||
* auxbus.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include <libaudio.h>
|
||||
#include "synthInternals.h"
|
||||
|
||||
Acmd *alAuxBusPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset,
|
||||
Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
ALAuxBus *m = (ALAuxBus *)filter;
|
||||
ALFilter **sources = m->sources;
|
||||
s32 i;
|
||||
|
||||
/*
|
||||
* clear the output buffers here
|
||||
*/
|
||||
aClearBuffer(ptr++, AL_AUX_L_OUT, outCount<<1);
|
||||
aClearBuffer(ptr++, AL_AUX_R_OUT, outCount<<1);
|
||||
|
||||
for (i = 0; i < m->sourceCount; i++) {
|
||||
ptr = (sources[i]->handler)(sources[i], outp, outCount, sampleOffset,
|
||||
ptr);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
s32 alAuxBusParam(void *filter, s32 paramID, void *param)
|
||||
{
|
||||
ALAuxBus *m = (ALAuxBus *) filter;
|
||||
ALFilter **sources = m->sources;
|
||||
|
||||
switch (paramID) {
|
||||
|
||||
case (AL_FILTER_ADD_SOURCE):
|
||||
sources[m->sourceCount++] = (ALFilter *) param;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* ??? */
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
143
src/libultra/al/bnkf.c
Normal file
143
src/libultra/al/bnkf.c
Normal file
@@ -0,0 +1,143 @@
|
||||
/*====================================================================
|
||||
* bnkf.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include <libaudio.h>
|
||||
#include <os_internal.h>
|
||||
#include <ultraerror.h>
|
||||
|
||||
/*
|
||||
* ### when the file format settles down a little, I'll remove these
|
||||
* ### for efficiency.
|
||||
*/
|
||||
static void _bnkfPatchBank(ALBank *bank, s32 offset, s32 table);
|
||||
static void _bnkfPatchInst(ALInstrument *i, s32 offset, s32 table);
|
||||
static void _bnkfPatchSound(ALSound *s, s32 offset, s32 table);
|
||||
static void _bnkfPatchWaveTable(ALWaveTable *w, s32 offset, s32 table);
|
||||
|
||||
void alSeqFileNew(ALSeqFile *file, u8 *base)
|
||||
{
|
||||
s32 offset = (s32) base;
|
||||
s32 i;
|
||||
|
||||
/*
|
||||
* patch the file so that offsets are pointers
|
||||
*/
|
||||
for (i = 0; i < file->seqCount; i++) {
|
||||
file->seqArray[i].offset = (u8 *)((u8 *)file->seqArray[i].offset + offset);
|
||||
}
|
||||
}
|
||||
|
||||
void alBnkfNew(ALBankFile *file, u8 *table)
|
||||
{
|
||||
s32 offset = (s32) file;
|
||||
s32 woffset = (s32) table;
|
||||
|
||||
s32 i;
|
||||
|
||||
/*
|
||||
* check the file format revision in debug libraries
|
||||
*/
|
||||
ALFailIf(file->revision != AL_BANK_VERSION, ERR_ALBNKFNEW);
|
||||
|
||||
/*
|
||||
* patch the file so that offsets are pointers
|
||||
*/
|
||||
for (i = 0; i < file->bankCount; i++) {
|
||||
file->bankArray[i] = (ALBank *)((u8 *)file->bankArray[i] + offset);
|
||||
if(file->bankArray[i])
|
||||
_bnkfPatchBank(file->bankArray[i], offset, woffset);
|
||||
}
|
||||
}
|
||||
|
||||
void _bnkfPatchBank(ALBank *bank, s32 offset, s32 table)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
if (bank->flags)
|
||||
return;
|
||||
|
||||
bank->flags = 1;
|
||||
|
||||
if (bank->percussion) {
|
||||
bank->percussion = (ALInstrument *)((u8 *)bank->percussion + offset);
|
||||
_bnkfPatchInst(bank->percussion, offset, table);
|
||||
}
|
||||
|
||||
for (i = 0; i < bank->instCount; i++) {
|
||||
bank->instArray[i] = (ALInstrument *)((u8 *)bank->instArray[i] +
|
||||
offset);
|
||||
if(bank->instArray[i])
|
||||
_bnkfPatchInst(bank->instArray[i], offset, table);
|
||||
}
|
||||
}
|
||||
|
||||
void _bnkfPatchInst(ALInstrument *inst, s32 offset, s32 table)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
if (inst->flags)
|
||||
return;
|
||||
|
||||
inst->flags = 1;
|
||||
|
||||
for (i = 0; i < inst->soundCount; i++) {
|
||||
inst->soundArray[i] = (ALSound *)((u8 *)inst->soundArray[i] +
|
||||
offset);
|
||||
_bnkfPatchSound(inst->soundArray[i], offset, table);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void _bnkfPatchSound(ALSound *s, s32 offset, s32 table)
|
||||
{
|
||||
if (s->flags)
|
||||
return;
|
||||
|
||||
s->flags = 1;
|
||||
|
||||
s->envelope = (ALEnvelope *)((u8 *)s->envelope + offset);
|
||||
s->keyMap = (ALKeyMap *)((u8 *)s->keyMap + offset);
|
||||
|
||||
s->wavetable = (ALWaveTable *)((u8 *)s->wavetable + offset);
|
||||
_bnkfPatchWaveTable(s->wavetable, offset, table);
|
||||
}
|
||||
|
||||
void _bnkfPatchWaveTable(ALWaveTable *w, s32 offset, s32 table)
|
||||
{
|
||||
if (w->flags)
|
||||
return;
|
||||
|
||||
w->flags = 1;
|
||||
|
||||
w->base += table;
|
||||
|
||||
/* sct 2/14/96 - patch wavetable loop info based on type. */
|
||||
if (w->type == AL_ADPCM_WAVE)
|
||||
{
|
||||
w->waveInfo.adpcmWave.book = (ALADPCMBook *)((u8 *)w->waveInfo.adpcmWave.book + offset);
|
||||
if (w->waveInfo.adpcmWave.loop)
|
||||
w->waveInfo.adpcmWave.loop = (ALADPCMloop *)((u8 *)w->waveInfo.adpcmWave.loop + offset);
|
||||
}
|
||||
else if (w->type == AL_RAW16_WAVE)
|
||||
{
|
||||
if (w->waveInfo.rawWave.loop)
|
||||
w->waveInfo.rawWave.loop = (ALRawLoop *)((u8 *)w->waveInfo.rawWave.loop + offset);
|
||||
}
|
||||
}
|
||||
34
src/libultra/al/copy.c
Normal file
34
src/libultra/al/copy.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/*====================================================================
|
||||
* copy.c
|
||||
*
|
||||
* Synopsis:
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include <libaudio.h>
|
||||
|
||||
void alCopy(void *src, void *dest, s32 len)
|
||||
{
|
||||
s32 i;
|
||||
u8 *s = (u8 *)src;
|
||||
u8 *d = (u8 *)dest;
|
||||
|
||||
for (i = 0; i < len; i++){
|
||||
*d++ = *s++;
|
||||
}
|
||||
}
|
||||
305
src/libultra/al/drvrNew.c
Normal file
305
src/libultra/al/drvrNew.c
Normal file
@@ -0,0 +1,305 @@
|
||||
/*====================================================================
|
||||
* drvrNew.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include <libaudio.h>
|
||||
#include "synthInternals.h"
|
||||
#include <os.h>
|
||||
#include "initfx.h"
|
||||
|
||||
// TODO: this comes from a header
|
||||
#ident "$Revision: 1.49 $"
|
||||
|
||||
/*
|
||||
* WARNING: THE FOLLOWING CONSTANT MUST BE KEPT IN SYNC
|
||||
* WITH SCALING IN MICROCODE!!!
|
||||
*/
|
||||
#define SCALE 16384
|
||||
|
||||
/*
|
||||
* the following arrays contain default parameters for
|
||||
* a few hopefully useful effects.
|
||||
*/
|
||||
#define ms *(((s32)((f32)44.1))&~0x7)
|
||||
|
||||
|
||||
static s32 SMALLROOM_PARAMS[26] = {
|
||||
/* sections length */
|
||||
3, 100 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 54 ms, 9830, -9830, 0, 0, 0, 0,
|
||||
19 ms, 38 ms, 3276, -3276, 0x3fff, 0, 0, 0,
|
||||
0, 60 ms, 5000, 0, 0, 0, 0, 0x5000
|
||||
};
|
||||
|
||||
static s32 BIGROOM_PARAMS[34] = {
|
||||
/* sections length */
|
||||
4, 100 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 66 ms, 9830, -9830, 0, 0, 0, 0,
|
||||
22 ms, 54 ms, 3276, -3276, 0x3fff, 0, 0, 0,
|
||||
66 ms, 91 ms, 3276, -3276, 0x3fff, 0, 0, 0,
|
||||
0, 94 ms, 8000, 0, 0, 0, 0, 0x5000
|
||||
};
|
||||
|
||||
static s32 ECHO_PARAMS[10] = {
|
||||
/* sections length */
|
||||
1, 200 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 179 ms, 12000, 0, 0x7fff, 0, 0, 0
|
||||
};
|
||||
|
||||
static s32 CHORUS_PARAMS[10] = {
|
||||
/* sections length */
|
||||
1, 20 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 5 ms, 0x4000, 0, 0x7fff, 7600, 700, 0
|
||||
};
|
||||
|
||||
static s32 FLANGE_PARAMS[10] = {
|
||||
/* sections length */
|
||||
1, 20 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 5 ms, 0, 0x5fff, 0x7fff, 380, 500, 0
|
||||
};
|
||||
|
||||
static s32 NULL_PARAMS[10] = {
|
||||
0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
|
||||
void _init_lpfilter(ALLowPass *lp)
|
||||
{
|
||||
s32 i, temp;
|
||||
s16 fc;
|
||||
f64 ffc, fcoef;
|
||||
|
||||
temp = lp->fc * SCALE;
|
||||
fc = temp >> 15;
|
||||
lp->fgain = SCALE - fc;
|
||||
|
||||
lp->first = 1;
|
||||
for (i=0; i<8; i++)
|
||||
lp->fcvec.fccoef[i] = 0;
|
||||
|
||||
lp->fcvec.fccoef[i++] = fc;
|
||||
fcoef = ffc = (f64)fc/SCALE;
|
||||
|
||||
for (; i<16; i++){
|
||||
fcoef *= ffc;
|
||||
lp->fcvec.fccoef[i] = (s16)(fcoef * SCALE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void alFxNew(ALFx *r, ALSynConfig *c, ALHeap *hp)
|
||||
{
|
||||
u16 i, j, k;
|
||||
s32 *param = 0;
|
||||
ALFilter *f = (ALFilter *) r;
|
||||
ALDelay *d;
|
||||
|
||||
alFilterNew(f, 0, alFxParam, AL_FX);
|
||||
f->handler = alFxPull;
|
||||
r->paramHdl = (ALSetFXParam)alFxParamHdl;
|
||||
|
||||
switch (c->fxType) {
|
||||
case AL_FX_SMALLROOM: param = SMALLROOM_PARAMS; break;
|
||||
case AL_FX_BIGROOM: param = BIGROOM_PARAMS; break;
|
||||
case AL_FX_ECHO: param = ECHO_PARAMS; break;
|
||||
case AL_FX_CHORUS: param = CHORUS_PARAMS; break;
|
||||
case AL_FX_FLANGE: param = FLANGE_PARAMS; break;
|
||||
case AL_FX_CUSTOM: param = c->params; break;
|
||||
default: param = NULL_PARAMS; break;
|
||||
}
|
||||
|
||||
|
||||
j = 0;
|
||||
|
||||
r->section_count = param[j++];
|
||||
r->length = param[j++];
|
||||
|
||||
r->delay = alHeapAlloc(hp, r->section_count, sizeof(ALDelay));
|
||||
r->base = alHeapAlloc(hp, r->length, sizeof(s16));
|
||||
r->input = r->base;
|
||||
|
||||
for ( k=0; k < r->length; k++)
|
||||
r->base[k] = 0;
|
||||
|
||||
for ( i=0; i<r->section_count; i++ ){
|
||||
d = &r->delay[i];
|
||||
d->input = param[j++];
|
||||
d->output = param[j++];
|
||||
d->fbcoef = param[j++];
|
||||
d->ffcoef = param[j++];
|
||||
d->gain = param[j++];
|
||||
|
||||
if (param[j]) {
|
||||
#define RANGE 2.0
|
||||
/* d->rsinc = ((f32) param[j++])/0xffffff; */
|
||||
d->rsinc = ((((f32)param[j++])/1000) * RANGE)/c->outputRate;
|
||||
|
||||
/*
|
||||
* the following constant is derived from:
|
||||
*
|
||||
* ratio = 2^(cents/1200)
|
||||
*
|
||||
* and therefore for hundredths of a cent
|
||||
* x
|
||||
* ln(ratio) = ---------------
|
||||
* (120,000)/ln(2)
|
||||
* where
|
||||
* 120,000/ln(2) = 173123.40...
|
||||
*/
|
||||
#define CONVERT 173123.404906676
|
||||
#define LENGTH (d->output - d->input)
|
||||
d->rsgain = (((f32) param[j++])/CONVERT) * LENGTH;
|
||||
d->rsval = 1.0;
|
||||
d->rsdelta = 0.0;
|
||||
d->rs = alHeapAlloc(hp, 1, sizeof(ALResampler));
|
||||
d->rs->state = alHeapAlloc(hp, 1, sizeof(RESAMPLE_STATE));
|
||||
d->rs->delta = 0.0;
|
||||
d->rs->first = 1;
|
||||
} else {
|
||||
d->rs = 0;
|
||||
j++;
|
||||
j++;
|
||||
}
|
||||
|
||||
if (param[j]) {
|
||||
d->lp = alHeapAlloc(hp, 1, sizeof(ALLowPass));
|
||||
d->lp->fstate = alHeapAlloc(hp, 1, sizeof(POLEF_STATE));
|
||||
d->lp->fc = param[j++];
|
||||
_init_lpfilter(d->lp);
|
||||
} else {
|
||||
d->lp = 0;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void alEnvmixerNew(ALEnvMixer *e, ALHeap *hp)
|
||||
{
|
||||
alFilterNew((ALFilter *) e, alEnvmixerPull, alEnvmixerParam, AL_ENVMIX);
|
||||
|
||||
e->state = alHeapAlloc(hp, 1, sizeof(ENVMIX_STATE));
|
||||
|
||||
e->first = 1;
|
||||
e->motion = AL_STOPPED;
|
||||
e->volume = 1;
|
||||
e->ltgt = 1;
|
||||
e->rtgt = 1;
|
||||
e->cvolL = 1;
|
||||
e->cvolR = 1;
|
||||
e->dryamt = 0;
|
||||
e->wetamt = 0;
|
||||
e->lratm = 1;
|
||||
e->lratl = 0;
|
||||
e->lratm = 1;
|
||||
e->lratl = 0;
|
||||
e->delta = 0;
|
||||
e->segEnd = 0;
|
||||
e->pan = 0;
|
||||
e->ctrlList = 0;
|
||||
e->ctrlTail = 0;
|
||||
e->sources = 0;
|
||||
}
|
||||
|
||||
void alLoadNew(ALLoadFilter *f, ALDMANew dmaNew, ALHeap *hp)
|
||||
{
|
||||
s32
|
||||
i;
|
||||
|
||||
/*
|
||||
* init filter superclass
|
||||
*/
|
||||
|
||||
alFilterNew((ALFilter *) f, alAdpcmPull, alLoadParam, AL_ADPCM);
|
||||
|
||||
f->state = alHeapAlloc(hp, 1, sizeof(ADPCM_STATE));
|
||||
f->lstate = alHeapAlloc(hp, 1, sizeof(ADPCM_STATE));
|
||||
|
||||
f->dma = dmaNew(&f->dmaState);
|
||||
|
||||
/*
|
||||
* init the adpcm state
|
||||
*/
|
||||
f->lastsam = 0;
|
||||
f->first = 1;
|
||||
f->memin = 0;
|
||||
}
|
||||
|
||||
void alResampleNew(ALResampler *r, ALHeap *hp)
|
||||
{
|
||||
alFilterNew((ALFilter *) r, alResamplePull, alResampleParam, AL_RESAMPLE);
|
||||
|
||||
/*
|
||||
* Init resampler state
|
||||
*/
|
||||
r->state = alHeapAlloc(hp, 1, sizeof(RESAMPLE_STATE));
|
||||
r->delta = 0.0;
|
||||
r->first = 1;
|
||||
r->motion = AL_STOPPED;
|
||||
r->ratio = 1.0;
|
||||
r->upitch = 0;
|
||||
r->ctrlList = 0;
|
||||
r->ctrlTail = 0;
|
||||
|
||||
/* state in the ucode is initialized by the A_INIT flag */
|
||||
}
|
||||
|
||||
void alAuxBusNew(ALAuxBus *m, void *sources, s32 maxSources)
|
||||
{
|
||||
alFilterNew((ALFilter *) m, alAuxBusPull, alAuxBusParam, AL_AUXBUS);
|
||||
m->sourceCount = 0;
|
||||
m->maxSources = maxSources;
|
||||
m->sources = (ALFilter **)sources;
|
||||
}
|
||||
|
||||
void alMainBusNew(ALMainBus *m, void *sources, s32 maxSources)
|
||||
{
|
||||
alFilterNew((ALFilter *) m, alMainBusPull, alMainBusParam, AL_MAINBUS);
|
||||
m->sourceCount = 0;
|
||||
m->maxSources = maxSources;
|
||||
m->sources = (ALFilter **)sources;
|
||||
}
|
||||
|
||||
void alSaveNew(ALSave *f)
|
||||
{
|
||||
/*
|
||||
* init filter superclass
|
||||
*/
|
||||
|
||||
alFilterNew((ALFilter *) f, alSavePull, alSaveParam, AL_SAVE);
|
||||
|
||||
/*
|
||||
* init the save state, which is a virtual dram address
|
||||
*/
|
||||
|
||||
f->dramout = 0;
|
||||
f->first = 1;
|
||||
|
||||
}
|
||||
|
||||
594
src/libultra/al/env.c
Normal file
594
src/libultra/al/env.c
Normal file
@@ -0,0 +1,594 @@
|
||||
/*====================================================================
|
||||
* envmixer.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include <libaudio.h>
|
||||
#include "synthInternals.h"
|
||||
#include <os.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
// TODO: these come from headers
|
||||
#ident "$Revision: 1.49 $"
|
||||
#ident "$Revision: 1.17 $"
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
extern u32 cnt_index, env_num, env_cnt, env_max, env_min, lastCnt[];
|
||||
extern u32 rate_num, rate_cnt, rate_max, rate_min;
|
||||
extern u32 vol_num, vol_cnt, vol_max, vol_min;
|
||||
#endif
|
||||
|
||||
#define EQPOWER_LENGTH 128
|
||||
static s16 eqpower[ EQPOWER_LENGTH ] = {
|
||||
32767, 32764, 32757, 32744, 32727, 32704,
|
||||
32677, 32644, 32607, 32564, 32517, 32464,
|
||||
32407, 32344, 32277, 32205, 32127, 32045,
|
||||
31958, 31866, 31770, 31668, 31561, 31450,
|
||||
31334, 31213, 31087, 30957, 30822, 30682,
|
||||
30537, 30388, 30234, 30075, 29912, 29744,
|
||||
29572, 29395, 29214, 29028, 28838, 28643,
|
||||
28444, 28241, 28033, 27821, 27605, 27385,
|
||||
27160, 26931, 26698, 26461, 26220, 25975,
|
||||
25726, 25473, 25216, 24956, 24691, 24423,
|
||||
24151, 23875, 23596, 23313, 23026, 22736,
|
||||
22442, 22145, 21845, 21541, 21234, 20924,
|
||||
20610, 20294, 19974, 19651, 19325, 18997,
|
||||
18665, 18331, 17993, 17653, 17310, 16965,
|
||||
16617, 16266, 15913, 15558, 15200, 14840,
|
||||
14477, 14113, 13746, 13377, 13006, 12633,
|
||||
12258, 11881, 11503, 11122, 10740, 10357,
|
||||
9971, 9584, 9196, 8806, 8415, 8023,
|
||||
7630, 7235, 6839, 6442, 6044, 5646,
|
||||
5246, 4845, 4444, 4042, 3640, 3237,
|
||||
2833, 2429, 2025, 1620, 1216, 810,
|
||||
405, 0
|
||||
};
|
||||
|
||||
extern f64 __pow(f64, f64);
|
||||
|
||||
/*
|
||||
* prototypes for private enveloper functions
|
||||
*/
|
||||
static Acmd *_pullSubFrame(void *filter, s16 *inp, s16 *outp, s32 outCount,
|
||||
s32 sampleOffset, Acmd *p) ;
|
||||
static s16 _getRate(f64 vol, f64 tgt, s32 count, u16* ratel);
|
||||
|
||||
static f32 _getVol(f32 ivol, s32 samples, s16 ratem, u16 ratel);
|
||||
|
||||
/***********************************************************************
|
||||
* Enveloper filter public interfaces
|
||||
***********************************************************************/
|
||||
Acmd *alEnvmixerPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset,
|
||||
Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
ALEnvMixer *e = (ALEnvMixer *)filter;
|
||||
s16 inp;
|
||||
s32 lastOffset;
|
||||
s32 thisOffset = sampleOffset;
|
||||
s32 samples;
|
||||
s16 loutp = 0;
|
||||
s32 fVol;
|
||||
ALParam *thisParam;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Force the input to be the resampler output
|
||||
*/
|
||||
inp = AL_RESAMPLER_OUT;
|
||||
|
||||
while (e->ctrlList != 0) {
|
||||
|
||||
lastOffset = thisOffset;
|
||||
thisOffset = e->ctrlList->delta;
|
||||
samples = thisOffset - lastOffset;
|
||||
if (samples > outCount)
|
||||
break;
|
||||
|
||||
#ifdef _DEBUG
|
||||
assert(samples >= 0);
|
||||
assert(samples <= AL_MAX_RSP_SAMPLES);
|
||||
#endif
|
||||
|
||||
switch (e->ctrlList->type) {
|
||||
case (AL_FILTER_START_VOICE_ALT):
|
||||
{
|
||||
ALStartParamAlt *param = (ALStartParamAlt *)e->ctrlList;
|
||||
ALFilter *f = (ALFilter *) e;
|
||||
s32 tmp;
|
||||
|
||||
if (param->unity) {
|
||||
(*e->filter.setParam)(&e->filter,
|
||||
AL_FILTER_SET_UNITY_PITCH, 0);
|
||||
}
|
||||
|
||||
(*e->filter.setParam)(&e->filter, AL_FILTER_SET_WAVETABLE,
|
||||
param->wave);
|
||||
(*e->filter.setParam)(&e->filter, AL_FILTER_START, 0);
|
||||
|
||||
e->first = 1;
|
||||
|
||||
e->delta = 0;
|
||||
e->segEnd = param->samples;
|
||||
|
||||
tmp = ((s32)param->volume * (s32)param->volume) >> 15;
|
||||
e->volume = (s16) tmp;
|
||||
e->pan = param->pan;
|
||||
e->dryamt = eqpower[param->fxMix];
|
||||
e->wetamt = eqpower[EQPOWER_LENGTH - param->fxMix - 1];
|
||||
|
||||
if (param->samples) {
|
||||
e->cvolL = 1;
|
||||
e->cvolR = 1;
|
||||
} else {
|
||||
/*
|
||||
* Attack time is zero. Simply set the
|
||||
* volume. We don't want an attack segment.
|
||||
*/
|
||||
e->cvolL = (e->volume * eqpower[e->pan]) >> 15;
|
||||
e->cvolR = (e->volume *
|
||||
eqpower[EQPOWER_LENGTH - e->pan - 1]) >> 15;
|
||||
}
|
||||
|
||||
if (f->source) {
|
||||
union {
|
||||
f32 f;
|
||||
s32 i;
|
||||
} data;
|
||||
data.f = param->pitch;
|
||||
(*f->source->setParam)(f->source, AL_FILTER_SET_PITCH,
|
||||
(void *)data.i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case (AL_FILTER_SET_FXAMT):
|
||||
case (AL_FILTER_SET_PAN):
|
||||
case (AL_FILTER_SET_VOLUME):
|
||||
ptr = _pullSubFrame(e, &inp, &loutp, samples, sampleOffset, ptr);
|
||||
|
||||
if (e->delta >= e->segEnd){
|
||||
/*
|
||||
* We should have reached our target, calculate
|
||||
* target in case e->segEnd was 0
|
||||
*/
|
||||
e->ltgt = (e->volume * eqpower[e->pan]) >> 15;
|
||||
e->rtgt = (e->volume *
|
||||
eqpower[EQPOWER_LENGTH - e->pan - 1]) >> 15;
|
||||
e->delta = e->segEnd; /* To prevent overflow */
|
||||
e->cvolL = e->ltgt;
|
||||
e->cvolR = e->rtgt;
|
||||
} else {
|
||||
/*
|
||||
* Estimate the current volume
|
||||
*/
|
||||
e->cvolL = _getVol(e->cvolL, e->delta, e->lratm, e->lratl);
|
||||
e->cvolR = _getVol(e->cvolR, e->delta, e->rratm, e->rratl);
|
||||
}
|
||||
|
||||
/*
|
||||
* We can't have volume of zero, because the envelope
|
||||
* would never go anywhere from there
|
||||
*/
|
||||
if( e->cvolL == 0 ) e->cvolL = 1;
|
||||
if( e->cvolR == 0 ) e->cvolR = 1;
|
||||
|
||||
if (e->ctrlList->type == AL_FILTER_SET_PAN)
|
||||
|
||||
/*
|
||||
* This should result in a change to the current
|
||||
* segment rate and target
|
||||
*/
|
||||
e->pan = (s16) e->ctrlList->data.i;
|
||||
|
||||
if (e->ctrlList->type == AL_FILTER_SET_VOLUME){
|
||||
|
||||
/*
|
||||
* Switching to a new segment
|
||||
*/
|
||||
e->delta = 0;
|
||||
|
||||
/*
|
||||
* Map volume non-linearly to give something close to
|
||||
* loudness
|
||||
*/
|
||||
fVol = (e->ctrlList->data.i);
|
||||
fVol = (fVol*fVol)>>15;
|
||||
e->volume = (s16) fVol;
|
||||
|
||||
e->segEnd = e->ctrlList->moredata.i;
|
||||
|
||||
}
|
||||
|
||||
if (e->ctrlList->type == AL_FILTER_SET_FXAMT){
|
||||
e->dryamt = eqpower[e->ctrlList->data.i];
|
||||
e->wetamt = eqpower[EQPOWER_LENGTH - e->ctrlList->data.i - 1];
|
||||
}
|
||||
|
||||
/*
|
||||
* Force a volume update
|
||||
*/
|
||||
e->first = 1;
|
||||
break;
|
||||
|
||||
case (AL_FILTER_START_VOICE):
|
||||
{
|
||||
ALStartParam *p = (ALStartParam *)e->ctrlList;
|
||||
|
||||
/*
|
||||
* Changing to PLAYING (since the previous state was
|
||||
* persumable STOPPED, we'll just bump the output
|
||||
* pointer rather than pull a subframe of zeros).
|
||||
*/
|
||||
if (p->unity) {
|
||||
(*e->filter.setParam)(&e->filter,
|
||||
AL_FILTER_SET_UNITY_PITCH, 0);
|
||||
}
|
||||
|
||||
(*e->filter.setParam)(&e->filter, AL_FILTER_SET_WAVETABLE,
|
||||
p->wave);
|
||||
(*e->filter.setParam)(&e->filter, AL_FILTER_START, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case (AL_FILTER_STOP_VOICE):
|
||||
{
|
||||
/*
|
||||
* Changing to STOPPED and reset the filter
|
||||
*/
|
||||
ptr = _pullSubFrame(e, &inp, &loutp, samples, sampleOffset, ptr);
|
||||
(*e->filter.setParam)(&e->filter, AL_FILTER_RESET, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case (AL_FILTER_FREE_VOICE):
|
||||
{
|
||||
ALSynth *drvr = &alGlobals->drvr;
|
||||
ALFreeParam *param = (ALFreeParam *)e->ctrlList;
|
||||
param->pvoice->offset = 0;
|
||||
_freePVoice(drvr, (PVoice *)param->pvoice);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* Pull the reuired number of samples and then pass the message
|
||||
* on down the chain
|
||||
*/
|
||||
ptr = _pullSubFrame(e, &inp, &loutp, samples, sampleOffset, ptr);
|
||||
(*e->filter.setParam)(&e->filter, e->ctrlList->type,
|
||||
(void *) e->ctrlList->data.i);
|
||||
break;
|
||||
}
|
||||
loutp += (samples<<1);
|
||||
outCount -= samples;
|
||||
|
||||
/*
|
||||
* put the param record back on the free list
|
||||
*/
|
||||
thisParam = e->ctrlList;
|
||||
e->ctrlList = e->ctrlList->next;
|
||||
if (e->ctrlList == 0)
|
||||
e->ctrlTail = 0;
|
||||
|
||||
__freeParam(thisParam);
|
||||
|
||||
}
|
||||
|
||||
ptr = _pullSubFrame(e, &inp, &loutp, outCount, sampleOffset, ptr);
|
||||
|
||||
/*
|
||||
* Prevent overflow in e->delta
|
||||
*/
|
||||
if (e->delta > e->segEnd)
|
||||
e->delta = e->segEnd;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(env_num, env_cnt, env_max, env_min);
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
|
||||
s32
|
||||
alEnvmixerParam(void *filter, s32 paramID, void *param)
|
||||
{
|
||||
ALFilter *f = (ALFilter *) filter;
|
||||
ALEnvMixer *e = (ALEnvMixer *) filter;
|
||||
|
||||
switch (paramID) {
|
||||
|
||||
case (AL_FILTER_ADD_UPDATE):
|
||||
if (e->ctrlTail) {
|
||||
e->ctrlTail->next = (ALParam *)param;
|
||||
} else {
|
||||
e->ctrlList = (ALParam *)param;
|
||||
}
|
||||
e->ctrlTail = (ALParam *)param;
|
||||
|
||||
break;
|
||||
|
||||
case (AL_FILTER_RESET):
|
||||
e->first = 1;
|
||||
e->motion = AL_STOPPED;
|
||||
e->volume = 1;
|
||||
if (f->source)
|
||||
(*f->source->setParam)(f->source, AL_FILTER_RESET, param);
|
||||
break;
|
||||
|
||||
case (AL_FILTER_START):
|
||||
e->motion = AL_PLAYING;
|
||||
if (f->source)
|
||||
(*f->source->setParam)(f->source, AL_FILTER_START, param);
|
||||
break;
|
||||
|
||||
case (AL_FILTER_SET_SOURCE):
|
||||
f->source = (ALFilter *) param;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (f->source)
|
||||
(*f->source->setParam)(f->source, paramID, param);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
Acmd* _pullSubFrame(void *filter, s16 *inp, s16 *outp, s32 outCount,
|
||||
s32 sampleOffset, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
ALEnvMixer *e = (ALEnvMixer *)filter;
|
||||
ALFilter *source= e->filter.source;
|
||||
|
||||
/* filter must be playing and request non-zero output samples to pull. */
|
||||
if (e->motion != AL_PLAYING || !outCount)
|
||||
return ptr;
|
||||
|
||||
/*
|
||||
* ask all filters upstream from us to build their command
|
||||
* lists.
|
||||
*/
|
||||
#ifdef _DEBUG
|
||||
assert(source);
|
||||
#endif
|
||||
|
||||
ptr = (*source->handler)(source, inp, outCount, sampleOffset, p);
|
||||
|
||||
/*
|
||||
* construct our portion of the command list
|
||||
*/
|
||||
aSetBuffer(ptr++, A_MAIN, *inp, AL_MAIN_L_OUT + *outp, outCount<<1);
|
||||
aSetBuffer(ptr++, A_AUX, AL_MAIN_R_OUT + *outp, AL_AUX_L_OUT + *outp,
|
||||
AL_AUX_R_OUT + *outp);
|
||||
|
||||
if (e->first){
|
||||
e->first = 0;
|
||||
|
||||
/*
|
||||
* Calculate derived parameters
|
||||
*/
|
||||
e->ltgt = (e->volume * eqpower[e->pan]) >> 15;
|
||||
e->lratm = _getRate((f64)e->cvolL, (f64)e->ltgt,
|
||||
e->segEnd, &(e->lratl));
|
||||
e->rtgt = (e->volume *
|
||||
eqpower[EQPOWER_LENGTH - e->pan - 1]) >> 15;
|
||||
e->rratm = _getRate((f64)e->cvolR, (f64)e->rtgt, e->segEnd,
|
||||
&(e->rratl));
|
||||
|
||||
aSetVolume(ptr++, A_LEFT | A_VOL, e->cvolL, 0, 0);
|
||||
aSetVolume(ptr++, A_RIGHT | A_VOL, e->cvolR, 0, 0);
|
||||
aSetVolume(ptr++, A_LEFT | A_RATE, e->ltgt, e->lratm, e->lratl);
|
||||
aSetVolume(ptr++, A_RIGHT | A_RATE, e->rtgt, e->rratm, e->rratl);
|
||||
aSetVolume(ptr++, A_AUX, e->dryamt, 0, e->wetamt);
|
||||
aEnvMixer (ptr++, A_INIT | A_AUX, osVirtualToPhysical(e->state));
|
||||
}
|
||||
else
|
||||
aEnvMixer(ptr++, A_CONTINUE | A_AUX, osVirtualToPhysical(e->state));
|
||||
|
||||
/*
|
||||
* bump the input buffer pointer
|
||||
*/
|
||||
|
||||
*inp += (outCount<<1);
|
||||
e->delta += outCount;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#define EXP_MASK 0x7f800000
|
||||
#define MANT_MASK 0x807fffff
|
||||
|
||||
f64
|
||||
_frexpf(f64 value, s32 *eptr)
|
||||
{
|
||||
f64 absvalue;
|
||||
|
||||
*eptr = 0;
|
||||
if (value == 0.0) /* nothing to do for zero */
|
||||
return (value);
|
||||
absvalue = (value > 0.0) ? value : -value;
|
||||
for ( ; absvalue >= 1.0; absvalue *= 0.5)
|
||||
++*eptr;
|
||||
for ( ; absvalue < 0.5; absvalue += absvalue)
|
||||
--*eptr;
|
||||
return (value > 0.0 ? absvalue : -absvalue);
|
||||
}
|
||||
|
||||
f64
|
||||
_ldexpf(f64 in, s32 ex)
|
||||
{
|
||||
s32 exp;
|
||||
|
||||
if ( ex ) {
|
||||
exp = 1 << ex;
|
||||
in *= (f64)exp;
|
||||
}
|
||||
|
||||
return ( in );
|
||||
}
|
||||
|
||||
/*
|
||||
_getRate() -- This function determines how to go from the
|
||||
current volume level (vol) to the target
|
||||
volume level (tgt) in some number of steps
|
||||
(count). Two values are returned that are
|
||||
used as multipliers to incrementally scale
|
||||
the volume. Some tricky math is used and
|
||||
is explained below.
|
||||
RWW 28jun95
|
||||
*/
|
||||
|
||||
static
|
||||
s16 _getRate(f64 vol, f64 tgt, s32 count, u16* ratel)
|
||||
{
|
||||
s16 s;
|
||||
|
||||
f64 invn = 1.0/count, eps, a, fs, mant;
|
||||
s32 i_invn, ex, indx;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
if (count == 0){
|
||||
if (tgt >= vol){
|
||||
*ratel = 0xffff;
|
||||
return 0x7fff;
|
||||
}
|
||||
else{
|
||||
*ratel = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (tgt < 1.0)
|
||||
tgt = 1.0;
|
||||
if (vol <= 0) vol = 1; /* zero and neg values not allowed */
|
||||
|
||||
#define NBITS (3)
|
||||
#define NPOS (1<<NBITS)
|
||||
#define NFRACBITS (30)
|
||||
#define M_LN2 0.69314718055994530942
|
||||
/*
|
||||
* rww's parametric pow()
|
||||
Goal: compute a = (tgt/vol)^(1/count)
|
||||
|
||||
Approach:
|
||||
(tgt/vol)^(1/count) =
|
||||
((tgt/vol)^(1/2^30))^(2^30*1/count)
|
||||
|
||||
(tgt/vol)^(1/2^30) ~= 1 + eps
|
||||
|
||||
where
|
||||
|
||||
eps ~= ln(tgt/vol)/2^30
|
||||
|
||||
ln(tgt/vol) = ln2(tgt/vol) * ln(2)
|
||||
|
||||
ln2(tgt/vol) = fp_exponent( tgt/vol ) +
|
||||
ln2( fp_mantissa( tgt/vol ) )
|
||||
|
||||
fp_mantissa() and fp_exponent() are
|
||||
calculated via tricky bit manipulations of
|
||||
the floating point number. ln2() is
|
||||
approximated by a look up table.
|
||||
|
||||
Note that this final (1+eps) value needs
|
||||
to be raised to the 2^30/count power. This
|
||||
is done by operating on the binary representaion
|
||||
of this number in the final while loop.
|
||||
|
||||
Enjoy!
|
||||
*/
|
||||
{
|
||||
f64 logtab[] = { -0.912537, -0.752072, -0.607683, -0.476438,
|
||||
-0.356144, -0.245112, -0.142019, -0.045804 };
|
||||
|
||||
i_invn = (s32) _ldexpf( invn, NFRACBITS );
|
||||
mant = _frexpf( tgt/vol, &ex );
|
||||
indx = (s32) (_ldexpf( mant, NBITS+1 ) ); /* NPOS <= indx < 2*NPOS */
|
||||
eps = (logtab[indx - NPOS] + ex) * M_LN2;
|
||||
eps /= _ldexpf( 1, NFRACBITS ); /* eps / 2^NFRACBITS */
|
||||
fs = (1.0 + eps);
|
||||
a = 1.0;
|
||||
while( i_invn ) {
|
||||
if( i_invn & 1 )
|
||||
a = a * fs;
|
||||
fs *= fs;
|
||||
i_invn >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
a *= (a *= (a *= a));
|
||||
s = (s16) a;
|
||||
*ratel = (s16)(0xffff * (a - (f32) s));
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(rate_num, rate_cnt, rate_max, rate_min);
|
||||
#endif
|
||||
return (s16)a;
|
||||
|
||||
}
|
||||
|
||||
static
|
||||
f32 _getVol(f32 ivol, s32 samples, s16 ratem, u16 ratel)
|
||||
{
|
||||
f32 r, a;
|
||||
s32 i;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Rate values are actually rate^8
|
||||
*/
|
||||
samples >>=3;
|
||||
if (samples == 0){
|
||||
return ivol;
|
||||
}
|
||||
r = ((f32) (ratem<<16) + (f32) ratel)/65536;
|
||||
|
||||
a = 1.0;
|
||||
for (i=0; i<32; i++){
|
||||
if( samples & 1 )
|
||||
a *= r;
|
||||
samples >>= 1;
|
||||
if (samples == 0)
|
||||
break;
|
||||
r *= r;
|
||||
}
|
||||
ivol *= a;
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(vol_num, vol_cnt, vol_max, vol_min);
|
||||
#endif
|
||||
return ivol;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
32
src/libultra/al/filter.c
Normal file
32
src/libultra/al/filter.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/*====================================================================
|
||||
* filter.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include <libaudio.h>
|
||||
#include "synthInternals.h"
|
||||
|
||||
void alFilterNew(ALFilter *f, ALCmdHandler h, ALSetParam s, s32 type)
|
||||
{
|
||||
f->source = 0;
|
||||
f->handler = h;
|
||||
f->setParam = s;
|
||||
f->inp = 0;
|
||||
f->outp = 0;
|
||||
f->type = type;
|
||||
}
|
||||
65
src/libultra/al/heapalloc.c
Normal file
65
src/libultra/al/heapalloc.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/*====================================================================
|
||||
* heapalloc.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include "synthInternals.h"
|
||||
#include <libaudio.h>
|
||||
#include <os_internal.h>
|
||||
#include <ultraerror.h>
|
||||
|
||||
void *alHeapDBAlloc(u8 *file, s32 line, ALHeap *hp, s32 num, s32 size)
|
||||
{
|
||||
s32 bytes;
|
||||
u8 *ptr = 0;
|
||||
|
||||
bytes = (num*size + AL_CACHE_ALIGN) & ~AL_CACHE_ALIGN;
|
||||
|
||||
#ifdef _DEBUG
|
||||
hp->count++;
|
||||
bytes += sizeof(HeapInfo);
|
||||
#endif
|
||||
|
||||
if ((hp->cur + bytes) <= (hp->base + hp->len)) {
|
||||
|
||||
ptr = hp->cur;
|
||||
hp->cur += bytes;
|
||||
|
||||
#ifdef _DEBUG
|
||||
((HeapInfo *)ptr)->magic = AL_HEAP_MAGIC;
|
||||
((HeapInfo *)ptr)->size = bytes;
|
||||
((HeapInfo *)ptr)->count = hp->count;
|
||||
if (file) {
|
||||
((HeapInfo *)ptr)->file = file;
|
||||
((HeapInfo *)ptr)->line = line;
|
||||
} else {
|
||||
((HeapInfo *)ptr)->file = (u8 *) "unknown";
|
||||
((HeapInfo *)ptr)->line = 0;
|
||||
}
|
||||
|
||||
ptr += sizeof(HeapInfo);
|
||||
#endif
|
||||
|
||||
} else {
|
||||
#ifdef _DEBUG
|
||||
__osError(ERR_ALHEAPNOFREE, 1, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
37
src/libultra/al/heapinit.c
Normal file
37
src/libultra/al/heapinit.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/*====================================================================
|
||||
* heapinit.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include "synthInternals.h"
|
||||
#include <libaudio.h>
|
||||
|
||||
void alHeapInit(ALHeap *hp, u8 *base, s32 len)
|
||||
{
|
||||
s32 extraAlign = (AL_CACHE_ALIGN+1) - ((s32) base & AL_CACHE_ALIGN);
|
||||
|
||||
if (extraAlign != AL_CACHE_ALIGN+1)
|
||||
hp->base = base + extraAlign;
|
||||
else
|
||||
hp->base = base;
|
||||
|
||||
hp->len = len;
|
||||
hp->cur = hp->base;
|
||||
hp->count = 0;
|
||||
}
|
||||
|
||||
471
src/libultra/al/load.c
Normal file
471
src/libultra/al/load.c
Normal file
@@ -0,0 +1,471 @@
|
||||
/*====================================================================
|
||||
* load.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include <libaudio.h>
|
||||
#include "synthInternals.h"
|
||||
#include <os.h>
|
||||
#include <R4300.h>
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
extern u32 cnt_index, adpcm_num, adpcm_cnt, adpcm_max, adpcm_min, lastCnt[];
|
||||
#endif
|
||||
|
||||
#define ADPCMFBYTES 9
|
||||
#define LFSAMPLES 4
|
||||
|
||||
static
|
||||
Acmd *_decodeChunk(Acmd *ptr, ALLoadFilter *f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags);
|
||||
|
||||
Acmd *alAdpcmPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
s16 inp;
|
||||
s32 tsam;
|
||||
s32 nframes;
|
||||
s32 nbytes;
|
||||
s32 overFlow;
|
||||
s32 startZero;
|
||||
s32 nOver;
|
||||
s32 nSam;
|
||||
s32 op;
|
||||
s32 nLeft;
|
||||
s32 bEnd;
|
||||
s32 decoded = 0;
|
||||
s32 looped = 0;
|
||||
|
||||
ALLoadFilter *f = (ALLoadFilter *)filter;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
if (outCount == 0)
|
||||
return ptr;
|
||||
|
||||
inp = AL_DECODER_IN;
|
||||
aLoadADPCM(ptr++, f->bookSize,
|
||||
K0_TO_PHYS(f->table->waveInfo.adpcmWave.book->book));
|
||||
|
||||
looped = (outCount + f->sample > f->loop.end) && (f->loop.count != 0);
|
||||
if (looped)
|
||||
nSam = f->loop.end - f->sample;
|
||||
else
|
||||
nSam = outCount;
|
||||
|
||||
if (f->lastsam)
|
||||
nLeft = ADPCMFSIZE - f->lastsam;
|
||||
else
|
||||
nLeft = 0;
|
||||
tsam = nSam - nLeft;
|
||||
if (tsam<0) tsam = 0;
|
||||
|
||||
nframes = (tsam+ADPCMFSIZE-1)>>LFSAMPLES;
|
||||
nbytes = nframes*ADPCMFBYTES;
|
||||
|
||||
if (looped){
|
||||
|
||||
ptr = _decodeChunk(ptr, f, tsam, nbytes, *outp, inp, f->first);
|
||||
|
||||
/*
|
||||
* Fix up output pointer, which will be used as the input pointer
|
||||
* by the following module.
|
||||
*/
|
||||
if (f->lastsam)
|
||||
*outp += (f->lastsam<<1);
|
||||
else
|
||||
*outp += (ADPCMFSIZE<<1);
|
||||
|
||||
/*
|
||||
* Now fix up state info to reflect the loop start point
|
||||
*/
|
||||
f->lastsam = f->loop.start &0xf;
|
||||
f->memin = (s32) f->table->base + ADPCMFBYTES *
|
||||
((s32) (f->loop.start>>LFSAMPLES) + 1);
|
||||
f->sample = f->loop.start;
|
||||
|
||||
bEnd = *outp;
|
||||
while (outCount > nSam){
|
||||
|
||||
outCount -= nSam;
|
||||
|
||||
/*
|
||||
* Put next one after the end of the last lot - on the
|
||||
* frame boundary (32 byte) after the end.
|
||||
*/
|
||||
op = (bEnd + ((nframes+1)<<(LFSAMPLES+1))) & ~0x1f;
|
||||
|
||||
/*
|
||||
* The actual end of data
|
||||
*/
|
||||
bEnd += (nSam<<1);
|
||||
|
||||
/*
|
||||
* -1 is loop forever - the loop count is not exact now
|
||||
* for small loops!
|
||||
*/
|
||||
if ((f->loop.count != -1) && (f->loop.count != 0))
|
||||
f->loop.count--;
|
||||
|
||||
/*
|
||||
* What's left to compute.
|
||||
*/
|
||||
nSam = MIN(outCount, f->loop.end - f->loop.start);
|
||||
tsam = nSam - ADPCMFSIZE + f->lastsam;
|
||||
if (tsam<0) tsam = 0;
|
||||
nframes = (tsam+ADPCMFSIZE-1)>>LFSAMPLES;
|
||||
nbytes = nframes*ADPCMFBYTES;
|
||||
ptr = _decodeChunk(ptr, f, tsam, nbytes, op, inp, f->first | A_LOOP);
|
||||
/*
|
||||
* Merge the two sections in DMEM.
|
||||
*/
|
||||
aDMEMMove(ptr++, op+(f->lastsam<<1), bEnd, nSam<<1);
|
||||
|
||||
}
|
||||
|
||||
f->lastsam = (outCount + f->lastsam) & 0xf;
|
||||
f->sample += outCount;
|
||||
f->memin += ADPCMFBYTES*nframes;
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(adpcm_num, adpcm_cnt, adpcm_max, adpcm_min);
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* The unlooped case, which is executed most of the time
|
||||
*/
|
||||
|
||||
nSam = nframes<<LFSAMPLES;
|
||||
|
||||
/*
|
||||
* overFlow is the number of bytes past the end
|
||||
* of the bitstream I try to generate
|
||||
*/
|
||||
overFlow = f->memin + nbytes - ((s32) f->table->base + f->table->len);
|
||||
if (overFlow < 0)
|
||||
overFlow = 0;
|
||||
nOver = (overFlow/ADPCMFBYTES)<<LFSAMPLES;
|
||||
if (nOver > nSam + nLeft)
|
||||
nOver = nSam + nLeft;
|
||||
|
||||
nbytes -= overFlow;
|
||||
|
||||
if ((nOver - (nOver & 0xf))< outCount){
|
||||
decoded = 1;
|
||||
ptr = _decodeChunk(ptr, f, nSam - nOver, nbytes, *outp, inp, f->first);
|
||||
|
||||
if (f->lastsam)
|
||||
*outp += (f->lastsam<<1);
|
||||
else
|
||||
*outp += (ADPCMFSIZE<<1);
|
||||
|
||||
f->lastsam = (outCount + f->lastsam) & 0xf;
|
||||
f->sample += outCount;
|
||||
f->memin += ADPCMFBYTES*nframes;
|
||||
} else {
|
||||
f->lastsam = 0;
|
||||
f->memin += ADPCMFBYTES*nframes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put zeros in if necessary
|
||||
*/
|
||||
if (nOver){
|
||||
f->lastsam = 0;
|
||||
if (decoded)
|
||||
startZero = (nLeft + nSam - nOver)<<1;
|
||||
else
|
||||
startZero = 0;
|
||||
aClearBuffer(ptr++, startZero + *outp, nOver<<1);
|
||||
}
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(adpcm_num, adpcm_cnt, adpcm_max, adpcm_min);
|
||||
#endif
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Acmd *alRaw16Pull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
s32 nbytes;
|
||||
s32 dramLoc;
|
||||
s32 dramAlign;
|
||||
s32 dmemAlign;
|
||||
s32 overFlow;
|
||||
s32 startZero;
|
||||
s32 nSam;
|
||||
s32 op;
|
||||
|
||||
ALLoadFilter *f = (ALLoadFilter *)filter;
|
||||
ALFilter *a = (ALFilter *) filter;
|
||||
|
||||
if (outCount == 0)
|
||||
return ptr;
|
||||
|
||||
if ((outCount + f->sample > f->loop.end) && (f->loop.count != 0)){
|
||||
|
||||
nSam = f->loop.end - f->sample;
|
||||
nbytes = nSam<<1;
|
||||
if (nSam > 0){
|
||||
dramLoc = (f->dma)(f->memin, nbytes, f->dmaState);
|
||||
|
||||
/*
|
||||
* Make sure enough is loaded into DMEM to take care
|
||||
* of 8 byte alignment
|
||||
*/
|
||||
dramAlign = dramLoc & 0x7;
|
||||
nbytes += dramAlign;
|
||||
aSetBuffer(ptr++, 0, *outp, 0, nbytes + 8 - (nbytes & 0x7));
|
||||
aLoadBuffer(ptr++, dramLoc - dramAlign);
|
||||
} else
|
||||
dramAlign = 0;
|
||||
|
||||
/*
|
||||
* Fix up output pointer to allow for dram alignment
|
||||
*/
|
||||
*outp += dramAlign;
|
||||
|
||||
f->memin = (s32) f->table->base + (f->loop.start<<1);
|
||||
f->sample = f->loop.start;
|
||||
op = *outp;
|
||||
|
||||
while (outCount > nSam){
|
||||
|
||||
op += (nSam<<1);
|
||||
outCount -= nSam;
|
||||
/*
|
||||
* -1 is loop forever
|
||||
*/
|
||||
if ((f->loop.count != -1) && (f->loop.count != 0))
|
||||
f->loop.count--;
|
||||
|
||||
/*
|
||||
* What to compute.
|
||||
*/
|
||||
nSam = MIN(outCount, f->loop.end - f->loop.start);
|
||||
nbytes = nSam<<1;
|
||||
|
||||
/*
|
||||
* Do the next section, same as last.
|
||||
*/
|
||||
dramLoc = (f->dma)(f->memin, nbytes, f->dmaState);
|
||||
|
||||
/*
|
||||
* Make sure enough is loaded into DMEM to take care
|
||||
* of 8 byte alignment
|
||||
*/
|
||||
dramAlign = dramLoc & 0x7;
|
||||
nbytes += dramAlign;
|
||||
if (op & 0x7)
|
||||
dmemAlign = 8 - (op & 0x7);
|
||||
else
|
||||
dmemAlign = 0;
|
||||
|
||||
aSetBuffer(ptr++, 0, op + dmemAlign, 0, nbytes + 8 - (nbytes & 0x7));
|
||||
aLoadBuffer(ptr++, dramLoc - dramAlign);
|
||||
|
||||
/*
|
||||
* Merge the two sections in DMEM.
|
||||
*/
|
||||
if (dramAlign || dmemAlign)
|
||||
aDMEMMove(ptr++, op+dramAlign+dmemAlign, op, nSam<<1);
|
||||
|
||||
}
|
||||
|
||||
f->sample += outCount;
|
||||
f->memin += (outCount<<1);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* The unlooped case, which is executed most of the time
|
||||
*
|
||||
* overFlow is the number of bytes past the end
|
||||
* of the bitstream I try to generate
|
||||
*/
|
||||
|
||||
nbytes = outCount<<1;
|
||||
overFlow = f->memin + nbytes - ((s32) f->table->base + f->table->len);
|
||||
if (overFlow < 0)
|
||||
overFlow = 0;
|
||||
if (overFlow > nbytes)
|
||||
overFlow = nbytes;
|
||||
|
||||
if (overFlow < nbytes){
|
||||
if (outCount > 0){
|
||||
nbytes -= overFlow;
|
||||
dramLoc = (f->dma)(f->memin, nbytes, f->dmaState);
|
||||
|
||||
/*
|
||||
* Make sure enough is loaded into DMEM to take care
|
||||
* of 8 byte alignment
|
||||
*/
|
||||
dramAlign = dramLoc & 0x7;
|
||||
nbytes += dramAlign;
|
||||
aSetBuffer(ptr++, 0, *outp, 0, nbytes + 8 - (nbytes & 0x7));
|
||||
aLoadBuffer(ptr++, dramLoc - dramAlign);
|
||||
} else
|
||||
dramAlign = 0;
|
||||
*outp += dramAlign;
|
||||
|
||||
f->sample += outCount;
|
||||
f->memin += outCount<<1;
|
||||
} else {
|
||||
f->memin += outCount<<1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put zeros in if necessary
|
||||
*/
|
||||
if (overFlow){
|
||||
startZero = (outCount<<1) - overFlow;
|
||||
if (startZero < 0)
|
||||
startZero = 0;
|
||||
aClearBuffer(ptr++, startZero + *outp, overFlow);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
s32
|
||||
alLoadParam(void *filter, s32 paramID, void *param)
|
||||
{
|
||||
ALLoadFilter *a = (ALLoadFilter *) filter;
|
||||
ALFilter *f = (ALFilter *) filter;
|
||||
|
||||
switch (paramID) {
|
||||
case (AL_FILTER_SET_WAVETABLE):
|
||||
a->table = (ALWaveTable *) param;
|
||||
a->memin = (s32) a->table->base;
|
||||
a->sample = 0;
|
||||
switch (a->table->type){
|
||||
case (AL_ADPCM_WAVE):
|
||||
|
||||
/*
|
||||
* Set up the correct handler
|
||||
*/
|
||||
f->handler = alAdpcmPull;
|
||||
|
||||
/*
|
||||
* Make sure the table length is an integer number of
|
||||
* frames
|
||||
*/
|
||||
a->table->len = ADPCMFBYTES *
|
||||
((s32) (a->table->len/ADPCMFBYTES));
|
||||
|
||||
a->bookSize = 2*a->table->waveInfo.adpcmWave.book->order*
|
||||
a->table->waveInfo.adpcmWave.book->npredictors*ADPCMVSIZE;
|
||||
if (a->table->waveInfo.adpcmWave.loop) {
|
||||
a->loop.start = a->table->waveInfo.adpcmWave.loop->start;
|
||||
a->loop.end = a->table->waveInfo.adpcmWave.loop->end;
|
||||
a->loop.count = a->table->waveInfo.adpcmWave.loop->count;
|
||||
alCopy(a->table->waveInfo.adpcmWave.loop->state,
|
||||
a->lstate, sizeof(ADPCM_STATE));
|
||||
} else {
|
||||
a->loop.start = a->loop.end = a->loop.count = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case (AL_RAW16_WAVE):
|
||||
f->handler = alRaw16Pull;
|
||||
if (a->table->waveInfo.rawWave.loop) {
|
||||
a->loop.start = a->table->waveInfo.rawWave.loop->start;
|
||||
a->loop.end = a->table->waveInfo.rawWave.loop->end;
|
||||
a->loop.count = a->table->waveInfo.rawWave.loop->count;
|
||||
} else {
|
||||
a->loop.start = a->loop.end = a->loop.count = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case (AL_FILTER_RESET):
|
||||
a->lastsam = 0;
|
||||
a->first = 1;
|
||||
a->sample = 0;
|
||||
|
||||
/* sct 2/14/96 - Check table since it is initialized to null and */
|
||||
/* Get loop info according to table type. */
|
||||
if (a->table)
|
||||
{
|
||||
a->memin = (s32) a->table->base;
|
||||
if (a->table->type == AL_ADPCM_WAVE)
|
||||
{
|
||||
if (a->table->waveInfo.adpcmWave.loop)
|
||||
a->loop.count = a->table->waveInfo.adpcmWave.loop->count;
|
||||
}
|
||||
else if (a->table->type == AL_RAW16_WAVE)
|
||||
{
|
||||
if (a->table->waveInfo.rawWave.loop)
|
||||
a->loop.count = a->table->waveInfo.rawWave.loop->count;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Acmd *_decodeChunk(Acmd *ptr, ALLoadFilter *f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags)
|
||||
|
||||
{
|
||||
|
||||
s32
|
||||
dramAlign,
|
||||
dramLoc;
|
||||
|
||||
if (nbytes > 0){
|
||||
dramLoc = (f->dma)(f->memin, nbytes, f->dmaState);
|
||||
/*
|
||||
* Make sure enough is loaded into DMEM to take care
|
||||
* of 8 byte alignment
|
||||
*/
|
||||
dramAlign = dramLoc & 0x7;
|
||||
nbytes += dramAlign;
|
||||
aSetBuffer(ptr++, 0, inp, 0, nbytes + 8 - (nbytes & 0x7));
|
||||
aLoadBuffer(ptr++, dramLoc - dramAlign);
|
||||
} else
|
||||
dramAlign = 0;
|
||||
|
||||
if (flags & A_LOOP){
|
||||
aSetLoop(ptr++, K0_TO_PHYS(f->lstate));
|
||||
}
|
||||
|
||||
aSetBuffer(ptr++, 0, inp + dramAlign, outp, tsam<<1);
|
||||
aADPCMdec(ptr++, flags, K0_TO_PHYS(f->state));
|
||||
f->first = 0;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
67
src/libultra/al/mainbus.c
Normal file
67
src/libultra/al/mainbus.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/*====================================================================
|
||||
* mainbus.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include <libaudio.h>
|
||||
#include "synthInternals.h"
|
||||
|
||||
Acmd *alMainBusPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
ALMainBus *m = (ALMainBus *)filter;
|
||||
ALFilter **sources = m->sources;
|
||||
s32 i;
|
||||
|
||||
/*
|
||||
* clear the output buffers here
|
||||
*/
|
||||
aClearBuffer(ptr++, AL_MAIN_L_OUT, outCount<<1);
|
||||
aClearBuffer(ptr++, AL_MAIN_R_OUT, outCount<<1);
|
||||
|
||||
for (i = 0; i < m->sourceCount; i++) {
|
||||
ptr = (sources[i]->handler)(sources[i], outp, outCount, sampleOffset,
|
||||
ptr);
|
||||
aSetBuffer(ptr++, 0, 0, 0, outCount<<1);
|
||||
aMix(ptr++, 0, 0x7fff, AL_AUX_L_OUT, AL_MAIN_L_OUT);
|
||||
aMix(ptr++, 0, 0x7fff, AL_AUX_R_OUT, AL_MAIN_R_OUT);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
s32 alMainBusParam(void *filter, s32 paramID, void *param)
|
||||
{
|
||||
ALMainBus *m = (ALMainBus *) filter;
|
||||
ALFilter **sources = m->sources;
|
||||
|
||||
switch (paramID) {
|
||||
|
||||
case (AL_FILTER_ADD_SOURCE):
|
||||
sources[m->sourceCount++] = (ALFilter *) param;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* ??? */
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
149
src/libultra/al/resample.c
Normal file
149
src/libultra/al/resample.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/*====================================================================
|
||||
* resample.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include <libaudio.h>
|
||||
#include "synthInternals.h"
|
||||
#include <os.h>
|
||||
|
||||
// TODO: this comes from a header
|
||||
#ident "$Revision: 1.49 $"
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
extern u32 cnt_index, resampler_num, resampler_cnt, resampler_max, resampler_min, lastCnt[];
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
* Resampler filter public interfaces
|
||||
***********************************************************************/
|
||||
Acmd *alResamplePull(void *filter, s16 *outp, s32 outCnt, s32 sampleOffset, Acmd *p)
|
||||
{
|
||||
ALResampler *f = (ALResampler *)filter;
|
||||
Acmd *ptr = p;
|
||||
s16 inp;
|
||||
s32 inCount;
|
||||
ALFilter *source = f->filter.source;
|
||||
s32 incr;
|
||||
f32 finCount;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
inp = AL_DECODER_OUT;
|
||||
|
||||
if (!outCnt)
|
||||
return ptr;
|
||||
|
||||
/*
|
||||
* check if resampler is required
|
||||
*/
|
||||
if (f->upitch) {
|
||||
|
||||
ptr = (*source->handler)(source, &inp, outCnt, sampleOffset, p);
|
||||
aDMEMMove(ptr++, inp, *outp, outCnt<<1);
|
||||
|
||||
} else {
|
||||
|
||||
/*
|
||||
* clip to maximum allowable pitch
|
||||
* FIXME: should we check for some minimum as well?
|
||||
*/
|
||||
if (f->ratio > MAX_RATIO) f->ratio = MAX_RATIO;
|
||||
|
||||
/*
|
||||
* quantize the pitch
|
||||
*/
|
||||
f->ratio = (s32)(f->ratio * UNITY_PITCH);
|
||||
f->ratio = f->ratio / UNITY_PITCH;
|
||||
|
||||
/*
|
||||
* determine how many samples to generate
|
||||
*/
|
||||
finCount = f->delta + (f->ratio * (f32) outCnt);
|
||||
inCount = (s32) finCount;
|
||||
f->delta = finCount - (f32)inCount;
|
||||
|
||||
/*
|
||||
* ask all filters upstream from us to build their command
|
||||
* lists.
|
||||
*/
|
||||
ptr = (*source->handler)(source, &inp, inCount, sampleOffset, p);
|
||||
|
||||
/*
|
||||
* construct our portion of the command list
|
||||
*/
|
||||
incr = (s32)(f->ratio * UNITY_PITCH);
|
||||
aSetBuffer(ptr++, 0, inp, *outp, outCnt<<1);
|
||||
aResample(ptr++, f->first, incr, osVirtualToPhysical(f->state));
|
||||
f->first = 0;
|
||||
}
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(resampler_num, resampler_cnt, resampler_max, resampler_min);
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
|
||||
s32 alResampleParam(void *filter, s32 paramID, void *param)
|
||||
{
|
||||
ALFilter *f = (ALFilter *) filter;
|
||||
ALResampler *r = (ALResampler *) filter;
|
||||
union {
|
||||
f32 f;
|
||||
s32 i;
|
||||
} data;
|
||||
|
||||
switch (paramID) {
|
||||
|
||||
case (AL_FILTER_SET_SOURCE):
|
||||
f->source = (ALFilter *) param;
|
||||
break;
|
||||
|
||||
case (AL_FILTER_RESET):
|
||||
r->delta = 0.0;
|
||||
r->first = 1;
|
||||
r->motion = AL_STOPPED;
|
||||
r->upitch = 0;
|
||||
if (f->source)
|
||||
(*f->source->setParam)(f->source, AL_FILTER_RESET, 0);
|
||||
break;
|
||||
|
||||
case (AL_FILTER_START):
|
||||
r->motion = AL_PLAYING;
|
||||
if (f->source)
|
||||
(*f->source->setParam)(f->source, AL_FILTER_START, 0);
|
||||
break;
|
||||
|
||||
case (AL_FILTER_SET_PITCH):
|
||||
data.i = (s32) param;
|
||||
r->ratio = data.f;
|
||||
break;
|
||||
|
||||
case (AL_FILTER_SET_UNITY_PITCH):
|
||||
r->upitch = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (f->source)
|
||||
(*f->source->setParam)(f->source, paramID, param);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
447
src/libultra/al/reverb.c
Normal file
447
src/libultra/al/reverb.c
Normal file
@@ -0,0 +1,447 @@
|
||||
/*====================================================================
|
||||
* reverb.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include <libaudio.h>
|
||||
#include <ultraerror.h>
|
||||
#include "synthInternals.h"
|
||||
#include <os.h>
|
||||
#include <os_internal.h>
|
||||
#include <assert.h>
|
||||
#include "initfx.h"
|
||||
|
||||
#define RANGE 2.0
|
||||
extern ALGlobals *alGlobals;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
extern u32 cnt_index, reverb_num, reverb_cnt, reverb_max, reverb_min, lastCnt[];
|
||||
extern u32 load_num, load_cnt, load_max, load_min, save_num, save_cnt, save_max, save_min;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* macros
|
||||
*/
|
||||
#define SWAP(in, out) \
|
||||
{ \
|
||||
s16 t = out; \
|
||||
out = in; \
|
||||
in = t; \
|
||||
}
|
||||
|
||||
Acmd *_loadOutputBuffer(ALFx *r, ALDelay *d, s32 buff, s32 incount, Acmd *p);
|
||||
Acmd *_loadBuffer(ALFx *r, s16 *curr_ptr, s32 buff, s32 count, Acmd *p);
|
||||
Acmd *_saveBuffer(ALFx *r, s16 *curr_ptr, s32 buff, s32 count, Acmd *p);
|
||||
Acmd *_filterBuffer(ALLowPass *lp, s32 buff, s32 count, Acmd *p);
|
||||
f32 _doModFunc(ALDelay *d, s32 count);
|
||||
|
||||
static s32 L_INC[] = { L0_INC, L1_INC, L2_INC };
|
||||
|
||||
/***********************************************************************
|
||||
* Reverb filter public interfaces
|
||||
***********************************************************************/
|
||||
Acmd *alFxPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset,
|
||||
Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
ALFx *r = (ALFx *)filter;
|
||||
ALFilter *source = r->filter.source;
|
||||
s16 i, buff1, buff2, input, output;
|
||||
s16 *in_ptr, *out_ptr, gain, *prev_out_ptr = 0;
|
||||
ALDelay *d, *pd;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
assert(source);
|
||||
/*
|
||||
* pull channels going into this effect first
|
||||
*/
|
||||
ptr = (*source->handler)(source, outp, outCount, sampleOffset, p);
|
||||
|
||||
input = AL_AUX_L_OUT;
|
||||
output = AL_AUX_R_OUT;
|
||||
buff1 = AL_TEMP_0;
|
||||
buff2 = AL_TEMP_1;
|
||||
|
||||
aSetBuffer(ptr++, 0, 0, 0, outCount<<1); /* set the buffer size */
|
||||
aMix(ptr++, 0, 0xda83, AL_AUX_L_OUT, input); /* .707L = L - .293L */
|
||||
aMix(ptr++, 0, 0x5a82, AL_AUX_R_OUT, input); /* mix the AuxL and AuxR into the AuxL */
|
||||
/* and write the mixed value to the delay line at r->input */
|
||||
ptr = _saveBuffer(r, r->input, input, outCount, ptr);
|
||||
|
||||
aClearBuffer(ptr++, output, outCount<<1); /* clear the AL_AUX_R_OUT */
|
||||
|
||||
for (i = 0; i < r->section_count; i++) {
|
||||
d = &r->delay[i]; /* get the ALDelay structure */
|
||||
in_ptr = &r->input[-d->input];
|
||||
out_ptr = &r->input[-d->output];
|
||||
|
||||
if (in_ptr == prev_out_ptr) {
|
||||
SWAP(buff1, buff2);
|
||||
} else { /* load data at in_ptr into buff1 */
|
||||
ptr = _loadBuffer(r, in_ptr, buff1, outCount, ptr);
|
||||
}
|
||||
ptr = _loadOutputBuffer(r, d, buff2, outCount, ptr);
|
||||
|
||||
if (d->ffcoef) {
|
||||
aMix(ptr++, 0, (u16)d->ffcoef, buff1, buff2);
|
||||
if (!d->rs && !d->lp) {
|
||||
ptr = _saveBuffer(r, out_ptr, buff2, outCount, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
if (d->fbcoef) {
|
||||
aMix(ptr++, 0, (u16)d->fbcoef, buff2, buff1);
|
||||
ptr = _saveBuffer(r, in_ptr, buff1, outCount, ptr);
|
||||
}
|
||||
|
||||
if (d->lp)
|
||||
ptr = _filterBuffer(d->lp, buff2, outCount, ptr);
|
||||
|
||||
if (!d->rs)
|
||||
ptr = _saveBuffer(r, out_ptr, buff2, outCount, ptr);
|
||||
|
||||
if (d->gain)
|
||||
aMix(ptr++, 0, (u16)d->gain, buff2, output);
|
||||
|
||||
prev_out_ptr = &r->input[d->output];
|
||||
}
|
||||
|
||||
/*
|
||||
* bump the master delay line input pointer
|
||||
* modulo the length
|
||||
*/
|
||||
r->input += outCount;
|
||||
if (r->input > &r->base[r->length])
|
||||
r->input -= r->length;
|
||||
|
||||
/*
|
||||
* output already in AL_AUX_R_OUT
|
||||
* just copy to AL_AUX_L_OUT
|
||||
*/
|
||||
aDMEMMove(ptr++, output, AL_AUX_L_OUT, outCount<<1);
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(reverb_num, reverb_cnt, reverb_max, reverb_min);
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
|
||||
s32 alFxParam(void *filter, s32 paramID, void *param)
|
||||
{
|
||||
if(paramID == AL_FILTER_SET_SOURCE)
|
||||
{
|
||||
ALFilter *f = (ALFilter *) filter;
|
||||
f->source = (ALFilter*) param;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine gets called by alSynSetFXParam. No checking takes place to
|
||||
* verify the validity of the paramID or the param value. input and output
|
||||
* values must be 8 byte aligned, so round down any param passed.
|
||||
*/
|
||||
s32 alFxParamHdl(void *filter, s32 paramID, void *param)
|
||||
{
|
||||
ALFx *f = (ALFx *) filter;
|
||||
s32 p = (paramID - 2) % 8;
|
||||
s32 s = (paramID - 2) / 8;
|
||||
s32 val = *(s32*)param;
|
||||
|
||||
#define INPUT_PARAM 0
|
||||
#define OUTPUT_PARAM 1
|
||||
#define FBCOEF_PARAM 2
|
||||
#define FFCOEF_PARAM 3
|
||||
#define GAIN_PARAM 4
|
||||
#define CHORUSRATE_PARAM 5
|
||||
#define CHORUSDEPTH_PARAM 6
|
||||
#define LPFILT_PARAM 7
|
||||
|
||||
switch(p)
|
||||
{
|
||||
case INPUT_PARAM:
|
||||
f->delay[s].input = (u32)val & 0xFFFFFFF8;
|
||||
break;
|
||||
case OUTPUT_PARAM:
|
||||
f->delay[s].output = (u32)val & 0xFFFFFFF8;
|
||||
break;
|
||||
case FFCOEF_PARAM:
|
||||
f->delay[s].ffcoef = (s16)val;
|
||||
break;
|
||||
case FBCOEF_PARAM:
|
||||
f->delay[s].fbcoef = (s16)val;
|
||||
break;
|
||||
case GAIN_PARAM:
|
||||
f->delay[s].gain = (s16)val;
|
||||
break;
|
||||
case CHORUSRATE_PARAM:
|
||||
/* f->delay[s].rsinc = ((f32)val)/0xffffff; */
|
||||
f->delay[s].rsinc = ((((f32)val)/1000) * RANGE)/alGlobals->drvr.outputRate;
|
||||
break;
|
||||
|
||||
/*
|
||||
* the following constant is derived from:
|
||||
*
|
||||
* ratio = 2^(cents/1200)
|
||||
*
|
||||
* and therefore for hundredths of a cent
|
||||
* x
|
||||
* ln(ratio) = ---------------
|
||||
* (120,000)/ln(2)
|
||||
* where
|
||||
* 120,000/ln(2) = 173123.40...
|
||||
*/
|
||||
#define CONVERT 173123.404906676
|
||||
#define LENGTH (f->delay[s].output - f->delay[s].input)
|
||||
|
||||
case CHORUSDEPTH_PARAM:
|
||||
/*f->delay[s].rsgain = (((f32)val) / CONVERT) * LENGTH; */
|
||||
f->delay[s].rsgain = (((f32)val) / CONVERT) * LENGTH;
|
||||
break;
|
||||
case LPFILT_PARAM:
|
||||
if(f->delay[s].lp)
|
||||
{
|
||||
f->delay[s].lp->fc = (s16)val;
|
||||
_init_lpfilter(f->delay[s].lp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Acmd *_loadOutputBuffer(ALFx *r, ALDelay *d, s32 buff, s32 incount, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
s32 ratio, count, rbuff = AL_TEMP_2;
|
||||
s16 *out_ptr;
|
||||
f32 fincount, fratio, delta;
|
||||
s32 ramalign = 0, length;
|
||||
static f32 val=0.0, lastval=-10.0;
|
||||
static f32 blob=0;
|
||||
/*
|
||||
* The following section implements the chorus resampling. Modulate where you pull
|
||||
* the samples from, since you need varying amounts of samples.
|
||||
*/
|
||||
if (d->rs) {
|
||||
length = d->output - d->input;
|
||||
delta = _doModFunc(d, incount); /* get the number of samples to modulate by */
|
||||
/*
|
||||
* find ratio of delta to delay length and quantize
|
||||
* to same resolution as resampler
|
||||
*/
|
||||
delta /= length; /* convert delta from number of samples to a pitch ratio */
|
||||
delta = (s32)(delta * UNITY_PITCH); /* quantize to value microcode will use */
|
||||
delta = delta / UNITY_PITCH;
|
||||
fratio = 1.0 - delta; /* pitch ratio needs to be centered around 1, not zero */
|
||||
|
||||
/* d->rs->delta is the difference between the fractional and integer value
|
||||
* of the samples needed. fratio * incount + rs->delta gives the number of samples
|
||||
* needed for this frame.
|
||||
*/
|
||||
fincount = d->rs->delta + (fratio * (f32)incount);
|
||||
count = (s32) fincount; /* quantize to s32 */
|
||||
d->rs->delta = fincount - (f32)count; /* calculate the round off and store */
|
||||
|
||||
/*
|
||||
* d->rsdelta is amount the out_ptr has deviated from its starting position.
|
||||
* You calc the out_ptr by taking d->output - d->rsdelta, and then using the
|
||||
* negative of that as an index into the delay buffer. loadBuffer that uses this
|
||||
* value then bumps it up if it is below the delay buffer.
|
||||
*/
|
||||
out_ptr = &r->input[-(d->output - d->rsdelta)];
|
||||
ramalign = ((s32)out_ptr & 0x7) >> 1; /* calculate the number of samples needed
|
||||
to align the buffer*/
|
||||
#ifdef _DEBUG
|
||||
#if 0
|
||||
if(length > 0) {
|
||||
if (length - d->rsdelta > (s32)r->length) {
|
||||
__osError(ERR_ALMODDELAYOVERFLOW, 1, length - d->rsdelta - r->length);
|
||||
}
|
||||
}
|
||||
else if(length < 0) {
|
||||
if ((-length) - d->rsdelta > (s32)r->length) {
|
||||
__osError(ERR_ALMODDELAYOVERFLOW, 1, (-length) - d->rsdelta - r->length);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
/* load the rbuff with samples, note that there will be ramalign worth of
|
||||
* samples at the begining which you don't care about. */
|
||||
ptr = _loadBuffer(r, out_ptr - ramalign, rbuff, count + ramalign, ptr);
|
||||
|
||||
/* convert fratio to 16 bit fraction for microcode use */
|
||||
ratio = (s32)(fratio * UNITY_PITCH);
|
||||
/* set the buffers, and do the resample */
|
||||
aSetBuffer(ptr++, 0, rbuff + (ramalign<<1), buff, incount<<1);
|
||||
aResample(ptr++, d->rs->first, ratio, osVirtualToPhysical(d->rs->state));
|
||||
|
||||
d->rs->first = 0; /* turn off first time flag */
|
||||
d->rsdelta += count - incount; /* add the number of samples to d->rsdelta */
|
||||
} else {
|
||||
out_ptr = &r->input[-d->output];
|
||||
ptr = _loadBuffer(r, out_ptr, buff, incount, ptr);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
/*
|
||||
* This routine is for loading data from the delay line buff. If the
|
||||
* address of curr_ptr < r->base, it will force it to be within r->base
|
||||
* space, If the load goes past the end of r->base it will wrap around.
|
||||
* Cause count bytes of data at curr_ptr (within the delay line) to be
|
||||
* loaded into buff. (Buff is a dmem buffer)
|
||||
*/
|
||||
Acmd *_loadBuffer(ALFx *r, s16 *curr_ptr, s32 buff, s32 count, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
s32 after_end, before_end;
|
||||
s16 *updated_ptr, *delay_end;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
delay_end = &r->base[r->length];
|
||||
|
||||
#ifdef _DEBUG
|
||||
if(curr_ptr > delay_end)
|
||||
__osError(ERR_ALMODDELAYOVERFLOW, 1, delay_end - curr_ptr);
|
||||
#endif
|
||||
|
||||
if (curr_ptr < r->base)
|
||||
curr_ptr += r->length;
|
||||
updated_ptr = curr_ptr + count;
|
||||
|
||||
if (updated_ptr > delay_end) {
|
||||
after_end = updated_ptr - delay_end;
|
||||
before_end = delay_end - curr_ptr;
|
||||
|
||||
aSetBuffer(ptr++, 0, buff, 0, before_end<<1);
|
||||
aLoadBuffer(ptr++, osVirtualToPhysical(curr_ptr));
|
||||
aSetBuffer(ptr++, 0, buff+(before_end<<1), 0, after_end<<1);
|
||||
aLoadBuffer(ptr++, osVirtualToPhysical(r->base));
|
||||
} else {
|
||||
aSetBuffer(ptr++, 0, buff, 0, count<<1);
|
||||
aLoadBuffer(ptr++, osVirtualToPhysical(curr_ptr));
|
||||
}
|
||||
|
||||
aSetBuffer(ptr++, 0, 0, 0, count<<1);
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(load_num, load_cnt, load_max, load_min);
|
||||
#endif
|
||||
return ptr;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine is for writing data to the delay line buff. If the
|
||||
* address of curr_ptr < r->base, it will force it to be within r->base
|
||||
* space. If the write goes past the end of r->base, it will wrap around
|
||||
* Cause count bytes of data at buff to be written to delay line, curr_ptr.
|
||||
*/
|
||||
Acmd *_saveBuffer(ALFx *r, s16 *curr_ptr, s32 buff, s32 count, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
s32 after_end, before_end;
|
||||
s16 *updated_ptr, *delay_end;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
delay_end = &r->base[r->length];
|
||||
if (curr_ptr < r->base) /* probably just security */
|
||||
curr_ptr += r->length; /* shouldn't occur */
|
||||
updated_ptr = curr_ptr + count;
|
||||
|
||||
if (updated_ptr > delay_end) { /* if the data wraps past end of r->base */
|
||||
after_end = updated_ptr - delay_end;
|
||||
before_end = delay_end - curr_ptr;
|
||||
|
||||
aSetBuffer(ptr++, 0, 0, buff, before_end<<1);
|
||||
aSaveBuffer(ptr++, osVirtualToPhysical(curr_ptr));
|
||||
aSetBuffer(ptr++, 0, 0, buff+(before_end<<1), after_end<<1);
|
||||
aSaveBuffer(ptr++, osVirtualToPhysical(r->base));
|
||||
aSetBuffer(ptr++, 0, 0, 0, count<<1);
|
||||
} else {
|
||||
aSetBuffer(ptr++, 0, 0, buff, count<<1);
|
||||
aSaveBuffer(ptr++, osVirtualToPhysical(curr_ptr));
|
||||
}
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(save_num, save_cnt, save_max, save_min);
|
||||
#endif
|
||||
return ptr;
|
||||
|
||||
}
|
||||
|
||||
Acmd *_filterBuffer(ALLowPass *lp, s32 buff, s32 count, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
|
||||
aSetBuffer(ptr++, 0, buff, buff, count<<1);
|
||||
aLoadADPCM(ptr++, 32, osVirtualToPhysical(lp->fcvec.fccoef));
|
||||
aPoleFilter(ptr++, lp->first, lp->fgain, osVirtualToPhysical(lp->fstate));
|
||||
lp->first = 0;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Generate a triangle wave from -1 to 1, and find the current position
|
||||
* in the wave. (Rate of the wave is controlled by d->rsinc, which is chorus
|
||||
* rate) Multiply the current triangle wave value by d->rsgain, (chorus depth)
|
||||
* which is expressed in number of samples back from output pointer the chorus
|
||||
* should go at it's full chorus. In otherwords, this function returns a number
|
||||
* of samples the output pointer should modulate backwards.
|
||||
*/
|
||||
f32 _doModFunc(ALDelay *d, s32 count)
|
||||
{
|
||||
f32 val;
|
||||
|
||||
/*
|
||||
* generate bipolar sawtooth
|
||||
* from -RANGE to +RANGE
|
||||
*/
|
||||
d->rsval += d->rsinc * count;
|
||||
d->rsval = (d->rsval > RANGE) ? d->rsval-(RANGE*2) : d->rsval;
|
||||
|
||||
/*
|
||||
* convert to monopolar triangle
|
||||
* from 0 to RANGE
|
||||
*/
|
||||
val = d->rsval;
|
||||
val = (val < 0) ? -val : val;
|
||||
|
||||
/*
|
||||
* convert to bipolar triangle
|
||||
* from -1 to 1
|
||||
*/
|
||||
val -= RANGE/2;
|
||||
|
||||
return(d->rsgain * val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
73
src/libultra/al/save.c
Normal file
73
src/libultra/al/save.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/*====================================================================
|
||||
* save.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include <libaudio.h>
|
||||
#include "synthInternals.h"
|
||||
#include <os.h>
|
||||
#include <assert.h>
|
||||
|
||||
// TODO: this comes from a header
|
||||
#ident "$Revision: 1.17 $"
|
||||
|
||||
Acmd *alSavePull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset,
|
||||
Acmd *p)
|
||||
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
ALSave *f = (ALSave *)filter;
|
||||
ALFilter *source = f->filter.source;
|
||||
|
||||
#ifdef _DEBUG
|
||||
assert(f->filter.source);
|
||||
#endif
|
||||
|
||||
ptr = (*source->handler)(source, outp, outCount, sampleOffset, ptr);
|
||||
|
||||
aSetBuffer (ptr++, 0, 0, 0, outCount<<1);
|
||||
aInterleave(ptr++, AL_MAIN_L_OUT, AL_MAIN_R_OUT);
|
||||
aSetBuffer (ptr++, 0, 0, 0, outCount<<2);
|
||||
aSaveBuffer(ptr++, f->dramout);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
s32 alSaveParam(void *filter, s32 paramID, void *param)
|
||||
{
|
||||
ALSave *a = (ALSave *) filter;
|
||||
ALFilter *f = (ALFilter *) filter;
|
||||
s32 pp = (s32) param;
|
||||
|
||||
switch (paramID) {
|
||||
case (AL_FILTER_SET_SOURCE):
|
||||
f->source = (ALFilter *) param;
|
||||
break;
|
||||
|
||||
case (AL_FILTER_SET_DRAM):
|
||||
a->dramout = pp;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
40
src/libultra/al/sl.c
Normal file
40
src/libultra/al/sl.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <libaudio.h>
|
||||
|
||||
extern ALGlobals* D_80079640;
|
||||
|
||||
void alUnlink(ALLink *ln)
|
||||
{
|
||||
if (ln->next) {
|
||||
ln->next->prev = ln->prev;
|
||||
}
|
||||
|
||||
if (ln->prev) {
|
||||
ln->prev->next = ln->next;
|
||||
}
|
||||
}
|
||||
|
||||
void alLink(ALLink *ln, ALLink *to)
|
||||
{
|
||||
ln->next = to->next;
|
||||
ln->prev = to;
|
||||
|
||||
if (to->next) {
|
||||
to->next->prev = ln;
|
||||
}
|
||||
|
||||
to->next = ln;
|
||||
}
|
||||
|
||||
void alClose(ALGlobals* glob) {
|
||||
if (alGlobals != NULL) {
|
||||
alSynDelete(&glob->drvr);
|
||||
alGlobals = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void alInit(ALGlobals* glob, ALSynConfig* c) {
|
||||
if (alGlobals == NULL) {
|
||||
alGlobals = glob;
|
||||
alSynNew(&glob->drvr, c);
|
||||
}
|
||||
}
|
||||
31
src/libultra/al/synallocfx.c
Normal file
31
src/libultra/al/synallocfx.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/*====================================================================
|
||||
* synallocfx.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include "synthInternals.h"
|
||||
|
||||
ALFxRef *alSynAllocFX(ALSynth *s, s16 bus, ALSynConfig *c, ALHeap *hp)
|
||||
{
|
||||
alFxNew(&s->auxBus[bus].fx[0], c, hp);
|
||||
alFxParam(&s->auxBus[bus].fx[0], AL_FILTER_SET_SOURCE,
|
||||
&s->auxBus[bus]);
|
||||
alMainBusParam(s->mainBus, AL_FILTER_ADD_SOURCE,&s->auxBus[bus].fx[0]);
|
||||
|
||||
return (ALFxRef)(&s->auxBus[bus].fx[0]);
|
||||
}
|
||||
26
src/libultra/al/syndelete.c
Normal file
26
src/libultra/al/syndelete.c
Normal file
@@ -0,0 +1,26 @@
|
||||
/*====================================================================
|
||||
* syndelete.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include "synthInternals.h"
|
||||
|
||||
void alSynDelete(ALSynth *drvr)
|
||||
{
|
||||
drvr->head = 0;
|
||||
}
|
||||
327
src/libultra/al/synthesizer.c
Normal file
327
src/libultra/al/synthesizer.c
Normal file
@@ -0,0 +1,327 @@
|
||||
/*====================================================================
|
||||
* synthesizer.c
|
||||
*
|
||||
* 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.
|
||||
*====================================================================*/
|
||||
|
||||
#include "synthInternals.h"
|
||||
#include <assert.h>
|
||||
|
||||
// TODO: this comes from a header
|
||||
#ident "$Revision: 1.17 $"
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
#include <os.h>
|
||||
extern u32 cnt_index, drvr_num, drvr_cnt, drvr_max, drvr_min, lastCnt[];
|
||||
extern u32 client_num, client_cnt, client_max, client_min;
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
static s32 __nextSampleTime(ALSynth *drvr, ALPlayer **client);
|
||||
static s32 _timeToSamplesNoRound(ALSynth *ALSynth, s32 micros);
|
||||
|
||||
/***********************************************************************
|
||||
* Synthesis driver public interfaces
|
||||
***********************************************************************/
|
||||
void alSynNew(ALSynth *drvr, ALSynConfig *c)
|
||||
{
|
||||
s32 i;
|
||||
ALVoice *vv;
|
||||
PVoice *pv;
|
||||
ALVoice *vvoices;
|
||||
PVoice *pvoices;
|
||||
ALHeap *hp = c->heap;
|
||||
ALSave *save;
|
||||
ALFilter *sources;
|
||||
ALParam *params;
|
||||
ALParam *paramPtr;
|
||||
|
||||
drvr->head = NULL;
|
||||
drvr->numPVoices = c->maxPVoices;
|
||||
drvr->curSamples = 0;
|
||||
drvr->paramSamples = 0;
|
||||
drvr->outputRate = c->outputRate;
|
||||
drvr->maxOutSamples = AL_MAX_RSP_SAMPLES;
|
||||
drvr->dma = (ALDMANew) c->dmaproc;
|
||||
|
||||
save = alHeapAlloc(hp, 1, sizeof(ALSave));
|
||||
alSaveNew(save);
|
||||
drvr->outputFilter = (ALFilter *)save;
|
||||
|
||||
/*
|
||||
* allocate and initialize the auxilliary effects bus. at present
|
||||
* we only support 1 effects bus.
|
||||
*/
|
||||
drvr->auxBus = alHeapAlloc(hp, 1, sizeof(ALAuxBus));
|
||||
drvr->maxAuxBusses = 1;
|
||||
sources = alHeapAlloc(hp, c->maxPVoices, sizeof(ALFilter *));
|
||||
alAuxBusNew(drvr->auxBus, sources, c->maxPVoices);
|
||||
|
||||
/*
|
||||
* allocate and initialize the main bus.
|
||||
*/
|
||||
drvr->mainBus = alHeapAlloc(hp, 1, sizeof(ALMainBus));
|
||||
sources = alHeapAlloc(hp, c->maxPVoices, sizeof(ALFilter *));
|
||||
alMainBusNew(drvr->mainBus, sources, c->maxPVoices);
|
||||
|
||||
if (c->fxType != AL_FX_NONE){
|
||||
/*
|
||||
* Allocate an effect and set parameters
|
||||
*/
|
||||
alSynAllocFX(drvr, 0, c, hp);
|
||||
} else
|
||||
/*
|
||||
* Connect the aux bus to the main bus
|
||||
*/
|
||||
alMainBusParam(drvr->mainBus, AL_FILTER_ADD_SOURCE, &drvr->auxBus[0]);
|
||||
|
||||
/*
|
||||
* Build the physical voice lists
|
||||
*/
|
||||
drvr->pFreeList.next = 0;
|
||||
drvr->pFreeList.prev = 0;
|
||||
drvr->pLameList.next = 0;
|
||||
drvr->pLameList.prev = 0;
|
||||
drvr->pAllocList.next = 0;
|
||||
drvr->pAllocList.prev = 0;
|
||||
|
||||
pvoices = alHeapAlloc(hp, c->maxPVoices, sizeof(PVoice));
|
||||
for (i = 0; i < c->maxPVoices; i++) {
|
||||
pv = &pvoices[i];
|
||||
alLink((ALLink *)pv, &drvr->pFreeList);
|
||||
pv->vvoice = 0;
|
||||
|
||||
alLoadNew(&pv->decoder, drvr->dma, hp);
|
||||
alLoadParam(&pv->decoder, AL_FILTER_SET_SOURCE, 0);
|
||||
|
||||
alResampleNew(&pv->resampler, hp);
|
||||
alResampleParam(&pv->resampler, AL_FILTER_SET_SOURCE, &pv->decoder);
|
||||
|
||||
alEnvmixerNew(&pv->envmixer, hp);
|
||||
alEnvmixerParam(&pv->envmixer, AL_FILTER_SET_SOURCE, &pv->resampler);
|
||||
|
||||
alAuxBusParam(drvr->auxBus, AL_FILTER_ADD_SOURCE, &pv->envmixer);
|
||||
|
||||
pv->channelKnob = (ALFilter *)&pv->envmixer;
|
||||
}
|
||||
|
||||
alSaveParam(save, AL_FILTER_SET_SOURCE, drvr->mainBus);
|
||||
|
||||
/*
|
||||
* build the parameter update list
|
||||
*/
|
||||
params = alHeapAlloc(hp, c->maxUpdates, sizeof(ALParam));
|
||||
drvr->paramList = 0;
|
||||
for (i = 0; i < c->maxUpdates; i++) {
|
||||
paramPtr= ¶ms[i];
|
||||
paramPtr->next = drvr->paramList;
|
||||
drvr->paramList = paramPtr;
|
||||
}
|
||||
|
||||
drvr->heap = hp;
|
||||
}
|
||||
|
||||
/*
|
||||
* slAudioFrame() is called every video frame, and is based on the video
|
||||
* frame interrupt. It is assumed to be an accurate time source for the
|
||||
* clients.
|
||||
*/
|
||||
Acmd *alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
|
||||
{
|
||||
ALPlayer *client;
|
||||
ALFilter *output;
|
||||
ALSynth *drvr = &alGlobals->drvr;
|
||||
s16 tmp = 0; /* Starting buffer in DMEM */
|
||||
Acmd *cmdlEnd = cmdList;
|
||||
Acmd *cmdPtr;
|
||||
s32 nOut;
|
||||
s16 *lOutBuf = outBuf;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
if (drvr->head == 0) {
|
||||
*cmdLen = 0;
|
||||
return cmdList; /* nothing to do */
|
||||
}
|
||||
|
||||
/*
|
||||
* run down list of clients and execute callback if needed this
|
||||
* subframe. Here we do all the work for the frame at the
|
||||
* start. Time offsets that occur before the next frame are
|
||||
* executed "early".
|
||||
*/
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* paramSamples = time of next parameter change.
|
||||
* curSamples = current sample time.
|
||||
* so paramSamples - curSamples is the time until the next parameter change.
|
||||
* if the next parameter change occurs within this frame time (outLen),
|
||||
* then call back the client that contains the parameter change.
|
||||
* Note, paramSamples must be rounded down to 16 sample boundary for use
|
||||
* during the client handler.
|
||||
*/
|
||||
|
||||
for (drvr->paramSamples = __nextSampleTime(drvr, &client);
|
||||
drvr->paramSamples - drvr->curSamples < outLen;
|
||||
drvr->paramSamples = __nextSampleTime(drvr, &client))
|
||||
{
|
||||
drvr->paramSamples &= ~0xf;
|
||||
client->samplesLeft += _timeToSamplesNoRound(drvr, (*client->handler)(client));
|
||||
}
|
||||
|
||||
/* for safety's sake, always store paramSamples aligned to 16 sample boundary.
|
||||
* this way, if an voice handler routine gets called outside the ALVoiceHandler
|
||||
* routine (alSynAllocVoice) it will get timestamped with an aligned value and
|
||||
* will be processed immediately next audio frame.
|
||||
*/
|
||||
drvr->paramSamples &= ~0xf;
|
||||
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(client_num, client_cnt, client_max, client_min);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Now build the command list in small chunks
|
||||
*/
|
||||
while (outLen > 0){
|
||||
nOut = MIN(drvr->maxOutSamples, outLen);
|
||||
|
||||
/*
|
||||
* construct the command list for each physical voice by calling
|
||||
* the head of the filter chain.
|
||||
*/
|
||||
cmdPtr = cmdlEnd;
|
||||
aSegment(cmdPtr++, 0, 0);
|
||||
output = drvr->outputFilter;
|
||||
(*output->setParam)(output, AL_FILTER_SET_DRAM, lOutBuf);
|
||||
cmdlEnd = (*output->handler)(output, &tmp, nOut, drvr->curSamples,
|
||||
cmdPtr);
|
||||
|
||||
outLen -= nOut;
|
||||
lOutBuf += nOut<<1; /* For Stereo */
|
||||
drvr->curSamples += nOut;
|
||||
|
||||
}
|
||||
*cmdLen = (s32) (cmdlEnd - cmdList);
|
||||
|
||||
_collectPVoices(drvr); /* collect free physical voices */
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(drvr_num, drvr_cnt, drvr_max, drvr_min);
|
||||
#endif
|
||||
return cmdlEnd;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Synthesis driver private interfaces
|
||||
***********************************************************************/
|
||||
|
||||
ALParam *__allocParam()
|
||||
{
|
||||
ALParam *update = 0;
|
||||
ALSynth *drvr = &alGlobals->drvr;
|
||||
|
||||
if (drvr->paramList) {
|
||||
update = drvr->paramList;
|
||||
drvr->paramList = drvr->paramList->next;
|
||||
update->next = 0;
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
void __freeParam(ALParam *param)
|
||||
{
|
||||
ALSynth *drvr = &alGlobals->drvr;
|
||||
param->next = drvr->paramList;
|
||||
drvr->paramList = param;
|
||||
}
|
||||
|
||||
void _collectPVoices(ALSynth *drvr)
|
||||
{
|
||||
ALLink *dl;
|
||||
PVoice *pv;
|
||||
|
||||
while ((dl = drvr->pLameList.next) != 0) {
|
||||
pv = (PVoice *)dl;
|
||||
|
||||
/* ### remove from mixer */
|
||||
|
||||
alUnlink(dl);
|
||||
alLink(dl, &drvr->pFreeList);
|
||||
}
|
||||
}
|
||||
|
||||
void _freePVoice(ALSynth *drvr, PVoice *pvoice)
|
||||
{
|
||||
/*
|
||||
* move the voice from the allocated list to the lame list
|
||||
*/
|
||||
alUnlink((ALLink *)pvoice);
|
||||
alLink((ALLink *)pvoice, &drvr->pLameList);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Add 0.5 to adjust the average affect of
|
||||
the truncation error produced by casting
|
||||
a float to an int.
|
||||
*/
|
||||
s32 _timeToSamplesNoRound(ALSynth *synth, s32 micros)
|
||||
{
|
||||
f32 tmp = ((f32)micros) * synth->outputRate / 1000000.0 + 0.5;
|
||||
|
||||
return (s32)tmp;
|
||||
}
|
||||
|
||||
s32 _timeToSamples(ALSynth *synth, s32 micros)
|
||||
{
|
||||
return _timeToSamplesNoRound(synth, micros) & ~0xf;
|
||||
}
|
||||
|
||||
static s32 __nextSampleTime(ALSynth *drvr, ALPlayer **client)
|
||||
{
|
||||
ALMicroTime delta = 0x7fffffff; /* max delta for s32 */
|
||||
ALPlayer *cl;
|
||||
|
||||
#ifdef _DEBUG
|
||||
assert(drvr->head);
|
||||
#endif
|
||||
|
||||
*client = 0;
|
||||
|
||||
for (cl = drvr->head; cl != 0; cl = cl->next) {
|
||||
if ((cl->samplesLeft - drvr->curSamples) < delta) {
|
||||
*client = cl;
|
||||
delta = cl->samplesLeft - drvr->curSamples;
|
||||
}
|
||||
}
|
||||
|
||||
return (*client)->samplesLeft;
|
||||
}
|
||||
|
||||
|
||||
|
||||
137
src/libultra/gu/cosf.c
Normal file
137
src/libultra/gu/cosf.c
Normal file
@@ -0,0 +1,137 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "guint.h"
|
||||
|
||||
/* ====================================================================
|
||||
* ====================================================================
|
||||
*
|
||||
* Module: fcos.c
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 1998/10/09 06:10:53 $
|
||||
* $Author: has $
|
||||
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/libultra/monegi/gu/cosf.c,v $
|
||||
*
|
||||
* Revision history:
|
||||
* 09-Jun-93 - Original Version
|
||||
*
|
||||
* Description: source code for fcos function
|
||||
*
|
||||
* ====================================================================
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
#pragma weak fcos = __cosf
|
||||
#pragma weak cosf = __cosf
|
||||
#define fcos __cosf
|
||||
|
||||
/* coefficients for polynomial approximation of cos on +/- pi/2 */
|
||||
|
||||
static const du P[] =
|
||||
{
|
||||
{0x3ff00000, 0x00000000},
|
||||
{0xbfc55554, 0xbc83656d},
|
||||
{0x3f8110ed, 0x3804c2a0},
|
||||
{0xbf29f6ff, 0xeea56814},
|
||||
{0x3ec5dbdf, 0x0e314bfe},
|
||||
};
|
||||
|
||||
static const du rpi =
|
||||
{0x3fd45f30, 0x6dc9c883};
|
||||
|
||||
static const du pihi =
|
||||
{0x400921fb, 0x50000000};
|
||||
|
||||
static const du pilo =
|
||||
{0x3e6110b4, 0x611a6263};
|
||||
|
||||
static const fu zero = {0x00000000};
|
||||
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* FunctionName fcos
|
||||
*
|
||||
* Description computes cosine of arg
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
float
|
||||
fcos( float x )
|
||||
{
|
||||
float absx;
|
||||
double dx, xsq, poly;
|
||||
double dn;
|
||||
int n;
|
||||
double result;
|
||||
int ix, xpt;
|
||||
|
||||
|
||||
ix = *(int *)&x;
|
||||
xpt = (ix >> 22);
|
||||
xpt &= 0x1ff;
|
||||
|
||||
/* xpt is exponent(x) + 1 bit of mantissa */
|
||||
|
||||
|
||||
if ( xpt < 0x136 )
|
||||
{
|
||||
/* |x| < 2^28 */
|
||||
|
||||
/* use the standard algorithm from Cody and Waite, doing
|
||||
the computations in double precision
|
||||
*/
|
||||
|
||||
absx = ABS(x);
|
||||
|
||||
dx = absx;
|
||||
|
||||
dn = dx*rpi.d + 0.5;
|
||||
n = ROUND(dn);
|
||||
dn = n;
|
||||
|
||||
dn -= 0.5;
|
||||
|
||||
dx = dx - dn*pihi.d;
|
||||
dx = dx - dn*pilo.d; /* dx = x - (n - 0.5)*pi */
|
||||
|
||||
xsq = dx*dx;
|
||||
|
||||
poly = ((P[4].d*xsq + P[3].d)*xsq + P[2].d)*xsq + P[1].d;
|
||||
|
||||
result = dx + (dx*xsq)*poly;
|
||||
|
||||
/* negate result if n is odd */
|
||||
|
||||
if ( (n & 1) == 0 )
|
||||
return ( (float)result );
|
||||
|
||||
return ( -(float)result );
|
||||
}
|
||||
|
||||
if ( x != x )
|
||||
{
|
||||
/* x is a NaN; return a quiet NaN */
|
||||
|
||||
#ifdef _IP_NAN_SETS_ERRNO
|
||||
|
||||
*__errnoaddr = EDOM;
|
||||
#endif
|
||||
|
||||
return ( __libm_qnan_f );
|
||||
}
|
||||
|
||||
/* just give up and return 0.0 */
|
||||
|
||||
return ( zero.f );
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user