The first commit

This commit is contained in:
Banjo Kazooie
2022-07-15 17:09:41 -05:00
commit dd13d34074
1087 changed files with 391897 additions and 0 deletions

74
.gitignore vendored Normal file
View File

@@ -0,0 +1,74 @@
# ignore all rom files
baseroms/*
*.z64
*.n64
*.v64
#compiled or ripped asm
asm/nonmatchings
asm/*.s
asm/*/*.s
asm/core1/os
!asm/ultra
!asm/core1/ultra
build/*
build/
#binaries ripped from the ROMs
assets/
assets/*
bin/
bin/*
tools/bk_crc/bk_crc
# This folder will hold modified asset binaries
# these assets will override the original game
# assets in the bin/ at compile time.
mod/
mod/*
#compiled object files
*.slo
*.lo
*.o
*.obj
#Precompiled Headers
*.gch
*.pch
#compiled dynamic libraries
*.so
*.dylib
*.dll
#static libraries
*.lai
*.la
*.a
*.lib
#misc
__pycache__/
*__pycache__/
expected/
.*/
*.ld
*.map
*auto.txt
.splat_cache
.splat_cache*
diff_settings.py
ctx.c
nonmatchings/
undefined_syms_auto*
undefined_funcs_auto*
#progress reports
*.csv
symbol_addrs.us.v10.txt
#secret folder
tmp/
tmp/*

18
.gitmodules vendored Normal file
View File

@@ -0,0 +1,18 @@
[submodule "tools/bk_tools"]
path = tools/bk_tools
url = https://github.com/MittenzHugg/bk_tools.git
[submodule "tools/asm-differ"]
path = tools/asm-differ
url = https://github.com/simonlindholm/asm-differ.git
[submodule "tools/asm-processor"]
path = tools/asm-processor
url = https://github.com/simonlindholm/asm-processor.git
[submodule "tools/n64splat"]
path = tools/n64splat
url = https://github.com/ethteck/splat
[submodule "tools/ido-static-recomp"]
path = tools/ido-static-recomp
url = https://github.com/Emill/ido-static-recomp.git
[submodule "tools/bk_asset_tool"]
path = tools/bk_asset_tool
url = https://github.com/MittenzHugg/bk_asset_tool.git

12
Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM ubuntu:20.04 as build
ENV DEBIAN_FRONTEND=noninteractive
COPY packages.txt /
RUN apt-get update && apt-get install -y $(cat packages.txt)
COPY requirements.txt /
RUN python3 -m pip install -r requirements.txt
RUN mkdir /banjo
WORKDIR /banjo

604
Makefile Normal file
View File

@@ -0,0 +1,604 @@
### Configuration ###
BASENAME := banjo
VERSION ?= us.v10
ifeq ($(VERSION),us.v10)
C_VERSION=0
endif
ifeq ($(VERSION),pal)
C_VERSION=1
endif
ifeq ($(VERSION),us.v11)
C_VERSION=2
endif
ifeq ($(VERSION),jp)
C_VERSION=3
endif
IN_CFLAGS ?= -DCODE2_CODE_CRC2=0 -DCODE2_DATA_CRC2=0
### Tools ###
# System tools
MKDIR := mkdir
CP := cp
CD := cd
RM := rm
CAT := cat
DIFF := diff
# Build tools
CROSS := mips-linux-gnu-
CC := ido/ido5.3_recomp/cc
CPP := cpp
GCC := $(CROSS)gcc
AS := $(CROSS)as
LD := $(CROSS)ld -b elf32-tradbigmips
OBJDUMP := $(CROSS)objdump
OBJCOPY := $(CROSS)objcopy
PYTHON := python3
GREP := grep -rl
SPLAT := $(PYTHON) tools/n64splat/split.py
PRINT := printf
PATCH_LIB_MATH := tools/patch_libultra_math
ASM_PROCESSOR_DIR := tools/asm-processor
BK_TOOLS := tools/bk_tools
BK_CRC := tools/bk_crc/bk_crc
BK_INFLATE := $(BK_TOOLS)/bk_inflate_code
BK_DEFLATE := $(BK_TOOLS)/bk_deflate_code
BK_ASSET_TOOL := tools/bk_asset_tool/bk_asset_tool
ASM_PROCESSOR := $(PYTHON) $(ASM_PROCESSOR_DIR)/asm_processor.py
SPLAT_INPUTS := $(PYTHON) tools/splat_inputs.py
PROGRESS := $(PYTHON) tools/progress.py
PROGRESS_READ := $(PYTHON) tools/progress_read.py
### Files and Directories ###
# Inputs
OVERLAYS := core1 core2 MM TTC CC BGS FP lair GV CCW RBB MMM SM fight cutscenes
# Creates a list of all the source files for the given overlay (e.g. BGS_C_SRCS)
# Appends that list to OVERLAY_C_FILES
define get_overlay_sources
$(1)_C_SRCS := $(filter $(SRC_ROOT)/$(1)/%,$(ALL_C_SRCS))
$(1)_ASM_SRCS := $(filter $(ASM_ROOT)/$(1)/%,$(ALL_ASM_SRCS))
$(1)_BINS := $(filter $(BIN_ROOT)/$(1)/%,$(ALL_BINS))
OVERLAY_C_SRCS += $$($(1)_C_SRCS)
OVERLAY_ASM_SRCS += $$($(1)_ASM_SRCS)
OVERLAY_BINS += $$($(1)_BINS)
# Overlay inputs
$(1)_NEW_FILES := $$(filter $(BIN_ROOT)/$(1)/%, $(NEW_BINS)) $$(filter $(SRC_ROOT)/$(1)/%, $(NEW_C_SRCS)) $$(filter $(ASM_ROOT)/$(1)/%, $(NEW_ASM_SRCS)) $$(filter $(ASM_ROOT)/data/$(1)/%, $(NEW_ASM_SRCS))
OVERLAY_NEW_FILES += $$($(1)_NEW_FILES)
endef
# Source files
SRC_ROOT := src
ASM_ROOT := asm
BIN_ROOT := bin
ASSET_ROOT := assets
SUBYAML := subyaml
NONMATCHINGS := nonmatchings
NONMATCHING_DIR := $(ASM_ROOT)/$(NONMATCHINGS)
BUILD_ROOT := build
BUILD_DIR := $(BUILD_ROOT)/$(VERSION)
ALL_ASSET_FILES := $(shell find $(ASSET_ROOT) -type f -iname '*.*' 2> /dev/null)
ALL_C_SRCS := $(shell find $(SRC_ROOT) -type f -iname '*.c' 2> /dev/null)
ALL_ASM_SRCS := $(filter-out $(ASM_ROOT)/$(NONMATCHINGS), $(shell find $(ASM_ROOT) -name $(NONMATCHINGS) -prune -o -iname '*.s' 2> /dev/null))
ALL_BINS := $(shell find $(BIN_ROOT) -type f -iname '*.bin' 2> /dev/null)
# Files referenced in the splat files
YAML_CALL := $(SPLAT_INPUTS) $(BASENAME).$(VERSION).yaml $(addprefix $(SUBYAML)/, $(addsuffix .$(VERSION).yaml, $(OVERLAYS)))
YAML_SRCS := $(shell $(SPLAT_INPUTS) $(BASENAME).$(VERSION).yaml $(addprefix $(SUBYAML)/, $(addsuffix .$(VERSION).yaml, $(OVERLAYS))))
YAML_C_SRCS := $(filter %.c, $(YAML_SRCS))
YAML_ASM_SRCS := $(filter %.s, $(YAML_SRCS))
YAML_BINS := $(filter %.bin, $(YAML_SRCS))
# Files that need to be extracted
NEW_C_SRCS := $(filter-out $(ALL_C_SRCS), $(YAML_C_SRCS))
NEW_ASM_SRCS := $(filter-out $(ALL_ASM_SRCS), $(YAML_ASM_SRCS))
NEW_BINS := $(filter-out $(ALL_BINS), $(YAML_BINS))
NEW_FILES := $(NEW_C_SRCS) $(NEW_ASM_SRCS) $(NEW_BINS)
$(foreach overlay,$(OVERLAYS),$(eval $(call get_overlay_sources,$(overlay))))
# Files for the rom itself
MAIN_C_SRCS := $(filter-out $(OVERLAY_C_SRCS),$(ALL_C_SRCS))
MAIN_ASM_SRCS := $(filter-out $(OVERLAY_ASM_SRCS),$(ALL_ASM_SRCS))
MAIN_BINS := $(filter-out $(OVERLAY_BINS),$(ALL_BINS))
# Files that need to be extracted for the rom itself
MAIN_NEW_FILES := $(filter-out $(OVERLAY_NEW_FILES), $(NEW_FILES))
# Any source files that have GLOBAL_ASM in them or do not exist before splitting
GLOBAL_ASM_C_SRCS := $(shell $(GREP) GLOBAL_ASM $(SRC_ROOT) </dev/null) $(NEW_C_SRCS)
CORE2_CODE_CRC_C_SRCS := $(shell $(GREP) CORE2_CODE_CRC2 $(SRC_ROOT) </dev/null)
CORE2_DATA_CRC_C_SRCS := $(shell $(GREP) CORE2_DATA_CRC2 $(SRC_ROOT) </dev/null)
# Build folders
C_DIRS := $(sort $(dir $(ALL_C_SRCS) $(NEW_C_SRCS)))
ASM_DIRS := $(sort $(dir $(ALL_ASM_SRCS) $(NEW_ASM_SRCS)))
BIN_DIRS := $(sort $(dir $(ALL_BINS) $(NEW_BINS)))
C_BUILD_DIRS := $(addprefix $(BUILD_DIR)/,$(C_DIRS))
ASM_BUILD_DIRS := $(addprefix $(BUILD_DIR)/,$(ASM_DIRS))
BIN_BUILD_DIRS := $(addprefix $(BUILD_DIR)/,$(BIN_DIRS))
ALL_DIRS := $(C_BUILD_DIRS) $(ASM_BUILD_DIRS) $(BIN_BUILD_DIRS) $(BUILD_DIR)
# Build files
BASEROM := baserom.$(VERSION).z64
C_OBJS := $(addprefix $(BUILD_DIR)/,$(ALL_C_SRCS:.c=.c.o))
GLOBAL_ASM_C_OBJS := $(addprefix $(BUILD_DIR)/,$(GLOBAL_ASM_C_SRCS:.c=.c.o))
CORE2_CODE_CRC_C_OBJS := $(addprefix $(BUILD_DIR)/,$(CORE2_CODE_CRC_C_SRCS:.c=.c.o))
CORE2_DATA_CRC_C_OBJS := $(addprefix $(BUILD_DIR)/,$(CORE2_DATA_CRC_C_SRCS:.c=.c.o))
# TODO remove this when all files in GLOBAL_ASM_C_OBJS are matched
GLOBAL_ASM_C_OBJS := $(filter-out $(CORE2_DATA_CRC_C_OBJS),$(GLOBAL_ASM_C_OBJS))
C_DEPS := $(C_OBJS:.o=.d)
ASM_OBJS := $(addprefix $(BUILD_DIR)/,$(ALL_ASM_SRCS:.s=.s.o) $(NEW_ASM_SRCS:.s=.s.o))
BIN_OBJS := $(addprefix $(BUILD_DIR)/,$(ALL_BINS:.bin=.bin.o) $(NEW_BINS:.bin=.bin.o))
Z64 := $(addprefix $(BUILD_DIR)/,$(BASENAME).$(VERSION).z64)
ELF := $(Z64:.z64=.elf)
LD_SCRIPT := $(BASENAME).ld
BK_BOOT_LD_SCRIPT := bk_boot.ld
OVERLAY_ELFS := $(addprefix $(BUILD_DIR)/,$(addsuffix .elf,$(OVERLAYS)))
OVERLAY_CODE_BINS := $(OVERLAY_ELFS:.elf=.code)
OVERLAY_DATA_BINS := $(OVERLAY_ELFS:.elf=.data)
OVERLAY_BINS := $(addprefix $(BUILD_DIR)/,$(addsuffix .$(VERSION).bin,$(OVERLAYS)))
ASSET_BIN := $(BUILD_DIR)/assets.bin
OVERLAY_RZIPS := $(addprefix $(BIN_ROOT)/,$(addsuffix .$(VERSION).rzip.bin,$(OVERLAYS)))
OVERLAY_RZIP_OUTS := $(addprefix $(BUILD_DIR)/,$(addsuffix .rzip.bin,$(OVERLAYS)))
OVERLAY_RZIP_OBJS := $(addprefix $(BUILD_DIR)/$(BIN_ROOT)/,$(addsuffix .$(VERSION).rzip.bin.o,$(OVERLAYS)))
CRC_OBJS := $(BUILD_DIR)/$(BIN_ROOT)/crc.bin.o
ASSET_OBJS := $(BUILD_DIR)/$(BIN_ROOT)/assets.bin.o
BIN_OBJS := $(filter-out $(OVERLAY_RZIP_OBJS) $(CRC_OBJS) $(ASSET_OBJS),$(BIN_OBJS))
ALL_OBJS := $(C_OBJS) $(ASM_OBJS) $(BIN_OBJS) $(OVERLAY_RZIP_OBJS) $(CRC_OBJS)
SYMBOL_ADDRS := symbol_addrs.$(VERSION).txt
SYMBOL_ADDR_FILES := $(filter-out $(SYMBOL_ADDRS), $(wildcard symbol_addrs.*.$(VERSION).txt))
MIPS3_OBJS := $(BUILD_DIR)/$(SRC_ROOT)/done/ll.c.o $(BUILD_DIR)/$(SRC_ROOT)/core1/done/ll.c.o
# Object files for the rom itself
MAIN_C_OBJS := $(addprefix $(BUILD_DIR)/,$(MAIN_C_SRCS:.c=.c.o))
MAIN_ASM_OBJS := $(addprefix $(BUILD_DIR)/,$(MAIN_ASM_SRCS:.s=.s.o))
MAIN_BIN_OBJS := $(addprefix $(BUILD_DIR)/,$(MAIN_BINS:.bin=.bin.o))
MAIN_OBJS := $(MAIN_C_OBJS) $(MAIN_ASM_OBJS) $(MAIN_BIN_OBJS)
# Includes the build artifacts of any files to be extracted
MAIN_ALL_OBJS := $(MAIN_OBJS) $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(MAIN_NEW_FILES)))
# Progress files
MAIN_PROG_CSV := progress/progress.bk_boot.csv
MAIN_PROG_SVG := progress/progress_bk_boot.svg
TOTAL_PROG_CSV := progress/progress.total.csv
TOTAL_PROG_SVG := progress/progress_total.svg
OVERLAY_PROG_CSVS := $(addprefix progress/progress., $(addsuffix .csv, $(OVERLAYS)))
OVERLAY_PROG_SVGS := $(addprefix progress/progress_, $(addsuffix .svg, $(OVERLAYS)))
# Creates a list of all the object files for the given overlay
define get_overlay_objects
$(1)_C_OBJS := $(addprefix $(BUILD_DIR)/,$($(1)_C_SRCS:.c=.c.o))
$(1)_ASM_OBJS := $(addprefix $(BUILD_DIR)/,$($(1)_ASM_SRCS:.s=.s.o))
$(1)_BIN_OBJS := $(addprefix $(BUILD_DIR)/,$($(1)_BINS:.bin=.bin.o))
$(1)_OBJS := $$($(1)_C_OBJS) $$($(1)_ASM_OBJS) $$($(1)_BIN_OBJS)
$(1)_ALL_OBJS := $$($(1)_OBJS) $$(addprefix $(BUILD_DIR)/, $$(addsuffix .o, $$($(1)_NEW_FILES)))
OVERLAY_OBJS += $$($(1)_OBJS)
endef
$(foreach overlay,$(OVERLAYS),$(eval $(call get_overlay_objects,$(overlay))))
### Functions ###
# Colorful text printing
NO_COL := \033[0m
RED := \033[0;31m
GREEN := \033[0;32m
BLUE := \033[0;34m
YELLOW := \033[0;33m
BLINK := \033[33;5m
# Print message with zero arguments (i.e. message)
define print0
@$(PRINT) "$(GREEN)$(1)$(NO_COL)\n"
endef
# Print message with one argument (i.e. message arg)
define print1
@$(PRINT) "$(GREEN)$(1) $(BLUE)$(2)$(NO_COL)\n"
endef
# Print message with two arguments (i.e. message arg1 -> arg2)
define print2
@$(PRINT) "$(GREEN)$(1) $(YELLOW)$(2)$(GREEN) -> $(BLUE)$(3)$(NO_COL)\n"
endef
### Flags ###
# Build tool flags
CFLAGS := -c -Wab,-r4300_mul -non_shared -G 0 -Xfullwarn -Xcpluscomm $(OPT_FLAGS) $(MIPSBIT) -D_FINALROM -DF3DEX_GBI -DVERSION='$(C_VERSION)'
CFLAGS += -woff 649,654,838,807
CFLAGS += $(IN_CFLAGS)
CPPFLAGS := -D_FINALROM -DN_MICRO
INCLUDE_CFLAGS := -I . -I include -I include/2.0L -I include/2.0L/PR
OPT_FLAGS := -O2
MIPSBIT := -mips2
ASFLAGS := -EB -mtune=vr4300 -march=vr4300 -mabi=32 -I include
GCC_ASFLAGS := -c -x assembler-with-cpp -mabi=32 -ffreestanding -mtune=vr4300 -march=vr4300 -mfix4300 -G 0 -O -mno-shared -fno-PIC -mno-abicalls
LDFLAGS_COMMON := -T symbol_addrs.core1.$(VERSION).txt -T symbol_addrs.core2.$(VERSION).txt -T symbol_addrs.global.$(VERSION).txt -T undefined_syms.$(VERSION).txt -T undefined_syms.libultra.txt --no-check-sections --accept-unknown-input-arch
LDFLAGS := -T $(LD_SCRIPT) -Map $(ELF:.elf=.map) --no-check-sections --accept-unknown-input-arch -T undefined_syms.libultra.txt
BINOFLAGS := -I binary -O elf32-tradbigmips
### Rules ###
# Default target, all
all: verify
# Shows progress for all overlays, boot, and total
progress: $(OVERLAY_PROG_CSVS) $(MAIN_PROG_CSV) $(TOTAL_PROG_CSV)
@$(foreach overlay,$(OVERLAYS),$(PROGRESS_READ) progress/progress.$(overlay).csv $(VERSION) $(overlay) &&) \
$(PROGRESS_READ) $(MAIN_PROG_CSV) $(VERSION) bk_boot
@$(PROGRESS_READ) $(TOTAL_PROG_CSV) $(VERSION) total
# Shows progress for a single overlay (e.g. progress-SM)
$(addprefix progress-,$(OVERLAYS)) : progress-% : progress/progress.%.csv
@$(PROGRESS_READ) $< $(VERSION) $*
# Verify that the roms match, also sets up diff_settings
verify: $(Z64)
@$(DIFF) $(BASEROM) $(Z64) > /dev/null && \
$(PRINT) "$(YELLOW) _\n _( )_\n [ ]_\n ) _ _)\n [_( )_]\n$(BLUE)$(BASENAME).$(VERSION).z64$(NO_COL): $(GREEN)OK$(NO_COL)\n" || \
$(PRINT) "$(BLUE)$(BASEROM) $(RED)differs$(NO_COL)\n"
@$(PRINT) "def apply(config, args):\n" > diff_settings.py
@$(PRINT) "\tconfig[\"baseimg\"] = \"$(BASEROM)\"\n" >> diff_settings.py
@$(PRINT) "\tconfig[\"myimg\"] = \"$(Z64)\"\n" >> diff_settings.py
@$(PRINT) "\tconfig[\"mapfile\"] = \"$(Z64:.z64=.map)\"\n" >> diff_settings.py
@$(PRINT) "\tconfig[\"source_directories\"] = ['$(SRC_ROOT)', 'include']\n" >> diff_settings.py
@$(PRINT) "\tconfig[\"makeflags\"] = ['-s']\n" >> diff_settings.py
# Musical note print for individual overlays
# Need to figure out how to print this only when building a single overlay
# $(YELLOW) ╒════╕\n │ │\n _│ _│\n └─┘ └─┘\n
# Verify that any given overlay matches, also sets up diff_settings
verify-%: $(BUILD_DIR)/%.rzip.bin $(BIN_ROOT)/%.$(VERSION).rzip.bin $(BUILD_DIR)/%.full progress/progress_%.svg
@$(DIFF) $< $(BIN_ROOT)/$*.$(VERSION).rzip.bin > /dev/null && \
$(PRINT) "$(BLUE)%-10s$(NO_COL): $(GREEN)OK$(NO_COL)\n" "$*" || \
$(PRINT) "$(BLUE)$* $(RED)differs$(NO_COL)\n"
@$(PRINT) "def apply(config, args):\n" > diff_settings.py
@$(PRINT) "\tconfig[\"baseimg\"] = \"$(BUILD_DIR)/$*.$(VERSION).bin\"\n" >> diff_settings.py
@$(PRINT) "\tconfig[\"myimg\"] = \"$(BUILD_DIR)/$*.full\"\n" >> diff_settings.py
@$(PRINT) "\tconfig[\"mapfile\"] = \"$(BUILD_DIR)/$*.map\"\n" >> diff_settings.py
@$(PRINT) "\tconfig[\"source_directories\"] = ['$(SRC_ROOT)/$*', 'include']\n" >> diff_settings.py
@$(PRINT) "\tconfig[\"makeflags\"] = ['TARGET=$*','-s']\n" >> diff_settings.py
$(OVERLAY_PROG_SVGS) : progress/progress_%.svg: progress/progress.%.csv
$(call print1,Creating progress svg for:,$*)
@$(PROGRESS_READ) $< $(VERSION) $*
$(OVERLAY_PROG_CSVS) : progress/progress.%.csv: $(BUILD_DIR)/%.elf
$(call print1,Calculating progress for:,$*)
@$(PROGRESS) . $(BUILD_DIR)/$*.elf .$*_code --version $(VERSION) --subcode $* > $@
$(MAIN_PROG_SVG): $(MAIN_PROG_CSV)
$(call print1,Creating progress svg for:,boot)
@$(PROGRESS_READ) $< $(VERSION) bk_boot
$(MAIN_PROG_CSV): $(ELF)
$(call print1,Calculating progress for:,boot)
@$(PROGRESS) . $< .boot_bk_boot --version $(VERSION) > $@
$(TOTAL_PROG_SVG): $(TOTAL_PROG_CSV)
$(call print0,Creating total progress svg)
@$(PROGRESS_READ) $< $(VERSION) total
$(TOTAL_PROG_CSV): $(OVERLAY_PROG_CSVS) $(MAIN_PROG_CSV)
$(call print0,Calculating total progress)
@cat $^ > $@
# Verify that each overlay matches
verify-each: $(addprefix verify-,$(OVERLAYS))
# per-overlay rules
define overlay_rules
# .o -> .elf (overlay)
$(BUILD_DIR)/$(1).elf : $$($(1)_ALL_OBJS) $(1).ld
$(LD) -T $(1).ld -R core2.elf --allow-multiple-definition -Map $(BUILD_DIR)/$(1).map $$(LDFLAGS_COMMON) -T undefined_syms_auto.$(1).$(VERSION).txt -T undefined_funcs_auto.$(1).$(VERSION).txt -o $$@
# split overlay
$(BUILD_DIR)/$(1)_SPLAT_TIMESTAMP : $(SUBYAML)/$(1).$(VERSION).yaml $(BUILD_DIR)/$(1).$(VERSION).bin $(SYMBOL_ADDRS)
$(call print1,Splitting bin:,$$<)
$(SPLAT) --target $(BUILD_DIR)/$(1).$(VERSION).bin $(SUBYAML)/$(1).$(VERSION).yaml --basedir .
@touch $$@
@touch $(1).ld
# Dummy target to make sure extraction happens before compilation, mainly for extracted asm
$$($(1)_C_SRCS) $$($(1)_ASM_SRCS) $$($(1)_BINS) : | $(BUILD_DIR)/$(1)_SPLAT_TIMESTAMP
@:
# Dummy target to make sure extraction happens before processing extracted files and linking
$$($(1)_NEW_FILES) $(1).ld: $(BUILD_DIR)/$(1)_SPLAT_TIMESTAMP
@:
endef
$(foreach overlay,$(OVERLAYS),$(eval $(call overlay_rules,$(overlay))))
# Additional symbols for core2
$(BUILD_DIR)/core2.elf: LDFLAGS_COMMON = -T symbol_addrs.core1.$(VERSION).txt -T symbol_addrs.core2.$(VERSION).txt -T symbol_addrs.global.$(VERSION).txt -T undefined_syms.$(VERSION).txt -T undefined_syms.libultra.txt --no-check-sections --accept-unknown-input-arch -T level_symbols.$(VERSION).txt
$(BUILD_DIR)/core2.temp.elf: LDFLAGS_COMMON = -T symbol_addrs.core1.$(VERSION).txt -T symbol_addrs.core2.$(VERSION).txt -T symbol_addrs.global.$(VERSION).txt -T undefined_syms.$(VERSION).txt -T undefined_syms.libultra.txt --no-check-sections --accept-unknown-input-arch -T level_symbols.$(VERSION).txt
# mkdir
$(ALL_DIRS) :
$(call print1,Making folder:,$@)
@$(MKDIR) -p $@
# .s -> .o (assemble with gcc for preprocessor support)
$(BUILD_DIR)/%.s.o: %.s | $(ASM_BUILD_DIRS)
$(call print2,Assembling:,$<,$@)
@$(GCC) $(GCC_ASFLAGS) $(INCLUDE_CFLAGS) -o $@ $<
# .bin -> .o
$(BIN_OBJS) : $(BUILD_DIR)/%.bin.o : %.bin | $(BIN_BUILD_DIRS)
$(call print2,Objcopying:,$<,$@)
@$(OBJCOPY) $(BINOFLAGS) $< $@
# .bin -> .o (overlay)
$(OVERLAY_RZIP_OBJS) : $(BUILD_DIR)/$(BIN_ROOT)/%.$(VERSION).rzip.bin.o : $(BUILD_DIR)/%.rzip.bin
$(call print2,Objcopying:,$<,$@)
@$(OBJCOPY) $(BINOFLAGS) $< $@
$(BUILD_DIR)/bk_boot.full: $(BUILD_DIR)/bk_boot.elf
@mips-linux-gnu-objcopy -I elf32-tradbigmips -O binary --only-section .boot_bk_boot $(BUILD_DIR)/bk_boot.elf $@
$(BUILD_DIR)/crc.bin : $(BUILD_DIR)/bk_boot.full $(BUILD_DIR)/core1.code $(BUILD_DIR)/core1.data $(BK_CRC)
@$(BK_CRC) $(BUILD_DIR)/bk_boot.full > $(BUILD_DIR)/crc.bin
@$(BK_CRC) $(BUILD_DIR)/core1.code >> $(BUILD_DIR)/crc.bin
@$(BK_CRC) $(BUILD_DIR)/core1.data >> $(BUILD_DIR)/crc.bin
# .bin -> .o (overlay crc check)
$(CRC_OBJS) : $(BUILD_DIR)/crc.bin
$(call print2,Objcopying:,$<,$@)
@$(OBJCOPY) $(BINOFLAGS) $< $@
# .c -> .o
$(BUILD_DIR)/%.c.o : %.c | $(C_BUILD_DIRS)
$(call print2,Compiling:,$<,$@)
@$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDE_CFLAGS) $(OPT_FLAGS) $(MIPSBIT) -o $@ $<
# .c -> .o (mips3)
$(MIPS3_OBJS) : $(BUILD_DIR)/%.c.o : %.c | $(C_BUILD_DIRS)
$(call print2,Compiling:,$<,$@)
@$(CC) -c -32 $(CFLAGS) $(CPPFLAGS) $(INCLUDE_CFLAGS) $(OPT_FLAGS) $(LOOP_UNROLL) $(MIPSBIT) -o $@ $<
@tools/set_o32abi_bit.py $@
# .c -> .o with asm processor
$(GLOBAL_ASM_C_OBJS) : $(BUILD_DIR)/%.c.o : %.c | $(C_BUILD_DIRS)
$(call print2,Compiling (with ASM Processor):,$<,$@)
@$(ASM_PROCESSOR) $(OPT_FLAGS) $< > $(BUILD_DIR)/$<
@$(CC) -32 $(CFLAGS) $(CPPFLAGS) $(INCLUDE_CFLAGS) $(OPT_FLAGS) $(MIPSBIT) -o $@ $(BUILD_DIR)/$<
@$(ASM_PROCESSOR) $(OPT_FLAGS) $< --post-process $@ \
--assembler "$(AS) $(ASFLAGS)" --asm-prelude include/prelude.s
# Split baserom
$(BUILD_DIR)/SPLAT_TIMESTAMP: $(BASENAME).$(VERSION).yaml $(SYMBOL_ADDRS) | $(BUILD_DIR)
$(call print1,Splitting rom:,$<)
@touch $@
@$(SPLAT) $(BASENAME).$(VERSION).yaml
@touch $(LD_SCRIPT)
# Dummy target to make the LD script and overlay rzips depend on splat being run
# without causing it to be rerun once for every overlay
# Bin files are also dependent on the splat timestamp since they get overwritten on resplit
$(MAIN_NEW_FILES) $(LD_SCRIPT) $(MAIN_BINS) : $(BUILD_DIR)/SPLAT_TIMESTAMP
@:
# Dummy target to make sure extraction happens before compilation, mainly for extracted asm
$(MAIN_C_SRCS) $(MAIN_ASM_SRCS) : | $(BUILD_DIR)/SPLAT_TIMESTAMP
@:
# .rzip.bin -> .bin
$(OVERLAY_BINS) : $(BUILD_DIR)/%.$(VERSION).bin : $(BIN_ROOT)/%.$(VERSION).rzip.bin $(BK_INFLATE) | $(BUILD_DIR)
$(call print1,Decompressing rzip:,$<)
@$(BK_INFLATE) $< $@
# Special rules to handle core2 code checksumming
ifneq ($(CORE2_CODE_CRC_C_OBJS),)
CORE2_TEMP_LD := core2.temp.ld
CORE2_CODE_CRC_C_TEMP_OBJS := $(CORE2_CODE_CRC_C_OBJS:.c.o=.c.o_)
core2_NON_CRC_OBJS := $(filter-out $(CORE2_CODE_CRC_C_OBJS),$(core2_ALL_OBJS))
# core2.ld -> core2.temp.ld
$(CORE2_TEMP_LD) : core2.ld
$(call print0,Creating linker script for initial core2 linking step)
@$(CP) $< $@
$(foreach obj, $(CORE2_CODE_CRC_C_OBJS), sed -i 's:$(obj):$(obj)_:g' $@)
# core2 .c -> .o with zero for core2 code CRC
$(CORE2_CODE_CRC_C_TEMP_OBJS) : $(BUILD_DIR)/%.c.o_ : %.c | $(C_BUILD_DIRS)
$(call print2,Compiling temp file:,$<,$@)
@$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDE_CFLAGS) $(OPT_FLAGS) $(MIPSBIT) -o $@ $<
# core2 objects with zero for code CRC -> core2.temp.elf
$(BUILD_DIR)/core2.temp.elf : $(core2_NON_CRC_OBJS) $(CORE2_TEMP_LD) $(CORE2_CODE_CRC_C_TEMP_OBJS)
$(call print1,Linking elf:,$@)
@$(LD) -T $(CORE2_TEMP_LD) -Map $(BUILD_DIR)/core2.map $(LDFLAGS_COMMON) -T undefined_syms_auto.core2.$(VERSION).txt -T undefined_funcs_auto.core2.$(VERSION).txt -o $@
# core2.temp.elf -> core2.temp.code
$(BUILD_DIR)/core2.temp.code : $(BUILD_DIR)/core2.temp.elf
$(call print2,Converting initial core2 code:,$<,$@)
@$(OBJCOPY) -O binary --only-section .core2_code $< $@
# core2 code -> core2 code crc
$(BUILD_DIR)/core2.code.crc : $(BUILD_DIR)/core2.temp.code $(BK_CRC)
$(call print0,Calculating core2 code CRC)
@$(BK_CRC) -D CORE2_CODE $< > $@
# core2 .c -> .o with correct core2 code CRC
$(CORE2_CODE_CRC_C_OBJS) : $(BUILD_DIR)/%.c.o : %.c $(BUILD_DIR)/core2.code.crc | $(C_BUILD_DIRS)
$(call print2,Compiling:,$<,$@)
@$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDE_CFLAGS) $(OPT_FLAGS) $(MIPSBIT) $(shell cat $(BUILD_DIR)/core2.code.crc) -o $@ $<
endif
# core2 data -> core2 data CRC
$(BUILD_DIR)/core2.data.crc : $(BUILD_DIR)/core2.data $(BK_CRC)
$(call print0,Calculating core2 data CRC)
@$(BK_CRC) -D CORE2_DATA $< > $@
# core1 .c -> .o with correct core2 data CRC
$(CORE2_DATA_CRC_C_OBJS) : $(BUILD_DIR)/%.o : % $(BUILD_DIR)/core2.data.crc | $(C_BUILD_DIRS)
$(call print2,Compiling file with core2 data CRC (with ASM Processor):,$<,$@)
@$(ASM_PROCESSOR) $(OPT_FLAGS) $< > $(BUILD_DIR)/$<
@$(CC) -32 $(CFLAGS) $(CPPFLAGS) $(INCLUDE_CFLAGS) $(OPT_FLAGS) $(MIPSBIT) $(shell cat $(BUILD_DIR)/core2.data.crc) -o $@ $(BUILD_DIR)/$<
@$(ASM_PROCESSOR) $(OPT_FLAGS) $< --post-process $@ \
--assembler "$(AS) $(ASFLAGS)" --asm-prelude include/prelude.s
# .elf -> .code
$(OVERLAY_CODE_BINS) : $(BUILD_DIR)/%.code : $(BUILD_DIR)/%.elf
$(call print2,Converting overlay code:,$<,$@)
@$(OBJCOPY) -I elf32-tradbigmips -O binary --only-section .$*_code --only-section .$*_mips3 $< $@
# .elf -> .data
$(OVERLAY_DATA_BINS) : $(BUILD_DIR)/%.data : $(BUILD_DIR)/%.elf
$(call print2,Converting overlay data:,$<,$@)
@$(OBJCOPY) -I elf32-tradbigmips -O binary --only-section .$*_data --only-section .*_data_* $< $@
# .elf -> .full
$(BUILD_DIR)/%.full : $(BUILD_DIR)/%.elf
@$(OBJCOPY) -I elf32-tradbigmips -O binary $< $@
# .data + .code -> .rzip.bin
$(BUILD_DIR)/%.rzip.bin : $(BUILD_DIR)/%.code $(BUILD_DIR)/%.data $(BK_DEFLATE)
$(call print1,Compressing overlay:,$@)
@cd $(BK_TOOLS) && ../../$(BK_DEFLATE) ../../$@ ../../$(BUILD_DIR)/$*.code ../../$(BUILD_DIR)/$*.data
# .bin -> .yaml
$(ASSET_ROOT)/assets.yaml : $(BIN_ROOT)/assets.bin $(BK_ASSET_TOOL)
$(call print1,Extracting Assets:,$@)
$(BK_ASSET_TOOL) -e $< $(ASSET_ROOT)
# .yaml -> .bin
ifneq (,$(shell which cargo))
$(ASSET_BIN): $(ASSET_ROOT)/assets.yaml $(BK_ASSET_TOOL) $(ALL_ASSET_FILES)
$(call print2,Constructing Asset Binary:,$<,$@)
$(BK_ASSET_TOOL) -c $< $@
else
$(ASSET_BIN): $(BIN_ROOT)/assets.bin
$(call print2,Copying Asset Binary (install cargo to construct instead):,$<,$@)
@$(CP) $< $@
endif
# .bin -> .o
$(ASSET_OBJS): $(ASSET_BIN)
$(call print2,Objcopying:,$<,$@)
@$(OBJCOPY) $(BINOFLAGS) $< $@
# .o -> .elf (game)
$(ELF): $(MAIN_ALL_OBJS) $(LD_SCRIPT) $(OVERLAY_RZIP_OBJS) $(addprefix $(BUILD_DIR)/, $(addsuffix .full, $(OVERLAYS))) $(ASSET_OBJS)
$(call print1,Linking elf:,$@)
@$(LD) $(LDFLAGS) -T undefined_syms_auto.$(VERSION).txt -o $@
$(BK_BOOT_LD_SCRIPT): $(LD_SCRIPT)
sed '\|$(CRC_OBJS)|d' $< > $@
# .o -> .elf (game)
$(BUILD_DIR)/bk_boot.elf: $(filter-out $(CRC_OBJS),$(MAIN_ALL_OBJS)) $(BK_BOOT_LD_SCRIPT) $(OVERLAY_RZIP_OBJS) $(addprefix $(BUILD_DIR)/, $(addsuffix .full, $(OVERLAYS)))
$(call print1,Linking elf:,$@)
@$(LD) -T $(BK_BOOT_LD_SCRIPT) -Map $(ELF:.elf=.map) --no-check-sections --accept-unknown-input-arch -T undefined_syms.libultra.txt -T undefined_syms_auto.$(VERSION).txt -o $@
# .elf -> .z64
$(Z64) : $(ELF) $(OVERLAY_PROG_SVGS) $(MAIN_PROG_SVG) $(TOTAL_PROG_SVG)
$(call print1,Creating z64:,$@)
@$(OBJCOPY) $< $@ -O binary $(OCOPYFLAGS)
$(BK_TOOLS)/gzip-1.2.4/gzip: $(BK_TOOLS)/gzip-1.2.4/Makefile
@$(CD) $(BK_TOOLS)/gzip-1.2.4 && $(MAKE) gzip
$(BK_TOOLS)/gzip-1.2.4/Makefile:
@$(CD) $(BK_TOOLS)/gzip-1.2.4 && ./configure
$(BK_ASSET_TOOL):
@$(CD) tools/bk_asset_tool && cargo build --release
@$(CP) tools/bk_asset_tool/target/release/bk_asset_tool $@
# Build tools
$(BK_TOOLS)/%: $(BK_TOOLS)/gzip-1.2.4/gzip
$(call print1,Compiling build tool:,$@)
@$(CD) $(BK_TOOLS) && $(MAKE) $*
$(BK_CRC) :
g++ $@.cpp -o $@
# Combined symbol addresses file
$(SYMBOL_ADDRS): $(SYMBOL_ADDR_FILES)
$(call print0,Combining symbol address files)
@$(CAT) symbol_addrs.*.$(VERSION).txt > $@
# Shorthand rules for each overlay (e.g. SM)
$(OVERLAYS): %: verify-%
clean:
$(call print0,Cleaning build artifacts)
@$(RM) -rf $(BUILD_ROOT)
@$(RM) -rf $(BIN_ROOT)
@$(RM) -rf $(NONMATCHING_DIR)
@$(RM) -rf $(ASM_ROOT)/*.s
@$(RM) -rf $(addprefix $(ASM_ROOT)/,$(filter-out core1,$(OVERLAYS)))
@$(RM) -rf $(ASM_ROOT)/core1/*.s
@$(RM) -rf $(ASM_ROOT)/core1/os
@$(RM) -f undefined_syms_auto* undefined_funcs_auto*
@$(RM) -f *.ld
@$(RM) -f $(SYMBOL_ADDRS)
# Per-file flag definitions
build/$(VERSION)/src/core1/io/%.c.o: OPT_FLAGS = -O1
build/$(VERSION)/src/core1/io/pimgr.c.o: OPT_FLAGS = -O1
build/$(VERSION)/src/core1/done/io/%.c.o: OPT_FLAGS = -O1
build/$(VERSION)/src/core1/os/%.c.o: OPT_FLAGS = -O1
build/$(VERSION)/src/core1/code_2D2D0.c.o: OPT_FLAGS = -O1
build/$(VERSION)/src/core1/done/os/%.c.o: OPT_FLAGS = -O1
build/$(VERSION)/src/core1/code_21A10.c.o: INCLUDE_CFLAGS = -I . -I include -I include/2.0L -I include/2.0L/PR
build/$(VERSION)/src/core1/code_21A10.c.o: OPT_FLAGS = -O3
build/$(VERSION)/src/core1/done/gu/%.c.o: OPT_FLAGS = -O3
build/$(VERSION)/src/core1/done/gu/%.c.o: INCLUDE_CFLAGS = -I . -I include -I include/2.0L -I include/2.0L/PR
build/$(VERSION)/src/core1/gu/mtxutil.c.o: OPT_FLAGS = -O2
build/$(VERSION)/src/core1/gu/rotate.c.o: OPT_FLAGS = -O2
build/$(VERSION)/src/core1/done/audio/%.c.o: INCLUDE_CFLAGS = -I . -I include -I include/2.0L -I include/2.0L/PR
build/$(VERSION)/src/core1/done/audio/%.c.o: OPT_FLAGS = -O3
# build/$(VERSION)/src/core1/code_21CB0.c.o: INCLUDE_CFLAGS = -I . -I include -I include/2.0L -I include/2.0L/PR
# build/$(VERSION)/src/core1/code_21CB0.c.o: OPT_FLAGS = -O3
build/$(VERSION)/src/core1/done/io/sptask.c.o: OPT_FLAGS = -O1
build/$(VERSION)/src/core1/done/ll.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/core1/done/ll.c.o: MIPSBIT := -mips3 -o32
build/$(VERSION)/src/bk_boot_27F0.c.o: OPT_FLAGS = -O2
build/$(VERSION)/src/done/destroythread.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/pirawdma.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/thread.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/pimgr.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/getthreadid.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/setthreadpri.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/createthread.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/yieldthread.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/setglobalintmask.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/recvmesg.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/startthread.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/devmgr.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/sendmesg.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/pigetstat.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/si.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/resetglobalintmask.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/epirawwrite.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/epirawread.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/createmesgqueue.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/leodiskinit.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/virtualtophysical.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/ll.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/ll.c.o: MIPSBIT := -mips3 -o32
build/$(VERSION)/src/done/sirawwrite.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/sirawread.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/initialize.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/pirawread.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/seteventmesg.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/siacs.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/cartrominit.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/leointerrupt.c.o: OPT_FLAGS := -O1
build/$(VERSION)/src/done/epirawdma.c.o: OPT_FLAGS := -O1
# Disable implicit rules
MAKEFLAGS += -r
# Disable built-in rules
.SUFFIXES:
# Phony targets
.PHONY: all clean verify $(OVERLAYS) progress $(addprefix progress-,$(OVERLAYS))
# Set up pipefail
SHELL = /bin/bash -e -o pipefail
# Debug variable print target
print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true

71
README.md Normal file
View File

@@ -0,0 +1,71 @@
# banjo
<img src="./progress/progress_total.svg">
- <img src="./progress/progress_bk_boot.svg">
- <img src="./progress/progress_core1.svg">
- <img src="./progress/progress_core2.svg">
- <img src="./progress/progress_SM.svg">
- <img src="./progress/progress_MM.svg">
- <img src="./progress/progress_TTC.svg">
- <img src="./progress/progress_CC.svg">
- <img src="./progress/progress_BGS.svg">
- <img src="./progress/progress_FP.svg">
- <img src="./progress/progress_GV.svg">
- <img src="./progress/progress_MMM.svg">
- <img src="./progress/progress_RBB.svg">
- <img src="./progress/progress_CCW.svg">
- <img src="./progress/progress_lair.svg">
- <img src="./progress/progress_fight.svg">
- <img src="./progress/progress_cutscenes.svg">
## Building
Grab tools
```sh
git submodule update --init --recursive
```
Drop in `US v1.0` as `baserom.us.v10.z64` (sha1sum: `1fe1632098865f639e22c11b9a81ee8f29c75d7a`)
To extract and build everything
```sh
make
```
where the following are supported values of `<module_id>`
- `core1`
- `core2`
- `MM`
- `TTC`
- `CC`
- `BGS`
- `FP`
- `lair`
- `GV`
- `CCW`
- `RBB`
- `MMM`
- `SM`
- `fight`
- `cutscenes`
### Prerequisites
Ubuntu 18.04 or higher.
```sh
sudo apt-get update && sudo apt-get install -y $(cat packages.txt)
python3 -m pip install -r requirements.txt
```
### Other versions
Drop in `us.v11`, `jp`, or `pal` as `baserom.<version>.z64` e.g. `baserom.us.v11.z64`
```sh
make VERSION=us.v11
```

View File

@@ -0,0 +1,5 @@
.rdata
.align 4
.globl __libm_qnan_f
__libm_qnan_f:
.word 0x7F810000

View File

@@ -0,0 +1,135 @@
#include <sys/asm.h>
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set gp=64 # allow use of 64-bit general purpose registers
.rdata
#define MI_INTR_MASK 0x3f
#define CLR_SP 0x0001
#define SET_SP 0x0002
#define CLR_SI 0x0004
#define SET_SI 0x0008
#define CLR_AI 0x0010
#define SET_AI 0x0020
#define CLR_VI 0x0040
#define SET_VI 0x0080
#define CLR_PI 0x0100
#define SET_PI 0x0200
#define CLR_DP 0x0400
#define SET_DP 0x0800
EXPORT(__osRcpImTable)
/* LUT to convert between MI_INTR and MI_INTR_MASK */
/* MI_INTR is status for each interrupt whereas */
/* MI_INTR_MASK has seperate bits for set/clr */
.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP
.half SET_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP
.half CLR_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP
.half SET_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP
.half CLR_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP
.half SET_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP
.half CLR_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP
.half SET_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP
.half CLR_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP
.half SET_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP
.half CLR_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP
.half SET_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP
.half CLR_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | CLR_DP
.half SET_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | CLR_DP
.half CLR_SP | SET_SI | SET_AI | SET_VI | CLR_PI | CLR_DP
.half SET_SP | SET_SI | SET_AI | SET_VI | CLR_PI | CLR_DP
.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP
.half SET_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP
.half CLR_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP
.half SET_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP
.half CLR_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | CLR_DP
.half SET_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | CLR_DP
.half CLR_SP | SET_SI | SET_AI | CLR_VI | SET_PI | CLR_DP
.half SET_SP | SET_SI | SET_AI | CLR_VI | SET_PI | CLR_DP
.half CLR_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | CLR_DP
.half SET_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | CLR_DP
.half CLR_SP | SET_SI | CLR_AI | SET_VI | SET_PI | CLR_DP
.half SET_SP | SET_SI | CLR_AI | SET_VI | SET_PI | CLR_DP
.half CLR_SP | CLR_SI | SET_AI | SET_VI | SET_PI | CLR_DP
.half SET_SP | CLR_SI | SET_AI | SET_VI | SET_PI | CLR_DP
.half CLR_SP | SET_SI | SET_AI | SET_VI | SET_PI | CLR_DP
.half SET_SP | SET_SI | SET_AI | SET_VI | SET_PI | CLR_DP
.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP
.half SET_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP
.half CLR_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP
.half SET_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP
.half CLR_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | SET_DP
.half SET_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | SET_DP
.half CLR_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | SET_DP
.half SET_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | SET_DP
.half CLR_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | SET_DP
.half SET_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | SET_DP
.half CLR_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | SET_DP
.half SET_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | SET_DP
.half CLR_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | SET_DP
.half SET_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | SET_DP
.half CLR_SP | SET_SI | SET_AI | SET_VI | CLR_PI | SET_DP
.half SET_SP | SET_SI | SET_AI | SET_VI | CLR_PI | SET_DP
.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | SET_DP
.half SET_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | SET_DP
.half CLR_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | SET_DP
.half SET_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | SET_DP
.half CLR_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | SET_DP
.half SET_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | SET_DP
.half CLR_SP | SET_SI | SET_AI | CLR_VI | SET_PI | SET_DP
.half SET_SP | SET_SI | SET_AI | CLR_VI | SET_PI | SET_DP
.half CLR_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | SET_DP
.half SET_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | SET_DP
.half CLR_SP | SET_SI | CLR_AI | SET_VI | SET_PI | SET_DP
.half SET_SP | SET_SI | CLR_AI | SET_VI | SET_PI | SET_DP
.half CLR_SP | CLR_SI | SET_AI | SET_VI | SET_PI | SET_DP
.half SET_SP | CLR_SI | SET_AI | SET_VI | SET_PI | SET_DP
.half CLR_SP | SET_SI | SET_AI | SET_VI | SET_PI | SET_DP
.half SET_SP | SET_SI | SET_AI | SET_VI | SET_PI | SET_DP
.text
.set noreorder
glabel osSetIntMask
mfc0 $t4, $12
andi $v0, $t4, 0xff01
lui $t0, %hi(__OSGlobalIntMask)
addiu $t0, $t0, %lo(__OSGlobalIntMask)
lw $t3, ($t0)
addiu $at, $zero, -1
xor $t0, $t3, $at
andi $t0, $t0, 0xff00
or $v0, $v0, $t0
lui $t2, %hi(D_A430000C)
lw $t2, %lo(D_A430000C)($t2)
beqz $t2, setintmask_1
srl $t1, $t3, 0x10
addiu $at, $zero, -1
xor $t1, $t1, $at
andi $t1, $t1, 0x3f
or $t2, $t2, $t1
setintmask_1:
sll $t2, $t2, 0x10
or $v0, $v0, $t2
lui $at, 0x3f
and $t0, $a0, $at
and $t0, $t0, $t3
srl $t0, $t0, 0xf
lui $t2, %hi(__osRcpImTable)
addu $t2, $t2, $t0
lhu $t2, %lo(__osRcpImTable)($t2)
lui $at, %hi(D_A430000C)
sw $t2, %lo(D_A430000C)($at)
andi $t0, $a0, 0xff01
andi $t1, $t3, 0xff00
and $t0, $t0, $t1
lui $at, 0xffff
ori $at, $at, 0xff
and $t4, $t4, $at
or $t4, $t4, $t0
mtc0 $t4, $12
nop
nop
jr $ra
nop
endlabel osSetIntMask

View File

@@ -0,0 +1,429 @@
.include "macro.inc"
.section .data
dlabel D_80392100
.double -500.0
dlabel jtbl_80392108
.word L80387794_13A4, L803877F8_1408, L803878FC_150C, L803879A0_15B0, L80387A20_1630, L80387A98_16A8
dlabel D_80392120
.float 0.95
dlabel D_80392124
.float 1.05
dlabel D_80392128
.float 5000.0
dlabel D_8039212C
.float 12000.0
dlabel D_80392130
.float 1e8
dlabel jtbl_80392134
.word L80388254_1E64, L80388558_2168, L80388558_2168, L80388268_1E78, L80388314_1F24, L8038837C_1F8C, L80388420_2030, L80388468_2078, L80388484_2094, L80388558_2168, L803884CC_20DC, L803884E0_20F0
dlabel D_80392164
.float 0.95
dlabel D_80392168
.float 1.05
dlabel D_8039216C
.float 5000.0
dlabel D_80392170
.float 12000.0, 0.95
dlabel D_80392178
.float 1.05
dlabel D_8039217C
.float 5000.0
dlabel D_80392180
.float 12000.0
dlabel D_80392184
.float 0.4
dlabel D_80392188
.float 5000.0
dlabel D_8039218C
.float 12000.0, 2700.0
dlabel D_80392194
.float 1150.0
dlabel D_80392198
.float 0.95
dlabel D_8039219C
.float 1.05
dlabel D_803921A0
.float 5000.0
dlabel D_803921A4
.float 12000.0
dlabel D_803921A8
.float 0.95
dlabel D_803921AC
.float 1.05
dlabel D_803921B0
.float 5000.0
dlabel D_803921B4
.float 12000.0
dlabel jtbl_803921B8
.word L803887AC_23BC, L803888A8_24B8, L80388964_2574, L803889EC_25FC, L80388B24_2734, L80388DC4_29D4, L80388E84_2A94, L80388F5C_2B6C, L80388FC4_2BD4, L80389054_2C64, L803890C0_2CD0, L80389158_2D68
dlabel D_803921E8
.double 0.3333333333333333
dlabel D_803921F0
.double 3300.0, 0.7333333333333334
dlabel D_80392200
.double 3300.0
dlabel D_80392208
.double 0.66
dlabel D_80392210
.double 0.65
dlabel jtbl_80392218
.word L803893E8_2FF8, L803894CC_30DC, L803894F0_3100, L80389594_31A4, L803895D8_31E8, L80389638_3248, L80389660_3270
dlabel jtbl_80392234
.word L8038975C_336C, L80389788_3398, L803897B4_33C4, L803897E0_33F0, L8038980C_341C
dlabel D_80392248
.float 1.54
dlabel jtbl_8039224C
.word L80389BD8_37E8, L80389CFC_390C, L80389D48_3958, L80389D80_3990, L80389E14_3A24, L80389E3C_3A4C, L80389F40_3B50
dlabel D_80392268
.word 0x3F99999A, 0x00000000
dlabel D_80392270
.double 0.1
dlabel D_80392278
.double 0.8
dlabel jtbl_80392280
.word L80389FEC_3BFC, L8038A4D4_40E4, L8038A01C_3C2C, L8038A4D4_40E4, L8038A1B4_3DC4, L8038A208_3E18, L8038A3D4_3FE4
dlabel D_8039229C
.float 2.2
dlabel D_803922A0
.float 2.2
dlabel D_803922A4
.float 2.2
dlabel D_803922A8
.float 4.4
dlabel D_803922AC
.float 4.4
dlabel D_803922B0
.float 4.4
dlabel D_803922B4
.float 6.6
dlabel D_803922B8
.float 6.6
dlabel D_803922BC
.float 6.6
dlabel D_803922C0
.float 8.8
dlabel D_803922C4
.float 8.8
dlabel D_803922C8
.float 8.8
dlabel D_803922CC
.float 0.95
dlabel D_803922D0
.float 1.05
dlabel D_803922D4
.float 5000.0
dlabel D_803922D8
.float 12000.0
dlabel D_803922DC
.float 0.6
dlabel D_803922E0
.double 1.7, -1190.0
dlabel D_803922F0
.float 1.7
dlabel D_803922F4
.float 1.7
dlabel D_803922F8
.float 1.7
dlabel D_803922FC
.float 1.7
dlabel D_80392300
.float 0.95
dlabel D_80392304
.float 1.05
dlabel D_80392308
.float 0.95
dlabel D_8039230C
.float 1.05
dlabel jtbl_80392310
.word L8038A778_4388, L8038A7D0_43E0, L8038A818_4428, L8038A8A0_44B0, L8038A8FC_450C, L8038A924_4534, L8038AA3C_464C
dlabel D_8039232C
.float 0.95
dlabel D_80392330
.float 1.05
dlabel D_80392334
.float 0.95
dlabel D_80392338
.float 1.05
dlabel D_8039233C
.float 0.95
dlabel D_80392340
.float 1.05
dlabel D_80392344
.float 0.95
dlabel D_80392348
.float 1.05
dlabel D_8039234C
.float 0.95
dlabel D_80392350
.float 1.05
dlabel D_80392354
.float 0.95
dlabel D_80392358
.float 1.05, 0.0
dlabel D_80392360
.double 0.4
dlabel D_80392368
.double 0.65
dlabel D_80392370
.double 0.005
dlabel D_80392378
.double 1.99
dlabel D_80392380
.float 0.95
dlabel D_80392384
.float 1.05
dlabel jtbl_80392388
.word L8038ACE8_48F8, L8038AD90_49A0, L8038ADA0_49B0, L8038AF14_4B24, L8038AF70_4B80, L8038ADA8_49B8, L8038AE00_4A10, L8038AE5C_4A6C, L8038AF28_4B38
dlabel D_803923AC
.float 0.95
dlabel D_803923B0
.float 1.05
dlabel D_803923B4
.float 5000.0
dlabel D_803923B8
.float 12000.0, 0.95
dlabel D_803923C0
.float 1.05
dlabel D_803923C4
.float 5000.0
dlabel D_803923C8
.float 12000.0
dlabel D_803923CC
.float 0.95
dlabel D_803923D0
.float 1.05
dlabel D_803923D4
.float 5000.0
dlabel D_803923D8
.float 12000.0
dlabel D_803923DC
.float 0.6
dlabel D_803923E0
.float 0.6, 2.4
dlabel D_803923E8
.float 2.4
dlabel D_803923EC
.float 4.4
dlabel D_803923F0
.float 4.4
dlabel jtbl_803923F4
.word L8038B290_4EA0, L8038B2A4_4EB4, L8038B2DC_4EEC, L8038B368_4F78, L8038B3B4_4FC4, L8038B460_5070, L8038B4FC_510C, L8038B564_5174, L8038B58C_519C
dlabel D_80392418
.double 0.56
dlabel D_80392420
.double 0.99
dlabel D_80392428
.float 4.8
dlabel jtbl_8039242C
.word L8038B874_5484, L8038B8D0_54E0, L8038B91C_552C, L8038B93C_554C, L8038B95C_556C
dlabel D_80392440
.float 0.95
dlabel D_80392444
.float 1.05
dlabel D_80392448
.float 5000.0
dlabel D_8039244C
.float 12000.0
dlabel D_80392450
.float 0.6
dlabel jtbl_80392454
.word L8038BF30_5B40, L8038BF40_5B50, L8038BF50_5B60, L8038BF60_5B70, L8038BF70_5B80, L8038BF80_5B90, 0
dlabel D_80392470
.double 0.08
dlabel D_80392478
.float 2.88, 0.0
dlabel D_80392480
.double 0.35
dlabel D_80392488
.double 0.65
dlabel D_80392490
.float 0.3, 0.0
dlabel D_80392498
.double 45.0
dlabel D_803924A0
.double 0.3
dlabel D_803924A8
.double 2.26
dlabel D_803924B0
.double 182.04444
dlabel jtbl_803924B8
.word L8038C92C_653C, L8038C980_6590, L8038CA48_6658, L8038CA48_6658, L8038CE68_6A78
dlabel D_803924CC
.float 0.95
dlabel D_803924D0
.float 1.05
dlabel D_803924D4
.float 5000.0
dlabel D_803924D8
.float 0.95
dlabel D_803924DC
.float 1.05
dlabel D_803924E0
.float 5000.0
dlabel D_803924E4
.float 12000.0
dlabel D_803924E8
.double 0.1
dlabel D_803924F0
.double 0.8
dlabel D_803924F8
.double 0.2
dlabel D_80392500
.float 0.1
dlabel D_80392504
.float 5000.0
dlabel D_80392508
.float 12000.0
dlabel D_8039250C
.float 2500.0
dlabel D_80392510
.double 0.98
dlabel D_80392518
.float 1.15
dlabel D_8039251C
.float 0.1
dlabel D_80392520
.float 2.26, 0.0, 0.0, 0.0

707
asm/ultra/exceptasm.s Normal file
View File

@@ -0,0 +1,707 @@
#include <sys/asm.h>
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
.data
EXPORT(__osHwIntTable)
.word 0x0, 0x0, 0x0, 0x0, 0x0
.rdata
#define REDISPATCH 0x00
#define SW1 0x04
#define SW2 0x08
#define RCP 0x0c
#define CART 0x10
#define PRENMI 0x14
#define IP6_HDLR 0x18
#define IP7_HDLR 0x1c
#define COUNTER 0x20
__osIntOffTable:
.byte REDISPATCH
.byte PRENMI
.byte IP6_HDLR
.byte IP6_HDLR
.byte IP7_HDLR
.byte IP7_HDLR
.byte IP7_HDLR
.byte IP7_HDLR
.byte COUNTER
.byte COUNTER
.byte IP6_HDLR
.byte IP6_HDLR
.byte IP7_HDLR
.byte IP7_HDLR
.byte IP7_HDLR
.byte IP7_HDLR
.byte REDISPATCH
.byte SW1
.byte SW2
.byte SW2
.byte RCP
.byte RCP
.byte RCP
.byte RCP
.byte CART
.byte CART
.byte CART
.byte CART
.byte CART
.byte CART
.byte CART
.byte CART
__osIntTable:
.word redispatch, sw1, sw2, rcp, cart, prenmi, IP6_Hdlr, IP7_Hdlr, counter
.text
glabel __osExceptionPreamble
/* 2E60 80002260 3C1A8000 */ lui $k0, %hi(__osException)
/* 2E64 80002264 275A2280 */ addiu $k0, $k0, %lo(__osException)
/* 2E68 80002268 03400008 */ jr $k0
/* 2E6C 8000226C 00000000 */ nop
endlabel __osExceptionPreamble
# What is this?
glabel __osExceptionPreamble2
/* 2E70 80002270 3C1A8000 */ lui $k0, %hi(__osException)
/* 2E74 80002274 275A2280 */ addiu $k0, $k0, %lo(__osException)
/* 2E78 80002278 03400008 */ jr $k0
/* 2E7C 8000227C 00000000 */ nop
endlabel __osExceptionPreamble2
glabel __osException
/* 2E80 80002280 3C1A8000 */ lui $k0, %hi(__osThreadSave)
/* 2E84 80002284 275A72C0 */ addiu $k0, $k0, %lo(__osThreadSave)
/* 2E88 80002288 FF410020 */ sd $at, 0x20($k0)
/* 2E8C 8000228C 401B6000 */ mfc0 $k1, $12
/* 2E90 80002290 AF5B0118 */ sw $k1, 0x118($k0)
/* 2E94 80002294 2401FFFC */ addiu $at, $zero, -4
/* 2E98 80002298 0361D824 */ and $k1, $k1, $at
/* 2E9C 8000229C 409B6000 */ mtc0 $k1, $12
/* 2EA0 800022A0 FF480058 */ sd $t0, 0x58($k0)
/* 2EA4 800022A4 FF490060 */ sd $t1, 0x60($k0)
/* 2EA8 800022A8 FF4A0068 */ sd $t2, 0x68($k0)
/* 2EAC 800022AC AF400018 */ sw $zero, 0x18($k0)
/* 2EB0 800022B0 40086800 */ mfc0 $t0, $13
/* 2EB4 800022B4 03404025 */ or $t0, $k0, $zero
/* 2EB8 800022B8 3C1A8000 */ lui $k0, %hi(__osRunningThread)
/* 2EBC 800022BC 8F5A5130 */ lw $k0, %lo(__osRunningThread)($k0)
/* 2EC0 800022C0 DD090020 */ ld $t1, 0x20($t0)
/* 2EC4 800022C4 FF490020 */ sd $t1, 0x20($k0)
/* 2EC8 800022C8 DD090118 */ ld $t1, 0x118($t0)
/* 2ECC 800022CC FF490118 */ sd $t1, 0x118($k0)
/* 2ED0 800022D0 DD090058 */ ld $t1, 0x58($t0)
/* 2ED4 800022D4 FF490058 */ sd $t1, 0x58($k0)
/* 2ED8 800022D8 DD090060 */ ld $t1, 0x60($t0)
/* 2EDC 800022DC FF490060 */ sd $t1, 0x60($k0)
/* 2EE0 800022E0 DD090068 */ ld $t1, 0x68($t0)
/* 2EE4 800022E4 FF490068 */ sd $t1, 0x68($k0)
/* 2EE8 800022E8 8F5B0118 */ lw $k1, 0x118($k0)
/* 2EEC 800022EC 00004012 */ mflo $t0
/* 2EF0 800022F0 FF480108 */ sd $t0, 0x108($k0)
/* 2EF4 800022F4 00004010 */ mfhi $t0
/* 2EF8 800022F8 3369FF00 */ andi $t1, $k1, 0xff00
/* 2EFC 800022FC FF420028 */ sd $v0, 0x28($k0)
/* 2F00 80002300 FF430030 */ sd $v1, 0x30($k0)
/* 2F04 80002304 FF440038 */ sd $a0, 0x38($k0)
/* 2F08 80002308 FF450040 */ sd $a1, 0x40($k0)
/* 2F0C 8000230C FF460048 */ sd $a2, 0x48($k0)
/* 2F10 80002310 FF470050 */ sd $a3, 0x50($k0)
/* 2F14 80002314 FF4B0070 */ sd $t3, 0x70($k0)
/* 2F18 80002318 FF4C0078 */ sd $t4, 0x78($k0)
/* 2F1C 8000231C FF4D0080 */ sd $t5, 0x80($k0)
/* 2F20 80002320 FF4E0088 */ sd $t6, 0x88($k0)
/* 2F24 80002324 FF4F0090 */ sd $t7, 0x90($k0)
/* 2F28 80002328 FF500098 */ sd $s0, 0x98($k0)
/* 2F2C 8000232C FF5100A0 */ sd $s1, 0xa0($k0)
/* 2F30 80002330 FF5200A8 */ sd $s2, 0xa8($k0)
/* 2F34 80002334 FF5300B0 */ sd $s3, 0xb0($k0)
/* 2F38 80002338 FF5400B8 */ sd $s4, 0xb8($k0)
/* 2F3C 8000233C FF5500C0 */ sd $s5, 0xc0($k0)
/* 2F40 80002340 FF5600C8 */ sd $s6, 0xc8($k0)
/* 2F44 80002344 FF5700D0 */ sd $s7, 0xd0($k0)
/* 2F48 80002348 FF5800D8 */ sd $t8, 0xd8($k0)
/* 2F4C 8000234C FF5900E0 */ sd $t9, 0xe0($k0)
/* 2F50 80002350 FF5C00E8 */ sd $gp, 0xe8($k0)
/* 2F54 80002354 FF5D00F0 */ sd $sp, 0xf0($k0)
/* 2F58 80002358 FF5E00F8 */ sd $fp, 0xf8($k0)
/* 2F5C 8000235C FF5F0100 */ sd $ra, 0x100($k0)
/* 2F60 80002360 1120000D */ beqz $t1, .L80002398
/* 2F64 80002364 FF480110 */ sd $t0, 0x110($k0)
/* 2F68 80002368 3C088000 */ lui $t0, %hi(__OSGlobalIntMask)
/* 2F6C 8000236C 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask)
/* 2F70 80002370 8D080000 */ lw $t0, ($t0)
/* 2F74 80002374 2401FFFF */ addiu $at, $zero, -1
/* 2F78 80002378 01014026 */ xor $t0, $t0, $at
/* 2F7C 8000237C 3C01FFFF */ lui $at, 0xffff
/* 2F80 80002380 3108FF00 */ andi $t0, $t0, 0xff00
/* 2F84 80002384 342100FF */ ori $at, $at, 0xff
/* 2F88 80002388 01284825 */ or $t1, $t1, $t0
/* 2F8C 8000238C 0361D824 */ and $k1, $k1, $at
/* 2F90 80002390 0369D825 */ or $k1, $k1, $t1
/* 2F94 80002394 AF5B0118 */ sw $k1, 0x118($k0)
.L80002398:
/* 2F98 80002398 3C09A430 */ lui $t1, %hi(D_A430000C)
/* 2F9C 8000239C 8D29000C */ lw $t1, %lo(D_A430000C)($t1)
/* 2FA0 800023A0 5120000C */ beql $t1, $zero, .L800023D4
/* 2FA4 800023A4 AF490128 */ sw $t1, 0x128($k0)
/* 2FA8 800023A8 3C088000 */ lui $t0, %hi(__OSGlobalIntMask)
/* 2FAC 800023AC 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask)
/* 2FB0 800023B0 8D080000 */ lw $t0, ($t0)
/* 2FB4 800023B4 8F4C0128 */ lw $t4, 0x128($k0)
/* 2FB8 800023B8 2401FFFF */ addiu $at, $zero, -1
/* 2FBC 800023BC 00084402 */ srl $t0, $t0, 0x10
/* 2FC0 800023C0 01014026 */ xor $t0, $t0, $at
/* 2FC4 800023C4 3108003F */ andi $t0, $t0, 0x3f
/* 2FC8 800023C8 010C4024 */ and $t0, $t0, $t4
/* 2FCC 800023CC 01284825 */ or $t1, $t1, $t0
/* 2FD0 800023D0 AF490128 */ sw $t1, 0x128($k0)
.L800023D4:
/* 2FD4 800023D4 40087000 */ mfc0 $t0, $14
/* 2FD8 800023D8 AF48011C */ sw $t0, 0x11c($k0)
/* 2FDC 800023DC 8F480018 */ lw $t0, 0x18($k0)
/* 2FE0 800023E0 11000014 */ beqz $t0, .L80002434
/* 2FE4 800023E4 00000000 */ nop
/* 2FE8 800023E8 4448F800 */ cfc1 $t0, $31
/* 2FEC 800023EC 00000000 */ nop
/* 2FF0 800023F0 AF48012C */ sw $t0, 0x12c($k0)
/* 2FF4 800023F4 F7400130 */ sdc1 $f0, 0x130($k0)
/* 2FF8 800023F8 F7420138 */ sdc1 $f2, 0x138($k0)
/* 2FFC 800023FC F7440140 */ sdc1 $f4, 0x140($k0)
/* 3000 80002400 F7460148 */ sdc1 $f6, 0x148($k0)
/* 3004 80002404 F7480150 */ sdc1 $f8, 0x150($k0)
/* 3008 80002408 F74A0158 */ sdc1 $f10, 0x158($k0)
/* 300C 8000240C F74C0160 */ sdc1 $f12, 0x160($k0)
/* 3010 80002410 F74E0168 */ sdc1 $f14, 0x168($k0)
/* 3014 80002414 F7500170 */ sdc1 $f16, 0x170($k0)
/* 3018 80002418 F7520178 */ sdc1 $f18, 0x178($k0)
/* 301C 8000241C F7540180 */ sdc1 $f20, 0x180($k0)
/* 3020 80002420 F7560188 */ sdc1 $f22, 0x188($k0)
/* 3024 80002424 F7580190 */ sdc1 $f24, 0x190($k0)
/* 3028 80002428 F75A0198 */ sdc1 $f26, 0x198($k0)
/* 302C 8000242C F75C01A0 */ sdc1 $f28, 0x1a0($k0)
/* 3030 80002430 F75E01A8 */ sdc1 $f30, 0x1a8($k0)
.L80002434:
/* 3034 80002434 40086800 */ mfc0 $t0, $13
/* 3038 80002438 AF480120 */ sw $t0, 0x120($k0)
/* 303C 8000243C 24090002 */ addiu $t1, $zero, 2
/* 3040 80002440 A7490010 */ sh $t1, 0x10($k0)
/* 3044 80002444 3109007C */ andi $t1, $t0, 0x7c
/* 3048 80002448 240A0024 */ addiu $t2, $zero, 0x24
/* 304C 8000244C 512A00B1 */ beql $t1, $t2, handle_break
/* 3050 80002450 24090001 */ addiu $t1, $zero, 1
/* 3054 80002454 240A002C */ addiu $t2, $zero, 0x2c
/* 3058 80002458 112A00FF */ beq $t1, $t2, handle_CpU
/* 305C 8000245C 00000000 */ nop
/* 3060 80002460 240A0000 */ addiu $t2, $zero, 0
/* 3064 80002464 152A00C3 */ bne $t1, $t2, .L80002774
/* 3068 80002468 00000000 */ nop
/* 306C 8000246C 03688024 */ and $s0, $k1, $t0
next_interrupt:
/* 3070 80002470 3209FF00 */ andi $t1, $s0, 0xff00
/* 3074 80002474 00095302 */ srl $t2, $t1, 0xc
/* 3078 80002478 15400003 */ bnez $t2, .L80002488
/* 307C 8000247C 00000000 */ nop
/* 3080 80002480 00095202 */ srl $t2, $t1, 8
/* 3084 80002484 214A0010 */ addi $t2, $t2, 0x10
.L80002488:
/* 3088 80002488 3C018000 */ lui $at, %hi(__osIntOffTable)
/* 308C 8000248C 002A0821 */ addu $at, $at, $t2
/* 3090 80002490 902A5180 */ lbu $t2, %lo(__osIntOffTable)($at)
/* 3094 80002494 3C018000 */ lui $at, %hi(__osIntTable)
/* 3098 80002498 002A0821 */ addu $at, $at, $t2
/* 309C 8000249C 8C2A51A0 */ lw $t2, %lo(__osIntTable)($at)
/* 30A0 800024A0 01400008 */ jr $t2
/* 30A4 800024A4 00000000 */ nop
IP6_Hdlr:
/* 30A8 800024A8 2401DFFF */ addiu $at, $zero, -0x2001
/* 30AC 800024AC 1000FFF0 */ b next_interrupt
/* 30B0 800024B0 02018024 */ and $s0, $s0, $at
IP7_Hdlr:
/* 30B4 800024B4 2401BFFF */ addiu $at, $zero, -0x4001
/* 30B8 800024B8 1000FFED */ b next_interrupt
/* 30BC 800024BC 02018024 */ and $s0, $s0, $at
counter:
/* 30C0 800024C0 40095800 */ mfc0 $t1, $11
/* 30C4 800024C4 40895800 */ mtc0 $t1, $11
/* 30C8 800024C8 0C0009E9 */ jal send_mesg
/* 30CC 800024CC 24040018 */ addiu $a0, $zero, 0x18
/* 30D0 800024D0 3C01FFFF */ lui $at, 0xffff
/* 30D4 800024D4 34217FFF */ ori $at, $at, 0x7fff
/* 30D8 800024D8 1000FFE5 */ b next_interrupt
/* 30DC 800024DC 02018024 */ and $s0, $s0, $at
cart:
/* 30E0 800024E0 2401F7FF */ addiu $at, $zero, -0x801
/* 30E4 800024E4 02018024 */ and $s0, $s0, $at
/* 30E8 800024E8 240A0004 */ addiu $t2, $zero, 4
/* 30EC 800024EC 3C018000 */ lui $at, %hi(__osHwIntTable)
/* 30F0 800024F0 002A0821 */ addu $at, $at, $t2
/* 30F4 800024F4 8C2A5100 */ lw $t2, %lo(__osHwIntTable)($at)
/* 30F8 800024F8 3C1D8000 */ lui $sp, %hi(leoDiskStack)
/* 30FC 800024FC 27BD7470 */ addiu $sp, $sp, %lo(leoDiskStack)
/* 3100 80002500 24040010 */ addiu $a0, $zero, 0x10
/* 3104 80002504 11400007 */ beqz $t2, .L80002524
/* 3108 80002508 27BD0FF0 */ addiu $sp, $sp, 0xff0
/* 310C 8000250C 0140F809 */ jalr $t2
/* 3110 80002510 00000000 */ nop
/* 3114 80002514 10400003 */ beqz $v0, .L80002524
/* 3118 80002518 00000000 */ nop
/* 311C 8000251C 10000082 */ b redispatch
/* 3120 80002520 00000000 */ nop
.L80002524:
/* 3124 80002524 0C0009E9 */ jal send_mesg
/* 3128 80002528 00000000 */ nop
/* 312C 8000252C 1000FFD1 */ b next_interrupt + 4
/* 3130 80002530 3209FF00 */ andi $t1, $s0, 0xff00
rcp:
/* 3134 80002534 3C088000 */ lui $t0, %hi(__OSGlobalIntMask)
/* 3138 80002538 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask)
/* 313C 8000253C 8D080000 */ lw $t0, ($t0)
/* 3140 80002540 3C11A430 */ lui $s1, %hi(D_A4300008)
/* 3144 80002544 8E310008 */ lw $s1, %lo(D_A4300008)($s1)
/* 3148 80002548 00084402 */ srl $t0, $t0, 0x10
/* 314C 8000254C 02288824 */ and $s1, $s1, $t0
/* 3150 80002550 32290001 */ andi $t1, $s1, 1
/* 3154 80002554 51200014 */ beql $t1, $zero, .L800025A8
/* 3158 80002558 32290008 */ andi $t1, $s1, 8
/* 315C 8000255C 3C0CA404 */ lui $t4, %hi(D_A4040010)
/* 3160 80002560 8D8C0010 */ lw $t4, %lo(D_A4040010)($t4)
/* 3164 80002564 24090008 */ addiu $t1, $zero, 8
/* 3168 80002568 3C01A404 */ lui $at, %hi(D_A4040010)
/* 316C 8000256C 318C0300 */ andi $t4, $t4, 0x300
/* 3170 80002570 3231003E */ andi $s1, $s1, 0x3e
/* 3174 80002574 11800007 */ beqz $t4, .L80002594
/* 3178 80002578 AC290010 */ sw $t1, %lo(D_A4040010)($at)
/* 317C 8000257C 0C0009E9 */ jal send_mesg
/* 3180 80002580 24040020 */ addiu $a0, $zero, 0x20
/* 3184 80002584 52200039 */ beql $s1, $zero, .L8000266C
/* 3188 80002588 2401FBFF */ addiu $at, $zero, -0x401
/* 318C 8000258C 10000006 */ b .L800025A8
/* 3190 80002590 32290008 */ andi $t1, $s1, 8
.L80002594:
/* 3194 80002594 0C0009E9 */ jal send_mesg
/* 3198 80002598 24040058 */ addiu $a0, $zero, 0x58
/* 319C 8000259C 52200033 */ beql $s1, $zero, .L8000266C
/* 31A0 800025A0 2401FBFF */ addiu $at, $zero, -0x401
/* 31A4 800025A4 32290008 */ andi $t1, $s1, 8
.L800025A8:
/* 31A8 800025A8 11200007 */ beqz $t1, .L800025C8
/* 31AC 800025AC 3C01A440 */ lui $at, %hi(D_A4400010)
/* 31B0 800025B0 32310037 */ andi $s1, $s1, 0x37
/* 31B4 800025B4 AC200010 */ sw $zero, %lo(D_A4400010)($at)
/* 31B8 800025B8 0C0009E9 */ jal send_mesg
/* 31BC 800025BC 24040038 */ addiu $a0, $zero, 0x38
/* 31C0 800025C0 5220002A */ beql $s1, $zero, .L8000266C
/* 31C4 800025C4 2401FBFF */ addiu $at, $zero, -0x401
.L800025C8:
/* 31C8 800025C8 32290004 */ andi $t1, $s1, 4
/* 31CC 800025CC 5120000A */ beql $t1, $zero, .L800025F8
/* 31D0 800025D0 32290002 */ andi $t1, $s1, 2
/* 31D4 800025D4 24090001 */ addiu $t1, $zero, 1
/* 31D8 800025D8 3C01A450 */ lui $at, %hi(D_A450000C)
/* 31DC 800025DC 3231003B */ andi $s1, $s1, 0x3b
/* 31E0 800025E0 AC29000C */ sw $t1, %lo(D_A450000C)($at)
/* 31E4 800025E4 0C0009E9 */ jal send_mesg
/* 31E8 800025E8 24040030 */ addiu $a0, $zero, 0x30
/* 31EC 800025EC 5220001F */ beql $s1, $zero, .L8000266C
/* 31F0 800025F0 2401FBFF */ addiu $at, $zero, -0x401
/* 31F4 800025F4 32290002 */ andi $t1, $s1, 2
.L800025F8:
/* 31F8 800025F8 11200007 */ beqz $t1, .L80002618
/* 31FC 800025FC 3C01A480 */ lui $at, %hi(D_A4800018)
/* 3200 80002600 3231003D */ andi $s1, $s1, 0x3d
/* 3204 80002604 AC200018 */ sw $zero, %lo(D_A4800018)($at)
/* 3208 80002608 0C0009E9 */ jal send_mesg
/* 320C 8000260C 24040028 */ addiu $a0, $zero, 0x28
/* 3210 80002610 52200016 */ beql $s1, $zero, .L8000266C
/* 3214 80002614 2401FBFF */ addiu $at, $zero, -0x401
.L80002618:
/* 3218 80002618 32290010 */ andi $t1, $s1, 0x10
/* 321C 8000261C 5120000A */ beql $t1, $zero, .L80002648
/* 3220 80002620 32290020 */ andi $t1, $s1, 0x20
/* 3224 80002624 24090002 */ addiu $t1, $zero, 2
/* 3228 80002628 3C01A460 */ lui $at, %hi(D_A4600010)
/* 322C 8000262C 3231002F */ andi $s1, $s1, 0x2f
/* 3230 80002630 AC290010 */ sw $t1, %lo(D_A4600010)($at)
/* 3234 80002634 0C0009E9 */ jal send_mesg
/* 3238 80002638 24040040 */ addiu $a0, $zero, 0x40
/* 323C 8000263C 5220000B */ beql $s1, $zero, .L8000266C
/* 3240 80002640 2401FBFF */ addiu $at, $zero, -0x401
/* 3244 80002644 32290020 */ andi $t1, $s1, 0x20
.L80002648:
/* 3248 80002648 51200008 */ beql $t1, $zero, .L8000266C
/* 324C 8000264C 2401FBFF */ addiu $at, $zero, -0x401
/* 3250 80002650 24090800 */ addiu $t1, $zero, 0x800
/* 3254 80002654 3C01A430 */ lui $at, 0xa430
/* 3258 80002658 3231001F */ andi $s1, $s1, 0x1f
/* 325C 8000265C AC290000 */ sw $t1, ($at)
/* 3260 80002660 0C0009E9 */ jal send_mesg
/* 3264 80002664 24040048 */ addiu $a0, $zero, 0x48
/* 3268 80002668 2401FBFF */ addiu $at, $zero, -0x401
.L8000266C:
/* 326C 8000266C 1000FF80 */ b next_interrupt
/* 3270 80002670 02018024 */ and $s0, $s0, $at
prenmi:
/* 3274 80002674 8F5B0118 */ lw $k1, 0x118($k0)
/* 3278 80002678 2401EFFF */ addiu $at, $zero, -0x1001
/* 327C 8000267C 3C098000 */ lui $t1, %hi(__osShutdown)
/* 3280 80002680 0361D824 */ and $k1, $k1, $at
/* 3284 80002684 AF5B0118 */ sw $k1, 0x118($k0)
/* 3288 80002688 252950EC */ addiu $t1, $t1, %lo(__osShutdown)
/* 328C 8000268C 8D2A0000 */ lw $t2, ($t1)
/* 3290 80002690 11400003 */ beqz $t2, firstnmi
/* 3294 80002694 2401EFFF */ addiu $at, $zero, -0x1001
/* 3298 80002698 10000023 */ b redispatch
/* 329C 8000269C 02018024 */ and $s0, $s0, $at
firstnmi:
/* 32A0 800026A0 240A0001 */ addiu $t2, $zero, 1
/* 32A4 800026A4 AD2A0000 */ sw $t2, ($t1)
/* 32A8 800026A8 0C0009E9 */ jal send_mesg
/* 32AC 800026AC 24040070 */ addiu $a0, $zero, 0x70
/* 32B0 800026B0 3C0A8000 */ lui $t2, %hi(__osRunQueue)
/* 32B4 800026B4 8D4A5128 */ lw $t2, %lo(__osRunQueue)($t2)
/* 32B8 800026B8 2401EFFF */ addiu $at, $zero, -0x1001
/* 32BC 800026BC 02018024 */ and $s0, $s0, $at
/* 32C0 800026C0 8D5B0118 */ lw $k1, 0x118($t2)
/* 32C4 800026C4 0361D824 */ and $k1, $k1, $at
/* 32C8 800026C8 10000017 */ b redispatch
/* 32CC 800026CC AD5B0118 */ sw $k1, 0x118($t2)
sw2:
/* 32D0 800026D0 2401FDFF */ addiu $at, $zero, -0x201
/* 32D4 800026D4 01014024 */ and $t0, $t0, $at
/* 32D8 800026D8 40886800 */ mtc0 $t0, $13
/* 32DC 800026DC 0C0009E9 */ jal send_mesg
/* 32E0 800026E0 24040008 */ addiu $a0, $zero, 8
/* 32E4 800026E4 2401FDFF */ addiu $at, $zero, -0x201
/* 32E8 800026E8 1000FF61 */ b next_interrupt
/* 32EC 800026EC 02018024 */ and $s0, $s0, $at
sw1:
/* 32F0 800026F0 2401FEFF */ addiu $at, $zero, -0x101
/* 32F4 800026F4 01014024 */ and $t0, $t0, $at
/* 32F8 800026F8 40886800 */ mtc0 $t0, $13
/* 32FC 800026FC 0C0009E9 */ jal send_mesg
/* 3300 80002700 24040000 */ addiu $a0, $zero, 0
/* 3304 80002704 2401FEFF */ addiu $at, $zero, -0x101
/* 3308 80002708 1000FF59 */ b next_interrupt
/* 330C 8000270C 02018024 */ and $s0, $s0, $at
/* 3310 80002710 24090001 */ addiu $t1, $zero, 1
handle_break:
/* 3314 80002714 A7490012 */ sh $t1, 0x12($k0)
/* 3318 80002718 0C0009E9 */ jal send_mesg
/* 331C 8000271C 24040050 */ addiu $a0, $zero, 0x50
/* 3320 80002720 10000001 */ b redispatch
/* 3324 80002724 00000000 */ nop
redispatch:
/* 3328 80002728 3C0A8000 */ lui $t2, %hi(__osRunQueue)
/* 332C 8000272C 8D4A5128 */ lw $t2, %lo(__osRunQueue)($t2)
/* 3330 80002730 8F490004 */ lw $t1, 4($k0)
/* 3334 80002734 8D4B0004 */ lw $t3, 4($t2)
/* 3338 80002738 012B082A */ slt $at, $t1, $t3
/* 333C 8000273C 10200007 */ beqz $at, enqueueRunning
/* 3340 80002740 00000000 */ nop
/* 3344 80002744 3C048000 */ lui $a0, %hi(__osRunQueue)
/* 3348 80002748 03402825 */ or $a1, $k0, $zero
/* 334C 8000274C 0C000A63 */ jal __osEnqueueThread
/* 3350 80002750 24845128 */ addiu $a0, $a0, %lo(__osRunQueue)
/* 3354 80002754 08000A79 */ j __osDispatchThread
/* 3358 80002758 00000000 */ nop
enqueueRunning:
/* 335C 8000275C 3C098000 */ lui $t1, %hi(__osRunQueue)
/* 3360 80002760 25295128 */ addiu $t1, $t1, %lo(__osRunQueue)
/* 3364 80002764 8D2A0000 */ lw $t2, ($t1)
/* 3368 80002768 AF4A0000 */ sw $t2, ($k0)
/* 336C 8000276C 08000A79 */ j __osDispatchThread
/* 3370 80002770 AD3A0000 */ sw $k0, ($t1)
.L80002774:
/* 3374 80002774 3C018000 */ lui $at, %hi(__osFaultedThread)
/* 3378 80002778 AC3A5134 */ sw $k0, %lo(__osFaultedThread)($at)
/* 337C 8000277C 24090001 */ addiu $t1, $zero, 1
/* 3380 80002780 A7490010 */ sh $t1, 0x10($k0)
/* 3384 80002784 24090002 */ addiu $t1, $zero, 2
/* 3388 80002788 A7490012 */ sh $t1, 0x12($k0)
/* 338C 8000278C 400A4000 */ mfc0 $t2, $8
/* 3390 80002790 AF4A0124 */ sw $t2, 0x124($k0)
/* 3394 80002794 0C0009E9 */ jal send_mesg
/* 3398 80002798 24040060 */ addiu $a0, $zero, 0x60
/* 339C 8000279C 08000A79 */ j __osDispatchThread
/* 33A0 800027A0 00000000 */ nop
endlabel __osException
glabel send_mesg
/* 33A4 800027A4 3C0A8001 */ lui $t2, %hi(__osEventStateTab)
/* 33A8 800027A8 254A8470 */ addiu $t2, $t2, %lo(__osEventStateTab)
/* 33AC 800027AC 01445021 */ addu $t2, $t2, $a0
/* 33B0 800027B0 8D490000 */ lw $t1, ($t2)
/* 33B4 800027B4 03E09025 */ or $s2, $ra, $zero
/* 33B8 800027B8 11200025 */ beqz $t1, send_done
/* 33BC 800027BC 00000000 */ nop
/* 33C0 800027C0 8D2B0008 */ lw $t3, 8($t1)
/* 33C4 800027C4 8D2C0010 */ lw $t4, 0x10($t1)
/* 33C8 800027C8 016C082A */ slt $at, $t3, $t4
/* 33CC 800027CC 10200020 */ beqz $at, send_done
/* 33D0 800027D0 00000000 */ nop
/* 33D4 800027D4 8D2D000C */ lw $t5, 0xc($t1)
/* 33D8 800027D8 01AB6821 */ addu $t5, $t5, $t3
/* 33DC 800027DC 01AC001A */ div $zero, $t5, $t4
/* 33E0 800027E0 15800002 */ bnez $t4, .L800027EC
/* 33E4 800027E4 00000000 */ nop
/* 33E8 800027E8 0007000D */ break 7
.L800027EC:
/* 33EC 800027EC 2401FFFF */ addiu $at, $zero, -1
/* 33F0 800027F0 15810004 */ bne $t4, $at, .L80002804
/* 33F4 800027F4 3C018000 */ lui $at, 0x8000
/* 33F8 800027F8 15A10002 */ bne $t5, $at, .L80002804
/* 33FC 800027FC 00000000 */ nop
/* 3400 80002800 0006000D */ break 6
.L80002804:
/* 3404 80002804 8D2C0014 */ lw $t4, 0x14($t1)
/* 3408 80002808 00006810 */ mfhi $t5
/* 340C 8000280C 000D6880 */ sll $t5, $t5, 2
/* 3410 80002810 018D6021 */ addu $t4, $t4, $t5
/* 3414 80002814 8D4D0004 */ lw $t5, 4($t2)
/* 3418 80002818 256A0001 */ addiu $t2, $t3, 1
/* 341C 8000281C AD8D0000 */ sw $t5, ($t4)
/* 3420 80002820 AD2A0008 */ sw $t2, 8($t1)
/* 3424 80002824 8D2A0000 */ lw $t2, ($t1)
/* 3428 80002828 8D4B0000 */ lw $t3, ($t2)
/* 342C 8000282C 11600008 */ beqz $t3, send_done
/* 3430 80002830 00000000 */ nop
/* 3434 80002834 0C000A75 */ jal __osPopThread
/* 3438 80002838 01202025 */ or $a0, $t1, $zero
/* 343C 8000283C 00405025 */ or $t2, $v0, $zero
/* 3440 80002840 3C048000 */ lui $a0, %hi(__osRunQueue)
/* 3444 80002844 01402825 */ or $a1, $t2, $zero
/* 3448 80002848 0C000A63 */ jal __osEnqueueThread
/* 344C 8000284C 24845128 */ addiu $a0, $a0, %lo(__osRunQueue)
send_done:
/* 3450 80002850 02400008 */ jr $s2
/* 3454 80002854 00000000 */ nop
endlabel send_mesg
glabel handle_CpU
/* 3458 80002858 3C013000 */ lui $at, 0x3000
/* 345C 8000285C 01014824 */ and $t1, $t0, $at
/* 3460 80002860 00094F02 */ srl $t1, $t1, 0x1c
/* 3464 80002864 240A0001 */ addiu $t2, $zero, 1
/* 3468 80002868 152AFFC2 */ bne $t1, $t2, .L80002774
/* 346C 8000286C 00000000 */ nop
/* 3470 80002870 8F5B0118 */ lw $k1, 0x118($k0)
/* 3474 80002874 3C012000 */ lui $at, 0x2000
/* 3478 80002878 24090001 */ addiu $t1, $zero, 1
/* 347C 8000287C 0361D825 */ or $k1, $k1, $at
/* 3480 80002880 AF490018 */ sw $t1, 0x18($k0)
/* 3484 80002884 1000FFB5 */ b enqueueRunning
/* 3488 80002888 AF5B0118 */ sw $k1, 0x118($k0)
endlabel handle_CpU
glabel __osEnqueueAndYield
/* 348C 8000288C 3C058000 */ lui $a1, %hi(__osRunningThread)
/* 3490 80002890 8CA55130 */ lw $a1, %lo(__osRunningThread)($a1)
/* 3494 80002894 40086000 */ mfc0 $t0, $12
/* 3498 80002898 8CBB0018 */ lw $k1, 0x18($a1)
/* 349C 8000289C 35080002 */ ori $t0, $t0, 2
/* 34A0 800028A0 ACA80118 */ sw $t0, 0x118($a1)
/* 34A4 800028A4 FCB00098 */ sd $s0, 0x98($a1)
/* 34A8 800028A8 FCB100A0 */ sd $s1, 0xa0($a1)
/* 34AC 800028AC FCB200A8 */ sd $s2, 0xa8($a1)
/* 34B0 800028B0 FCB300B0 */ sd $s3, 0xb0($a1)
/* 34B4 800028B4 FCB400B8 */ sd $s4, 0xb8($a1)
/* 34B8 800028B8 FCB500C0 */ sd $s5, 0xc0($a1)
/* 34BC 800028BC FCB600C8 */ sd $s6, 0xc8($a1)
/* 34C0 800028C0 FCB700D0 */ sd $s7, 0xd0($a1)
/* 34C4 800028C4 FCBC00E8 */ sd $gp, 0xe8($a1)
/* 34C8 800028C8 FCBD00F0 */ sd $sp, 0xf0($a1)
/* 34CC 800028CC FCBE00F8 */ sd $fp, 0xf8($a1)
/* 34D0 800028D0 FCBF0100 */ sd $ra, 0x100($a1)
/* 34D4 800028D4 13600009 */ beqz $k1, .L800028FC
/* 34D8 800028D8 ACBF011C */ sw $ra, 0x11c($a1)
/* 34DC 800028DC 445BF800 */ cfc1 $k1, $31
/* 34E0 800028E0 F4B40180 */ sdc1 $f20, 0x180($a1)
/* 34E4 800028E4 F4B60188 */ sdc1 $f22, 0x188($a1)
/* 34E8 800028E8 F4B80190 */ sdc1 $f24, 0x190($a1)
/* 34EC 800028EC F4BA0198 */ sdc1 $f26, 0x198($a1)
/* 34F0 800028F0 F4BC01A0 */ sdc1 $f28, 0x1a0($a1)
/* 34F4 800028F4 F4BE01A8 */ sdc1 $f30, 0x1a8($a1)
/* 34F8 800028F8 ACBB012C */ sw $k1, 0x12c($a1)
.L800028FC:
/* 34FC 800028FC 8CBB0118 */ lw $k1, 0x118($a1)
/* 3500 80002900 3369FF00 */ andi $t1, $k1, 0xff00
/* 3504 80002904 5120000E */ beql $t1, $zero, .L80002940
/* 3508 80002908 3C1BA430 */ lui $k1, 0xa430
/* 350C 8000290C 3C088000 */ lui $t0, %hi(__OSGlobalIntMask)
/* 3510 80002910 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask)
/* 3514 80002914 8D080000 */ lw $t0, ($t0)
/* 3518 80002918 2401FFFF */ addiu $at, $zero, -1
/* 351C 8000291C 01014026 */ xor $t0, $t0, $at
/* 3520 80002920 3C01FFFF */ lui $at, 0xffff
/* 3524 80002924 3108FF00 */ andi $t0, $t0, 0xff00
/* 3528 80002928 342100FF */ ori $at, $at, 0xff
/* 352C 8000292C 01284825 */ or $t1, $t1, $t0
/* 3530 80002930 0361D824 */ and $k1, $k1, $at
/* 3534 80002934 0369D825 */ or $k1, $k1, $t1
/* 3538 80002938 ACBB0118 */ sw $k1, 0x118($a1)
/* 353C 8000293C 3C1BA430 */ lui $k1, %hi(D_A430000C)
.L80002940:
/* 3540 80002940 8F7B000C */ lw $k1, %lo(D_A430000C)($k1)
/* 3544 80002944 1360000B */ beqz $k1, .L80002974
/* 3548 80002948 00000000 */ nop
/* 354C 8000294C 3C1A8000 */ lui $k0, %hi(__OSGlobalIntMask)
/* 3550 80002950 275A50F0 */ addiu $k0, $k0, %lo(__OSGlobalIntMask)
/* 3554 80002954 8F5A0000 */ lw $k0, ($k0)
/* 3558 80002958 8CA80128 */ lw $t0, 0x128($a1)
/* 355C 8000295C 2401FFFF */ addiu $at, $zero, -1
/* 3560 80002960 001AD402 */ srl $k0, $k0, 0x10
/* 3564 80002964 0341D026 */ xor $k0, $k0, $at
/* 3568 80002968 335A003F */ andi $k0, $k0, 0x3f
/* 356C 8000296C 0348D024 */ and $k0, $k0, $t0
/* 3570 80002970 037AD825 */ or $k1, $k1, $k0
.L80002974:
/* 3574 80002974 10800003 */ beqz $a0, .L80002984
/* 3578 80002978 ACBB0128 */ sw $k1, 0x128($a1)
/* 357C 8000297C 0C000A63 */ jal __osEnqueueThread
/* 3580 80002980 00000000 */ nop
.L80002984:
/* 3584 80002984 08000A79 */ j __osDispatchThread
/* 3588 80002988 00000000 */ nop
endlabel __osEnqueueAndYield
glabel __osEnqueueThread
/* 358C 8000298C 8C980000 */ lw $t8, ($a0)
/* 3590 80002990 8CAF0004 */ lw $t7, 4($a1)
/* 3594 80002994 0080C825 */ or $t9, $a0, $zero
/* 3598 80002998 8F0E0004 */ lw $t6, 4($t8)
/* 359C 8000299C 01CF082A */ slt $at, $t6, $t7
/* 35A0 800029A0 54200008 */ bnel $at, $zero, .L800029C4
/* 35A4 800029A4 8F380000 */ lw $t8, ($t9)
/* 35A8 800029A8 0300C825 */ or $t9, $t8, $zero
.L800029AC:
/* 35AC 800029AC 8F180000 */ lw $t8, ($t8)
/* 35B0 800029B0 8F0E0004 */ lw $t6, 4($t8)
/* 35B4 800029B4 01CF082A */ slt $at, $t6, $t7
/* 35B8 800029B8 5020FFFC */ beql $at, $zero, .L800029AC
/* 35BC 800029BC 0300C825 */ or $t9, $t8, $zero
/* 35C0 800029C0 8F380000 */ lw $t8, ($t9)
.L800029C4:
/* 35C4 800029C4 ACB80000 */ sw $t8, ($a1)
/* 35C8 800029C8 AF250000 */ sw $a1, ($t9)
/* 35CC 800029CC 03E00008 */ jr $ra
/* 35D0 800029D0 ACA40008 */ sw $a0, 8($a1)
endlabel __osEnqueueThread
glabel __osPopThread
/* 35D4 800029D4 8C820000 */ lw $v0, ($a0)
/* 35D8 800029D8 8C590000 */ lw $t9, ($v0)
/* 35DC 800029DC 03E00008 */ jr $ra
/* 35E0 800029E0 AC990000 */ sw $t9, ($a0)
endlabel __osPopThread
glabel __osDispatchThread
/* 35E4 800029E4 3C048000 */ lui $a0, %hi(__osRunQueue)
/* 35E8 800029E8 0C000A75 */ jal __osPopThread
/* 35EC 800029EC 24845128 */ addiu $a0, $a0, %lo(__osRunQueue)
/* 35F0 800029F0 3C018000 */ lui $at, %hi(__osRunningThread)
/* 35F4 800029F4 AC225130 */ sw $v0, %lo(__osRunningThread)($at)
/* 35F8 800029F8 24080004 */ addiu $t0, $zero, 4
/* 35FC 800029FC A4480010 */ sh $t0, 0x10($v0)
/* 3600 80002A00 0040D025 */ or $k0, $v0, $zero
/* 3604 80002A04 3C088000 */ lui $t0, %hi(__OSGlobalIntMask)
/* 3608 80002A08 8F5B0118 */ lw $k1, 0x118($k0)
/* 360C 80002A0C 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask)
/* 3610 80002A10 8D080000 */ lw $t0, ($t0)
/* 3614 80002A14 3C01FFFF */ lui $at, 0xffff
/* 3618 80002A18 3369FF00 */ andi $t1, $k1, 0xff00
/* 361C 80002A1C 342100FF */ ori $at, $at, 0xff
/* 3620 80002A20 3108FF00 */ andi $t0, $t0, 0xff00
/* 3624 80002A24 01284824 */ and $t1, $t1, $t0
/* 3628 80002A28 0361D824 */ and $k1, $k1, $at
/* 362C 80002A2C 0369D825 */ or $k1, $k1, $t1
/* 3630 80002A30 409B6000 */ mtc0 $k1, $12
/* 3634 80002A34 DF5B0108 */ ld $k1, 0x108($k0)
/* 3638 80002A38 DF410020 */ ld $at, 0x20($k0)
/* 363C 80002A3C DF420028 */ ld $v0, 0x28($k0)
/* 3640 80002A40 03600013 */ mtlo $k1
/* 3644 80002A44 DF5B0110 */ ld $k1, 0x110($k0)
/* 3648 80002A48 DF430030 */ ld $v1, 0x30($k0)
/* 364C 80002A4C DF440038 */ ld $a0, 0x38($k0)
/* 3650 80002A50 DF450040 */ ld $a1, 0x40($k0)
/* 3654 80002A54 DF460048 */ ld $a2, 0x48($k0)
/* 3658 80002A58 DF470050 */ ld $a3, 0x50($k0)
/* 365C 80002A5C DF480058 */ ld $t0, 0x58($k0)
/* 3660 80002A60 DF490060 */ ld $t1, 0x60($k0)
/* 3664 80002A64 DF4A0068 */ ld $t2, 0x68($k0)
/* 3668 80002A68 DF4B0070 */ ld $t3, 0x70($k0)
/* 366C 80002A6C DF4C0078 */ ld $t4, 0x78($k0)
/* 3670 80002A70 DF4D0080 */ ld $t5, 0x80($k0)
/* 3674 80002A74 DF4E0088 */ ld $t6, 0x88($k0)
/* 3678 80002A78 DF4F0090 */ ld $t7, 0x90($k0)
/* 367C 80002A7C DF500098 */ ld $s0, 0x98($k0)
/* 3680 80002A80 DF5100A0 */ ld $s1, 0xa0($k0)
/* 3684 80002A84 DF5200A8 */ ld $s2, 0xa8($k0)
/* 3688 80002A88 DF5300B0 */ ld $s3, 0xb0($k0)
/* 368C 80002A8C DF5400B8 */ ld $s4, 0xb8($k0)
/* 3690 80002A90 DF5500C0 */ ld $s5, 0xc0($k0)
/* 3694 80002A94 DF5600C8 */ ld $s6, 0xc8($k0)
/* 3698 80002A98 DF5700D0 */ ld $s7, 0xd0($k0)
/* 369C 80002A9C DF5800D8 */ ld $t8, 0xd8($k0)
/* 36A0 80002AA0 DF5900E0 */ ld $t9, 0xe0($k0)
/* 36A4 80002AA4 DF5C00E8 */ ld $gp, 0xe8($k0)
/* 36A8 80002AA8 03600011 */ mthi $k1
/* 36AC 80002AAC DF5D00F0 */ ld $sp, 0xf0($k0)
/* 36B0 80002AB0 DF5E00F8 */ ld $fp, 0xf8($k0)
/* 36B4 80002AB4 DF5F0100 */ ld $ra, 0x100($k0)
/* 36B8 80002AB8 8F5B011C */ lw $k1, 0x11c($k0)
/* 36BC 80002ABC 409B7000 */ mtc0 $k1, $14
/* 36C0 80002AC0 8F5B0018 */ lw $k1, 0x18($k0)
/* 36C4 80002AC4 13600013 */ beqz $k1, .L80002B14
/* 36C8 80002AC8 00000000 */ nop
/* 36CC 80002ACC 8F5B012C */ lw $k1, 0x12c($k0)
/* 36D0 80002AD0 44DBF800 */ ctc1 $k1, $31
/* 36D4 80002AD4 D7400130 */ ldc1 $f0, 0x130($k0)
/* 36D8 80002AD8 D7420138 */ ldc1 $f2, 0x138($k0)
/* 36DC 80002ADC D7440140 */ ldc1 $f4, 0x140($k0)
/* 36E0 80002AE0 D7460148 */ ldc1 $f6, 0x148($k0)
/* 36E4 80002AE4 D7480150 */ ldc1 $f8, 0x150($k0)
/* 36E8 80002AE8 D74A0158 */ ldc1 $f10, 0x158($k0)
/* 36EC 80002AEC D74C0160 */ ldc1 $f12, 0x160($k0)
/* 36F0 80002AF0 D74E0168 */ ldc1 $f14, 0x168($k0)
/* 36F4 80002AF4 D7500170 */ ldc1 $f16, 0x170($k0)
/* 36F8 80002AF8 D7520178 */ ldc1 $f18, 0x178($k0)
/* 36FC 80002AFC D7540180 */ ldc1 $f20, 0x180($k0)
/* 3700 80002B00 D7560188 */ ldc1 $f22, 0x188($k0)
/* 3704 80002B04 D7580190 */ ldc1 $f24, 0x190($k0)
/* 3708 80002B08 D75A0198 */ ldc1 $f26, 0x198($k0)
/* 370C 80002B0C D75C01A0 */ ldc1 $f28, 0x1a0($k0)
/* 3710 80002B10 D75E01A8 */ ldc1 $f30, 0x1a8($k0)
.L80002B14:
/* 3714 80002B14 8F5B0128 */ lw $k1, 0x128($k0)
/* 3718 80002B18 3C1A8000 */ lui $k0, %hi(__OSGlobalIntMask)
/* 371C 80002B1C 275A50F0 */ addiu $k0, $k0, %lo(__OSGlobalIntMask)
/* 3720 80002B20 8F5A0000 */ lw $k0, ($k0)
/* 3724 80002B24 001AD402 */ srl $k0, $k0, 0x10
/* 3728 80002B28 037AD824 */ and $k1, $k1, $k0
/* 372C 80002B2C 001BD840 */ sll $k1, $k1, 1
/* 3730 80002B30 3C1A8000 */ lui $k0, %hi(__osRcpImTable)
/* 3734 80002B34 275A51D0 */ addiu $k0, $k0, %lo(__osRcpImTable)
/* 3738 80002B38 037AD821 */ addu $k1, $k1, $k0
/* 373C 80002B3C 977B0000 */ lhu $k1, ($k1)
/* 3740 80002B40 3C1AA430 */ lui $k0, %hi(D_A430000C)
/* 3744 80002B44 275A000C */ addiu $k0, $k0, %lo(D_A430000C)
/* 3748 80002B48 AF5B0000 */ sw $k1, ($k0)
/* 374C 80002B4C 00000000 */ nop
/* 3750 80002B50 00000000 */ nop
/* 3754 80002B54 00000000 */ nop
/* 3758 80002B58 00000000 */ nop
/* 375C 80002B5C 42000018 */ eret
endlabel __osDispatchThread
glabel __osCleanupThread
/* 3760 80002B60 0C000EB4 */ jal osDestroyThread
/* 3764 80002B64 00002025 */ or $a0, $zero, $zero
/* 3768 80002B68 00000000 */ nop
/* 376C 80002B6C 00000000 */ nop
endlabel __osCleanupThread

135
asm/ultra/setintmask.s Normal file
View File

@@ -0,0 +1,135 @@
#include <sys/asm.h>
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set gp=64 # allow use of 64-bit general purpose registers
.rdata
#define MI_INTR_MASK 0x3f
#define CLR_SP 0x0001
#define SET_SP 0x0002
#define CLR_SI 0x0004
#define SET_SI 0x0008
#define CLR_AI 0x0010
#define SET_AI 0x0020
#define CLR_VI 0x0040
#define SET_VI 0x0080
#define CLR_PI 0x0100
#define SET_PI 0x0200
#define CLR_DP 0x0400
#define SET_DP 0x0800
EXPORT(__osRcpImTable)
/* LUT to convert between MI_INTR and MI_INTR_MASK */
/* MI_INTR is status for each interrupt whereas */
/* MI_INTR_MASK has seperate bits for set/clr */
.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP
.half SET_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP
.half CLR_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP
.half SET_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP
.half CLR_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP
.half SET_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP
.half CLR_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP
.half SET_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP
.half CLR_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP
.half SET_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP
.half CLR_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP
.half SET_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP
.half CLR_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | CLR_DP
.half SET_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | CLR_DP
.half CLR_SP | SET_SI | SET_AI | SET_VI | CLR_PI | CLR_DP
.half SET_SP | SET_SI | SET_AI | SET_VI | CLR_PI | CLR_DP
.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP
.half SET_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP
.half CLR_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP
.half SET_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP
.half CLR_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | CLR_DP
.half SET_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | CLR_DP
.half CLR_SP | SET_SI | SET_AI | CLR_VI | SET_PI | CLR_DP
.half SET_SP | SET_SI | SET_AI | CLR_VI | SET_PI | CLR_DP
.half CLR_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | CLR_DP
.half SET_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | CLR_DP
.half CLR_SP | SET_SI | CLR_AI | SET_VI | SET_PI | CLR_DP
.half SET_SP | SET_SI | CLR_AI | SET_VI | SET_PI | CLR_DP
.half CLR_SP | CLR_SI | SET_AI | SET_VI | SET_PI | CLR_DP
.half SET_SP | CLR_SI | SET_AI | SET_VI | SET_PI | CLR_DP
.half CLR_SP | SET_SI | SET_AI | SET_VI | SET_PI | CLR_DP
.half SET_SP | SET_SI | SET_AI | SET_VI | SET_PI | CLR_DP
.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP
.half SET_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP
.half CLR_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP
.half SET_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP
.half CLR_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | SET_DP
.half SET_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | SET_DP
.half CLR_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | SET_DP
.half SET_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | SET_DP
.half CLR_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | SET_DP
.half SET_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | SET_DP
.half CLR_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | SET_DP
.half SET_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | SET_DP
.half CLR_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | SET_DP
.half SET_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | SET_DP
.half CLR_SP | SET_SI | SET_AI | SET_VI | CLR_PI | SET_DP
.half SET_SP | SET_SI | SET_AI | SET_VI | CLR_PI | SET_DP
.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | SET_DP
.half SET_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | SET_DP
.half CLR_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | SET_DP
.half SET_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | SET_DP
.half CLR_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | SET_DP
.half SET_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | SET_DP
.half CLR_SP | SET_SI | SET_AI | CLR_VI | SET_PI | SET_DP
.half SET_SP | SET_SI | SET_AI | CLR_VI | SET_PI | SET_DP
.half CLR_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | SET_DP
.half SET_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | SET_DP
.half CLR_SP | SET_SI | CLR_AI | SET_VI | SET_PI | SET_DP
.half SET_SP | SET_SI | CLR_AI | SET_VI | SET_PI | SET_DP
.half CLR_SP | CLR_SI | SET_AI | SET_VI | SET_PI | SET_DP
.half SET_SP | CLR_SI | SET_AI | SET_VI | SET_PI | SET_DP
.half CLR_SP | SET_SI | SET_AI | SET_VI | SET_PI | SET_DP
.half SET_SP | SET_SI | SET_AI | SET_VI | SET_PI | SET_DP
.text
.set noreorder
glabel func_80003A30
/* 4630 80003A30 400C6000 */ mfc0 $t4, $12
/* 4634 80003A34 3182FF01 */ andi $v0, $t4, 0xff01
/* 4638 80003A38 3C088000 */ lui $t0, %hi(__OSGlobalIntMask)
/* 463C 80003A3C 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask)
/* 4640 80003A40 8D0B0000 */ lw $t3, ($t0)
/* 4644 80003A44 2401FFFF */ addiu $at, $zero, -1
/* 4648 80003A48 01614026 */ xor $t0, $t3, $at
/* 464C 80003A4C 3108FF00 */ andi $t0, $t0, 0xff00
/* 4650 80003A50 00481025 */ or $v0, $v0, $t0
/* 4654 80003A54 3C0AA430 */ lui $t2, %hi(D_A430000C)
/* 4658 80003A58 8D4A000C */ lw $t2, %lo(D_A430000C)($t2)
/* 465C 80003A5C 11400005 */ beqz $t2, .L80003A74
/* 4660 80003A60 000B4C02 */ srl $t1, $t3, 0x10
/* 4664 80003A64 2401FFFF */ addiu $at, $zero, -1
/* 4668 80003A68 01214826 */ xor $t1, $t1, $at
/* 466C 80003A6C 3129003F */ andi $t1, $t1, 0x3f
/* 4670 80003A70 01495025 */ or $t2, $t2, $t1
.L80003A74:
/* 4674 80003A74 000A5400 */ sll $t2, $t2, 0x10
/* 4678 80003A78 004A1025 */ or $v0, $v0, $t2
/* 467C 80003A7C 3C01003F */ lui $at, 0x3f
/* 4680 80003A80 00814024 */ and $t0, $a0, $at
/* 4684 80003A84 010B4024 */ and $t0, $t0, $t3
/* 4688 80003A88 000843C2 */ srl $t0, $t0, 0xf
/* 468C 80003A8C 3C0A8000 */ lui $t2, %hi(__osRcpImTable)
/* 4690 80003A90 01485021 */ addu $t2, $t2, $t0
/* 4694 80003A94 954A51D0 */ lhu $t2, %lo(__osRcpImTable)($t2)
/* 4698 80003A98 3C01A430 */ lui $at, %hi(D_A430000C)
/* 469C 80003A9C AC2A000C */ sw $t2, %lo(D_A430000C)($at)
/* 46A0 80003AA0 3088FF01 */ andi $t0, $a0, 0xff01
/* 46A4 80003AA4 3169FF00 */ andi $t1, $t3, 0xff00
/* 46A8 80003AA8 01094024 */ and $t0, $t0, $t1
/* 46AC 80003AAC 3C01FFFF */ lui $at, 0xffff
/* 46B0 80003AB0 342100FF */ ori $at, $at, 0xff
/* 46B4 80003AB4 01816024 */ and $t4, $t4, $at
/* 46B8 80003AB8 01886025 */ or $t4, $t4, $t0
/* 46BC 80003ABC 408C6000 */ mtc0 $t4, $12
/* 46C0 80003AC0 00000000 */ nop
/* 46C4 80003AC4 00000000 */ nop
/* 46C8 80003AC8 03E00008 */ jr $ra
/* 46CC 80003ACC 00000000 */ nop
endlabel func_80003A30

86
banjo.jp.yaml Normal file
View File

@@ -0,0 +1,86 @@
options:
basename: banjo
find_file_boundaries: true
compiler: "\"IDO\""
undefined_syms_path: undefined_syms.jp.txt
segments:
- name: header
type: header
start: 0x00000000
subsegments:
- [0x00000000, header, header]
- name: boot
type: bin
start: 0x00000040
- name: bk_boot
type: code
start: 0x00001000
vram: 0x80000400
subsegments:
- [0x00001000, asm]
- name: assets
type: bin
start: 0x00005E90
subsegments:
- [0x00005E90, bin, assets]
- name: soundfont1
type: bin
start: 0x00DA80A0
subsegments:
- [0x00DA80A0, bin, soundfont1.ctl]
- [0x00DB8E90, bin, soundfont1.tbl]
- name: soundfont2
type: bin
start: 0x00EC7890
subsegments:
- [0x00EC7890, bin, soundfont2.ctl]
- [0x00ED16F0, bin, soundfont2.tbl]
- name: core1.jp.rzip
type: bin
start: 0x00F3CC30
- name: core2.jp.rzip
type: bin
start: 0x00F5B1A0
- name: level2.jp.rzip
type: bin
start: 0x00FC8190
- name: level9.jp.rzip
type: bin
start: 0x00FCA100
- name: level6.jp.rzip
type: bin
start: 0x00FCD300
- name: level1.jp.rzip
type: bin
start: 0x00FD2AB0
- name: level0.jp.rzip
type: bin
start: 0x00FD6710
- name: level3.jp.rzip
type: bin
start: 0x00FD8740
- name: level8.jp.rzip
type: bin
start: 0x00FDDC80
- name: level4.jp.rzip
type: bin
start: 0x00FE2E60
- name: level10.jp.rzip
type: bin
start: 0x00FE8A90
- name: level12.jp.rzip
type: bin
start: 0x00FEB1A0
- name: level5.jp.rzip
type: bin
start: 0x00FED3D0
- name: level11.jp.rzip
type: bin
start: 0x00FF46E0
- name: level7.jp.rzip
type: bin
start: 0x00FFA4D0
- name: emptyLvl.jp.rzip
type: bin
start: 0x00FFED30
- [0x01000000]

185
banjo.pal.yaml Normal file
View File

@@ -0,0 +1,185 @@
options:
basename: banjo
find_file_boundaries: True
compiler: "IDO"
platform: n64
asm_endlabels: "endlabel"
cpp_args:
- "-Iinclude"
- "-Iinclude/2.0L"
- "-D_LANGUAGE_C"
generated_c_preamble: |
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
create_detected_syms: yes
undefined_syms_path: undefined_syms.pal.txt
symbol_addrs_path: symbol_addrs.boot.pal.txt
undefined_funcs_auto_path: undefined_funcs_auto.pal.txt
undefined_syms_auto_path: undefined_syms_auto.pal.txt
base_path: .
target_path: baserom.pal.z64
asset_path: bin
build_path: build/pal
segments:
- [0x0, bin, binner]
# - name: header
# type: header
# start: 0x00000000
# - name: boot
# type: code
# start: 0x00000040
# vram: 0xA4000040
# subsegments:
# - [0x0040, asm, boot]
# - [0x0B70, bin, boot2]
# - name: entry
# type: code
# start: 0x1000
# vram: 0x80000400
# subsegments:
# - [0x1000, hasm, entry]
# - name: boot/bk_boot
# type: code
# start: 0x1050
# vram: 0x80000450
# subsegments:
# - [0x1050, c, done/bk_boot_1050]
# - [0x1150, c, done/rarezip]
# - [0x12B0, c, done/inflate]
# - [0x27F0, c, done/overlays]
# - [0x2970, c, done/initialize]
# - [0x2C00, c, done/pirawdma]
# - [0x2CE0, c, done/pigetstat]
# - [0x2CF0, hasm, bzero]
# - [0x2D90, hasm, setsr]
# - [0x2DA0, hasm, getsr]
# - [0x2DB0, hasm, setfpccsr]
# - [0x2DC0, c, done/sirawread]
# - [0x2E10, c, done/sirawwrite]
# - [0x2E60, hasm, ultra/exceptasm]
# - [0x3770, hasm, writebackdcache]
# - [0x37F0, hasm, invalicache]
# - [0x3870, hasm, maptlbrdb]
# - [0x38D0, c, done/pirawread]
# - [0x3930, c, done/ll]
# - [0x3BF0, bin, padding3BF0] # Empty space
# - [0x3C50, c, done/virtualtophysical]
# - [0x3CD0, c, done/si]
# - [0x3D00, c, done/thread]
# - [0x3D40, c, done/leointerrupt]
# - [0x45C0, c, done/seteventmesg]
# - [0x4630, hasm, ultra/setintmask]
# - [0x46D0, c, done/destroythread]
# - [0x47D0, hasm, probetlb]
# - [0x4890, c, done/leodiskinit]
# - [0x4990, c, done/epirawdma]
# - [0x4BC0, hasm, interrupt]
# - [0x4C00, c, done/pimgr]
# - [0x4D90, c, done/cartrominit]
# - [0x4E90, c, done/createmesgqueue]
# - [0x4EC0, c, done/piacs]
# - [0x4F80, c, done/getthreadpri]
# - [0x4FA0, c, done/setthreadpri]
# - [0x5080, c, done/createthread]
# - [0x51D0, c, done/devmgr]
# - [0x5660, c, done/startthread]
# - [0x57B0, c, done/sendmesg]
# - [0x5900, c, done/recvmesg]
# - [0x5A40, c, done/resetglobalintmask]
# - [0x5AA0, c, done/epirawwrite]
# - [0x5AF0, c, done/epirawread]
# - [0x5B40, c, done/setglobalintmask]
# - [0x5B90, c, done/yieldthread]
# - [0x5BE0, c, done/kdebugserver]
# - [0x5BE0, .data, done/inflate]
# - [0x5CE0, .data, done/initialize]
# - [0x5D00, .data, ultra/exceptasm]
# - [0x5D20, .data, done/thread]
# - [0x5D40, .data, done/pimgr]
# - [0x5D70, .data, done/piacs]
# - [0x5D80, .rodata, ultra/exceptasm]
# - [0x5DD0, .rodata, ultra/setintmask]
# - [0x5E50, .rodata, done/devmgr]
# - [0x5E70, .bss, done/bk_boot_1050]
# - [0x5E70, .bss, done/rarezip]
# - [0x5E70, .bss, done/inflate]
# - [0x5E70, .bss, done/initialize]
# - [0x5E70, .bss, done/kdebugserver]
# - [0x5E70, .bss, done/leointerrupt]
# - [0x5E70, .bss, done/seteventmesg]
# - [0x5E70, .bss, done/leodiskinit]
# - [0x5E70, .bss, done/pimgr]
# - [0x5E70, .bss, done/cartrominit]
# - [0x5E70, .bss, done/piacs]
# - name: crc
# type: bin
# start: 0x5E70
# subsegments:
# - [0x5E70, bin, crc]
# - name: assets
# type: bin
# start: 0x5E90
# subsegments:
# - [0x5E90, bin, assets]
# - name: soundfont1
# type: bin
# start: 0x00DA8DF0
# subsegments:
# - [0x00DA8DF0, bin, soundfont1.ctl]
# - [0x00DB9BE0, bin, soundfont1.tbl]
# - name: soundfont2
# type: bin
# start: 0x00EC85E0
# subsegments:
# - [0x00EC85E0, bin, soundfont2.ctl]
# - [0x00ED2440, bin, soundfont2.tbl]
# - name: core1.pal.rzip
# type: bin
# start: 0x00F3D980
# - name: core2.pal.rzip
# type: bin
# start: 0x00F5BEC0
# - name: CC.pal.rzip
# type: bin
# start: 0x00FC8460
# - name: MMM.pal.rzip
# type: bin
# start: 0x00FCA3C0
# - name: GV.pal.rzip
# type: bin
# start: 0x00FCD5C0
# - name: TTC.pal.rzip
# type: bin
# start: 0x00FD2CC0
# - name: MM.pal.rzip
# type: bin
# start: 0x00FD6900
# - name: BGS.pal.rzip
# type: bin
# start: 0x00FD8930
# - name: RBB.pal.rzip
# type: bin
# start: 0x00FDDE80
# - name: FP.pal.rzip
# type: bin
# start: 0x00FE3060
- name: SM.pal.rzip
type: bin
start: 0x00FE8CA0
- name: cutscenes.pal.rzip
type: bin
start: 0x00FEB540
# - name: lair.pal.rzip
# type: bin
# start: 0x00FED780
# - name: fight.pal.rzip
# type: bin
# start: 0x00FF4A50
# - name: CCW.pal.rzip
# type: bin
# start: 0x00FFA830
# - name: emptyLvl.pal.rzip
# type: bin
# start: 0x00FFF090
- [0x01000000]

199
banjo.us.v10.yaml Normal file
View File

@@ -0,0 +1,199 @@
sha1: 1fe1632098865f639e22c11b9a81ee8f29c75d7a
options:
basename: banjo
find_file_boundaries: True
compiler: "IDO"
platform: n64
asm_endlabels: "endlabel"
cpp_args:
- "-Iinclude"
- "-Iinclude/2.0L"
- "-D_LANGUAGE_C"
generated_c_preamble: |
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
create_detected_syms: yes
undefined_syms_path: undefined_syms.us.v10.txt
symbol_addrs_path: symbol_addrs.boot.us.v10.txt
undefined_funcs_auto_path: undefined_funcs_auto.us.v10.txt
undefined_syms_auto_path: undefined_syms_auto.us.v10.txt
base_path: .
target_path: baserom.us.v10.z64
asset_path: bin
build_path: build/us.v10
segments:
- name: header
type: header
start: 0x00000000
- name: boot
type: code
start: 0x0040
vram: 0xA4000040
subsegments:
- [0x0040, asm, boot]
- [0x0B70, bin, boot2]
- name: entry
type: code
start: 0x1000
vram: 0x80000400
subsegments:
- [0x1000, hasm, entry]
- name: boot/bk_boot
type: code
start: 0x1050
vram: 0x80000450
subsegments:
- [0x1050, c, done/bk_boot_1050]
- [0x1150, c, done/rarezip]
- [0x12B0, c, done/inflate]
- [0x27F0, c, done/overlays]
- [0x2970, c, done/initialize]
- [0x2C00, c, done/pirawdma]
- [0x2CE0, c, done/pigetstat]
- [0x2CF0, hasm, bzero]
- [0x2D90, hasm, setsr]
- [0x2DA0, hasm, getsr]
- [0x2DB0, hasm, setfpccsr]
- [0x2DC0, c, done/sirawread]
- [0x2E10, c, done/sirawwrite]
- [0x2E60, hasm, ultra/exceptasm]
- [0x3770, hasm, writebackdcache]
- [0x37F0, hasm, invalicache]
- [0x3870, hasm, maptlbrdb]
- [0x38D0, c, done/pirawread]
- [0x3930, c, done/ll]
- [0x3BF0, bin, padding3BF0] # Empty space
- [0x3C50, c, done/virtualtophysical]
- [0x3CD0, c, done/si]
- [0x3D00, c, done/thread]
- [0x3D40, c, done/leointerrupt]
- [0x45C0, c, done/seteventmesg]
- [0x4630, hasm, ultra/setintmask]
- [0x46D0, c, done/destroythread]
- [0x47D0, hasm, probetlb]
- [0x4890, c, done/leodiskinit]
- [0x4990, c, done/epirawdma]
- [0x4BC0, hasm, interrupt]
- [0x4C00, c, done/pimgr]
- [0x4D90, c, done/cartrominit]
- [0x4E90, c, done/createmesgqueue]
- [0x4EC0, c, done/piacs]
- [0x4F80, c, done/getthreadpri]
- [0x4FA0, c, done/setthreadpri]
- [0x5080, c, done/createthread]
- [0x51D0, c, done/devmgr]
- [0x5660, c, done/startthread]
- [0x57B0, c, done/sendmesg]
- [0x5900, c, done/recvmesg]
- [0x5A40, c, done/resetglobalintmask]
- [0x5AA0, c, done/epirawwrite]
- [0x5AF0, c, done/epirawread]
- [0x5B40, c, done/setglobalintmask]
- [0x5B90, c, done/yieldthread]
- [0x5BE0, c, done/kdebugserver]
- [0x5BE0, .data, done/inflate]
- [0x5CE0, .data, done/initialize]
- [0x5D00, .data, ultra/exceptasm]
- [0x5D20, .data, done/thread]
- [0x5D40, .data, done/pimgr]
- [0x5D70, .data, done/piacs]
- [0x5D80, .rodata, ultra/exceptasm]
- [0x5DD0, .rodata, ultra/setintmask]
- [0x5E50, .rodata, done/devmgr]
- [0x5E70, .bss, done/bk_boot_1050]
- [0x5E70, .bss, done/rarezip]
- [0x5E70, .bss, done/inflate]
- [0x5E70, .bss, done/initialize]
- [0x5E70, .bss, done/kdebugserver]
- [0x5E70, .bss, done/leointerrupt]
- [0x5E70, .bss, done/seteventmesg]
- [0x5E70, .bss, done/leodiskinit]
- [0x5E70, .bss, done/pimgr]
- [0x5E70, .bss, done/cartrominit]
- [0x5E70, .bss, done/piacs]
- name: crc
type: bin
start: 0x5E70
subsegments:
- [0x5E70, bin, crc]
- name: assets
type: bin
start: 0x5E90
subsegments:
- [0x5E90, bin, assets]
- name: soundfont1
type: bin
start: 0xD846C0
subsegments:
- [0xD846C0, bin, soundfont1.ctl]
- [0xD954B0, bin, soundfont1.tbl]
- name: soundfont2
type: bin
start: 0xEA3EB0
subsegments:
- [0xEA3EB0, bin, soundfont2.ctl]
- [0xEADE60, bin, soundfont2.tbl]
- name: core1.us.v10.rzip
type: bin #type: rzip_code #compressed code
start: 0xF19250
#vram: 0x8023DA20
- name: core2.us.v10.rzip
type: bin #type: rzip_code #compressed code
start: 0xF37F90
#vram: 0x80286F90
- name: CC.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFA3FD0
#vram: 0x803863F0
- name: MMM.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFA5F50
#vram: 0x803863F0
- name: GV.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFA9150
#vram: 0x803863F0
- name: TTC.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFAE860
#vram: 0x803863F0
- name: MM.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFB24A0
#vram: 0x803863F0
- name: BGS.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFB44E0
#vram: 0x803863F0
- name: RBB.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFB9A30
#vram: 0x803863F0
- name: FP.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFBEBE0
#vram: 0x803863F0
- name: SM.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFC4810
#vram: 0x803863F0
- name: cutscenes.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFC6F20
#vram: 0x803863F0
- name: lair.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFC9150
#vram: 0x803863F0
- name: fight.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFD0420
#vram: 0x803863F0
- name: CCW.us.v10.rzip
type: bin #type: rzip_code/overlay #compressed code
start: 0xFD6190
#vram: 0x803863F0
- [0xFDAA10, bin, emptyLvl.us.v10.rzip]
- [0xFDAA30, bin, trailer] # 0xff to end
- [0x1000000] # end of ROM

87
banjo.us.v11.yaml Normal file
View File

@@ -0,0 +1,87 @@
options:
basename: banjo
find_file_boundaries: True
compiler: "IDO"
undefined_syms_path: undefined_syms.us.v11.txt
symbol_addrs_path: symbol_addrs.us.v11.txt
segments:
- name: header
type: header
start: 0x00000000
subsegments:
- [0x00000000, header, header]
- name: boot
type: bin
start: 0x00000040
- name: bk_boot
type: code
start: 0x00001000
vram: 0x80000400
subsegments:
- [0x00001000, asm]
- name: assets
type: bin
start: 0x00005E90
subsegments:
- [0x00005E90, bin, assets]
- name: soundfont1
type: bin
start: 0x00D87CA0
subsegments:
- [0x00D87CA0, bin, soundfont1.ctl]
- [0x00D98A90, bin, soundfont1.tbl]
- name: soundfont2
type: bin
start: 0x00EA7490
subsegments:
- [0x00EA7490, bin, soundfont2.ctl]
- [0x00EB12F0, bin, soundfont2.tbl]
- name: core1.us.v11.rzip
type: bin
start: 0x00F1C830
- name: core2.us.v11.rzip
type: bin
start: 0x00F3ADB0
- name: level2.us.v11.rzip
type: bin
start: 0x00FA6F80
- name: level9.us.v11.rzip
type: bin
start: 0x00FA8EE0
- name: level6.us.v11.rzip
type: bin
start: 0x00FAC0E0
- name: level1.us.v11.rzip
type: bin
start: 0x00FB1810
- name: level0.us.v11.rzip
type: bin
start: 0x00FB5450
- name: level3.us.v11.rzip
type: bin
start: 0x00FB7480
- name: level8.us.v11.rzip
type: bin
start: 0x00FBC9C0
- name: level4.us.v11.rzip
type: bin
start: 0x00FC1BA0
- name: level10.us.v11.rzip
type: bin
start: 0x00FC77E0
- name: level12.us.v11.rzip
type: bin
start: 0x00FC9EF0
- name: level5.us.v11.rzip
type: bin
start: 0x00FCC120
- name: level11.us.v11.rzip
type: bin
start: 0x00FD3400
- name: level7.us.v11.rzip
type: bin
start: 0x00FD91F0
- name: emptyLvl.us.v11.rzip
type: bin
start: 0x00FDDA80
- [0x01000000]

5
diff Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
python3 ./tools/asm-differ/diff.py -wm3 $1

View File

@@ -0,0 +1,37 @@
IRIX_ROOT := ../ido5.3_compiler
cc: OPT_CFLAGS := -O2
cfe: OPT_CFLAGS := -O2
uopt: OPT_CFLAGS := -O2
ugen: OPT_CFLAGS := -O2
as1: OPT_CFLAGS := -O2
acpp: OPT_CFLAGS := -O2
RECOMP := recomp
ugen_c.c: RECOMP_FLAGS := --conservative
all: cc cfe uopt ugen as1 acpp copt ujoin uld umerge usplit err.english.cc
clean:
$(RM) cc* cfe* uopt* ugen* as1* acpp* copt* ujoin* uld* umerge* usplit* err.english.cc $(RECOMP) libc_impl.o
$(RECOMP): recomp.cpp
$(CXX) $^ -o $@ -std=c++11 -O2 -Wno-switch `pkg-config --cflags --libs capstone`
libc_impl.o: libc_impl.c libc_impl.h
$(CC) $< -c -fno-strict-aliasing -O2 -DIDO53
err.english.cc: $(IRIX_ROOT)/usr/lib/err.english.cc
cp $^ $@
cc_c.c: $(IRIX_ROOT)/usr/bin/cc $(RECOMP)
./$(RECOMP) $(RECOMP_FLAGS) $< > $@
%_c.c: $(IRIX_ROOT)/usr/lib/% $(RECOMP)
./$(RECOMP) $(RECOMP_FLAGS) $< > $@
%: %_c.c libc_impl.o
$(CC) libc_impl.o $< -o $@ $(OPT_CFLAGS) -fno-strict-aliasing -lm -no-pie
.PHONY: all clean

BIN
ido/ido5.3_recomp/acpp Executable file

Binary file not shown.

BIN
ido/ido5.3_recomp/as1 Executable file

Binary file not shown.

BIN
ido/ido5.3_recomp/cc Executable file

Binary file not shown.

70220
ido/ido5.3_recomp/cc_c.c Normal file

File diff suppressed because it is too large Load Diff

BIN
ido/ido5.3_recomp/cfe Executable file

Binary file not shown.

BIN
ido/ido5.3_recomp/copt Executable file

Binary file not shown.

99
ido/ido5.3_recomp/elf.h Normal file
View File

@@ -0,0 +1,99 @@
#ifndef ELF_H
#define ELF_H
#include <stdint.h>
#define EI_DATA 5
#define EI_NIDENT 16
#define SHT_SYMTAB 2
#define SHT_DYNAMIC 6
#define SHT_REL 9
#define SHT_DYNSYM 11
#define SHT_MIPS_REGINFO 0x70000006
#define STN_UNDEF 0
#define STT_OBJECT 1
#define STT_FUNC 2
#define DT_PLTGOT 3
#define DT_MIPS_LOCAL_GOTNO 0x7000000a
#define DT_MIPS_SYMTABNO 0x70000011
#define DT_MIPS_GOTSYM 0x70000013
#define ELF32_R_SYM(info) ((info) >> 8)
#define ELF32_R_TYPE(info) ((info) & 0xff)
#define ELF32_ST_TYPE(info) ((info) & 0xf)
#define R_MIPS_26 4
#define R_MIPS_HI16 5
#define R_MIPS_LO16 6
#define SHN_UNDEF 0
#define SHN_COMMON 0xfff2
#define SHN_MIPS_ACOMMON 0xff00
#define SHN_MIPS_TEXT 0xff01
#define SHN_MIPS_DATA 0xff02
typedef uint32_t Elf32_Addr;
typedef uint32_t Elf32_Off;
typedef struct {
uint8_t e_ident[EI_NIDENT];
uint16_t e_type;
uint16_t e_machine;
uint32_t e_version;
Elf32_Addr e_entry;
Elf32_Off e_phoff;
Elf32_Off e_shoff;
uint32_t e_flags;
uint16_t e_ehsize;
uint16_t e_phentsize;
uint16_t e_phnum;
uint16_t e_shentsize;
uint16_t e_shnum;
uint16_t e_shstrndx;
} Elf32_Ehdr;
typedef struct {
uint32_t sh_name;
uint32_t sh_type;
uint32_t sh_flags;
Elf32_Addr sh_addr;
Elf32_Off sh_offset;
uint32_t sh_size;
uint32_t sh_link;
uint32_t sh_info;
uint32_t sh_addralign;
uint32_t sh_entsize;
} Elf32_Shdr;
typedef struct {
uint32_t st_name;
Elf32_Addr st_value;
uint32_t st_size;
uint8_t st_info;
uint8_t st_other;
uint16_t st_shndx;
} Elf32_Sym;
typedef struct {
Elf32_Addr r_offset;
uint32_t r_info;
} Elf32_Rel;
typedef struct
{
uint32_t ri_gprmask; /* General registers used. */
uint32_t ri_cprmask[4]; /* Coprocessor registers used. */
int32_t ri_gp_value; /* $gp register value. */
} Elf32_RegInfo;
typedef struct
{
int32_t d_tag; /* Dynamic entry type */
union {
uint32_t d_val; /* Integer value */
Elf32_Addr d_ptr; /* Address value */
} d_un;
} Elf32_Dyn;
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include "libc_impl.h"
#include "helpers.h"
#define RM_RN 0
#define RM_RZ 1
#define RM_RP 2
#define RM_RM 3
union FloatReg {
float f[2];
uint32_t w[2];
double d;
};
#define cvt_w_d(f) \
((fcsr & RM_RZ) ? ((isnan(f) || f <= -2147483649.0 || f >= 2147483648.0) ? (fcsr |= 0x40, 2147483647) : (int)f) : (assert(0), 0))
#define cvt_w_s(f) cvt_w_d((double)f)
static union FloatReg f0 = {{0, 0}}, f2 = {{0, 0}}, f4 = {{0, 0}}, f6 = {{0, 0}}, f8 = {{0, 0}},
f10 = {{0, 0}}, f12 = {{0, 0}}, f14 = {{0, 0}}, f16 = {{0, 0}}, f18 = {{0, 0}}, f20 = {{0, 0}},
f22 = {{0, 0}}, f24 = {{0, 0}}, f26 = {{0, 0}}, f28 = {{0, 0}}, f30 = {{0, 0}};
static uint32_t fcsr = 1;

View File

@@ -0,0 +1,13 @@
#ifndef HELPERS_H
#define HELPERS_H
#include <stdint.h>
#define MEM_U32(a) (*(uint32_t *)(mem + a))
#define MEM_S32(a) (*(int32_t *)(mem + a))
#define MEM_U16(a) (*(uint16_t *)(mem + ((a) ^ 2)))
#define MEM_S16(a) (*(int16_t *)(mem + ((a) ^ 2)))
#define MEM_U8(a) (*(uint8_t *)(mem + ((a) ^ 3)))
#define MEM_S8(a) (*(int8_t *)(mem + ((a) ^ 3)))
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,163 @@
#include <stdint.h>
void mmap_initial_data_range(uint8_t *mem, uint32_t start, uint32_t end);
void setup_libc_data(uint8_t *mem);
uint32_t wrapper_sbrk(uint8_t *mem, int increment);
uint32_t wrapper_malloc(uint8_t *mem, uint32_t size);
uint32_t wrapper_calloc(uint8_t *mem, uint32_t num, uint32_t size);
uint32_t wrapper_realloc(uint8_t *mem, uint32_t data_addr, uint32_t size);
int wrapper_fscanf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp);
int wrapper_printf(uint8_t *mem, uint32_t format_addr, uint32_t sp);
int wrapper_sprintf(uint8_t *mem, uint32_t str_addr, uint32_t format_addr, uint32_t sp);
int wrapper_fprintf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp);
int wrapper__doprnt(uint8_t *mem, uint32_t format_addr, uint32_t params_addr, uint32_t fp_addr);
void wrapper_free(uint8_t *mem, uint32_t data_addr);
uint32_t wrapper_strlen(uint8_t *mem, uint32_t str_addr);
int wrapper_open(uint8_t *mem, uint32_t pathname_addr, int flags, int mode);
int wrapper_creat(uint8_t *mem, uint32_t pathname_addr, int mode);
int wrapper_access(uint8_t *mem, uint32_t pathname_addr, int mode);
int wrapper_rename(uint8_t *mem, uint32_t oldpath_addr, uint32_t newpath_addr);
int wrapper_utime(uint8_t *mem, uint32_t filename_addr, uint32_t times_addr);
int wrapper_flock(uint8_t *mem, int fd, int operation);
int wrapper_chmod(uint8_t *mem, uint32_t path_addr, uint32_t mode);
int wrapper_umask(int mode);
uint32_t wrapper_ecvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr);
uint32_t wrapper_fcvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr);
double wrapper_sqrt(double v);
float wrapper_sqrtf(float v);
int wrapper_atoi(uint8_t *mem, uint32_t nptr_addr);
int wrapper_atol(uint8_t *mem, uint32_t nptr_addr);
double wrapper_atof(uint8_t *mem, uint32_t nptr_addr);
int wrapper_strtol(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base);
uint32_t wrapper_strtoul(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base);
double wrapper_strtod(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr);
uint32_t wrapper_strchr(uint8_t *mem, uint32_t str_addr, int c);
uint32_t wrapper_strrchr(uint8_t *mem, uint32_t str_addr, int c);
uint32_t wrapper_strcspn(uint8_t *mem, uint32_t str_addr, uint32_t invalid_addr);
uint32_t wrapper_strpbrk(uint8_t *mem, uint32_t str_addr, uint32_t accept_addr);
int wrapper_fstat(uint8_t *mem, int fildes, uint32_t buf_addr);
int wrapper_stat(uint8_t *mem, uint32_t pathname_addr, uint32_t buf_addr);
int wrapper_ftruncate(uint8_t *mem, int fd, int length);
void wrapper_bcopy(uint8_t *mem, uint32_t src_addr, uint32_t dst_addr, uint32_t len);
uint32_t wrapper_memcpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, uint32_t len);
uint32_t wrapper_memccpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, int c, uint32_t len);
int wrapper_read(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes);
int wrapper_write(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes);
uint32_t wrapper_fopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr);
uint32_t wrapper_freopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr, uint32_t fp_addr);
int wrapper_fclose(uint8_t *mem, uint32_t fp_addr);
int wrapper_fflush(uint8_t *mem, uint32_t fp_addr);
int wrapper_ftell(uint8_t *mem, uint32_t fp_addr);
void wrapper_rewind(uint8_t *mem, uint32_t fp_addr);
int wrapper_fseek(uint8_t *mem, uint32_t fp_addr, int offset, int origin);
int wrapper_lseek(uint8_t *mem, int fd, int offset, int whence);
int wrapper_dup(uint8_t *mem, int fd);
int wrapper_dup2(uint8_t *mem, int oldfd, int newfd);
int wrapper_pipe(uint8_t *mem, uint32_t pipefd_addr);
void wrapper_perror(uint8_t *mem, uint32_t str_addr);
int wrapper_fdopen(uint8_t *mem, int fd, uint32_t mode_addr);
uint32_t wrapper_memset(uint8_t *mem, uint32_t dest_addr, int byte, uint32_t n);
int wrapper_bcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n);
int wrapper_memcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n);
int wrapper_getpid(void);
int wrapper_getpgrp(uint8_t *mem);
int wrapper_remove(uint8_t *mem, uint32_t path_addr);
int wrapper_unlink(uint8_t *mem, uint32_t path_addr);
int wrapper_close(uint8_t *mem, int fd);
int wrapper_strcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr);
int wrapper_strncmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n);
uint32_t wrapper_strcpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr);
uint32_t wrapper_strncpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n);
uint32_t wrapper_strcat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr);
uint32_t wrapper_strncat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n);
uint32_t wrapper_strtok(uint8_t *mem, uint32_t str_addr, uint32_t delimiters_addr);
uint32_t wrapper_strstr(uint8_t *mem, uint32_t str1_addr, uint32_t str2_addr);
uint32_t wrapper_strdup(uint8_t *mem, uint32_t str_addr);
int wrapper_toupper(int c);
int wrapper_tolower(int c);
int wrapper_gethostname(uint8_t *mem, uint32_t name_addr, uint32_t len);
int wrapper_isatty(uint8_t *mem, int fd);
int wrapper_times(uint8_t *mem, uint32_t buffer_addr);
uint32_t wrapper_strftime(uint8_t *mem, uint32_t ptr_addr, uint32_t maxsize, uint32_t format_addr, uint32_t timeptr_addr);
int wrapper_clock(void);
uint32_t wrapper_ctime(uint8_t *mem, uint32_t timep_addr);
uint32_t wrapper_localtime(uint8_t *mem, uint32_t timep_addr);
int wrapper_setvbuf(uint8_t *mem, uint32_t fp_addr, uint32_t buf_addr, int mode, uint32_t size);
int wrapper___semgetc(uint8_t *mem, uint32_t fp_addr);
int wrapper___semputc(uint8_t *mem, int c, uint32_t fp_addr);
int wrapper_fgetc(uint8_t *mem, uint32_t fp_addr);
int wrapper_fgets(uint8_t *mem, uint32_t str_addr, int count, uint32_t fp_addr);
int wrapper___filbuf(uint8_t *mem, uint32_t fp_addr);
int wrapper___flsbuf(uint8_t *mem, int ch, uint32_t fp_addr);
int wrapper_ungetc(uint8_t *mem, int ch, uint32_t fp_addr);
uint32_t wrapper_gets(uint8_t *mem, uint32_t str_addr);
uint32_t wrapper_fread(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr);
uint32_t wrapper_fwrite(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr);
int wrapper_fputs(uint8_t *mem, uint32_t str_addr, uint32_t fp_addr);
int wrapper_puts(uint8_t *mem, uint32_t str_addr);
uint32_t wrapper_getcwd(uint8_t *mem, uint32_t buf_addr, uint32_t size);
int wrapper_time(uint8_t *mem, uint32_t tloc_addr);
void wrapper_bzero(uint8_t *mem, uint32_t str_addr, uint32_t n);
int wrapper_fp_class_d(double d);
double wrapper_ldexp(double d, int i);
int64_t wrapper___ll_mul(int64_t a0, int64_t a1);
int64_t wrapper___ll_div(int64_t a0, int64_t a1);
int64_t wrapper___ll_rem(uint64_t a0, int64_t a1);
int64_t wrapper___ll_lshift(int64_t a0, uint64_t shift);
int64_t wrapper___ll_rshift(int64_t a0, uint64_t shift);
uint64_t wrapper___ull_div(uint64_t a0, uint64_t a1);
uint64_t wrapper___ull_rem(uint64_t a0, uint64_t a1);
uint64_t wrapper___ull_rshift(uint64_t a0, uint64_t shift);
uint64_t wrapper___d_to_ull(double d);
int64_t wrapper___d_to_ll(double d);
uint64_t wrapper___f_to_ull(float f);
int64_t wrapper___f_to_ll(float f);
float wrapper___ull_to_f(uint64_t v);
float wrapper___ll_to_f(int64_t v);
double wrapper___ull_to_d(uint64_t v);
double wrapper___ll_to_d(int64_t v);
void wrapper_abort(uint8_t *mem);
void wrapper_exit(uint8_t *mem, int status);
void wrapper__exit(uint8_t *mem, int status);
void wrapper__cleanup(uint8_t *mem);
uint32_t wrapper__rld_new_interface(uint8_t *mem, uint32_t operation, uint32_t sp);
void wrapper__exithandle(uint8_t *mem);
int wrapper__prctl(uint8_t *mem, int operation, uint32_t sp);
double wrapper__atod(uint8_t *mem, uint32_t buffer_addr, int ndigits, int dexp);
int wrapper_pathconf(uint8_t *mem, uint32_t path_addr, int name);
uint32_t wrapper_getenv(uint8_t *mem, uint32_t name_addr);
uint32_t wrapper_gettxt(uint8_t *mem, uint32_t msgid_addr, uint32_t default_str_addr);
uint32_t wrapper_setlocale(uint8_t *mem, int category, uint32_t locale_addr);
uint32_t wrapper_mmap(uint8_t *mem, uint32_t addr, uint32_t length, int prot, int flags, int fd, int offset);
int wrapper_munmap(uint8_t *mem, uint32_t addr, uint32_t length);
int wrapper_mprotect(uint8_t *mem, uint32_t addr, uint32_t length, int prot);
int wrapper_sysconf(uint8_t *mem, int name);
int wrapper_getpagesize(uint8_t *mem);
int wrapper_strerror(uint8_t *mem, int errnum);
int wrapper_ioctl(uint8_t *mem, int fd, uint32_t request, uint32_t sp);
int wrapper_fcntl(uint8_t *mem, int fd, int cmd, uint32_t sp);
uint32_t wrapper_signal(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t handler_addr, uint32_t sp);
uint32_t wrapper_sigset(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t disp_addr, uint32_t sp);
int wrapper_get_fpc_csr(uint8_t *mem);
int wrapper_set_fpc_csr(uint8_t *mem, int csr);
int wrapper_setjmp(uint8_t *mem, uint32_t addr);
void wrapper_longjmp(uint8_t *mem, uint32_t addr, int status);
uint32_t wrapper_tempnam(uint8_t *mem, uint32_t dir_addr, uint32_t pfx_addr);
uint32_t wrapper_tmpnam(uint8_t *mem, uint32_t str_addr);
uint32_t wrapper_mktemp(uint8_t *mem, uint32_t template_addr);
int wrapper_mkstemp(uint8_t *mem, uint32_t name_addr);
uint32_t wrapper_tmpfile(uint8_t *mem);
int wrapper_wait(uint8_t *mem, uint32_t wstatus_addr);
int wrapper_kill(uint8_t *mem, int pid, int sig);
int wrapper_execlp(uint8_t *mem, uint32_t file_addr, uint32_t sp);
int wrapper_execv(uint8_t *mem, uint32_t pathname_addr, uint32_t argv_addr);
int wrapper_execvp(uint8_t *mem, uint32_t file_addr, uint32_t argv_addr);
int wrapper_fork(uint8_t *mem);
int wrapper_system(uint8_t *mem, uint32_t command_addr);
uint32_t wrapper_tsearch(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr);
uint32_t wrapper_tfind(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr);
uint32_t wrapper_qsort(uint8_t *mem, uint32_t base_addr, uint32_t num, uint32_t size, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t compare_addr, uint32_t sp);
uint32_t wrapper_regcmp(uint8_t *mem, uint32_t string1_addr, uint32_t sp);
uint32_t wrapper_regex(uint8_t *mem, uint32_t re_addr, uint32_t subject_addr, uint32_t sp);
void wrapper___assert(uint8_t *mem, uint32_t assertion_addr, uint32_t file_addr, int line);

BIN
ido/ido5.3_recomp/recomp Executable file

Binary file not shown.

2933
ido/ido5.3_recomp/recomp.cpp Normal file

File diff suppressed because it is too large Load Diff

BIN
ido/ido5.3_recomp/ugen Executable file

Binary file not shown.

133401
ido/ido5.3_recomp/ugen_c.c Normal file

File diff suppressed because it is too large Load Diff

BIN
ido/ido5.3_recomp/ujoin Executable file

Binary file not shown.

BIN
ido/ido5.3_recomp/uld Executable file

Binary file not shown.

BIN
ido/ido5.3_recomp/umerge Executable file

Binary file not shown.

BIN
ido/ido5.3_recomp/uopt Executable file

Binary file not shown.

BIN
ido/ido5.3_recomp/usplit Executable file

Binary file not shown.

126
include/2.0L/PR/PRimage.h Normal file
View File

@@ -0,0 +1,126 @@
/**************************************************************************
*
* $Revision: 1.4 $
* $Date: 1997/11/26 00:30:50 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/PRimage.h,v $
*
**************************************************************************/
#ifndef __GL_IMAGE_H__
#define __GL_IMAGE_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* Defines for image files . . . .
*
* Paul Haeberli - 1984
* Look in /usr/people/4Dgifts/iristools/imgtools for example code!
*
*/
#include <stdio.h>
#define IMAGIC 0732
/* colormap of images */
#define CM_NORMAL 0 /* file contains rows of values which
* are either RGB values (zsize == 3)
* or greyramp values (zsize == 1) */
#define CM_DITHERED 1
#define CM_SCREEN 2 /* file contains data which is a screen
* image; getrow returns buffer which
* can be displayed directly with
* writepixels */
#define CM_COLORMAP 3 /* a colormap file */
#define TYPEMASK 0xff00
#define BPPMASK 0x00ff
#define ITYPE_VERBATIM 0x0000
#define ITYPE_RLE 0x0100
#define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE)
#define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM)
#define BPP(type) ((type) & BPPMASK)
#define RLE(bpp) (ITYPE_RLE | (bpp))
#define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp))
#define IBUFSIZE(pixels) (((pixels)+((pixels)>>6))<<2)
#define RLE_NOP 0x00
#define ierror(p) (((p)->flags&_IOERR)!=0)
#define ifileno(p) ((p)->file)
#define getpix(p) (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p))
#define putpix(p,x) (--(p)->cnt>=0 \
? ((int)(*(p)->ptr++=(unsigned)(x))) \
: iflsbuf(p,(unsigned)(x)))
typedef struct {
unsigned short imagic; /* stuff saved on disk . . */
unsigned short type;
unsigned short dim;
unsigned short xsize;
unsigned short ysize;
unsigned short zsize;
unsigned long min;
unsigned long max;
unsigned long wastebytes;
char name[80];
unsigned long colormap;
long file; /* stuff used in core only */
unsigned short flags;
short dorev;
short x;
short y;
short z;
short cnt;
unsigned short *ptr;
unsigned short *base;
unsigned short *tmpbuf;
unsigned long offset;
unsigned long rleend; /* for rle images */
unsigned long *rowstart; /* for rle images */
long *rowsize; /* for rle images */
} IMAGE;
IMAGE *icreate();
/*
* IMAGE *iopen(char *file, char *mode, unsigned int type, unsigned int dim,
* unsigned int xsize, unsigned int ysize, unsigned int zsize);
* IMAGE *fiopen(int f, char *mode, unsigned int type, unsigned int dim,
* unsigned int xsize, unsigned int ysize, unsigned int zsize);
*
* ...while iopen and fiopen can take an extended set of parameters, the
* last five are optional, so a more correct prototype would be:
*
*/
IMAGE *iopen(char *file, char *mode, ...);
IMAGE *fiopen(int f, char *mode, ...);
/*
*
* unsigned short *ibufalloc(IMAGE *image);
* int ifilbuf(IMAGE *image);
* int iflush(IMAGE *image);
* unsigned int iflsbuf(IMAGE *image, unsigned int c);
* void isetname(IMAGE *image, char *name);
* void isetcolormap(IMAGE *image, int colormap);
*/
int iclose(IMAGE *image);
int putrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z);
int getrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z);
/*
IMAGE *iopen();
IMAGE *icreate();
*/
unsigned short *ibufalloc();
#define IMAGEDEF /* for backwards compatibility */
#ifdef __cplusplus
}
#endif
#endif /* !__GL_IMAGE_H__ */

453
include/2.0L/PR/R4300.h Normal file
View File

@@ -0,0 +1,453 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.13 $
* $Date: 1997/02/11 08:15:34 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/R4300.h,v $
*
**************************************************************************/
#ifndef __R4300_H__
#define __R4300_H__
#include <PR/ultratypes.h>
/*
* Segment base addresses and sizes
*/
#define KUBASE 0
#define KUSIZE 0x80000000
#define K0BASE 0x80000000
#define K0SIZE 0x20000000
#define K1BASE 0xA0000000
#define K1SIZE 0x20000000
#define K2BASE 0xC0000000
#define K2SIZE 0x20000000
/*
* Exception vectors
*/
#define SIZE_EXCVEC 0x80 /* Size of an exc. vec */
#define UT_VEC K0BASE /* utlbmiss vector */
#define R_VEC (K1BASE+0x1fc00000) /* reset vector */
#define XUT_VEC (K0BASE+0x80) /* extended address tlbmiss */
#define ECC_VEC (K0BASE+0x100) /* Ecc exception vector */
#define E_VEC (K0BASE+0x180) /* Gen. exception vector */
/*
* Address conversion macros
*/
#ifdef _LANGUAGE_ASSEMBLY
#define K0_TO_K1(x) ((x)|0xA0000000) /* kseg0 to kseg1 */
#define K1_TO_K0(x) ((x)&0x9FFFFFFF) /* kseg1 to kseg0 */
#define K0_TO_PHYS(x) ((x)&0x1FFFFFFF) /* kseg0 to physical */
#define K1_TO_PHYS(x) ((x)&0x1FFFFFFF) /* kseg1 to physical */
#define KDM_TO_PHYS(x) ((x)&0x1FFFFFFF) /* direct mapped to physical */
#define PHYS_TO_K0(x) ((x)|0x80000000) /* physical to kseg0 */
#define PHYS_TO_K1(x) ((x)|0xA0000000) /* physical to kseg1 */
#else /* _LANGUAGE_C */
#define K0_TO_K1(x) ((u32)(x)|0xA0000000) /* kseg0 to kseg1 */
#define K1_TO_K0(x) ((u32)(x)&0x9FFFFFFF) /* kseg1 to kseg0 */
#define K0_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg0 to physical */
#define K1_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg1 to physical */
#define KDM_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* direct mapped to physical */
#define PHYS_TO_K0(x) ((u32)(x)|0x80000000) /* physical to kseg0 */
#define PHYS_TO_K1(x) ((u32)(x)|0xA0000000) /* physical to kseg1 */
#endif /* _LANGUAGE_ASSEMBLY */
/*
* Address predicates
*/
#define IS_KSEG0(x) ((u32)(x) >= K0BASE && (u32)(x) < K1BASE)
#define IS_KSEG1(x) ((u32)(x) >= K1BASE && (u32)(x) < K2BASE)
#define IS_KSEGDM(x) ((u32)(x) >= K0BASE && (u32)(x) < K2BASE)
#define IS_KSEG2(x) ((u32)(x) >= K2BASE && (u32)(x) < KPTE_SHDUBASE)
#define IS_KPTESEG(x) ((u32)(x) >= KPTE_SHDUBASE)
#define IS_KUSEG(x) ((u32)(x) < K0BASE)
/*
* TLB size constants
*/
#define NTLBENTRIES 31 /* entry 31 is reserved by rdb */
#define TLBHI_VPN2MASK 0xffffe000
#define TLBHI_VPN2SHIFT 13
#define TLBHI_PIDMASK 0xff
#define TLBHI_PIDSHIFT 0
#define TLBHI_NPID 255 /* 255 to fit in 8 bits */
#define TLBLO_PFNMASK 0x3fffffc0
#define TLBLO_PFNSHIFT 6
#define TLBLO_CACHMASK 0x38 /* cache coherency algorithm */
#define TLBLO_CACHSHIFT 3
#define TLBLO_UNCACHED 0x10 /* not cached */
#define TLBLO_NONCOHRNT 0x18 /* Cacheable non-coherent */
#define TLBLO_EXLWR 0x28 /* Exclusive write */
#define TLBLO_D 0x4 /* writeable */
#define TLBLO_V 0x2 /* valid bit */
#define TLBLO_G 0x1 /* global access bit */
#define TLBINX_PROBE 0x80000000
#define TLBINX_INXMASK 0x3f
#define TLBINX_INXSHIFT 0
#define TLBRAND_RANDMASK 0x3f
#define TLBRAND_RANDSHIFT 0
#define TLBWIRED_WIREDMASK 0x3f
#define TLBCTXT_BASEMASK 0xff800000
#define TLBCTXT_BASESHIFT 23
#define TLBCTXT_BASEBITS 9
#define TLBCTXT_VPNMASK 0x7ffff0
#define TLBCTXT_VPNSHIFT 4
#define TLBPGMASK_4K 0x0
#define TLBPGMASK_16K 0x6000
#define TLBPGMASK_64K 0x1e000
/*
* Status register
*/
#define SR_CUMASK 0xf0000000 /* coproc usable bits */
#define SR_CU3 0x80000000 /* Coprocessor 3 usable */
#define SR_CU2 0x40000000 /* Coprocessor 2 usable */
#define SR_CU1 0x20000000 /* Coprocessor 1 usable */
#define SR_CU0 0x10000000 /* Coprocessor 0 usable */
#define SR_RP 0x08000000 /* Reduced power (quarter speed) */
#define SR_FR 0x04000000 /* MIPS III FP register mode */
#define SR_RE 0x02000000 /* Reverse endian */
#define SR_ITS 0x01000000 /* Instruction trace support */
#define SR_BEV 0x00400000 /* Use boot exception vectors */
#define SR_TS 0x00200000 /* TLB shutdown */
#define SR_SR 0x00100000 /* Soft reset occured */
#define SR_CH 0x00040000 /* Cache hit for last 'cache' op */
#define SR_CE 0x00020000 /* Create ECC */
#define SR_DE 0x00010000 /* ECC of parity does not cause error */
/*
* Interrupt enable bits
* (NOTE: bits set to 1 enable the corresponding level interrupt)
*/
#define SR_IMASK 0x0000ff00 /* Interrupt mask */
#define SR_IMASK8 0x00000000 /* mask level 8 */
#define SR_IMASK7 0x00008000 /* mask level 7 */
#define SR_IMASK6 0x0000c000 /* mask level 6 */
#define SR_IMASK5 0x0000e000 /* mask level 5 */
#define SR_IMASK4 0x0000f000 /* mask level 4 */
#define SR_IMASK3 0x0000f800 /* mask level 3 */
#define SR_IMASK2 0x0000fc00 /* mask level 2 */
#define SR_IMASK1 0x0000fe00 /* mask level 1 */
#define SR_IMASK0 0x0000ff00 /* mask level 0 */
#define SR_IBIT8 0x00008000 /* bit level 8 */
#define SR_IBIT7 0x00004000 /* bit level 7 */
#define SR_IBIT6 0x00002000 /* bit level 6 */
#define SR_IBIT5 0x00001000 /* bit level 5 */
#define SR_IBIT4 0x00000800 /* bit level 4 */
#define SR_IBIT3 0x00000400 /* bit level 3 */
#define SR_IBIT2 0x00000200 /* bit level 2 */
#define SR_IBIT1 0x00000100 /* bit level 1 */
#define SR_IMASKSHIFT 8
#define SR_KX 0x00000080 /* extended-addr TLB vec in kernel */
#define SR_SX 0x00000040 /* xtended-addr TLB vec supervisor */
#define SR_UX 0x00000020 /* xtended-addr TLB vec in user mode */
#define SR_KSU_MASK 0x00000018 /* mode mask */
#define SR_KSU_USR 0x00000010 /* user mode */
#define SR_KSU_SUP 0x00000008 /* supervisor mode */
#define SR_KSU_KER 0x00000000 /* kernel mode */
#define SR_ERL 0x00000004 /* Error level, 1=>cache error */
#define SR_EXL 0x00000002 /* Exception level, 1=>exception */
#define SR_IE 0x00000001 /* interrupt enable, 1=>enable */
/*
* Cause Register
*/
#define CAUSE_BD 0x80000000 /* Branch delay slot */
#define CAUSE_CEMASK 0x30000000 /* coprocessor error */
#define CAUSE_CESHIFT 28
/* Interrupt pending bits */
#define CAUSE_IP8 0x00008000 /* External level 8 pending - COMPARE */
#define CAUSE_IP7 0x00004000 /* External level 7 pending - INT4 */
#define CAUSE_IP6 0x00002000 /* External level 6 pending - INT3 */
#define CAUSE_IP5 0x00001000 /* External level 5 pending - INT2 */
#define CAUSE_IP4 0x00000800 /* External level 4 pending - INT1 */
#define CAUSE_IP3 0x00000400 /* External level 3 pending - INT0 */
#define CAUSE_SW2 0x00000200 /* Software level 2 pending */
#define CAUSE_SW1 0x00000100 /* Software level 1 pending */
#define CAUSE_IPMASK 0x0000FF00 /* Pending interrupt mask */
#define CAUSE_IPSHIFT 8
#define CAUSE_EXCMASK 0x0000007C /* Cause code bits */
#define CAUSE_EXCSHIFT 2
/* Cause register exception codes */
#define EXC_CODE(x) ((x)<<2)
/* Hardware exception codes */
#define EXC_INT EXC_CODE(0) /* interrupt */
#define EXC_MOD EXC_CODE(1) /* TLB mod */
#define EXC_RMISS EXC_CODE(2) /* Read TLB Miss */
#define EXC_WMISS EXC_CODE(3) /* Write TLB Miss */
#define EXC_RADE EXC_CODE(4) /* Read Address Error */
#define EXC_WADE EXC_CODE(5) /* Write Address Error */
#define EXC_IBE EXC_CODE(6) /* Instruction Bus Error */
#define EXC_DBE EXC_CODE(7) /* Data Bus Error */
#define EXC_SYSCALL EXC_CODE(8) /* SYSCALL */
#define EXC_BREAK EXC_CODE(9) /* BREAKpoint */
#define EXC_II EXC_CODE(10) /* Illegal Instruction */
#define EXC_CPU EXC_CODE(11) /* CoProcessor Unusable */
#define EXC_OV EXC_CODE(12) /* OVerflow */
#define EXC_TRAP EXC_CODE(13) /* Trap exception */
#define EXC_VCEI EXC_CODE(14) /* Virt. Coherency on Inst. fetch */
#define EXC_FPE EXC_CODE(15) /* Floating Point Exception */
#define EXC_WATCH EXC_CODE(23) /* Watchpoint reference */
#define EXC_VCED EXC_CODE(31) /* Virt. Coherency on data read */
/* C0_PRID Defines */
#define C0_IMPMASK 0xff00
#define C0_IMPSHIFT 8
#define C0_REVMASK 0xff
#define C0_MAJREVMASK 0xf0
#define C0_MAJREVSHIFT 4
#define C0_MINREVMASK 0xf
/*
* Coprocessor 0 operations
*/
#define C0_READI 0x1 /* read ITLB entry addressed by C0_INDEX */
#define C0_WRITEI 0x2 /* write ITLB entry addressed by C0_INDEX */
#define C0_WRITER 0x6 /* write ITLB entry addressed by C0_RAND */
#define C0_PROBE 0x8 /* probe for ITLB entry addressed by TLBHI */
#define C0_RFE 0x10 /* restore for exception */
/*
* 'cache' instruction definitions
*/
/* Target cache */
#define CACH_PI 0x0 /* specifies primary inst. cache */
#define CACH_PD 0x1 /* primary data cache */
#define CACH_SI 0x2 /* secondary instruction cache */
#define CACH_SD 0x3 /* secondary data cache */
/* Cache operations */
#define C_IINV 0x0 /* index invalidate (inst, 2nd inst) */
#define C_IWBINV 0x0 /* index writeback inval (d, sd) */
#define C_ILT 0x4 /* index load tag (all) */
#define C_IST 0x8 /* index store tag (all) */
#define C_CDX 0xc /* create dirty exclusive (d, sd) */
#define C_HINV 0x10 /* hit invalidate (all) */
#define C_HWBINV 0x14 /* hit writeback inv. (d, sd) */
#define C_FILL 0x14 /* fill (i) */
#define C_HWB 0x18 /* hit writeback (i, d, sd) */
#define C_HSV 0x1c /* hit set virt. (si, sd) */
/*
* Cache size definitions
*/
#define ICACHE_SIZE 0x4000 /* 16K */
#define ICACHE_LINESIZE 32 /* 8 words */
#define ICACHE_LINEMASK (ICACHE_LINESIZE-1)
#define DCACHE_SIZE 0x2000 /* 8K */
#define DCACHE_LINESIZE 16 /* 4 words */
#define DCACHE_LINEMASK (DCACHE_LINESIZE-1)
/*
* C0_CONFIG register definitions
*/
#define CONFIG_CM 0x80000000 /* 1 == Master-Checker enabled */
#define CONFIG_EC 0x70000000 /* System Clock ratio */
#define CONFIG_EC_1_1 0x6 /* System Clock ratio 1 :1 */
#define CONFIG_EC_3_2 0x7 /* System Clock ratio 1.5 :1 */
#define CONFIG_EC_2_1 0x0 /* System Clock ratio 2 :1 */
#define CONFIG_EC_3_1 0x1 /* System Clock ratio 3 :1 */
#define CONFIG_EP 0x0f000000 /* Transmit Data Pattern */
#define CONFIG_SB 0x00c00000 /* Secondary cache block size */
#define CONFIG_SS 0x00200000 /* Split scache: 0 == I&D combined */
#define CONFIG_SW 0x00100000 /* scache port: 0==128, 1==64 */
#define CONFIG_EW 0x000c0000 /* System Port width: 0==64, 1==32 */
#define CONFIG_SC 0x00020000 /* 0 -> 2nd cache present */
#define CONFIG_SM 0x00010000 /* 0 -> Dirty Shared Coherency enabled*/
#define CONFIG_BE 0x00008000 /* Endian-ness: 1 --> BE */
#define CONFIG_EM 0x00004000 /* 1 -> ECC mode, 0 -> parity */
#define CONFIG_EB 0x00002000 /* Block order:1->sequent,0->subblock */
#define CONFIG_IC 0x00000e00 /* Primary Icache size */
#define CONFIG_DC 0x000001c0 /* Primary Dcache size */
#define CONFIG_IB 0x00000020 /* Icache block size */
#define CONFIG_DB 0x00000010 /* Dcache block size */
#define CONFIG_CU 0x00000008 /* Update on Store-conditional */
#define CONFIG_K0 0x00000007 /* K0SEG Coherency algorithm */
#define CONFIG_UNCACHED 0x00000002 /* K0 is uncached */
#define CONFIG_NONCOHRNT 0x00000003
#define CONFIG_COHRNT_EXLWR 0x00000005
#define CONFIG_SB_SHFT 22 /* shift SB to bit position 0 */
#define CONFIG_IC_SHFT 9 /* shift IC to bit position 0 */
#define CONFIG_DC_SHFT 6 /* shift DC to bit position 0 */
#define CONFIG_BE_SHFT 15 /* shift BE to bit position 0 */
/*
* C0_TAGLO definitions for setting/getting cache states and physaddr bits
*/
#define SADDRMASK 0xFFFFE000 /* 31..13 -> scache paddr bits 35..17 */
#define SVINDEXMASK 0x00000380 /* 9..7: prim virt index bits 14..12 */
#define SSTATEMASK 0x00001c00 /* bits 12..10 hold scache line state */
#define SINVALID 0x00000000 /* invalid --> 000 == state 0 */
#define SCLEANEXCL 0x00001000 /* clean exclusive --> 100 == state 4 */
#define SDIRTYEXCL 0x00001400 /* dirty exclusive --> 101 == state 5 */
#define SECC_MASK 0x0000007f /* low 7 bits are ecc for the tag */
#define SADDR_SHIFT 4 /* shift STagLo (31..13) to 35..17 */
#define PADDRMASK 0xFFFFFF00 /* PTagLo31..8->prim paddr bits35..12 */
#define PADDR_SHIFT 4 /* roll bits 35..12 down to 31..8 */
#define PSTATEMASK 0x00C0 /* bits 7..6 hold primary line state */
#define PINVALID 0x0000 /* invalid --> 000 == state 0 */
#define PCLEANEXCL 0x0080 /* clean exclusive --> 10 == state 2 */
#define PDIRTYEXCL 0x00C0 /* dirty exclusive --> 11 == state 3 */
#define PPARITY_MASK 0x0001 /* low bit is parity bit (even). */
/*
* C0_CACHE_ERR definitions.
*/
#define CACHERR_ER 0x80000000 /* 0: inst ref, 1: data ref */
#define CACHERR_EC 0x40000000 /* 0: primary, 1: secondary */
#define CACHERR_ED 0x20000000 /* 1: data error */
#define CACHERR_ET 0x10000000 /* 1: tag error */
#define CACHERR_ES 0x08000000 /* 1: external ref, e.g. snoop*/
#define CACHERR_EE 0x04000000 /* error on SysAD bus */
#define CACHERR_EB 0x02000000 /* complicated, see spec. */
#define CACHERR_EI 0x01000000 /* complicated, see spec. */
#define CACHERR_SIDX_MASK 0x003ffff8 /* secondary cache index */
#define CACHERR_PIDX_MASK 0x00000007 /* primary cache index */
#define CACHERR_PIDX_SHIFT 12 /* bits 2..0 are paddr14..12 */
/* R4000 family supports hardware watchpoints:
* C0_WATCHLO:
* bits 31..3 are bits 31..3 of physaddr to watch
* bit 2: reserved; must be written as 0.
* bit 1: when set causes a watchpoint trap on load accesses to paddr.
* bit 0: when set traps on stores to paddr;
* C0_WATCHHI
* bits 31..4 are reserved and must be written as zeros.
* bits 3..0 are bits 35..32 of the physaddr to watch
*/
#define WATCHLO_WTRAP 0x00000001
#define WATCHLO_RTRAP 0x00000002
#define WATCHLO_ADDRMASK 0xfffffff8
#define WATCHLO_VALIDMASK 0xfffffffb
#define WATCHHI_VALIDMASK 0x0000000f
/*
* Coprocessor 0 registers
*/
#ifdef _LANGUAGE_ASSEMBLY
#define C0_INX $0
#define C0_RAND $1
#define C0_ENTRYLO0 $2
#define C0_ENTRYLO1 $3
#define C0_CONTEXT $4
#define C0_PAGEMASK $5 /* page mask */
#define C0_WIRED $6 /* # wired entries in tlb */
#define C0_BADVADDR $8
#define C0_COUNT $9 /* free-running counter */
#define C0_ENTRYHI $10
#define C0_SR $12
#define C0_CAUSE $13
#define C0_EPC $14
#define C0_PRID $15 /* revision identifier */
#define C0_COMPARE $11 /* counter comparison reg. */
#define C0_CONFIG $16 /* hardware configuration */
#define C0_LLADDR $17 /* load linked address */
#define C0_WATCHLO $18 /* watchpoint */
#define C0_WATCHHI $19 /* watchpoint */
#define C0_ECC $26 /* S-cache ECC and primary parity */
#define C0_CACHE_ERR $27 /* cache error status */
#define C0_TAGLO $28 /* cache operations */
#define C0_TAGHI $29 /* cache operations */
#define C0_ERROR_EPC $30 /* ECC error prg. counter */
# else /* ! _LANGUAGE_ASSEMBLY */
#define C0_INX 0
#define C0_RAND 1
#define C0_ENTRYLO0 2
#define C0_ENTRYLO1 3
#define C0_CONTEXT 4
#define C0_PAGEMASK 5 /* page mask */
#define C0_WIRED 6 /* # wired entries in tlb */
#define C0_BADVADDR 8
#define C0_COUNT 9 /* free-running counter */
#define C0_ENTRYHI 10
#define C0_SR 12
#define C0_CAUSE 13
#define C0_EPC 14
#define C0_PRID 15 /* revision identifier */
#define C0_COMPARE 11 /* counter comparison reg. */
#define C0_CONFIG 16 /* hardware configuration */
#define C0_LLADDR 17 /* load linked address */
#define C0_WATCHLO 18 /* watchpoint */
#define C0_WATCHHI 19 /* watchpoint */
#define C0_ECC 26 /* S-cache ECC and primary parity */
#define C0_CACHE_ERR 27 /* cache error status */
#define C0_TAGLO 28 /* cache operations */
#define C0_TAGHI 29 /* cache operations */
#define C0_ERROR_EPC 30 /* ECC error prg. counter */
#endif /* _LANGUAGE_ASSEMBLY */
/*
* floating-point status register
*/
#define FPCSR_FS 0x01000000 /* flush denorm to zero */
#define FPCSR_C 0x00800000 /* condition bit */
#define FPCSR_CE 0x00020000 /* cause: unimplemented operation */
#define FPCSR_CV 0x00010000 /* cause: invalid operation */
#define FPCSR_CZ 0x00008000 /* cause: division by zero */
#define FPCSR_CO 0x00004000 /* cause: overflow */
#define FPCSR_CU 0x00002000 /* cause: underflow */
#define FPCSR_CI 0x00001000 /* cause: inexact operation */
#define FPCSR_EV 0x00000800 /* enable: invalid operation */
#define FPCSR_EZ 0x00000400 /* enable: division by zero */
#define FPCSR_EO 0x00000200 /* enable: overflow */
#define FPCSR_EU 0x00000100 /* enable: underflow */
#define FPCSR_EI 0x00000080 /* enable: inexact operation */
#define FPCSR_FV 0x00000040 /* flag: invalid operation */
#define FPCSR_FZ 0x00000020 /* flag: division by zero */
#define FPCSR_FO 0x00000010 /* flag: overflow */
#define FPCSR_FU 0x00000008 /* flag: underflow */
#define FPCSR_FI 0x00000004 /* flag: inexact operation */
#define FPCSR_RM_MASK 0x00000003 /* rounding mode mask */
#define FPCSR_RM_RN 0x00000000 /* round to nearest */
#define FPCSR_RM_RZ 0x00000001 /* round to zero */
#define FPCSR_RM_RP 0x00000002 /* round to positive infinity */
#define FPCSR_RM_RM 0x00000003 /* round to negative infinity */
#endif /* __R4300_H */

410
include/2.0L/PR/abi.h Normal file
View File

@@ -0,0 +1,410 @@
#ifndef _ABI_H_
#define _ABI_H_
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.32 $
* $Date: 1997/02/11 08:16:37 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/abi.h,v $
*
**************************************************************************/
/*
* Header file for the Audio Binary Interface.
* This is included in the Media Binary Interface file
* mbi.h.
*
* This file follows the framework used for graphics.
*
*/
/* Audio commands: */
#define A_SPNOOP 0
#define A_ADPCM 1
#define A_CLEARBUFF 2
#define A_ENVMIXER 3
#define A_LOADBUFF 4
#define A_RESAMPLE 5
#define A_SAVEBUFF 6
#define A_SEGMENT 7
#define A_SETBUFF 8
#define A_SETVOL 9
#define A_DMEMMOVE 10
#define A_LOADADPCM 11
#define A_MIXER 12
#define A_INTERLEAVE 13
#define A_POLEF 14
#define A_SETLOOP 15
#define ACMD_SIZE 32
/*
* Audio flags
*/
#define A_INIT 0x01
#define A_CONTINUE 0x00
#define A_LOOP 0x02
#define A_OUT 0x02
#define A_LEFT 0x02
#define A_RIGHT 0x00
#define A_VOL 0x04
#define A_RATE 0x00
#define A_AUX 0x08
#define A_NOAUX 0x00
#define A_MAIN 0x00
#define A_MIX 0x10
/*
* BEGIN C-specific section: (typedef's)
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/*
* Data Structures.
*/
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int addr;
} Aadpcm;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int addr;
} Apolef;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
} Aenvelope;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int dmem:16;
unsigned int pad2:16;
unsigned int count:16;
} Aclearbuff;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int pad2:16;
unsigned int inL:16;
unsigned int inR:16;
} Ainterleave;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int addr;
} Aloadbuff;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
} Aenvmixer;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int dmemi:16;
unsigned int dmemo:16;
} Amixer;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int dmem2:16;
unsigned int addr;
} Apan;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pitch:16;
unsigned int addr;
} Aresample;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
} Areverb;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int addr;
} Asavebuff;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int pad2:2;
unsigned int number:4;
unsigned int base:24;
} Asegment;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int dmemin:16;
unsigned int dmemout:16;
unsigned int count:16;
} Asetbuff;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int vol:16;
unsigned int voltgt:16;
unsigned int volrate:16;
} Asetvol;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int dmemin:16;
unsigned int dmemout:16;
unsigned int count:16;
} Admemmove;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int count:16;
unsigned int addr;
} Aloadadpcm;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int pad2:16;
unsigned int addr;
} Asetloop;
/*
* Generic Acmd Packet
*/
typedef struct {
unsigned int w0;
unsigned int w1;
} Awords;
typedef union {
Awords words;
Aadpcm adpcm;
Apolef polef;
Aclearbuff clearbuff;
Aenvelope envelope;
Ainterleave interleave;
Aloadbuff loadbuff;
Aenvmixer envmixer;
Aresample resample;
Areverb reverb;
Asavebuff savebuff;
Asegment segment;
Asetbuff setbuff;
Asetvol setvol;
Admemmove dmemmove;
Aloadadpcm loadadpcm;
Amixer mixer;
Asetloop setloop;
long long int force_union_align; /* dummy, force alignment */
} Acmd;
/*
* ADPCM State
*/
#define ADPCMVSIZE 8
#define ADPCMFSIZE 16
typedef short ADPCM_STATE[ADPCMFSIZE];
/*
* Pole filter state
*/
typedef short POLEF_STATE[4];
/*
* Resampler state
*/
typedef short RESAMPLE_STATE[16];
/*
* Resampler constants
*/
#define UNITY_PITCH 0x8000
#define MAX_RATIO 1.99996 /* within .03 cents of +1 octave */
/*
* Enveloper/Mixer state
*/
typedef short ENVMIX_STATE[40];
/*
* Macros to assemble the audio command list
*/
#define aADPCMdec(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (unsigned int)(s); \
}
#define aPoleFilter(pkt, f, g, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(g, 0, 16)); \
_a->words.w1 = (unsigned int)(s); \
}
#define aClearBuffer(pkt, d, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_CLEARBUFF, 24, 8) | _SHIFTL(d, 0, 24); \
_a->words.w1 = (unsigned int)(c); \
}
#define aEnvMixer(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (unsigned int)(s); \
}
#define aInterleave(pkt, l, r) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \
_a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
}
#define aLoadBuffer(pkt, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8); \
_a->words.w1 = (unsigned int)(s); \
}
#define aMix(pkt, f, g, i, o) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(g, 0, 16)); \
_a->words.w1 = _SHIFTL(i,16, 16) | _SHIFTL(o, 0, 16); \
}
#define aPan(pkt, f, d, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_PAN, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(d, 0, 16)); \
_a->words.w1 = (unsigned int)(s); \
}
#define aResample(pkt, f, p, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(f, 16, 8) |\
_SHIFTL(p, 0, 16)); \
_a->words.w1 = (unsigned int)(s); \
}
#define aSaveBuffer(pkt, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8); \
_a->words.w1 = (unsigned int)(s); \
}
#define aSegment(pkt, s, b) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_SEGMENT, 24, 8); \
_a->words.w1 = _SHIFTL(s, 24, 8) | _SHIFTL(b, 0, 24); \
}
#define aSetBuffer(pkt, f, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_SETBUFF, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(i, 0, 16)); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
#define aSetVolume(pkt, f, v, t, r) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
_SHIFTL(v, 0, 16)); \
_a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \
}
#define aSetLoop(pkt, a) \
{ \
Acmd *_a = (Acmd *)pkt; \
_a->words.w0 = _SHIFTL(A_SETLOOP, 24, 8); \
_a->words.w1 = (unsigned int)(a); \
}
#define aDMEMMove(pkt, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_DMEMMOVE, 24, 8) | _SHIFTL(i, 0, 24); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
#define aLoadADPCM(pkt, c, d) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
_a->words.w1 = (unsigned int) d; \
}
#endif /* _LANGUAGE_C */
#endif /* !_ABI_H_ */

4572
include/2.0L/PR/gbi.h Normal file

File diff suppressed because it is too large Load Diff

392
include/2.0L/PR/gs2dex.h Normal file
View File

@@ -0,0 +1,392 @@
/*---------------------------------------------------------------------
Copyright (C) 1997, Nintendo.
File gs2dex.h
Coded by Yoshitaka Yasumoto. Jul 31, 1997.
Modified by
Comments Header file for S2DEX ucode.
$Id: gs2dex.h,v 1.21 1998/05/28 00:14:49 has Exp $
---------------------------------------------------------------------*/
#ifndef _GS2DEX_H_
#define _GS2DEX_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
/*===========================================================================*
* Macro
*===========================================================================*/
#define GS_CALC_DXT(line) (((1<< G_TX_DXT_FRAC)-1)/(line)+1)
#define GS_PIX2TMEM(pix, siz) ((pix)>>(4-(siz)))
#define GS_PIX2DXT(pix, siz) GS_CALC_DXT(GS_PIX2TMEM((pix), (siz)))
/*===========================================================================*
* Data structures for S2DEX microcode
*===========================================================================*/
/*---------------------------------------------------------------------------*
* Background
*---------------------------------------------------------------------------*/
#define G_BGLT_LOADBLOCK 0x0033
#define G_BGLT_LOADTILE 0xfff4
#define G_BG_FLAG_FLIPS 0x01
#define G_BG_FLAG_FLIPT 0x10
/* Non scalable background plane */
typedef struct {
u16 imageX; /* x-coordinate of upper-left position of texture (u10.5) */
u16 imageW; /* width of the texture (u10.2) */
s16 frameX; /* upper-left position of transferred frame (s10.2) */
u16 frameW; /* width of transferred frame (u10.2) */
u16 imageY; /* y-coordinate of upper-left position of texture (u10.5) */
u16 imageH; /* height of the texture (u10.2) */
s16 frameY; /* upper-left position of transferred frame (s10.2) */
u16 frameH; /* height of transferred frame (u10.2) */
u64 *imagePtr; /* texture source address on DRAM */
u16 imageLoad; /* which to use, LoadBlock or LoadTile */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u16 imagePal; /* pallet number */
u16 imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */
/* The following is set in the initialization routine guS2DInitBg(). There is no need for the user to set it. */
u16 tmemW; /* TMEM width and Word size of frame 1 line.
At LoadBlock, GS_PIX2TMEM(imageW/4,imageSiz)
At LoadTile GS_PIX2TMEM(frameW/4,imageSiz)+1 */
u16 tmemH; /* height of TMEM loadable at a time (s13.2) 4 times value
When the normal texture, 512/tmemW*4
When the CI texture, 256/tmemW*4 */
u16 tmemLoadSH; /* SH value
At LoadBlock, tmemSize/2-1
At LoadTile, tmemW*16-1 */
u16 tmemLoadTH; /* TH value or Stride value
At LoadBlock, GS_CALC_DXT(tmemW)
At LoadTile, tmemH-1 */
u16 tmemSizeW; /* skip value of imagePtr for image 1-line
At LoadBlock, tmemW*2
At LoadTile, GS_PIX2TMEM(imageW/4,imageSiz)*2 */
u16 tmemSize; /* skip value of imagePtr for 1-loading
= tmemSizeW*tmemH */
} uObjBg_t; /* 40 bytes */
/* Scalable background plane */
typedef struct {
u16 imageX; /* x-coordinate of upper-left position of texture (u10.5) */
u16 imageW; /* width of texture (u10.2) */
s16 frameX; /* upper-left position of transferred frame (s10.2) */
u16 frameW; /* width of transferred frame (u10.2) */
u16 imageY; /* y-coordinate of upper-left position of texture (u10.5) */
u16 imageH; /* height of texture (u10.2) */
s16 frameY; /* upper-left position of transferred frame (s10.2) */
u16 frameH; /* height of transferred frame (u10.2) */
u64 *imagePtr; /* texture source address on DRAM */
u16 imageLoad; /* Which to use, LoadBlock or LoadTile? */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u16 imagePal; /* pallet number */
u16 imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */
u16 scaleW; /* scale value of X-direction (u5.10) */
u16 scaleH; /* scale value of Y-direction (u5.10) */
s32 imageYorig; /* start point of drawing on image (s20.5) */
u8 padding[4];
} uObjScaleBg_t; /* 40 bytes */
typedef union {
uObjBg_t b;
uObjScaleBg_t s;
long long int force_structure_alignment;
} uObjBg;
/*---------------------------------------------------------------------------*
* 2D Objects
*---------------------------------------------------------------------------*/
#define G_OBJ_FLAG_FLIPS 1<<0 /* inversion to S-direction */
#define G_OBJ_FLAG_FLIPT 1<<4 /* nversion to T-direction */
typedef struct {
s16 objX; /* s10.2 OBJ x-coordinate of upper-left end */
u16 scaleW; /* u5.10 Scaling of u5.10 width direction */
u16 imageW; /* u10.5 width of u10.5 texture (length of S-direction) */
u16 paddingX; /* Unused - Always 0 */
s16 objY; /* s10.2 OBJ y-coordinate of s10.2 OBJ upper-left end */
u16 scaleH; /* u5.10 Scaling of u5.10 height direction */
u16 imageH; /* u10.5 height of u10.5 texture (length of T-direction) */
u16 paddingY; /* Unused - Always 0 */
u16 imageStride; /* folding width of texel (In units of 64bit word) */
u16 imageAdrs; /* texture header position in TMEM (In units of 64bit word) */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u8 imagePal; /* pallet number (0-7) */
u8 imageFlags; /* The display flag - G_OBJ_FLAG_FLIP* */
} uObjSprite_t; /* 24 bytes */
typedef union {
uObjSprite_t s;
long long int force_structure_alignment;
} uObjSprite;
/*---------------------------------------------------------------------------*
* 2D Matrix
*---------------------------------------------------------------------------*/
typedef struct {
s32 A, B, C, D; /* s15.16 */
s16 X, Y; /* s10.2 */
u16 BaseScaleX; /* u5.10 */
u16 BaseScaleY; /* u5.10 */
} uObjMtx_t; /* 24 bytes */
typedef union {
uObjMtx_t m;
long long int force_structure_alignment;
} uObjMtx;
typedef struct {
s16 X, Y; /* s10.2 */
u16 BaseScaleX; /* u5.10 */
u16 BaseScaleY; /* u5.10 */
} uObjSubMtx_t; /* 8 bytes */
typedef union {
uObjSubMtx_t m;
long long int force_structure_alignment;
} uObjSubMtx;
/*---------------------------------------------------------------------------*
* Loading into TMEM
*---------------------------------------------------------------------------*/
#define G_OBJLT_TXTRBLOCK 0x00001033
#define G_OBJLT_TXTRTILE 0x00fc1034
#define G_OBJLT_TLUT 0x00000030
#define GS_TB_TSIZE(pix,siz) (GS_PIX2TMEM((pix),(siz))-1)
#define GS_TB_TLINE(pix,siz) (GS_CALC_DXT(GS_PIX2TMEM((pix),(siz))))
typedef struct {
u32 type; /* G_OBJLT_TXTRBLOCK divided into types */
u64 *image; /* texture source address on DRAM */
u16 tmem; /* loaded TMEM word address (8byteWORD) */
u16 tsize; /* Texture size, Specified by macro GS_TB_TSIZE() */
u16 tline; /* width of Texture 1-line, Specified by macro GS_TB_TLINE() */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrBlock_t; /* 24 bytes */
#define GS_TT_TWIDTH(pix,siz) ((GS_PIX2TMEM((pix), (siz))<<2)-1)
#define GS_TT_THEIGHT(pix,siz) (((pix)<<2)-1)
typedef struct {
u32 type; /* G_OBJLT_TXTRTILE divided into types */
u64 *image; /* texture source address on DRAM */
u16 tmem; /* loaded TMEM word address (8byteWORD)*/
u16 twidth; /* width of Texture (Specified by macro GS_TT_TWIDTH()) */
u16 theight; /* height of Texture (Specified by macro GS_TT_THEIGHT()) */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrTile_t; /* 24 bytes */
#define GS_PAL_HEAD(head) ((head)+256)
#define GS_PAL_NUM(num) ((num)-1)
typedef struct {
u32 type; /* G_OBJLT_TLUT divided into types */
u64 *image; /* texture source address on DRAM */
u16 phead; /* pallet number of load header (Between 256 and 511) */
u16 pnum; /* loading pallet number -1 */
u16 zero; /* Assign 0 all the time */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12)*/
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrTLUT_t; /* 24 bytes */
typedef union {
uObjTxtrBlock_t block;
uObjTxtrTile_t tile;
uObjTxtrTLUT_t tlut;
long long int force_structure_alignment;
} uObjTxtr;
/*---------------------------------------------------------------------------*
* Loading into TMEM & 2D Objects
*---------------------------------------------------------------------------*/
typedef struct {
uObjTxtr txtr;
uObjSprite sprite;
} uObjTxSprite; /* 48 bytes */
/*===========================================================================*
* GBI Commands for S2DEX microcode
*===========================================================================*/
/* GBI Header */
#ifdef F3DEX_GBI_2
#define G_OBJ_RECTANGLE_R 0xda
#define G_OBJ_MOVEMEM 0xdc
#define G_RDPHALF_0 0xe4
#define G_OBJ_RECTANGLE 0x01
#define G_OBJ_SPRITE 0x02
#define G_SELECT_DL 0x04
#define G_OBJ_LOADTXTR 0x05
#define G_OBJ_LDTX_SPRITE 0x06
#define G_OBJ_LDTX_RECT 0x07
#define G_OBJ_LDTX_RECT_R 0x08
#define G_BG_1CYC 0x09
#define G_BG_COPY 0x0a
#define G_OBJ_RENDERMODE 0x0b
#else
#define G_BG_1CYC 0x01
#define G_BG_COPY 0x02
#define G_OBJ_RECTANGLE 0x03
#define G_OBJ_SPRITE 0x04
#define G_OBJ_MOVEMEM 0x05
#define G_SELECT_DL 0xb0
#define G_OBJ_RENDERMODE 0xb1
#define G_OBJ_RECTANGLE_R 0xb2
#define G_OBJ_LOADTXTR 0xc1
#define G_OBJ_LDTX_SPRITE 0xc2
#define G_OBJ_LDTX_RECT 0xc3
#define G_OBJ_LDTX_RECT_R 0xc4
#define G_RDPHALF_0 0xe4
#endif
/*---------------------------------------------------------------------------*
* Background wrapped screen
*---------------------------------------------------------------------------*/
#define gSPBgRectangle(pkt, m, mptr) gDma0p((pkt),(m),(mptr),0)
#define gsSPBgRectangle(m, mptr) gsDma0p( (m),(mptr),0)
#define gSPBgRectCopy(pkt, mptr) gSPBgRectangle((pkt), G_BG_COPY, (mptr))
#define gsSPBgRectCopy(mptr) gsSPBgRectangle( G_BG_COPY, (mptr))
#define gSPBgRect1Cyc(pkt, mptr) gSPBgRectangle((pkt), G_BG_1CYC, (mptr))
#define gsSPBgRect1Cyc(mptr) gsSPBgRectangle( G_BG_1CYC, (mptr))
/*---------------------------------------------------------------------------*
* 2D Objects
*---------------------------------------------------------------------------*/
#define gSPObjSprite(pkt, mptr) gDma0p((pkt),G_OBJ_SPRITE, (mptr),0)
#define gsSPObjSprite(mptr) gsDma0p( G_OBJ_SPRITE, (mptr),0)
#define gSPObjRectangle(pkt, mptr) gDma0p((pkt),G_OBJ_RECTANGLE, (mptr),0)
#define gsSPObjRectangle(mptr) gsDma0p( G_OBJ_RECTANGLE, (mptr),0)
#define gSPObjRectangleR(pkt, mptr) gDma0p((pkt),G_OBJ_RECTANGLE_R,(mptr),0)
#define gsSPObjRectangleR(mptr) gsDma0p( G_OBJ_RECTANGLE_R,(mptr),0)
/*---------------------------------------------------------------------------*
* 2D Matrix
*---------------------------------------------------------------------------*/
#define gSPObjMatrix(pkt, mptr) gDma1p((pkt),G_OBJ_MOVEMEM,(mptr),0,23)
#define gsSPObjMatrix(mptr) gsDma1p( G_OBJ_MOVEMEM,(mptr),0,23)
#define gSPObjSubMatrix(pkt, mptr) gDma1p((pkt),G_OBJ_MOVEMEM,(mptr),2, 7)
#define gsSPObjSubMatrix(mptr) gsDma1p( G_OBJ_MOVEMEM,(mptr),2, 7)
/*---------------------------------------------------------------------------*
* Loading into TMEM
*---------------------------------------------------------------------------*/
#define gSPObjLoadTxtr(pkt, tptr) gDma0p((pkt),G_OBJ_LOADTXTR, (tptr),23)
#define gsSPObjLoadTxtr(tptr) gsDma0p( G_OBJ_LOADTXTR, (tptr),23)
#define gSPObjLoadTxSprite(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_SPRITE,(tptr),47)
#define gsSPObjLoadTxSprite(tptr) gsDma0p( G_OBJ_LDTX_SPRITE,(tptr),47)
#define gSPObjLoadTxRect(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_RECT, (tptr),47)
#define gsSPObjLoadTxRect(tptr) gsDma0p( G_OBJ_LDTX_RECT, (tptr),47)
#define gSPObjLoadTxRectR(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_RECT_R,(tptr),47)
#define gsSPObjLoadTxRectR(tptr) gsDma0p( G_OBJ_LDTX_RECT_R,(tptr),47)
/*---------------------------------------------------------------------------*
* Select Display List
*---------------------------------------------------------------------------*/
#define gSPSelectDL(pkt, mptr, sid, flag, mask) \
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); }
#define gsSPSelectDL(mptr, sid, flag, mask) \
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); }
#define gSPSelectBranchDL(pkt, mptr, sid, flag, mask) \
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); }
#define gsSPSelectBranchDL(mptr, sid, flag, mask) \
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); }
/*---------------------------------------------------------------------------*
* Set general status
*---------------------------------------------------------------------------*/
#define G_MW_GENSTAT 0x08 /* Note that it is the same value of G_MW_FOG */
#define gSPSetStatus(pkt, sid, val) \
gMoveWd((pkt), G_MW_GENSTAT, (sid), (val))
#define gsSPSetStatus(sid, val) \
gsMoveWd( G_MW_GENSTAT, (sid), (val))
/*---------------------------------------------------------------------------*
* Set Object Render Mode
*---------------------------------------------------------------------------*/
#define G_OBJRM_NOTXCLAMP 0x01
#define G_OBJRM_XLU 0x02 /* Ignored */
#define G_OBJRM_ANTIALIAS 0x04 /* Ignored */
#define G_OBJRM_BILERP 0x08
#define G_OBJRM_SHRINKSIZE_1 0x10
#define G_OBJRM_SHRINKSIZE_2 0x20
#define G_OBJRM_WIDEN 0x40
#define gSPObjRenderMode(pkt, mode) gImmp1((pkt),G_OBJ_RENDERMODE,(mode))
#define gsSPObjRenderMode(mode) gsImmp1( G_OBJ_RENDERMODE,(mode))
/*===========================================================================*
* Render Mode Macro
*===========================================================================*/
#define RM_RA_SPRITE(clk) \
AA_EN | CVG_DST_CLAMP | \
CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define G_RM_SPRITE G_RM_OPA_SURF
#define G_RM_SPRITE2 G_RM_OPA_SURF2
#define G_RM_RA_SPRITE RM_RA_SPRITE(1)
#define G_RM_RA_SPRITE2 RM_RA_SPRITE(2)
#define G_RM_AA_SPRITE G_RM_AA_TEX_TERR
#define G_RM_AA_SPRITE2 G_RM_AA_TEX_TERR2
#define G_RM_XLU_SPRITE G_RM_XLU_SURF
#define G_RM_XLU_SPRITE2 G_RM_XLU_SURF2
#define G_RM_AA_XLU_SPRITE G_RM_AA_XLU_SURF
#define G_RM_AA_XLU_SPRITE2 G_RM_AA_XLU_SURF2
/*===========================================================================*
* External functions
*===========================================================================*/
extern u64 gspS2DEX_fifoTextStart[], gspS2DEX_fifoTextEnd[];
extern u64 gspS2DEX_fifoDataStart[], gspS2DEX_fifoDataEnd[];
extern u64 gspS2DEX_fifo_dTextStart[], gspS2DEX_fifo_dTextEnd[];
extern u64 gspS2DEX_fifo_dDataStart[], gspS2DEX_fifo_dDataEnd[];
extern u64 gspS2DEX2_fifoTextStart[], gspS2DEX2_fifoTextEnd[];
extern u64 gspS2DEX2_fifoDataStart[], gspS2DEX2_fifoDataEnd[];
extern u64 gspS2DEX2_xbusTextStart[], gspS2DEX2_xbusTextEnd[];
extern u64 gspS2DEX2_xbusDataStart[], gspS2DEX2_xbusDataEnd[];
extern void guS2DInitBg(uObjBg *);
#ifdef F3DEX_GBI_2
# define guS2DEmuBgRect1Cyc guS2D2EmuBgRect1Cyc /*Wrapper*/
# define guS2DEmuSetScissor guS2D2EmuSetScissor /*Wrapper*/
extern void guS2D2EmuSetScissor(u32, u32, u32, u32, u8);
extern void guS2D2EmuBgRect1Cyc(Gfx **, uObjBg *);
#else
extern void guS2DEmuSetScissor(u32, u32, u32, u32, u8);
extern void guS2DEmuBgRect1Cyc(Gfx **, uObjBg *);
#endif
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* _GS2DEX_H_ */
/*======== End of gs2dex.h ========*/

365
include/2.0L/PR/gt.h Normal file
View File

@@ -0,0 +1,365 @@
/*
* Copyright 1995, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
*
* UNPUBLISHED -- Rights reserved under the copyright laws of the United
* States. Use of a copyright notice is precautionary only and does not
* imply publication or disclosure.
*
* U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
* in similar or successor clauses in the FAR, or the DOD or NASA FAR
* Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
* 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
*
* THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
* INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
* DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
* PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
* GRAPHICS, INC.
*
*/
/*
* File: gt.h
* Creator: hsa@sgi.com
* Create Date: Thu Oct 12 15:48:14 PDT 1995
*
* This file defines the GBI for the TURBO 3D graphics microcode.
* The turbo microcode is a special FEATURE-LIMITED microcode designed
* for specific applications. It is not for general use.
*
* (see XXX for more information)
*
*/
/**************************************************************************
*
* $Revision: 1.16 $
* $Date: 1998/05/28 00:14:50 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/gt.h,v $
*
**************************************************************************/
#ifndef _GT_H_
#define _GT_H_
/* this file should be #included AFTER gbi.h */
#include "sptask.h"
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif /* _LANGUAGE_C_PLUS_PLUS */
#include <PR/ultratypes.h>
/* the following #defines seem out of order, but we need them
* for the microcode.
*/
/*
* object state field: rendState
*
* This flag word is built up out of the bits from a
* subset of the G_SETGEOMETRYMODE flags from gbi.h.
*
* When each of these bits is '1', the comments below explain
* the effect on the triangles.
*/
#define GT_ZBUFFER G_ZBUFFER
#define GT_TEXTURE G_TEXTURE_ENABLE /* texture ON */
#define GT_CULL_BACK G_CULL_BACK /* reject backfaces */
#define GT_SHADING_SMOOTH G_SHADING_SMOOTH /* smooth shade ON */
/*
* object state field: textureState
*
* The lower 3 bits of this flag word contain the texture tile number
* to be used. All triangles of an object are rendered with the same
* texture tile.
*/
/*
* object state field: flag
*
* This is a group of what would be pad bits. We use them for some
* flag bits.
*/
#define GT_FLAG_NOMTX 0x01 /* don't load the matrix */
#define GT_FLAG_NO_XFM 0x02 /* load vtx, use verbatim */
#define GT_FLAG_XFM_ONLY 0x04 /* xform vtx, write to *TriN */
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* turbo 3D ucode: */
extern long long int gspTurbo3DTextStart[], gspTurbo3DTextEnd[];
extern long long int gspTurbo3DDataStart[], gspTurbo3DDataEnd[];
extern long long int gspTurbo3D_dramTextStart[], gspTurbo3D_dramTextEnd[];
extern long long int gspTurbo3D_dramDataStart[], gspTurbo3D_dramDataEnd[];
extern long long int gspTurbo3D_fifoTextStart[], gspTurbo3D_fifoTextEnd[];
extern long long int gspTurbo3D_fifoDataStart[], gspTurbo3D_fifoDataEnd[];
/*
* This is the global state structure. It's definition carefully
* matches the ucode, so if this structure changes, you must also change
* the ucode.
*/
typedef struct {
u16 perspNorm; /* persp normalization */
u16 pad0;
u32 flag;
Gfx rdpOthermode;
u32 segBases[16]; /* table of segment base addrs (SEE NOTE!) */
Vp viewport; /* the viewport to use */
Gfx *rdpCmds; /* block of RDP data, process if !NULL
* block terminated by gDPEndDisplayList()
* (This is a segment address)
*/
} gtGlobState_t;
/* NOTE:
* Although there are 16 segment table entries, the first one (segment 0)
* is reserved for physical memory mapping. You should not segment 0
* to anything other than 0x0.
*/
typedef union {
gtGlobState_t sp;
long long int force_structure_alignment;
} gtGlobState;
/*
* This is the 'state' structure associated with each object
* to be rendered. It's definition carefully matches the
* ucode, so if this structure changes, you must also change
* the gtoff.c tool and the ucode.
*/
typedef struct {
u32 renderState; /* render state */
u32 textureState; /* texture state */
u8 vtxCount; /* how many verts? */
u8 vtxV0; /* where to load verts? */
u8 triCount; /* how many tris? */
u8 flag;
Gfx *rdpCmds; /* ptr (segment address) to RDP DL */
Gfx rdpOthermode;
Mtx transform; /* the transform matrix to use */
} gtState_t;
typedef union {
gtState_t sp;
long long int force_structure_alignment;
} gtState;
/* gtStateLite : same as gtState, but no matrix (see flags below) */
/* this structure must be identical to gtState! (bad) */
typedef struct {
u32 renderState; /* render state */
u32 textureState; /* texture state */
u8 vtxCount; /* how many verts? */
u8 vtxV0; /* where to load verts? */
u8 triCount; /* how many tris? */
u8 flag;
Gfx *rdpCmds; /* ptr (segment address) to RDP DL */
Gfx rdpOthermode;
} gtStateL_t;
typedef union {
gtStateL_t sp;
long long int force_structure_alignment;
} gtStateL;
/*
* The vertex list for the turbo display list uses the
* Vtx struct in gbi.h
*
*/
/*
* This structure represents a single triangle, part of the
* triangle list of the object to be rendered.
*
* NOTE: The triangle list MUST be aligned to an 8-byte boundary.
* Since this structure is only 4 bytes, we are REQUIRING that
* this structure only be used as an array of triangles, and we
* depend on the MIPS C compiler (which always aligns arrays to
* 8-byte boundaries). THIS IS DANGEROUS!!!!
*
*/
typedef struct {
u8 v0, v1, v2, flag; /* flag is which one for flat shade */
} gtTriN;
/*
* This structure represents the transformed points. It is the format
* of the points written out when GT_FLAG_XFM_ONLY is set, as well as
* the format expected when GT_FLAG_NO_XFM is used.
*
* NOTE: The size and layout of these points is very similar to Vtx,
* except the screen coordinates overwrite the x,y,z,pad fields.
* (we could consider adding to the Vtx union, but we want to keep
* turbo stuff out of gbi.h)
*
* NOTE: The z is a special format. It can be used to compare vertices
* for sorting, but it should not be used for other purposes. If modified,
* the z-buffer hardware might not understand the data.
*
*/
typedef struct {
short int xscrn; /* x,y screen coordinates are SSSS10.2 */
short int yscrn;
int zscrn; /* z screen is S15.16 */
short int s; /* transformed texture coord, S10.5 */
short int t;
u8 r; /* color (or normal) */
u8 g;
u8 b;
u8 a;
} gtVtxOut_t;
/* see "Data Structure" comment in gbi.h for information about why
* we use this union.
*/
typedef union {
gtVtxOut_t v;
long long int force_structure_alignment;
} gtVtxOut;
/*
* state field: rdpOthermode
*
* This is one of the trickier state fields. The turbo interface
* requires the RDP othermode command to be cached by the host,
* therefore we provide a different interface in libultra to help cache
* this in the gt state (this word is just bits, you could pack them
* on your own).
*
* gtStateSetOthermode() accomplishs this, taking as arguments
* the state, one of the following mode enums, and a piece of data
* (othermode parameters from gbi.h).
*
* By definition, the othermode word from the gt state structure is sent
* to the RDP *before* any RDP commands from the rdpCmds[] field. The
* othermode is *always* sent.
*
* Stated another way, NONE of the gbi RDP othermode commands equivalent
* to those listed here are allowed in the rdpCmd[] field of the
* gt state structure.
*
* Notice also that many of these commands do not make sense for
* the turbo ucode (they control features not supported, like mip-mapping).
* They are only included here for completeness.
*
*/
typedef enum {
GT_CLEAR, /* special gt mode, clears othermode state */
GT_ALPHACOMPARE,
GT_ZSRCSEL,
GT_RENDERMODE,
GT_ALPHADITHER,
GT_RGBDITHER,
GT_COMBKEY,
GT_TEXTCONV,
GT_TEXTFILT,
GT_TEXTLUT,
GT_TEXTLOD,
GT_TEXTDETAIL,
GT_TEXTPERSP,
GT_CYCLETYPE,
GT_PIPELINE
} gtStateOthermode_t;
/*
* This call builds up an othermode command word. The 'mode' is one of
* the above modes, the 'data' field comes from gbi.h, it is the data
* field for the equivalent gbi setothermode macro.
*/
extern void gtStateSetOthermode(Gfx *om, gtStateOthermode_t mode, int data);
/*
* This call dumps a turbo display list for use with gbi2mem and RSPSIM
*/
#define GT_DUMPTURBO_HANGAFTER 64
#define GT_DUMPTURBO_NOTEXTURES 128
extern void gtDumpTurbo(OSTask *tp,u8 flags);
/*
* Special macros to init othermode words to all 0's, a good default
* value.
*/
#define gDPClearOtherMode(pkt) \
{ \
Gfx *_g = (Gfx *)(pkt); \
\
_g->words.w0 = _SHIFTL(G_RDPSETOTHERMODE, 24, 8); \
_g->words.w1 = 0x0; \
}
#define gsDPClearOtherMode() \
{ \
_SHIFTL(G_RDPSETOTHERMODE, 24, 8), 0x0 \
}
/*
* Special macros to end DP blocks (see above). These commands
* generate all 0's, which the turbo ucode looks for. They *aren't*
* real DP commands!
*/
#define gDPEndDisplayList(pkt) gSPNoOp(pkt)
#define gsDPEndDisplayList() gsSPNoOp()
/*
* This structure is a turbo 'object', the turbo display list is
* simply a list of these.
*
* NOTE: All pointers are segment addresses
*
* NOTE: If (statep->flag & GT_FLAG_XFM_ONLY), the trip field is
* interpreted as a pointer to gtVtxOut[] that can be used to store
* the transformed points. (statep->triCount should be 0, else bad
* things could happen...)
*
* NOTE: If (statep->flag & GT_FLAG_NO_XFM), the vtxp field is
* interpreted as a pointer to gtVtxOut[] that can be used to load
* pre-transformed points.
*
*/
typedef struct {
gtGlobState *gstatep; /* global state, usually NULL */
gtState *statep; /* if this is NULL, end object processing */
Vtx *vtxp; /* if this is NULL, use points in buffer */
gtTriN *trip; /* if this is NULL, use tris in buffer */
} gtGfx_t;
typedef union {
gtGfx_t obj;
long long int force_structure_alignment;
} gtGfx;
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_ASSEMBLY
#include <PR/gtoff.h>
#endif /* _LANGUAGE_ASSEMBLY */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif /* _LANGUAGE_C_PLUS_PLUS */
#ifdef _LANGUAGE_MAKEROM
#endif /* _LANGUAGE_MAKEROM */
#endif /* _GT_H_ */

269
include/2.0L/PR/gu.h Normal file
View File

@@ -0,0 +1,269 @@
#ifndef _GU_H_
#define _GU_H_
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.48 $
* $Date: 1999/07/13 08:00:20 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/gu.h,v $
*
**************************************************************************/
#include <PR/mbi.h>
#include <PR/ultratypes.h>
#include <PR/sptask.h>
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
#define M_PI 3.14159265358979323846
#define M_DTOR (3.14159265358979323846/180.0)
#define FTOFIX32(x) (long)((x) * (float)0x00010000)
#define FIX32TOF(x) ((float)(x) * (1.0f / (float)0x00010000))
#define FTOFRAC8(x) ((int) MIN(((x) * (128.0f)), 127.0f) & 0xff)
#define FILTER_WRAP 0
#define FILTER_CLAMP 1
#define RAND(x) (guRandom()%x) /* random number between 0 to x */
/*
* Data Structures
*/
typedef struct {
unsigned char *base;
int fmt, siz;
int xsize, ysize;
int lsize;
/* current tile info */
int addr;
int w, h;
int s, t;
} Image;
typedef struct {
float col[3];
float pos[3];
float a1, a2; /* actual color = col/(a1*dist + a2) */
} PositionalLight;
/*
* Function Prototypes
*/
extern int guLoadTextureBlockMipMap(Gfx **glist, unsigned char *tbuf, Image *im,
unsigned char startTile, unsigned char pal, unsigned char cms,
unsigned char cmt, unsigned char masks, unsigned char maskt,
unsigned char shifts, unsigned char shiftt, unsigned char cfs,
unsigned char cft);
extern int guGetDPLoadTextureTileSz (int ult, int lrt);
extern void guDPLoadTextureTile (Gfx *glistp, void *timg,
int texl_fmt, int texl_size,
int img_width, int img_height,
int uls, int ult, int lrs, int lrt,
int palette,
int cms, int cmt,
int masks, int maskt,
int shifts, int shiftt);
/*
* matrix operations:
*
* The 'F' version is floating point, in case the application wants
* to do matrix manipulations and convert to fixed-point at the last
* minute.
*/
extern void guMtxIdent(Mtx *m);
extern void guMtxIdentF(float mf[4][4]);
extern void guOrtho(Mtx *m, float l, float r, float b, float t,
float n, float f, float scale);
extern void guOrthoF(float mf[4][4], float l, float r, float b, float t,
float n, float f, float scale);
extern void guFrustum(Mtx *m, float l, float r, float b, float t,
float n, float f, float scale);
extern void guFrustumF(float mf[4][4], float l, float r, float b, float t,
float n, float f, float scale);
extern void guPerspective(Mtx *m, u16 *perspNorm, float fovy,
float aspect, float near, float far, float scale);
extern void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy,
float aspect, float near, float far, float scale);
extern void guLookAt(Mtx *m,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
extern void guLookAtF(float mf[4][4], float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
extern void guLookAtReflect(Mtx *m, LookAt *l,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
extern void guLookAtReflectF(float mf[4][4], LookAt *l,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
extern void guLookAtHilite(Mtx *m, LookAt *l, Hilite *h,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp,
float xl1, float yl1, float zl1,
float xl2, float yl2, float zl2,
int twidth, int theight);
extern void guLookAtHiliteF(float mf[4][4], LookAt *l, Hilite *h,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp,
float xl1, float yl1, float zl1,
float xl2, float yl2, float zl2,
int twidth, int theight);
extern void guLookAtStereo(Mtx *m,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp,
float eyedist);
extern void guLookAtStereoF(float mf[4][4],
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp,
float eyedist);
extern void guRotate(Mtx *m, float a, float x, float y, float z);
extern void guRotateF(float mf[4][4], float a, float x, float y, float z);
extern void guRotateRPY(Mtx *m, float r, float p, float y);
extern void guRotateRPYF(float mf[4][4], float r, float p, float h);
extern void guAlign(Mtx *m, float a, float x, float y, float z);
extern void guAlignF(float mf[4][4], float a, float x, float y, float z);
extern void guScale(Mtx *m, float x, float y, float z);
extern void guScaleF(float mf[4][4], float x, float y, float z);
extern void guTranslate(Mtx *m, float x, float y, float z);
extern void guTranslateF(float mf[4][4], float x, float y, float z);
extern void guPosition(Mtx *m, float r, float p, float h, float s,
float x, float y, float z);
extern void guPositionF(float mf[4][4], float r, float p, float h, float s,
float x, float y, float z);
extern void guMtxF2L(float mf[4][4], Mtx *m);
extern void guMtxL2F(float mf[4][4], Mtx *m);
extern void guMtxCatF(float m[4][4], float n[4][4], float r[4][4]);
extern void guMtxCatL(Mtx *m, Mtx *n, Mtx *res);
extern void guMtxXFMF(float mf[4][4], float x, float y, float z,
float *ox, float *oy, float *oz);
extern void guMtxXFML(Mtx *m, float x, float y, float z,
float *ox, float *oy, float *oz);
/* vector utility: */
extern void guNormalize(float *x, float *y, float *z);
/* light utilities: */
void guPosLight(PositionalLight *pl, Light *l,
float xOb, float yOb, float zOb);
void guPosLightHilite(PositionalLight *pl1, PositionalLight *pl2,
Light *l1, Light *l2,
LookAt *l, Hilite *h,
float xEye, float yEye, float zEye,
float xOb, float yOb, float zOb,
float xUp, float yUp, float zUp,
int twidth, int theight);
extern int guRandom(void);
/*
* Math functions
*/
extern float sinf(float angle);
extern float cosf(float angle);
extern signed short sins (unsigned short angle);
extern signed short coss (unsigned short angle);
extern float sqrtf(float value);
#ifdef __sgi
#pragma intrinsic(sqrtf);
#endif
/*
* Dump routines for low-level display lists
*/
/* flag values for guParseRdpDL() */
#define GU_PARSERDP_VERBOSE 1
#define GU_PARSERDP_PRAREA 2
#define GU_PARSERDP_PRHISTO 4
#define GU_PARSERDP_DUMPONLY 32 /* doesn't need to be same as */
/* GU_PARSEGBI_DUMPOLNY, but this */
/* allows app to use interchangeably */
extern void guParseRdpDL(u64 *rdp_dl, u64 nbytes, u8 flags);
extern void guParseString(char *StringPointer, u64 nbytes);
/*
* NO LONGER SUPPORTED,
* use guParseRdpDL with GU_PARSERDP_DUMPONLY flags
*/
/* extern void guDumpRawRdpDL(u64 *rdp_dl, u64 nbytes); */
/* flag values for guBlinkRdpDL() */
#define GU_BLINKRDP_HILITE 1
#define GU_BLINKRDP_EXTRACT 2
extern void
guBlinkRdpDL(u64 *rdp_dl_in, u64 nbytes_in,
u64 *rdp_dl_out, u64 *nbytes_out,
u32 x, u32 y, u32 radius,
u8 red, u8 green, u8 blue,
u8 flags);
/* flag values for guParseGbiDL() */
#define GU_PARSEGBI_ROWMAJOR 1
#define GU_PARSEGBI_NONEST 2
#define GU_PARSEGBI_FLTMTX 4
#define GU_PARSEGBI_SHOWDMA 8
#define GU_PARSEGBI_ALLMTX 16
#define GU_PARSEGBI_DUMPONLY 32
/*
#define GU_PARSEGBI_HANGAFTER 64
#define GU_PARSEGBI_NOTEXTURES 128
*/
extern void guParseGbiDL(u64 *gbi_dl, u32 nbytes, u8 flags);
extern void guDumpGbiDL(OSTask *tp,u8 flags);
#define GU_PARSE_GBI_TYPE 1
#define GU_PARSE_RDP_TYPE 2
#define GU_PARSE_READY 3
#define GU_PARSE_MEM_BLOCK 4
#define GU_PARSE_ABI_TYPE 5
#define GU_PARSE_STRING_TYPE 6
typedef struct {
int dataSize;
int dlType;
int flags;
u32 paddr;
} guDLPrintCB;
void guSprite2DInit(uSprite *SpritePointer,
void *SourceImagePointer,
void *TlutPointer,
int Stride,
int SubImageWidth,
int SubImageHeight,
int SourceImageType,
int SourceImageBitSize,
int SourceImageOffsetS,
int SourceImageOffsetT);
#endif /* !_GU_H_ */

280
include/2.0L/PR/leo.h Normal file
View File

@@ -0,0 +1,280 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.
$RCSfile: leo.h,v $
$Revision: 1.29 $
$Date: 1998/12/21 07:30:15 $
*---------------------------------------------------------------------*/
#ifndef _LEO_H_
#define _LEO_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#include <PR/leoappli.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
typedef u32 LEOError;
typedef u8 LEOSpdlMode;
typedef u8 LEOStatus;
typedef struct
{
u8 drive; /* version of hw */
u8 driver; /* version of sw */
u8 deviceType; /* dev type, always 00 */
u8 ndevices; /* # of devices, always 01 */
} LEOVersion;
typedef struct
{
u32 startLBA;
u32 endLBA;
u32 nbytes;
} LEOCapacity;
typedef struct
{
u8 pad;
u8 yearhi;
u8 yearlo;
u8 month;
u8 day;
u8 hour;
u8 minute;
u8 second;
} LEODiskTime;
typedef struct
{
u64 lineNumber;
LEODiskTime time;
} LEOSerialNum;
typedef struct
{
u8 gameName[4];
u8 gameVersion;
u8 diskNumber;
u8 ramUsage;
u8 diskUsage;
LEOSerialNum serialNumber;
u8 company[2];
u8 freeArea[6];
} LEODiskID;
typedef struct
{
LEOCmdHeader header;
union
{
struct
{
u32 lba;
u32 xfer_blks;
void *buff_ptr;
u32 rw_bytes;
#ifdef _LONGCMD
u32 size;
#endif
} readwrite;
struct
{
u32 lba;
} seek;
struct
{
void *buffer_pointer;
} readdiskid;
LEODiskTime time;
struct
{
u8 reserve1;
u8 reserve2;
u8 standby_time;
u8 sleep_time;
u32 reserve3;
} modeselect;
} data;
} LEOCmd;
#define _nbytes readwrite.rw_bytes
#define _result header.status
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
#define LEO_SW_VERSION 6 /* This will be returned by */
/* LeoInquiry command */
#define OS_PRIORITY_LEOMGR OS_PRIORITY_PIMGR
/*
* Drive Rom offset address
*/
#define DDROM_FONT_START 0x000a0000
#define DDROM_WAVEDATA_START 0x00140000
/*
* Definition for osLeoSpdlMotor()
*/
#define ACTIVE 0
#define STANDBY 1
#define SLEEP 2
#define BRAKE 4
#define LEO_MOTOR_ACTIVE 0
#define LEO_MOTOR_STANDBY 1
#define LEO_MOTOR_SLEEP 2
#define LEO_MOTOR_BRAKE 4
#define NUM_LBAS 4292 /* total number of LBAs */
#define BLK_SIZE_ZONE0 19720
#define BLK_SIZE_ZONE1 18360
#define BLK_SIZE_ZONE2 17680
#define BLK_SIZE_ZONE3 16320
#define BLK_SIZE_ZONE4 14960
#define BLK_SIZE_ZONE5 13600
#define BLK_SIZE_ZONE6 12240
#define BLK_SIZE_ZONE7 10880
#define BLK_SIZE_ZONE8 9520
#define MAX_BLK_SIZE BLK_SIZE_ZONE0
#define MIN_BLK_SIZE BLK_SIZE_ZONE8
/*
* Error codes
*/
#define LEO_ERROR_GOOD 0
#define LEO_ERROR_DRIVE_NOT_READY 1
#define LEO_ERROR_DIAGNOSTIC_FAILURE 2
#define LEO_ERROR_COMMAND_PHASE_ERROR 3
#define LEO_ERROR_DATA_PHASE_ERROR 4
#define LEO_ERROR_REAL_TIME_CLOCK_FAILURE 5
#define LEO_ERROR_BUSY 8
#define LEO_ERROR_INCOMPATIBLE_MEDIUM_INSTALLED 11
#define LEO_ERROR_UNKNOWN_FORMAT 11
#define LEO_ERROR_NO_SEEK_COMPLETE 21
#define LEO_ERROR_WRITE_FAULT 22
#define LEO_ERROR_UNRECOVERED_READ_ERROR 23
#define LEO_ERROR_NO_REFERENCE_POSITION_FOUND 24
#define LEO_ERROR_TRACK_FOLLOWING_ERROR 25
#define LEO_ERROR_TRACKING_OR_SPDL_SERVO_FAILURE 25
#define LEO_ERROR_INVALID_COMMAND_OPERATION_CODE 31
#define LEO_ERROR_LBA_OUT_OF_RANGE 32
#define LEO_ERROR_WRITE_PROTECT_ERROR 33
#define LEO_ERROR_COMMAND_CLEARED_BY_HOST 34
#define LEO_ERROR_COMMAND_TERMINATED 34
#define LEO_ERROR_QUEUE_FULL 35
#define LEO_ERROR_ILLEGAL_TIMER_VALUE 36
#define LEO_ERROR_WAITING_NMI 37
#define LEO_ERROR_DEVICE_COMMUNICATION_FAILURE 41
#define LEO_ERROR_MEDIUM_NOT_PRESENT 42
#define LEO_ERROR_POWERONRESET_DEVICERESET_OCCURED 43
#define LEO_ERROR_RAMPACK_NOT_CONNECTED 44
#define LEO_ERROR_MEDIUM_MAY_HAVE_CHANGED 47
#define LEO_ERROR_EJECTED_ILLEGALLY_RESUME 49
/*
* Reserved
*/
#define LEO_ERROR_NOT_BOOTED_DISK 45
#define LEO_ERROR_DIDNOT_CHANGED_DISK_AS_EXPECTED 46
/*
* Error codes only used in IPL
*/
#define LEO_ERROR_RTC_NOT_SET_CORRECTLY 48
#define LEO_ERROR_DIAGNOSTIC_FAILURE_RESET 50
#define LEO_ERROR_EJECTED_ILLEGALLY_RESET 51
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
#define GET_ERROR(x) ((x).header.sense)
/**************************************************************************
*
* Extern variables
*
*/
extern LEODiskID leoBootID;
extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Initialize routine */
extern s32 LeoCreateLeoManager(OSPri comPri, OSPri intPri,
OSMesg *cmdBuf, s32 cmdMsgCnt);
extern s32 LeoCJCreateLeoManager(OSPri comPri, OSPri intPri,
OSMesg *cmdBuf, s32 cmdMsgCnt);
extern s32 LeoCACreateLeoManager(OSPri comPri, OSPri intPri,
OSMesg *cmdBuf, s32 cmdMsgCnt);
extern u32 LeoDriveExist(void);
/* Synchronous functions */
extern s32 LeoClearQueue(void);
extern s32 LeoByteToLBA(s32 startLBA, u32 nbytes, s32 *lbas);
extern s32 LeoLBAToByte(s32 startLBA, u32 nLBAs, s32 *bytes);
extern s32 LeoReadCapacity(LEOCapacity *cap, s32 dir);
extern s32 LeoInquiry(LEOVersion *ver);
extern s32 LeoTestUnitReady(LEOStatus *status);
/* Asynchronous functions */
extern s32 LeoSpdlMotor(LEOCmd *cmdBlock, LEOSpdlMode mode, OSMesgQueue *mq);
extern s32 LeoSeek(LEOCmd *cmdBlock, u32 lba, OSMesgQueue *mq);
extern s32 LeoRezero(LEOCmd *cmdBlock, OSMesgQueue *mq);
extern s32 LeoReadWrite(LEOCmd *cmdBlock, s32 direction,
u32 LBA, void *vAddr, u32 nLBAs, OSMesgQueue *mq);
extern s32 LeoReadDiskID(LEOCmd *cmdBlock, LEODiskID *vaddr, OSMesgQueue *mq);
extern s32 LeoSetRTC(LEOCmd *cmdBlock, LEODiskTime *RTCdata, OSMesgQueue *mq);
extern s32 LeoReadRTC(LEOCmd *cmdBlock, OSMesgQueue *mq);
extern s32 LeoModeSelectAsync(LEOCmd *cmdBlock, u32 standby,
u32 sleep, OSMesgQueue *mq);
/* Font routines */
extern int LeoGetKAdr(int sjis);
extern int LeoGetAAdr(int code,int *dx,int *dy, int *cy);
extern int LeoGetAAdr2(u32 ccode,int *dx,int *dy, int *cy);
/* Boot function */
extern void LeoBootGame(void *entry);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_LEO_H */

274
include/2.0L/PR/leoappli.h Normal file
View File

@@ -0,0 +1,274 @@
/*
* F i l e N a m e : l e o a p p l i . h
*
****************************************************************************
* (C) Copyright ALPS Electric Co., Ltd. 1995-1997
****************************************************************************
* Version
*
* ver Date
* ---- --------
* 1.01 '97-11-18 Add MOTOR BRAKE definition for control bit.
****************************************************************************
*/
/*-----------------------------------*/
/* DRIVE PARAMETER */
/*-----------------------------------*/
#define LEO_DISK_TYPE_MIN 0
#define LEO_DISK_TYPE_MAX 6
#define LEO_LBA_MIN 0
#define LEO_LBA_MAX 4291
#define LEO_LBA_ROM_TOP LEO_LBA_MIN
#define LEO_LBA_ROM_END0 1417
#define LEO_LBA_ROM_END1 1965
#define LEO_LBA_ROM_END2 2513
#define LEO_LBA_ROM_END3 3061
#define LEO_LBA_ROM_END4 3609
#define LEO_LBA_ROM_END5 4087
#define LEO_LBA_ROM_END6 LEO_LBA_MAX
#define LEO_LBA_RAM_TOP0 (LEO_LBA_ROM_END0+1)
#define LEO_LBA_RAM_TOP1 (LEO_LBA_ROM_END1+1)
#define LEO_LBA_RAM_TOP2 (LEO_LBA_ROM_END2+1)
#define LEO_LBA_RAM_TOP3 (LEO_LBA_ROM_END3+1)
#define LEO_LBA_RAM_TOP4 (LEO_LBA_ROM_END4+1)
#define LEO_LBA_RAM_TOP5 (LEO_LBA_ROM_END5+1)
#define LEO_LBA_RAM_TOP6 (LEO_LBA_ROM_END6+1)
#define LEO_LBA_RAM_END6 LEO_LBA_MAX
/*-----------------------------------*/
/* LEO FUNCTION DEFINITIONS */
/*-----------------------------------*/
extern void leoInitialize(OSPri PRI_WRK, OSPri PRI_INT, OSMesg *command_que_buf, u32 cmd_buff_size);
extern void leoCommand(void *CDB);
extern void LeoReset(void);
extern s32 LeoResetClear(void);
/*-----------------------------------*/
/* THREAD PRIORITY */
/*-----------------------------------*/
#define LEO_PRIORITY_WRK (OS_PRIORITY_PIMGR-1)
#define LEO_PRIORITY_INT OS_PRIORITY_PIMGR
/*-----------------------------------*/
/* COMMAND CODE */
/*-----------------------------------*/
#define LEO_COMMAND_CLEAR_QUE 0x01
#define LEO_COMMAND_INQUIRY 0x02
#define LEO_COMMAND_TEST_UNIT_READY 0x03
#define LEO_COMMAND_REZERO 0x04
#define LEO_COMMAND_READ 0x05
#define LEO_COMMAND_WRITE 0x06
#define LEO_COMMAND_SEEK 0x07
#define LEO_COMMAND_START_STOP 0x08
#define LEO_COMMAND_READ_CAPACITY 0x09
#define LEO_COMMAND_TRANSLATE 0x0a
#define LEO_COMMAND_MODE_SELECT 0x0b
#define LEO_COMMAND_READ_DISK_ID 0x0c
#define LEO_COMMAND_READ_TIMER 0x0d
#define LEO_COMMAND_SET_TIMER 0x0e
/*-----------------------------------*/
/* CONTROL BIT */
/*-----------------------------------*/
#define LEO_CONTROL_POST 0x80 /* ENABLE POST QUEUE */
#define LEO_CONTROL_START 0x01 /* START COMMAND */
#define LEO_CONTROL_STBY 0x02 /* STAND-BY MODE(NOT SLEEP MODE) */
#define LEO_CONTROL_WRT 0x01 /* READ RE-WRITE-ABLE CAPACITY */
#define LEO_CONTROL_TBL 0x01 /* TRANSLATE BYTE TO LBA */
#define LEO_CONTROL_BRAKE 0x04 /* SLEEP MODE(BRAKE ON) */
/*-----------------------------------*/
/* BIT FIELD PARAMETER */
/*-----------------------------------*/
#define LEO_TEST_UNIT_MR 0x01 /* MEDIUM REMOVED */
#define LEO_TEST_UNIT_RE 0x02 /* HEAD RETRACTED */
#define LEO_TEST_UNIT_SS 0x04 /* SPINDLE STOPPED */
/*-----------------------------------*/
/* STATUS */
/*-----------------------------------*/
#define LEO_STATUS_GOOD 0x00
#define LEO_STATUS_CHECK_CONDITION 0x02
#define LEO_STATUS_BUSY 0x08
/*-----------------------------------*/
/* SENSE CODE */
/*-----------------------------------*/
#define LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION 00
#define LEO_SENSE_DRIVE_NOT_READY 01
#define LEO_SENSE_DIAGNOSTIC_FAILURE 02
#define LEO_SENSE_COMMAND_PHASE_ERROR 03
#define LEO_SENSE_DATA_PHASE_ERROR 04
#define LEO_SENSE_REAL_TIME_CLOCK_FAILURE 05
#define LEO_SENSE_INCOMPATIBLE_MEDIUM_INSTALLED 11
#define LEO_SENSE_UNKNOWN_FORMAT 11
#define LEO_SENSE_NO_SEEK_COMPLETE 21
#define LEO_SENSE_WRITE_FAULT 22
#define LEO_SENSE_UNRECOVERED_READ_ERROR 23
#define LEO_SENSE_NO_REFERENCE_POSITION_FOUND 24
#define LEO_SENSE_TRACK_FOLLOWING_ERROR 25
#define LEO_SENSE_TRACKING_OR_SPDL_SERVO_FAILURE 25
#define LEO_SENSE_INVALID_COMMAND_OPERATION_CODE 31
#define LEO_SENSE_LBA_OUT_OF_RANGE 32
#define LEO_SENSE_WRITE_PROTECT_ERROR 33
#define LEO_SENSE_COMMAND_TERMINATED 34
#define LEO_SENSE_QUEUE_FULL 35
#define LEO_SENSE_ILLEGAL_TIMER_VALUE 36
#define LEO_SENSE_WAITING_NMI 37
#define LEO_SENSE_DEVICE_COMMUNICATION_FAILURE 41
#define LEO_SENSE_MEDIUM_NOT_PRESENT 42
#define LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED 43
#define LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED 47
#define LEO_SENSE_EJECTED_ILLEGALLY_RESUME 49
/*-----------------------------------*/
/* Command Block Header */
/*-----------------------------------*/
typedef struct{
u8 command;
u8 reserve1;
u8 control;
u8 reserve3;
u8 status;
u8 sense;
u8 reserve6;
u8 reserve7;
OSMesgQueue *post;
} LEOCmdHeader;
/*-----------------------------------*/
/* CLEAR QUEUE(01H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
} LEOCmdClearQue;
/*-----------------------------------*/
/* INQUIRY(02H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u8 dev_type;
u8 version;
u8 dev_num;
u8 leo_bios_ver;
u32 reserve5;
} LEOCmdInquiry;
/*-----------------------------------*/
/* TEST UNIT READY(03H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u8 test;
u8 reserve2;
u8 reserve3;
u8 reserve4;
} LEOCmdTestUnitReady;
/*-----------------------------------*/
/* REZERO(04H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
} LEOCmdRezero;
/*-----------------------------------*/
/* READ(05H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u32 lba;
u32 xfer_blks;
void *buff_ptr;
u32 rw_bytes;
} LEOCmdRead;
/*-----------------------------------*/
/* WRITE(06H) command */
/*-----------------------------------*/
typedef LEOCmdRead LEOCmdWrite;
/*-----------------------------------*/
/* SEEK(07H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u32 lba;
} LEOCmdSeek;
/*-----------------------------------*/
/* START/STOP(08H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
} LEOCmdStartStop;
/*-----------------------------------*/
/* READ CAPACITY(09H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u32 start_lba;
u32 end_lba;
u32 capa_bytes;
} LEOCmdReadCapacity;
/*-----------------------------------*/
/* TRANSLATE(0AH) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u32 start_lba;
u32 in_param;
u32 out_param;
} LEOCmdTranslate;
/*-----------------------------------*/
/* MODE SELECT(0BH) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u8 page_code;
u8 reserve1;
u8 standby_time;
u8 sleep_time;
u8 led_on_time;
u8 led_off_time;
u8 reserve18;
u8 reserve19;
} LEOCmdModeSelect;
/*-----------------------------------*/
/* READ DISK ID(0CH) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
void *buffer_pointer;
} LEOCmdReadDiskId;
/*-----------------------------------*/
/* READ TIMER(0DH) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u8 reserve12;
u8 reserve13;
u8 year;
u8 month;
u8 day;
u8 hour;
u8 minute;
u8 second;
} LEOCmdReadTimer;
/*-----------------------------------*/
/* SET TIMER(0EH) command */
/*-----------------------------------*/
typedef LEOCmdReadTimer LEOCmdSetTimer;
/*-------end of leoappli.h--------------------------*/

972
include/2.0L/PR/libaudio.h Normal file
View File

@@ -0,0 +1,972 @@
/*====================================================================
* libaudio.h
*
* Copyright 1993, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
/**************************************************************************
*
* $Revision: 1.173 $
* $Date: 1997/12/01 12:42:21 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/libaudio.h,v $
*
**************************************************************************/
#ifndef __LIB_AUDIO__
#define __LIB_AUDIO__
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#include <PR/mbi.h>
/***********************************************************************
* misc defines
***********************************************************************/
#ifndef _EMULATOR
# ifdef AUD_PROFILE
#define PROFILE_AUD(num, cnt, max, min) \
{ \
u32 currCnt = osGetCount(); \
currCnt -= lastCnt[cnt_index]; \
cnt_index--; \
cnt += currCnt; \
num++; \
\
if ( currCnt > max ) max = currCnt; \
if ( currCnt < min ) min = currCnt; \
}
# endif /* AUD_PROFILE */
#endif /* EMULATOR */
#ifndef NULL
#define NULL 0
#endif
#define AL_FX_BUFFER_SIZE 8192
#define AL_FRAME_INIT -1
#define AL_USEC_PER_FRAME 16000
#define AL_MAX_PRIORITY 127
#define AL_GAIN_CHANGE_TIME 1000
typedef s32 ALMicroTime;
typedef u8 ALPan;
#define AL_PAN_CENTER 64
#define AL_PAN_LEFT 0
#define AL_PAN_RIGHT 127
#define AL_VOL_FULL 127
#define AL_KEY_MIN 0
#define AL_KEY_MAX 127
#define AL_DEFAULT_FXMIX 0
#define AL_SUSTAIN 63
/***********************************************************************
* Error handling
***********************************************************************/
#ifdef _DEBUG
#define ALFailIf(condition, error) \
if (condition) { \
__osError(error, 0); \
return; }
#else
#define ALFailIf(condition, error) \
if (condition) { \
return; }
#endif
#ifdef _DEBUG
#define ALFlagFailIf(condition, flag, error) \
if (condition) { \
if(flag) __osError(error, 0); \
return; }
#else
#define ALFlagFailIf(condition, flag, error) \
if (condition) { \
return; }
#endif
/***********************************************************************
* Audio Library global routines
***********************************************************************/
typedef struct ALLink_s {
struct ALLink_s *next;
struct ALLink_s *prev;
} ALLink;
void alUnlink(ALLink *element);
void alLink(ALLink *element, ALLink *after);
typedef s32 (*ALDMAproc)(s32 addr, s32 len, void *state);
typedef ALDMAproc (*ALDMANew)(void *state);
void alCopy(void *src, void *dest, s32 len);
typedef struct {
u8 *base;
u8 *cur;
s32 len;
s32 count;
} ALHeap;
#define AL_HEAP_DEBUG 1
#define AL_HEAP_MAGIC 0x20736a73
#define AL_HEAP_INIT 0
void alHeapInit(ALHeap *hp, u8 *base, s32 len);
void *alHeapDBAlloc(u8 *file, s32 line, ALHeap *hp, s32 num, s32 size);
s32 alHeapCheck(ALHeap *hp);
#ifdef _DEBUG
#define alHeapAlloc(hp, elem ,size) alHeapDBAlloc((u8 *) __FILE__,__LINE__,(hp),(elem),(size))
#else
#define alHeapAlloc(hp, elem ,size) alHeapDBAlloc(0, 0,(hp),(elem),(size))
#endif
/***********************************************************************
* FX Stuff
***********************************************************************/
#define AL_FX_NONE 0
#define AL_FX_SMALLROOM 1
#define AL_FX_BIGROOM 2
#define AL_FX_CHORUS 3
#define AL_FX_FLANGE 4
#define AL_FX_ECHO 5
#define AL_FX_CUSTOM 6
typedef u8 ALFxId;
typedef void *ALFxRef;
/***********************************************************************
* data structures for sound banks
***********************************************************************/
#define AL_BANK_VERSION 0x4231 /* 'B1' */
/* Possible wavetable types */
enum {AL_ADPCM_WAVE = 0,
AL_RAW16_WAVE};
typedef struct {
s32 order;
s32 npredictors;
s16 book[1]; /* Actually variable size. Must be 8-byte aligned */
} ALADPCMBook;
typedef struct {
u32 start;
u32 end;
u32 count;
ADPCM_STATE state;
} ALADPCMloop;
typedef struct {
u32 start;
u32 end;
u32 count;
} ALRawLoop;
typedef struct {
ALMicroTime attackTime;
ALMicroTime decayTime;
ALMicroTime releaseTime;
u8 attackVolume;
u8 decayVolume;
} ALEnvelope;
typedef struct {
u8 velocityMin;
u8 velocityMax;
u8 keyMin;
u8 keyMax;
u8 keyBase;
s8 detune;
} ALKeyMap;
typedef struct {
ALADPCMloop *loop;
ALADPCMBook *book;
} ALADPCMWaveInfo;
typedef struct {
ALRawLoop *loop;
} ALRAWWaveInfo;
typedef struct ALWaveTable_s {
u8 *base; /* ptr to start of wave data */
s32 len; /* length of data in bytes */
u8 type; /* compression type */
u8 flags; /* offset/address flags */
union {
ALADPCMWaveInfo adpcmWave;
ALRAWWaveInfo rawWave;
} waveInfo;
} ALWaveTable;
typedef struct ALSound_s {
ALEnvelope *envelope;
ALKeyMap *keyMap;
ALWaveTable *wavetable; /* offset to wavetable struct */
ALPan samplePan;
u8 sampleVolume;
u8 flags;
} ALSound;
typedef struct {
u8 volume; /* overall volume for this instrument */
ALPan pan; /* 0 = hard left, 127 = hard right */
u8 priority; /* voice priority for this instrument */
u8 flags;
u8 tremType; /* the type of tremelo osc. to use */
u8 tremRate; /* the rate of the tremelo osc. */
u8 tremDepth; /* the depth of the tremelo osc */
u8 tremDelay; /* the delay for the tremelo osc */
u8 vibType; /* the type of tremelo osc. to use */
u8 vibRate; /* the rate of the tremelo osc. */
u8 vibDepth; /* the depth of the tremelo osc */
u8 vibDelay; /* the delay for the tremelo osc */
s16 bendRange; /* pitch bend range in cents */
s16 soundCount; /* number of sounds in this array */
ALSound *soundArray[1];
} ALInstrument;
typedef struct ALBank_s {
s16 instCount; /* number of programs in this bank */
u8 flags;
u8 pad;
s32 sampleRate; /* e.g. 44100, 22050, etc... */
ALInstrument *percussion; /* default percussion for GM */
ALInstrument *instArray[1]; /* ARRAY of instruments */
} ALBank;
typedef struct { /* Note: sizeof won't be correct */
s16 revision; /* format revision of this file */
s16 bankCount; /* number of banks */
ALBank *bankArray[1]; /* ARRAY of bank offsets */
} ALBankFile;
void alBnkfNew(ALBankFile *f, u8 *table);
/***********************************************************************
* Sequence Files
***********************************************************************/
#define AL_SEQBANK_VERSION 'S1'
typedef struct {
u8 *offset;
s32 len;
} ALSeqData;
typedef struct { /* Note: sizeof won't be correct */
s16 revision; /* format revision of this file */
s16 seqCount; /* number of sequences */
ALSeqData seqArray[1]; /* ARRAY of sequence info */
} ALSeqFile;
void alSeqFileNew(ALSeqFile *f, u8 *base);
/***********************************************************************
* Synthesis driver stuff
***********************************************************************/
typedef ALMicroTime (*ALVoiceHandler)(void *);
typedef struct {
s32 maxVVoices; /* obsolete */
s32 maxPVoices;
s32 maxUpdates;
s32 maxFXbusses;
void *dmaproc;
ALHeap *heap;
s32 outputRate; /* output sample rate */
ALFxId fxType;
s32 *params;
} ALSynConfig;
typedef struct ALPlayer_s {
struct ALPlayer_s *next;
void *clientData; /* storage for client callback */
ALVoiceHandler handler; /* voice handler for player */
ALMicroTime callTime; /* usec requested callback */
s32 samplesLeft; /* usec remaining to callback */
} ALPlayer;
typedef struct ALVoice_s {
ALLink node;
struct PVoice_s *pvoice;
ALWaveTable *table;
void *clientPrivate;
s16 state;
s16 priority;
s16 fxBus;
s16 unityPitch;
} ALVoice;
typedef struct ALVoiceConfig_s {
s16 priority; /* voice priority */
s16 fxBus; /* bus assignment */
u8 unityPitch; /* unity pitch flag */
} ALVoiceConfig;
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 ALMainBus_s *mainBus;
struct ALAuxBus_s *auxBus; /* ptr to array of aux bus structs */
struct ALFilter_s *outputFilter; /* last filter in the filter chain */
s32 numPVoices;
s32 maxAuxBusses;
s32 outputRate; /* output sample rate */
s32 maxOutSamples; /* Maximum samples rsp can generate
at one time at output rate */
} ALSynth;
void alSynNew(ALSynth *s, ALSynConfig *config);
void alSynDelete(ALSynth *s);
void alSynAddPlayer(ALSynth *s, ALPlayer *client);
void alSynRemovePlayer(ALSynth *s, ALPlayer *client);
s32 alSynAllocVoice(ALSynth *s, ALVoice *v, ALVoiceConfig *vc);
void alSynFreeVoice(ALSynth *s, ALVoice *voice);
void alSynStartVoice(ALSynth *s, ALVoice *voice, ALWaveTable *w);
void alSynStartVoiceParams(ALSynth *s, ALVoice *voice, ALWaveTable *w,
f32 pitch, s16 vol, ALPan pan, u8 fxmix,
ALMicroTime t);
void alSynStopVoice(ALSynth *s, ALVoice *voice);
void alSynSetVol(ALSynth *s, ALVoice *v, s16 vol, ALMicroTime delta);
void alSynSetPitch(ALSynth *s, ALVoice *voice, f32 ratio);
void alSynSetPan(ALSynth *s, ALVoice *voice, ALPan pan);
void alSynSetFXMix(ALSynth *s, ALVoice *voice, u8 fxmix);
void alSynSetPriority(ALSynth *s, ALVoice *voice, s16 priority);
s16 alSynGetPriority(ALSynth *s, ALVoice *voice);
ALFxRef *alSynAllocFX(ALSynth *s, s16 bus, ALSynConfig *c, ALHeap *hp);
ALFxRef alSynGetFXRef(ALSynth *s, s16 bus, s16 index);
void alSynFreeFX(ALSynth *s, ALFxRef *fx);
void alSynSetFXParam(ALSynth *s, ALFxRef fx, s16 paramID, void *param);
/***********************************************************************
* Audio Library (AL) stuff
***********************************************************************/
typedef struct {
ALSynth drvr;
} ALGlobals;
extern ALGlobals *alGlobals;
void alInit(ALGlobals *glob, ALSynConfig *c);
void alClose(ALGlobals *glob);
Acmd *alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen);
/***********************************************************************
* Sequence Player stuff
***********************************************************************/
/*
* Play states
*/
#define AL_STOPPED 0
#define AL_PLAYING 1
#define AL_STOPPING 2
#define AL_DEFAULT_PRIORITY 5
#define AL_DEFAULT_VOICE 0
#define AL_MAX_CHANNELS 16
/*
* Audio Library event type definitions
*/
enum ALMsg {
AL_SEQ_REF_EVT, /* Reference to a pending event in the sequence. */
AL_SEQ_MIDI_EVT,
AL_SEQP_MIDI_EVT,
AL_TEMPO_EVT,
AL_SEQ_END_EVT,
AL_NOTE_END_EVT,
AL_SEQP_ENV_EVT,
AL_SEQP_META_EVT,
AL_SEQP_PROG_EVT,
AL_SEQP_API_EVT,
AL_SEQP_VOL_EVT,
AL_SEQP_LOOP_EVT,
AL_SEQP_PRIORITY_EVT,
AL_SEQP_SEQ_EVT,
AL_SEQP_BANK_EVT,
AL_SEQP_PLAY_EVT,
AL_SEQP_STOP_EVT,
AL_SEQP_STOPPING_EVT,
AL_TRACK_END,
AL_CSP_LOOPSTART,
AL_CSP_LOOPEND,
AL_CSP_NOTEOFF_EVT,
AL_TREM_OSC_EVT,
AL_VIB_OSC_EVT,
AL_UNK18_EVT
};
/*
* Midi event definitions
*/
#define AL_EVTQ_END 0x7fffffff
enum AL_MIDIstatus {
/* For distinguishing channel number from status */
AL_MIDI_ChannelMask = 0x0F,
AL_MIDI_StatusMask = 0xF0,
/* Channel voice messages */
AL_MIDI_ChannelVoice = 0x80,
AL_MIDI_NoteOff = 0x80,
AL_MIDI_NoteOn = 0x90,
AL_MIDI_PolyKeyPressure = 0xA0,
AL_MIDI_ControlChange = 0xB0,
AL_MIDI_ChannelModeSelect = 0xB0,
AL_MIDI_ProgramChange = 0xC0,
AL_MIDI_ChannelPressure = 0xD0,
AL_MIDI_PitchBendChange = 0xE0,
/* System messages */
AL_MIDI_SysEx = 0xF0, /* System Exclusive */
/* System common */
AL_MIDI_SystemCommon = 0xF1,
AL_MIDI_TimeCodeQuarterFrame = 0xF1,
AL_MIDI_SongPositionPointer = 0xF2,
AL_MIDI_SongSelect = 0xF3,
AL_MIDI_Undefined1 = 0xF4,
AL_MIDI_Undefined2 = 0xF5,
AL_MIDI_TuneRequest = 0xF6,
AL_MIDI_EOX = 0xF7, /* End of System Exclusive */
/* System real time */
AL_MIDI_SystemRealTime = 0xF8,
AL_MIDI_TimingClock = 0xF8,
AL_MIDI_Undefined3 = 0xF9,
AL_MIDI_Start = 0xFA,
AL_MIDI_Continue = 0xFB,
AL_MIDI_Stop = 0xFC,
AL_MIDI_Undefined4 = 0xFD,
AL_MIDI_ActiveSensing = 0xFE,
AL_MIDI_SystemReset = 0xFF,
AL_MIDI_Meta = 0xFF /* MIDI Files only */
};
enum AL_MIDIctrl {
AL_MIDI_VOLUME_CTRL = 0x07,
AL_MIDI_PAN_CTRL = 0x0A,
AL_MIDI_PRIORITY_CTRL = 0x10, /* use general purpose controller for priority */
AL_MIDI_FX_CTRL_0 = 0x14,
AL_MIDI_FX_CTRL_1 = 0x15,
AL_MIDI_FX_CTRL_2 = 0x16,
AL_MIDI_FX_CTRL_3 = 0x17,
AL_MIDI_FX_CTRL_4 = 0x18,
AL_MIDI_FX_CTRL_5 = 0x19,
AL_MIDI_FX_CTRL_6 = 0x1A,
AL_MIDI_FX_CTRL_7 = 0x1B,
AL_MIDI_FX_CTRL_8 = 0x1C,
AL_MIDI_FX_CTRL_9 = 0x1D,
AL_MIDI_SUSTAIN_CTRL = 0x40,
AL_MIDI_FX1_CTRL = 0x5B,
AL_MIDI_FX3_CTRL = 0x5D
};
enum AL_MIDImeta {
AL_MIDI_META_TEMPO = 0x51,
AL_MIDI_META_EOT = 0x2f
};
#define AL_CMIDI_BLOCK_CODE 0xFE
#define AL_CMIDI_LOOPSTART_CODE 0x2E
#define AL_CMIDI_LOOPEND_CODE 0x2D
#define AL_CMIDI_CNTRL_LOOPSTART 102
#define AL_CMIDI_CNTRL_LOOPEND 103
#define AL_CMIDI_CNTRL_LOOPCOUNT_SM 104
#define AL_CMIDI_CNTRL_LOOPCOUNT_BIG 105
typedef struct {
u8 *curPtr; /* ptr to the next event */
s32 lastTicks; /* sequence clock ticks (used by alSeqSetLoc) */
s32 curTicks; /* sequence clock ticks of next event (used by loop end test) */
s16 lastStatus; /* the last status msg */
} ALSeqMarker;
typedef struct {
s32 ticks; /* MIDI, Tempo and End events must start with ticks */
u8 status;
u8 byte1;
u8 byte2;
u32 duration;
} ALMIDIEvent;
typedef struct {
s32 ticks;
u8 status;
u8 type;
u8 len;
u8 byte1;
u8 byte2;
u8 byte3;
} ALTempoEvent;
typedef struct {
s32 ticks;
u8 status;
u8 type;
u8 len;
} ALEndEvent;
typedef struct {
struct ALVoice_s *voice;
} ALNoteEvent;
typedef struct {
struct ALVoice_s *voice;
ALMicroTime delta;
u8 vol;
} ALVolumeEvent;
typedef struct {
s16 vol;
} ALSeqpVolEvent;
typedef struct {
ALSeqMarker *start;
ALSeqMarker *end;
s32 count;
} ALSeqpLoopEvent;
typedef struct {
u8 chan;
u8 priority;
} ALSeqpPriorityEvent;
typedef struct {
void *seq; /* pointer to a seq (could be an ALSeq or an ALCSeq). */
} ALSeqpSeqEvent;
typedef struct {
ALBank *bank;
} ALSeqpBankEvent;
typedef struct {
struct ALVoiceState_s *vs;
void *oscState;
u8 chan;
} ALOscEvent;
typedef struct {
float unk0;
float unk4;
} ALUnk18Event;
typedef struct {
struct struct_81_s * unk0;
s32 unk4;
} ALUnk_Core1_3A70_Event;
typedef struct {
ALVoice voice;
ALSound *sound; /* sound referenced here */
s16 priority;
f32 pitch; /* current playback pitch */
s32 state; /* play state for this sound */
s16 vol; /* volume - combined with volume from bank */
ALPan pan; /* pan - 0 = left, 127 = right */
u8 fxMix; /* wet/dry mix - 0 = dry, 127 = wet */
} ALSoundState;
typedef struct {
s16 type;
union {
ALMIDIEvent midi;
ALTempoEvent tempo;
ALEndEvent end;
ALNoteEvent note;
ALVolumeEvent vol;
ALSeqpLoopEvent loop;
ALSeqpVolEvent spvol;
ALSeqpPriorityEvent sppriority;
ALSeqpSeqEvent spseq;
ALSeqpBankEvent spbank;
ALOscEvent osc;
ALUnk18Event unk18;
ALUnk_Core1_3A70_Event unk3A70;
} msg;
} ALEvent;
typedef struct {
ALLink node;
ALMicroTime delta;
ALEvent evt;
} ALEventListItem;
typedef struct {
ALLink freeList;
ALLink allocList;
s32 eventCount;
} ALEventQueue;
void alEvtqNew(ALEventQueue *evtq, ALEventListItem *items,
s32 itemCount);
ALMicroTime alEvtqNextEvent(ALEventQueue *evtq, ALEvent *evt);
void alEvtqPostEvent(ALEventQueue *evtq, ALEvent *evt,
ALMicroTime delta);
void alEvtqFlush(ALEventQueue *evtq);
void alEvtqFlushType(ALEventQueue *evtq, s16 type);
#define AL_PHASE_ATTACK 0
#define AL_PHASE_NOTEON 0
#define AL_PHASE_DECAY 1
#define AL_PHASE_SUSTAIN 2
#define AL_PHASE_RELEASE 3
#define AL_PHASE_SUSTREL 4
typedef struct ALVoiceState_s {
struct ALVoiceState_s *next;/* MUST be first */
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 */
} ALVoiceState;
typedef struct {
ALInstrument *instrument; /* instrument assigned to this chan */
s16 bendRange; /* pitch bend range in cents */
ALFxId fxId; /* type of fx assigned to this chan */
ALPan pan; /* overall pan for this chan */
u8 priority; /* priority for this chan */
u8 vol; /* current volume for this chan */
u8 unk9;
u8 fxmix; /* current fx mix for this chan */
u8 sustain; /* current sustain pedal state */
f32 pitchBend; /* current pitch bend val in cents */
} ALChanState;
typedef struct ALSeq_s {
u8 *base; /* ptr to start of sequence file */
u8 *trackStart; /* ptr to first MIDI event */
u8 *curPtr; /* ptr to next event to read */
s32 lastTicks; /* MIDI ticks for last event */
s32 len; /* length of sequence in bytes */
f32 qnpt; /* qrter notes / tick (1/division) */
s16 division; /* ticks per quarter note */
s16 lastStatus; /* for running status */
} ALSeq;
typedef struct {
u32 trackOffset[16];
u32 division;
} ALCMidiHdr;
typedef struct ALCSeq_s {
ALCMidiHdr *base; /* ptr to start of sequence file */
u32 validTracks; /* set of flags, showing valid tracks */
f32 qnpt; /* qrter notes / tick (1/division) */
u32 lastTicks; /* keep track of ticks incase app wants */
u32 lastDeltaTicks; /* number of delta ticks of last event */
u32 deltaFlag; /* flag: set if delta's not subtracted */
u8 *curLoc[16]; /* ptr to current track location, */
/* may point to next event, or may point */
/* to a backup code */
u8 *curBUPtr[16]; /* ptr to next event if in backup mode */
u8 curBULen[16]; /* if > 0, then in backup mode */
u8 lastStatus[16]; /* for running status */
u32 evtDeltaTicks[16]; /* delta time to next event */
} ALCSeq;
typedef struct {
u32 validTracks;
s32 lastTicks;
u32 lastDeltaTicks;
u8 *curLoc[16];
u8 *curBUPtr[16];
u8 curBULen[16];
u8 lastStatus[16];
u32 evtDeltaTicks[16];
} ALCSeqMarker;
#define NO_SOUND_ERR_MASK 0x01
#define NOTE_OFF_ERR_MASK 0x02
#define NO_VOICE_ERR_MASK 0x04
typedef struct {
s32 maxVoices; /* max number of voices to alloc */
s32 maxEvents; /* max internal events to support */
u8 maxChannels; /* max MIDI channels to support (16)*/
u8 debugFlags; /* control which error get reported */
ALHeap *heap; /* ptr to initialized heap */
void *initOsc;
void *updateOsc;
void *stopOsc;
} ALSeqpConfig;
typedef ALMicroTime (*ALOscInit)(void **oscState,f32 *initVal, u8 oscType,
u8 oscRate, u8 oscDepth, u8 oscDelay);
typedef ALMicroTime (*ALOscUpdate)(void *oscState, f32 *updateVal);
typedef void (*ALOscStop)(void *oscState);
typedef struct {
ALPlayer node; /* note: must be first in structure */
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 */
ALEvent nextEvent;
ALEventQueue evtq;
ALMicroTime frameTime;
ALChanState *chanState; /* 16 channels for MIDI */
ALVoiceState *vAllocHead; /* list head for allocated voices */
ALVoiceState *vAllocTail; /* list tail for allocated voices */
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 */
} ALSeqPlayer;
typedef struct {
ALPlayer node; /* note: must be first in structure */
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 */
ALEvent nextEvent;
ALEventQueue evtq;
ALMicroTime frameTime;
ALChanState *chanState; /* 16 channels for MIDI */
ALVoiceState *vAllocHead; /* list head for allocated voices */
ALVoiceState *vAllocTail; /* list tail for allocated voices */
ALVoiceState *vFreeList; /* list of free voice state structs */
ALOscInit initOsc;
ALOscUpdate updateOsc;
ALOscStop stopOsc;
} ALCSPlayer;
/*
* Sequence data representation routines
*/
void alSeqNew(ALSeq *seq, u8 *ptr, s32 len);
void alSeqNextEvent(ALSeq *seq, ALEvent *event);
s32 alSeqGetTicks(ALSeq *seq);
f32 alSeqTicksToSec(ALSeq *seq, s32 ticks, u32 tempo);
u32 alSeqSecToTicks(ALSeq *seq, f32 sec, u32 tempo);
void alSeqNewMarker(ALSeq *seq, ALSeqMarker *m, u32 ticks);
void alSeqSetLoc(ALSeq *seq, ALSeqMarker *marker);
void alSeqGetLoc(ALSeq *seq, ALSeqMarker *marker);
/*
* Compact Sequence data representation routines
*/
void alCSeqNew(ALCSeq *seq, u8 *ptr);
void alCSeqNextEvent(ALCSeq *seq,ALEvent *evt);
s32 alCSeqGetTicks(ALCSeq *seq);
f32 alCSeqTicksToSec(ALCSeq *seq, s32 ticks, u32 tempo);
u32 alCSeqSecToTicks(ALCSeq *seq, f32 sec, u32 tempo);
void alCSeqNewMarker(ALCSeq *seq, ALCSeqMarker *m, u32 ticks);
void alCSeqSetLoc(ALCSeq *seq, ALCSeqMarker *marker);
void alCSeqGetLoc(ALCSeq *seq, ALCSeqMarker *marker);
/*
* Sequence Player routines
*/
f32 alCents2Ratio(s32 cents);
void alSeqpNew(ALSeqPlayer *seqp, ALSeqpConfig *config);
void alSeqpDelete(ALSeqPlayer *seqp);
void alSeqpSetSeq(ALSeqPlayer *seqp, ALSeq *seq);
ALSeq *alSeqpGetSeq(ALSeqPlayer *seqp);
void alSeqpPlay(ALSeqPlayer *seqp);
void alSeqpStop(ALSeqPlayer *seqp);
s32 alSeqpGetState(ALSeqPlayer *seqp);
void alSeqpSetBank(ALSeqPlayer *seqp, ALBank *b);
void alSeqpSetTempo(ALSeqPlayer *seqp, s32 tempo);
s32 alSeqpGetTempo(ALSeqPlayer *seqp);
s16 alSeqpGetVol(ALSeqPlayer *seqp); /* Master volume control */
void alSeqpSetVol(ALSeqPlayer *seqp, s16 vol);
void alSeqpLoop(ALSeqPlayer *seqp, ALSeqMarker *start, ALSeqMarker *end, s32 count);
void alSeqpSetChlProgram(ALSeqPlayer *seqp, u8 chan, u8 prog);
s32 alSeqpGetChlProgram(ALSeqPlayer *seqp, u8 chan);
void alSeqpSetChlFXMix(ALSeqPlayer *seqp, u8 chan, u8 fxmix);
u8 alSeqpGetChlFXMix(ALSeqPlayer *seqp, u8 chan);
void alSeqpSetChlVol(ALSeqPlayer *seqp, u8 chan, u8 vol);
u8 alSeqpGetChlVol(ALSeqPlayer *seqp, u8 chan);
void alSeqpSetChlPan(ALSeqPlayer *seqp, u8 chan, ALPan pan);
ALPan alSeqpGetChlPan(ALSeqPlayer *seqp, u8 chan);
void alSeqpSetChlPriority(ALSeqPlayer *seqp, u8 chan, u8 priority);
u8 alSeqpGetChlPriority(ALSeqPlayer *seqp, u8 chan);
void alSeqpSendMidi(ALSeqPlayer *seqp, s32 ticks, u8 status, u8 byte1, u8 byte2);
/* Maintain backwards compatibility with old routine names. */
#define alSeqpSetProgram alSeqpSetChlProgram
#define alSeqpGetProgram alSeqpGetChlProgram
#define alSeqpSetFXMix alSeqpSetChlFXMix
#define alSeqpGetFXMix alSeqpGetChlFXMix
#define alSeqpSetPan alSeqpSetChlPan
#define alSeqpGetPan alSeqpGetChlPan
#define alSeqpSetChannelPriority alSeqpSetChlPriority
#define alSeqpGetChannelPriority alSeqpGetChlPriority
/*
* Compressed Sequence Player routines
*/
void alCSPNew(ALCSPlayer *seqp, ALSeqpConfig *config);
void alCSPDelete(ALCSPlayer *seqp);
void alCSPSetSeq(ALCSPlayer *seqp, ALCSeq *seq);
ALCSeq *alCSPGetSeq(ALCSPlayer *seqp);
void alCSPPlay(ALCSPlayer *seqp);
void alCSPStop(ALCSPlayer *seqp);
s32 alCSPGetState(ALCSPlayer *seqp);
void alCSPSetBank(ALCSPlayer *seqp, ALBank *b);
void alCSPSetTempo(ALCSPlayer *seqp, s32 tempo);
s32 alCSPGetTempo(ALCSPlayer *seqp);
s16 alCSPGetVol(ALCSPlayer *seqp);
void alCSPSetVol(ALCSPlayer *seqp, s16 vol);
void alCSPSetChlProgram(ALCSPlayer *seqp, u8 chan, u8 prog);
s32 alCSPGetChlProgram(ALCSPlayer *seqp, u8 chan);
void alCSPSetChlFXMix(ALCSPlayer *seqp, u8 chan, u8 fxmix);
u8 alCSPGetChlFXMix(ALCSPlayer *seqp, u8 chan);
void alCSPSetChlPan(ALCSPlayer *seqp, u8 chan, ALPan pan);
ALPan alCSPGetChlPan(ALCSPlayer *seqp, u8 chan);
void alCSPSetChlVol(ALCSPlayer *seqp, u8 chan, u8 vol);
u8 alCSPGetChlVol(ALCSPlayer *seqp, u8 chan);
void alCSPSetChlPriority(ALCSPlayer *seqp, u8 chan, u8 priority);
u8 alCSPGetChlPriority(ALCSPlayer *seqp, u8 chan);
void alCSPSendMidi(ALCSPlayer *seqp, s32 ticks, u8 status,
u8 byte1, u8 byte2);
/* Maintain backwards compatibility with old routine names. */
#define alCSPSetProgram alCSPSetChlProgram
#define alCSPGetProgram alCSPGetChlProgram
#define alCSPSetFXMix alCSPSetChlFXMix
#define alCSPGetFXMix alCSPGetChlFXMix
#define alCSPSetPan alCSPSetChlPan
#define alCSPGetPan alCSPGetChlPan
#define alCSPSetChannelPriority alCSPSetChlPriority
#define alCSPGetChannelPriority alCSPGetChlPriority
/***********************************************************************
* Sound Player stuff
***********************************************************************/
typedef struct {
s32 maxSounds;
s32 maxEvents;
ALHeap *heap;
} ALSndpConfig;
typedef struct {
ALPlayer node; /* note: must be first in structure */
ALEventQueue evtq;
ALEvent nextEvent;
ALSynth *drvr; /* reference to the client driver */
s32 target;
void *sndState;
s32 maxSounds;
ALMicroTime frameTime;
ALMicroTime nextDelta; /* microseconds to next callback */
ALMicroTime curTime;
} ALSndPlayer;
typedef s16 ALSndId;
void alSndpNew(ALSndPlayer *sndp, ALSndpConfig *c);
void alSndpDelete(ALSndPlayer *sndp);
ALSndId alSndpAllocate(ALSndPlayer *sndp, ALSound *sound);
void alSndpDeallocate(ALSndPlayer *sndp, ALSndId id);
void alSndpSetSound(ALSndPlayer *sndp, ALSndId id);
ALSndId alSndpGetSound(ALSndPlayer *sndp);
void alSndpPlay(ALSndPlayer *sndp);
void alSndpPlayAt(ALSndPlayer *sndp, ALMicroTime delta);
void alSndpStop(ALSndPlayer *sndp);
void alSndpSetVol(ALSndPlayer *sndp, s16 vol);
void alSndpSetPitch(ALSndPlayer *sndp, f32 pitch);
void alSndpSetPan(ALSndPlayer *sndp, ALPan pan);
void alSndpSetPriority(ALSndPlayer *sndp, ALSndId id, u8 priority);
void alSndpSetFXMix(ALSndPlayer *sndp, u8 mix);
s32 alSndpGetState(ALSndPlayer *sndp);
#ifndef _FINALROM
void alParseAbiCL(Acmd *cmdList, u32 nbytes);
#endif
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !__LIB_AUDIO__ */

100
include/2.0L/PR/mbi.h Normal file
View File

@@ -0,0 +1,100 @@
#ifndef _MBI_H_
#define _MBI_H_
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.136 $
* $Date: 1999/01/05 13:04:00 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/mbi.h,v $
*
**************************************************************************/
/*
* Header file for the Media Binary Interface
*
* NOTE: This file is included by the RSP microcode, so any C-specific
* constructs must be bracketed by #ifdef _LANGUAGE_C
*
*/
/*
* the SHIFT macros are used to build display list commands, inserting
* bit-fields into a 32-bit word. They take a value, a shift amount,
* and a width.
*
* For the left shift, the lower bits of the value are masked,
* then shifted left.
*
* For the right shift, the value is shifted right, then the lower bits
* are masked.
*
* (NOTE: _SHIFTL(v, 0, 32) won't work, just use an assignment)
*
*/
#define _SHIFTL(v, s, w) \
((unsigned int) (((unsigned int)(v) & ((0x01 << (w)) - 1)) << (s)))
#define _SHIFTR(v, s, w) \
((unsigned int)(((unsigned int)(v) >> (s)) & ((0x01 << (w)) - 1)))
#define _SHIFT _SHIFTL /* old, for compatibility only */
#define G_ON (1)
#define G_OFF (0)
/**************************************************************************
*
* Graphics Binary Interface
*
**************************************************************************/
#include <PR/gbi.h>
/**************************************************************************
*
* Audio Binary Interface
*
**************************************************************************/
#include <PR/abi.h>
/**************************************************************************
*
* Task list
*
**************************************************************************/
#define M_GFXTASK 1
#define M_AUDTASK 2
#define M_VIDTASK 3
#define M_HVQTASK 6
#define M_HVQMTASK 7
/**************************************************************************
*
* Segment macros and definitions
*
**************************************************************************/
#define NUM_SEGMENTS (16)
#define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00ffffff)
#define SEGMENT_NUMBER(a) (((unsigned int)(a) << 4) >> 28)
#define SEGMENT_ADDR(num, off) (((num) << 24) + (off))
#ifndef NULL
#define NULL 0
#endif
#endif /* !_MBI_H_ */

122
include/2.0L/PR/n_abi.h Normal file
View File

@@ -0,0 +1,122 @@
/*====================================================================
*
* 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_ABI__
#define __N_ABI__
/*
* BEGIN C-specific section: (typedef's)
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/*
* Macros to assemble the audio command list
*/
#define n_aADPCMdec(pkt, s, f, c, a, d) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(s, 0, 24)); \
_a->words.w1 = (_SHIFTL(f, 28, 4) | _SHIFTL(c, 16, 12) | \
_SHIFTL(a, 12, 4) | _SHIFTL(d, 0, 12)); \
}
#define n_aPoleFilter(pkt, f, g, t, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(g, 0, 16)); \
_a->words.w1 = (_SHIFTL(t, 24, 8) | \
_SHIFTL((unsigned int)(s), 0, 24)); \
}
#define n_aEnvMixer(pkt, f, t, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8) |\
_SHIFTL(t, 0, 16)); \
_a->words.w1 = (unsigned int)(s); \
}
#define n_aInterleave(pkt) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \
}
#define n_aLoadBuffer(pkt, c, d, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_LOADBUFF, 24, 8) | _SHIFTL(c, 12, 12)|\
_SHIFTL(d, 0, 12)); \
_a->words.w1 = (unsigned int)(s); \
}
#define n_aResample(pkt, s, f, p, i, o) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(s, 0, 24));\
_a->words.w1 = (_SHIFTL(f, 30, 2) | _SHIFTL(p, 14, 16) | \
_SHIFTL(i, 2, 12) | _SHIFTL(o, 0, 2)); \
}
#define n_aSaveBuffer(pkt, c, d, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_SAVEBUFF, 24, 8) | _SHIFTL(c, 12, 12)|\
_SHIFTL(d, 0, 12)); \
_a->words.w1 = (unsigned int)(s); \
}
#define n_aSetVolume(pkt, f, v, t, r) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(v, 0, 16)); \
_a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \
}
#define n_aLoadADPCM(pkt, c, d) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
_a->words.w1 = (unsigned int) d; \
}
#endif /* _LANGUAGE_C */
#endif /* __N_ABI__ */

View File

@@ -0,0 +1,380 @@
/*====================================================================
*
* 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>
/*
* 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 */
ALPlayer *n_seqp1; /* for fade in / fade out */
ALPlayer *n_seqp2;
ALPlayer *n_sndp;
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;
ALPlayer *unk5C;
ALPlayer *unk60;
ALPlayer *unk64;
ALPlayer *unk68;
ALPlayer *unk6C;
ALPlayer *unk70;
} 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, ALMicroTime t);
void n_alSynStopVoice( N_ALVoice *v);
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 {
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;
} 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 foo);
void n_alEvtqFlushType(ALEventQueue *evtq, s16 type);
//N_ALVoiceState?
typedef struct struct_81_s{
ALLink node;
ALSound *unk8;
N_ALVoice voice;
f32 unk28; //pitch?
f32 unk2C; //vibrato?
struct struct_81_s **unk30;
s16 unk34;
s8 unk36;
u8 pad37[1];
s32 unk38;
u8 envPhase;
u8 unk3D;
u8 unk3E;
u8 unk3F; //key
u8 unk40;
u8 pad41[3];
f32 unk44; //volume
ALMicroTime unk48; //time_remaining?
s32 unk4C;
} Struct81s;
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 */
} 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 */
} 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;
} 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);
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);
/*
* 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_(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 */
s32 target;
void *sndState;
s32 maxSounds;
ALMicroTime frameTime;
ALMicroTime nextDelta; /* microseconds to next callback */
ALMicroTime curTime;
} N_ALSndPlayer;
void n_alSndpNew(N_ALSndPlayer *sndp, 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[];
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* __N_LIBAUDIO__ */

View File

@@ -0,0 +1,120 @@
#define ALVoice N_ALVoice
#define ALSynth N_ALSynth
#define ALGlobals N_ALGlobals
#define n_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 n_alSynStartVoiceParams( a, b, c, d, e, f, g, h) \
n_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 n_
#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

108
include/2.0L/PR/os.h Normal file
View File

@@ -0,0 +1,108 @@
/*====================================================================
* os.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.h,v $
$Revision: 1.168 $
$Date: 2000/06/15 06:24:52 $
*---------------------------------------------------------------------*/
#ifndef _OS_H_
#define _OS_H_
#include <PR/os_thread.h>
#include <PR/os_message.h>
#include <PR/os_exception.h>
#include <PR/os_tlb.h>
#include <PR/os_pi.h>
#include <PR/os_vi.h>
#include <PR/os_ai.h>
#include <PR/os_si.h>
#include <PR/os_time.h>
#include <PR/os_cont.h>
#include <PR/os_pfs.h>
#include <PR/os_gbpak.h>
#include <PR/os_voice.h>
#include <PR/os_cache.h>
#include <PR/os_debug.h>
#include <PR/os_error.h>
#include <PR/os_gio.h>
#include <PR/os_reg.h>
#include <PR/os_system.h>
#include <PR/os_eeprom.h>
#include <PR/os_flash.h>
#include <PR/os_host.h>
#include <PR/os_convert.h>
#include <PR/os_rdp.h>
#include <PR/os_rsp.h>
#include <PR/os_motor.h>
#include <PR/os_libc.h>
#include <PR/os_version.h>
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
/**************************************************************************
*
* Global definitions
*
*/
/*
* Stack size for I/O device managers: PIM (PI Manager), VIM (VI Manager),
* SIM (SI Manager)
*
*/
#define OS_PIM_STACKSIZE 4096
#define OS_VIM_STACKSIZE 4096
#define OS_SIM_STACKSIZE 4096
#define OS_MIN_STACKSIZE 72
/*
* Leo Disk
*/
/* transfer mode */
#define LEO_BLOCK_MODE 1
#define LEO_TRACK_MODE 2
#define LEO_SECTOR_MODE 3
/*
* Boot addresses
*/
#define BOOT_ADDRESS_ULTRA 0x80000400
#define BOOT_ADDRESS_COSIM 0x80002000
#define BOOT_ADDRESS_EMU 0x20010000
#define BOOT_ADDRESS_INDY 0x88100000
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_H */

92
include/2.0L/PR/os_ai.h Normal file
View 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_ */

View 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/2.0L/PR/os_cont.h Normal file
View 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_ */

View File

@@ -0,0 +1,111 @@
/*====================================================================
* 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.2 $
$Date: 1999/04/21 02:53:11 $
*---------------------------------------------------------------------*/
#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))
/* OS_K?_TO_PHYSICAL macro bug fix for CodeWarrior */
#ifndef __MWERKS__
#define OS_K0_TO_PHYSICAL(x) (u32)(((char *)(x)-0x80000000))
#define OS_K1_TO_PHYSICAL(x) (u32)(((char *)(x)-0xa0000000))
#else
#define OS_K0_TO_PHYSICAL(x) ((char *)(x)-0x80000000)
#define OS_K1_TO_PHYSICAL(x) ((char *)(x)-0xa0000000)
#endif
#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_ */

117
include/2.0L/PR/os_debug.h Normal file
View File

@@ -0,0 +1,117 @@
/*====================================================================
* 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.4 $
$Date: 1999/06/30 03:04:08 $
*---------------------------------------------------------------------*/
#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);
/* Thread Profiler Interface */
extern void osThreadProfileClear(OSId);
extern void osThreadProfileInit(void);
extern void osThreadProfileStart(void);
extern void osThreadProfileStop(void);
extern u32 osThreadProfileReadCount(OSId);
extern u32 osThreadProfileReadCountTh(OSThread*);
extern OSTime osThreadProfileReadTime(OSId);
extern OSTime osThreadProfileReadTimeTh(OSThread*);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_DEBUG_H_ */

107
include/2.0L/PR/os_eeprom.h Normal file
View 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_ */

View 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_ */

View File

@@ -0,0 +1,119 @@
/*====================================================================
* 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 <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
typedef u32 OSIntMask;
typedef u32 OSHWIntr;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/* 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_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)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* 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_ */

View File

@@ -0,0 +1,71 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.
$RCSfile: os_flash.h,v $
$Revision: 1.1 $
$Date: 2000/06/15 06:24:55 $
*---------------------------------------------------------------------*/
#ifndef _OS_FLASH_H_
#define _OS_FLASH_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/*
* defines for FLASH
*/
#define FLASH_START_ADDR 0x08000000
#define FLASH_SIZE 0x20000
#define FLASH_LATENCY 0x5
#define FLASH_PULSE 0x0c
#define FLASH_PAGE_SIZE 0xf
#define FLASH_REL_DURATION 0x2
#define DEVICE_TYPE_FLASH 8
#define FLASH_VERSION_MX_PROTO_A 0x00c20000
#define FLASH_VERSION_MX_A 0x00c20001
#define FLASH_VERSION_MX_C 0x00c2001e
#define FLASH_VERSION_MX_B_AND_D 0x00c2001d
#define FLASH_VERSION_MEI 0x003200f1
#define OLD_FLASH 0
#define NEW_FLASH 1
/* OLD_FLASH is MX_PROTO_A, MX_A and MX_C */
/* NEW_FLASH is MX_B_AND_D and MATSUSHITA flash */
#define FLASH_STATUS_ERASE_BUSY 2
#define FLASH_STATUS_ERASE_ERROR -1
#define FLASH_STATUS_ERASE_OK 0
extern OSPiHandle *osFlashReInit(u8 latency, u8 pulse,
u8 page_size, u8 rel_duration, u32 start);
extern OSPiHandle *osFlashInit(void);
extern void osFlashReadStatus(u8 *flash_status);
extern void osFlashReadId(u32 *flash_type, u32 *flash_maker);
extern void osFlashClearStatus(void);
extern s32 osFlashAllErase(void);
extern s32 osFlashSectorErase(u32 page_num);
extern s32 osFlashWriteBuffer(OSIoMesg *mb, s32 priority,
void *dramAddr, OSMesgQueue *mq);
extern s32 osFlashWriteArray(u32 page_num);
extern s32 osFlashReadArray(OSIoMesg *mb, s32 priority, u32 page_num,
void *dramAddr, u32 n_pages, OSMesgQueue *mq);
extern void osFlashChange(u32 flash_num);
extern void osFlashAllEraseThrough(void);
extern void osFlashSectorEraseThrough(u32 page_num);
extern s32 osFlashCheckEraseEnd(void);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_FLASH_H_ */

107
include/2.0L/PR/os_gbpak.h Normal file
View 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/2.0L/PR/os_gio.h Normal file
View 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_ */

161
include/2.0L/PR/os_host.h Normal file
View File

@@ -0,0 +1,161 @@
/*====================================================================
* 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.3 $
$Date: 1999/06/24 09:23:06 $
*---------------------------------------------------------------------*/
#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
*
*/
extern void __osInitialize_common(void);
#if defined(_FINALROM)
#define osInitialize() __osInitialize_common()
#else
/* PARTNER-N64 */
#if defined(PTN64)
extern void __osInitialize_kmc(void);
#define osReadHost osReadHost_pt
#define osWriteHost osWriteHost_pt
#define osInitialize() \
{ \
__osInitialize_common(); \
__osInitialize_kmc(); \
}
/* MONEGI SMART PACK A */
#elif defined(MWN64)
extern void __osInitialize_msp(void);
#define osReadHost osReadHost_pt
#define osWriteHost osWriteHost_pt
#define osInitialize() \
{ \
__osInitialize_common(); \
__osInitialize_msp(); \
}
/* IS-Viewer(for Debugger) */
#elif defined(ISV64)
extern void __osInitialize_isv(void);
#define osInitialize() \
{ \
__osInitialize_common(); \
__osInitialize_isv(); \
}
/* Emulation board for INDY */
#elif defined(EMU64)
extern void __osInitialize_emu(void);
#define osInitialize() \
{ \
__osInitialize_common(); \
__osInitialize_emu(); \
}
#else
/* Default (auto detect) */
extern void __osInitialize_autodetect(void);
extern void __osInitialize_msp(void);
extern void __osInitialize_kmc(void);
extern void __osInitialize_isv(void);
extern void __osInitialize_emu(void);
#define osInitialize() \
{ \
__osInitialize_common(); \
__osInitialize_autodetect(); \
}
#endif
#endif /* _FINAL_ROM */
/**************************************************************************
*
* 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_ */

View 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.h,v $
$Revision: 1.20 $
$Date: 1998/10/09 08:01:09 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_H_
#define _OS_INTERNAL_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
#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 */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_H */

View 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 */

View 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 */

View 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)); // no 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 */

View 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 */

View 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 */

View File

@@ -0,0 +1,59 @@
/**************************************************************************
* *
* 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.2 $
$Date: 1999/03/10 12:19:14 $
*---------------------------------------------------------------------*/
#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);
extern u32 __osGetWatchLo(void);
extern void __osSetWatchLo(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 */

View 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 */

View 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 */

View 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 */

View 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 */

100
include/2.0L/PR/os_libc.h Normal file
View File

@@ -0,0 +1,100 @@
/*====================================================================
* 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.3 $
$Date: 1999/07/13 01:43:47 $
*---------------------------------------------------------------------*/
#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_ */

View 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_ */

View File

@@ -0,0 +1,75 @@
/*---------------------------------------------------------------------*
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);
extern s32 osMotorStop(OSPfs *);
extern s32 osMotorStart(OSPfs *);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_MOTOR_H_ */

174
include/2.0L/PR/os_pfs.h Normal file
View File

@@ -0,0 +1,174 @@
/*====================================================================
* 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
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* file system interface */
extern s32 osPfsInitPak(OSMesgQueue *, OSPfs *, int);
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_ */

228
include/2.0L/PR/os_pi.h Normal file
View File

@@ -0,0 +1,228 @@
/*====================================================================
* 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);
extern s32 osEPiRawStartDma(OSPiHandle *, s32 , u32 , void *, u32 );
/* 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 *);
extern s32 osPiRawStartDma(s32, u32, void *, u32);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_PI_H_ */

92
include/2.0L/PR/os_rdp.h Normal file
View 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/2.0L/PR/os_reg.h Normal file
View 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/2.0L/PR/os_rsp.h Normal file
View 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/2.0L/PR/os_si.h Normal file
View 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/2.0L/PR/os_system.h Normal file
View 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_ */

154
include/2.0L/PR/os_thread.h Normal file
View File

@@ -0,0 +1,154 @@
/*====================================================================
* 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.3 $
$Date: 1999/06/15 12:39:40 $
*---------------------------------------------------------------------*/
#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 {
u32 flag;
u32 count;
u64 time;
} __OSThreadprofile_s;
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 */
__OSThreadprofile_s *thprof; /* workarea for thread profiler */
__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 */
/* for thread profiler */
#define THPROF_IDMAX 64
#define THPROF_STACKSIZE 256
#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/2.0L/PR/os_time.h Normal file
View 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/2.0L/PR/os_tlb.h Normal file
View 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_ */

View File

@@ -0,0 +1,16 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.
$RCSfile: os_version.h,v $
$Revision: 1.2 $
$Date: 1999/06/17 01:33:01 $
*---------------------------------------------------------------------*/
#ifndef _OS_VERSION_H_
#define _OS_VERSION_H_
#define OS_MAJOR_VERSION "2.0K" /* major version */
#define OS_MINOR_VERSION 0 /* patch level */
#endif /* !_OS_VERSION_H_ */

298
include/2.0L/PR/os_vi.h Normal file
View 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/2.0L/PR/os_voice.h Normal file
View File

@@ -0,0 +1,108 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.
$RCSfile: os_voice.h,v $
$Revision: 1.2 $
$Date: 1999/07/13 08:36:42 $
*---------------------------------------------------------------------*/
#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...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_ */

113
include/2.0L/PR/ramrom.h Normal file
View File

@@ -0,0 +1,113 @@
#ifndef _RAMROM_H
#define _RAMROM_H
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.20 $
* $Date: 1997/02/11 08:26:47 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ramrom.h,v $
*
**************************************************************************/
/*
* Defines for the GIO card in the Nintendo Development Station
*
* The RAM on the GIO card acts as ROM for the game
* Interrupts available between the game and the Indy host
*
* The last part of the ramrom is used for communication between
* game and host. There are 6 4K buffers defined:
* log, printf, rmon to indy, rmon from indy, app to indy, app from indy
* The last 8 bytes of the buffer are used in the emulator environment
*/
#define RAMROM_SIZE (0x1000000)
#define RAMROM_BUF_SIZE (4096)
#define RAMROM_MSG_SIZE (RAMROM_BUF_SIZE*6)
#define RAMROM_MSG_ADDR (RAMROM_SIZE - RAMROM_MSG_SIZE)
#define RAMROM_MSG_HDR_SIZE (3*sizeof(long))
#define RAMROM_USER_DATA_SIZE (RAMROM_MSG_SIZE-RAMROM_MSG_HDR_SIZE)
#define RAMROM_APP_READ_ADDR (RAMROM_MSG_ADDR + (0*RAMROM_BUF_SIZE))
#define RAMROM_APP_WRITE_ADDR (RAMROM_MSG_ADDR + (1*RAMROM_BUF_SIZE))
#define RAMROM_RMON_READ_ADDR (RAMROM_MSG_ADDR + (2*RAMROM_BUF_SIZE))
#define RAMROM_RMON_WRITE_ADDR (RAMROM_MSG_ADDR + (3*RAMROM_BUF_SIZE))
#define RAMROM_PRINTF_ADDR (RAMROM_MSG_ADDR + (4*RAMROM_BUF_SIZE))
#define RAMROM_LOG_ADDR (RAMROM_MSG_ADDR + (5*RAMROM_BUF_SIZE))
/*#define RAMROM_GIO_INTERRUPT (RAMROM_MSG_ADDR + RAMROM_MSG_SIZE - 4)*/
/*
* For the initial round of PIF bringup, we will load in a bootstrap loader
* 0x400 bytes into the ramrom, and the rom will be loaded at 0x2000
*/
#ifndef _HW_VERSION_1
#define RAMROM_BOOTSTRAP_OFFSET 0x40
#define RAMROM_GAME_OFFSET 0x1000
#define RAMROM_FONTDATA_OFFSET 0xb70
#define RAMROM_FONTDATA_SIZE 1152
#else
#define RAMROM_BOOTSTRAP_OFFSET 0x400
#define RAMROM_GAME_OFFSET 0x2000
#endif
#define RAMROM_CLOCKRATE_OFFSET 0x4
#define RAMROM_CLOCKRATE_MASK 0xfffffff0
#define RAMROM_BOOTADDR_OFFSET 0x8
#define RAMROM_RELEASE_OFFSET 0xc
/*
* Second version of the PIF jumps to location 0x1000, and we'll put a jump to
* location 0x400 into the ramrom (for backwards compatibility).
*/
#define RAMROM_PIF2BOOTSTRAP_OFFSET 0x1000
typedef struct {
long type;
long length; /* in bytes of userdata */
long magic;
char userdata[RAMROM_USER_DATA_SIZE];
} RamRomBuffer;
/*
* Interrupt values (must fit in 6 bits!)
* values are used for both request & response
* Transactions initiated by the host start with HOST
* and those initiated by the target start with GAME.
*/
#define HOST_PIACCESS_REQ 1
#define HOST_DBG_CMD_READY 2
#define GAME_DBG_DATA_SEND 3
#define HOST_DBG_DATA_ACK 4
#define GAME_PRINTF_SEND 5
#define HOST_PRINTF_ACK 6
#define GAME_LOG_SEND 7
#define HOST_LOG_ACK 8
#define HOST_APP_CMD_READY 9
#define GAME_APP_DATA_READY 10
#define HOST_PROF_REQ 11
#define GAME_PROF_SEND 12
#define HOST_PROF_ACK 13
#define GAME_FAULT_SEND 14
#define HOST_FAULT_ACK 15
#define GAME_EXIT 16
#define HOST_DATA_ACK 17
#ifdef _EMULATOR
void __RamRomInit(int key, void *romaddr);
void __RamRomDestroy(int key);
#endif /* _EMULATOR */
#endif /* !_RAMROM_H */

885
include/2.0L/PR/rcp.h Normal file
View File

@@ -0,0 +1,885 @@
#ifndef _RCP_H_
#define _RCP_H_
/**************************************************************************
* *
* 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. *
* *
**************************************************************************/
/**************************************************************************
*
* File: rcp.h
*
* This file contains register and bit definitions for RCP memory map.
* $Revision: 1.22 $
* $Date: 1999/05/20 03:01:49 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rcp.h,v $
*
**************************************************************************/
#include <PR/R4300.h>
#include <PR/ultratypes.h>
/**********************************************************************
*
* Here is a quick overview of the RCP memory map:
*
0x0000_0000 .. 0x03ef_ffff RDRAM memory
0x03f0_0000 .. 0x03ff_ffff RDRAM registers
RCP registers (see below)
0x0400_0000 .. 0x040f_ffff SP registers
0x0410_0000 .. 0x041f_ffff DP command registers
0x0420_0000 .. 0x042f_ffff DP span registers
0x0430_0000 .. 0x043f_ffff MI registers
0x0440_0000 .. 0x044f_ffff VI registers
0x0450_0000 .. 0x045f_ffff AI registers
0x0460_0000 .. 0x046f_ffff PI registers
0x0470_0000 .. 0x047f_ffff RI registers
0x0480_0000 .. 0x048f_ffff SI registers
0x0490_0000 .. 0x04ff_ffff unused
0x0500_0000 .. 0x05ff_ffff cartridge domain 2
0x0600_0000 .. 0x07ff_ffff cartridge domain 1
0x0800_0000 .. 0x0fff_ffff cartridge domain 2
0x1000_0000 .. 0x1fbf_ffff cartridge domain 1
0x1fc0_0000 .. 0x1fc0_07bf PIF Boot Rom (1984 bytes)
0x1fc0_07c0 .. 0x1fc0_07ff PIF (JoyChannel) RAM (64 bytes)
0x1fc0_0800 .. 0x1fcf_ffff Reserved
0x1fd0_0000 .. 0x7fff_ffff cartridge domain 1
0x8000_0000 .. 0xffff_ffff external SysAD device
The Indy development board use cartridge domain 1:
0x1000_0000 .. 0x10ff_ffff RAMROM
0x1800_0000 .. 0x1800_0003 GIO interrupt (6 bits valid in 4 bytes)
0x1800_0400 .. 0x1800_0403 GIO sync (6 bits valid in 4 bytes)
0x1800_0800 .. 0x1800_0803 CART interrupt (6 bits valid in 4 bytes)
**************************************************************************/
/*************************************************************************
* RDRAM Memory (Assumes that maximum size is 4 MB)
*/
#define RDRAM_0_START 0x00000000
#define RDRAM_0_END 0x001FFFFF
#define RDRAM_1_START 0x00200000
#define RDRAM_1_END 0x003FFFFF
#define RDRAM_START RDRAM_0_START
#define RDRAM_END RDRAM_1_END
/*************************************************************************
* Address predicates
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
#define IS_RDRAM(x) ((unsigned)(x) >= RDRAM_START && \
(unsigned)(x) < RDRAM_END)
#endif
/*************************************************************************
* RDRAM Registers (0x03f0_0000 .. 0x03ff_ffff)
*/
#define RDRAM_BASE_REG 0x03F00000
#define RDRAM_CONFIG_REG (RDRAM_BASE_REG+0x00)
#define RDRAM_DEVICE_TYPE_REG (RDRAM_BASE_REG+0x00)
#define RDRAM_DEVICE_ID_REG (RDRAM_BASE_REG+0x04)
#define RDRAM_DELAY_REG (RDRAM_BASE_REG+0x08)
#define RDRAM_MODE_REG (RDRAM_BASE_REG+0x0c)
#define RDRAM_REF_INTERVAL_REG (RDRAM_BASE_REG+0x10)
#define RDRAM_REF_ROW_REG (RDRAM_BASE_REG+0x14)
#define RDRAM_RAS_INTERVAL_REG (RDRAM_BASE_REG+0x18)
#define RDRAM_MIN_INTERVAL_REG (RDRAM_BASE_REG+0x1c)
#define RDRAM_ADDR_SELECT_REG (RDRAM_BASE_REG+0x20)
#define RDRAM_DEVICE_MANUF_REG (RDRAM_BASE_REG+0x24)
#define RDRAM_0_DEVICE_ID 0
#define RDRAM_1_DEVICE_ID 1
#define RDRAM_RESET_MODE 0
#define RDRAM_ACTIVE_MODE 1
#define RDRAM_STANDBY_MODE 2
#define RDRAM_LENGTH (2*512*2048)
#define RDRAM_0_BASE_ADDRESS (RDRAM_0_DEVICE_ID*RDRAM_LENGTH)
#define RDRAM_1_BASE_ADDRESS (RDRAM_1_DEVICE_ID*RDRAM_LENGTH)
#define RDRAM_0_CONFIG 0x00000
#define RDRAM_1_CONFIG 0x00400
#define RDRAM_GLOBAL_CONFIG 0x80000
/*************************************************************************
* PIF Physical memory map (total size = 2 KB)
*
* Size Description Mode
* 1FC007FF +-------+-----------------+-----+
* | 64 B | JoyChannel RAM | R/W |
* 1FC007C0 +-------+-----------------+-----+
* |1984 B | Boot ROM | * | * = Reserved
* 1FC00000 +-------+-----------------+-----+
*
*/
#define PIF_ROM_START 0x1FC00000
#define PIF_ROM_END 0x1FC007BF
#define PIF_RAM_START 0x1FC007C0
#define PIF_RAM_END 0x1FC007FF
/*************************************************************************
* Controller channel
* Each game controller channel has 4 error bits that are defined in bit 6-7 of
* the Rx and Tx data size area bytes. Programmers need to clear these bits
* when setting the Tx/Rx size area values for a channel
*/
#define CHNL_ERR_NORESP 0x80 /* Bit 7 (Rx): No response error */
#define CHNL_ERR_OVERRUN 0x40 /* Bit 6 (Rx): Overrun error */
#define CHNL_ERR_FRAME 0x80 /* Bit 7 (Tx): Frame error */
#define CHNL_ERR_COLLISION 0x40 /* Bit 6 (Tx): Collision error */
#define CHNL_ERR_MASK 0xC0 /* Bit 6-7: channel errors */
/*************************************************************************
* External device info
*/
#define DEVICE_TYPE_CART 0 /* ROM cartridge */
#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 */
/* 8-14 are reserved */
/*************************************************************************
* SP Memory
*/
#define SP_DMEM_START 0x04000000 /* read/write */
#define SP_DMEM_END 0x04000FFF
#define SP_IMEM_START 0x04001000 /* read/write */
#define SP_IMEM_END 0x04001FFF
/*************************************************************************
* SP CP0 Registers
*/
#define SP_BASE_REG 0x04040000
/* SP memory address (R/W): [11:0] DMEM/IMEM address; [12] 0=DMEM,1=IMEM */
#define SP_MEM_ADDR_REG (SP_BASE_REG+0x00) /* Master */
/* SP DRAM DMA address (R/W): [23:0] RDRAM address */
#define SP_DRAM_ADDR_REG (SP_BASE_REG+0x04) /* Slave */
/* SP read DMA length (R/W): [11:0] length, [19:12] count, [31:20] skip */
/* direction: I/DMEM <- RDRAM */
#define SP_RD_LEN_REG (SP_BASE_REG+0x08) /* R/W: read len */
/* SP write DMA length (R/W): [11:0] length, [19:12] count, [31:20] skip */
/* direction: I/DMEM -> RDRAM */
#define SP_WR_LEN_REG (SP_BASE_REG+0x0C) /* R/W: write len */
/* SP status (R/W): [14:0] valid bits; see below for write/read mode */
#define SP_STATUS_REG (SP_BASE_REG+0x10)
/* SP DMA full (R): [0] valid bit; dma full */
#define SP_DMA_FULL_REG (SP_BASE_REG+0x14)
/* SP DMA busy (R): [0] valid bit; dma busy */
#define SP_DMA_BUSY_REG (SP_BASE_REG+0x18)
/* SP semaphore (R/W): Read: [0] semaphore flag (set on read) */
/* Write: [] clear semaphore flag */
#define SP_SEMAPHORE_REG (SP_BASE_REG+0x1C)
/* SP PC (R/W): [11:0] program counter */
#define SP_PC_REG 0x04080000
/* SP MEM address: bit 12 specifies if address is IMEM or DMEM */
#define SP_DMA_DMEM 0x0000 /* Bit 12: 0=DMEM, 1=IMEM */
#define SP_DMA_IMEM 0x1000 /* Bit 12: 0=DMEM, 1=IMEM */
/*
* Values to clear/set bit in status reg (SP_STATUS_REG - write)
*/
#define SP_CLR_HALT 0x00001 /* Bit 0: clear halt */
#define SP_SET_HALT 0x00002 /* Bit 1: set halt */
#define SP_CLR_BROKE 0x00004 /* Bit 2: clear broke */
#define SP_CLR_INTR 0x00008 /* Bit 3: clear intr */
#define SP_SET_INTR 0x00010 /* Bit 4: set intr */
#define SP_CLR_SSTEP 0x00020 /* Bit 5: clear sstep */
#define SP_SET_SSTEP 0x00040 /* Bit 6: set sstep */
#define SP_CLR_INTR_BREAK 0x00080 /* Bit 7: clear intr on break */
#define SP_SET_INTR_BREAK 0x00100 /* Bit 8: set intr on break */
#define SP_CLR_SIG0 0x00200 /* Bit 9: clear signal 0 */
#define SP_SET_SIG0 0x00400 /* Bit 10: set signal 0 */
#define SP_CLR_SIG1 0x00800 /* Bit 11: clear signal 1 */
#define SP_SET_SIG1 0x01000 /* Bit 12: set signal 1 */
#define SP_CLR_SIG2 0x02000 /* Bit 13: clear signal 2 */
#define SP_SET_SIG2 0x04000 /* Bit 14: set signal 2 */
#define SP_CLR_SIG3 0x08000 /* Bit 15: clear signal 3 */
#define SP_SET_SIG3 0x10000 /* Bit 16: set signal 3 */
#define SP_CLR_SIG4 0x20000 /* Bit 17: clear signal 4 */
#define SP_SET_SIG4 0x40000 /* Bit 18: set signal 4 */
#define SP_CLR_SIG5 0x80000 /* Bit 19: clear signal 5 */
#define SP_SET_SIG5 0x100000 /* Bit 20: set signal 5 */
#define SP_CLR_SIG6 0x200000 /* Bit 21: clear signal 6 */
#define SP_SET_SIG6 0x400000 /* Bit 22: set signal 6 */
#define SP_CLR_SIG7 0x800000 /* Bit 23: clear signal 7 */
#define SP_SET_SIG7 0x1000000 /* Bit 24: set signal 7 */
/*
* Patterns to interpret status reg (SP_STATUS_REG - read)
*/
#define SP_STATUS_HALT 0x001 /* Bit 0: halt */
#define SP_STATUS_BROKE 0x002 /* Bit 1: broke */
#define SP_STATUS_DMA_BUSY 0x004 /* Bit 2: dma busy */
#define SP_STATUS_DMA_FULL 0x008 /* Bit 3: dma full */
#define SP_STATUS_IO_FULL 0x010 /* Bit 4: io full */
#define SP_STATUS_SSTEP 0x020 /* Bit 5: single step */
#define SP_STATUS_INTR_BREAK 0x040 /* Bit 6: interrupt on break */
#define SP_STATUS_SIG0 0x080 /* Bit 7: signal 0 set */
#define SP_STATUS_SIG1 0x100 /* Bit 8: signal 1 set */
#define SP_STATUS_SIG2 0x200 /* Bit 9: signal 2 set */
#define SP_STATUS_SIG3 0x400 /* Bit 10: signal 3 set */
#define SP_STATUS_SIG4 0x800 /* Bit 11: signal 4 set */
#define SP_STATUS_SIG5 0x1000 /* Bit 12: signal 5 set */
#define SP_STATUS_SIG6 0x2000 /* Bit 13: signal 6 set */
#define SP_STATUS_SIG7 0x4000 /* Bit 14: signal 7 set */
/*
* Use of SIG bits
*/
#define SP_CLR_YIELD SP_CLR_SIG0
#define SP_SET_YIELD SP_SET_SIG0
#define SP_STATUS_YIELD SP_STATUS_SIG0
#define SP_CLR_YIELDED SP_CLR_SIG1
#define SP_SET_YIELDED SP_SET_SIG1
#define SP_STATUS_YIELDED SP_STATUS_SIG1
#define SP_CLR_TASKDONE SP_CLR_SIG2
#define SP_SET_TASKDONE SP_SET_SIG2
#define SP_STATUS_TASKDONE SP_STATUS_SIG2
#define SP_CLR_RSPSIGNAL SP_CLR_SIG3
#define SP_SET_RSPSIGNAL SP_SET_SIG3
#define SP_STATUS_RSPSIGNAL SP_STATUS_SIG3
#define SP_CLR_CPUSIGNAL SP_CLR_SIG4
#define SP_SET_CPUSIGNAL SP_SET_SIG4
#define SP_STATUS_CPUSIGNAL SP_STATUS_SIG4
/* SP IMEM BIST REG (R/W): [6:0] BIST status bits; see below for detail */
#define SP_IBIST_REG 0x04080004
/*
* Patterns to interpret status reg (SP_BIST_REG - write)
*/
#define SP_IBIST_CHECK 0x01 /* Bit 0: BIST check */
#define SP_IBIST_GO 0x02 /* Bit 1: BIST go */
#define SP_IBIST_CLEAR 0x04 /* Bit 2: BIST clear */
/*
* Patterns to interpret status reg (SP_BIST_REG - read)
*/
/* First 2 bits are same as in write mode:
* Bit 0: BIST check; Bit 1: BIST go
*/
#define SP_IBIST_DONE 0x04 /* Bit 2: BIST done */
#define SP_IBIST_FAILED 0x78 /* Bit [6:3]: BIST fail */
/*************************************************************************
* DP Command Registers
*/
#define DPC_BASE_REG 0x04100000
/* DP CMD DMA start (R/W): [23:0] DMEM/RDRAM start address */
#define DPC_START_REG (DPC_BASE_REG+0x00)
/* DP CMD DMA end (R/W): [23:0] DMEM/RDRAM end address */
#define DPC_END_REG (DPC_BASE_REG+0x04)
/* DP CMD DMA end (R): [23:0] DMEM/RDRAM current address */
#define DPC_CURRENT_REG (DPC_BASE_REG+0x08)
/* DP CMD status (R/W): [9:0] valid bits - see below for definitions */
#define DPC_STATUS_REG (DPC_BASE_REG+0x0C)
/* DP clock counter (R): [23:0] clock counter */
#define DPC_CLOCK_REG (DPC_BASE_REG+0x10)
/* DP buffer busy counter (R): [23:0] clock counter */
#define DPC_BUFBUSY_REG (DPC_BASE_REG+0x14)
/* DP pipe busy counter (R): [23:0] clock counter */
#define DPC_PIPEBUSY_REG (DPC_BASE_REG+0x18)
/* DP TMEM load counter (R): [23:0] clock counter */
#define DPC_TMEM_REG (DPC_BASE_REG+0x1C)
/*
* Values to clear/set bit in status reg (DPC_STATUS_REG - write)
*/
#define DPC_CLR_XBUS_DMEM_DMA 0x0001 /* Bit 0: clear xbus_dmem_dma */
#define DPC_SET_XBUS_DMEM_DMA 0x0002 /* Bit 1: set xbus_dmem_dma */
#define DPC_CLR_FREEZE 0x0004 /* Bit 2: clear freeze */
#define DPC_SET_FREEZE 0x0008 /* Bit 3: set freeze */
#define DPC_CLR_FLUSH 0x0010 /* Bit 4: clear flush */
#define DPC_SET_FLUSH 0x0020 /* Bit 5: set flush */
#define DPC_CLR_TMEM_CTR 0x0040 /* Bit 6: clear tmem ctr */
#define DPC_CLR_PIPE_CTR 0x0080 /* Bit 7: clear pipe ctr */
#define DPC_CLR_CMD_CTR 0x0100 /* Bit 8: clear cmd ctr */
#define DPC_CLR_CLOCK_CTR 0x0200 /* Bit 9: clear clock ctr */
/*
* Patterns to interpret status reg (DPC_STATUS_REG - read)
*/
#define DPC_STATUS_XBUS_DMEM_DMA 0x001 /* Bit 0: xbus_dmem_dma */
#define DPC_STATUS_FREEZE 0x002 /* Bit 1: freeze */
#define DPC_STATUS_FLUSH 0x004 /* Bit 2: flush */
/*#define DPC_STATUS_FROZEN 0x008*/ /* Bit 3: frozen */
#define DPC_STATUS_START_GCLK 0x008 /* Bit 3: start gclk */
#define DPC_STATUS_TMEM_BUSY 0x010 /* Bit 4: tmem busy */
#define DPC_STATUS_PIPE_BUSY 0x020 /* Bit 5: pipe busy */
#define DPC_STATUS_CMD_BUSY 0x040 /* Bit 6: cmd busy */
#define DPC_STATUS_CBUF_READY 0x080 /* Bit 7: cbuf ready */
#define DPC_STATUS_DMA_BUSY 0x100 /* Bit 8: dma busy */
#define DPC_STATUS_END_VALID 0x200 /* Bit 9: end valid */
#define DPC_STATUS_START_VALID 0x400 /* Bit 10: start valid */
/*************************************************************************
* DP Span Registers
*/
#define DPS_BASE_REG 0x04200000
/* DP tmem bist (R/W): [10:0] BIST status bits; see below for detail */
#define DPS_TBIST_REG (DPS_BASE_REG+0x00)
/* DP span test mode (R/W): [0] Span buffer test access enable */
#define DPS_TEST_MODE_REG (DPS_BASE_REG+0x04)
/* DP span buffer test address (R/W): [6:0] bits; see below for detail */
#define DPS_BUFTEST_ADDR_REG (DPS_BASE_REG+0x08)
/* DP span buffer test data (R/W): [31:0] span buffer data */
#define DPS_BUFTEST_DATA_REG (DPS_BASE_REG+0x0C)
/*
* Patterns to interpret status reg (DPS_TMEM_BIST_REG - write)
*/
#define DPS_TBIST_CHECK 0x01 /* Bit 0: BIST check */
#define DPS_TBIST_GO 0x02 /* Bit 1: BIST go */
#define DPS_TBIST_CLEAR 0x04 /* Bit 2: BIST clear */
/*
* Patterns to interpret status reg (DPS_TMEM_BIST_REG - read)
*/
/* First 2 bits are same as in write mode:
* Bit 0: BIST check; Bit 1: BIST go
*/
#define DPS_TBIST_DONE 0x004 /* Bit 2: BIST done */
#define DPS_TBIST_FAILED 0x7F8 /* Bit [10:3]: BIST fail */
/*************************************************************************
* MIPS Interface (MI) Registers
*/
#define MI_BASE_REG 0x04300000
/*
* MI init mode (W): [6:0] init length, [7] clear init mode, [8] set init mode
* [9/10] clear/set ebus test mode, [11] clear DP interrupt
* (R): [6:0] init length, [7] init mode, [8] ebus test mode
*/
#define MI_INIT_MODE_REG (MI_BASE_REG+0x00)
#define MI_MODE_REG MI_INIT_MODE_REG
/*
* Values to clear/set bit in mode reg (MI_MODE_REG - write)
*/
#define MI_CLR_INIT 0x0080 /* Bit 7: clear init mode */
#define MI_SET_INIT 0x0100 /* Bit 8: set init mode */
#define MI_CLR_EBUS 0x0200 /* Bit 9: clear ebus test */
#define MI_SET_EBUS 0x0400 /* Bit 10: set ebus test mode */
#define MI_CLR_DP_INTR 0x0800 /* Bit 11: clear dp interrupt */
#define MI_CLR_RDRAM 0x1000 /* Bit 12: clear RDRAM reg */
#define MI_SET_RDRAM 0x2000 /* Bit 13: set RDRAM reg mode */
/*
* Patterns to interpret mode reg (MI_MODE_REG - read)
*/
#define MI_MODE_INIT 0x0080 /* Bit 7: init mode */
#define MI_MODE_EBUS 0x0100 /* Bit 8: ebus test mode */
#define MI_MODE_RDRAM 0x0200 /* Bit 9: RDRAM reg mode */
/* MI version (R): [7:0] io, [15:8] rac, [23:16] rdp, [31:24] rsp */
#define MI_VERSION_REG (MI_BASE_REG+0x04)
#define MI_NOOP_REG MI_VERSION_REG
/* MI interrupt (R): [5:0] valid bits - see below for bit patterns */
#define MI_INTR_REG (MI_BASE_REG+0x08)
/*
* MI interrupt mask (W): [11:0] valid bits - see below for bit patterns
* (R): [5:0] valid bits - see below for bit patterns
*/
#define MI_INTR_MASK_REG (MI_BASE_REG+0x0C)
/*
* The following are values to check for interrupt setting (MI_INTR_REG)
*/
#define MI_INTR_SP 0x01 /* Bit 0: SP intr */
#define MI_INTR_SI 0x02 /* Bit 1: SI intr */
#define MI_INTR_AI 0x04 /* Bit 2: AI intr */
#define MI_INTR_VI 0x08 /* Bit 3: VI intr */
#define MI_INTR_PI 0x10 /* Bit 4: PI intr */
#define MI_INTR_DP 0x20 /* Bit 5: DP intr */
/*
* The following are values to clear/set various interrupt bit mask
* They can be ORed together to manipulate multiple bits
* (MI_INTR_MASK_REG - write)
*/
#define MI_INTR_MASK_CLR_SP 0x0001 /* Bit 0: clear SP mask */
#define MI_INTR_MASK_SET_SP 0x0002 /* Bit 1: set SP mask */
#define MI_INTR_MASK_CLR_SI 0x0004 /* Bit 2: clear SI mask */
#define MI_INTR_MASK_SET_SI 0x0008 /* Bit 3: set SI mask */
#define MI_INTR_MASK_CLR_AI 0x0010 /* Bit 4: clear AI mask */
#define MI_INTR_MASK_SET_AI 0x0020 /* Bit 5: set AI mask */
#define MI_INTR_MASK_CLR_VI 0x0040 /* Bit 6: clear VI mask */
#define MI_INTR_MASK_SET_VI 0x0080 /* Bit 7: set VI mask */
#define MI_INTR_MASK_CLR_PI 0x0100 /* Bit 8: clear PI mask */
#define MI_INTR_MASK_SET_PI 0x0200 /* Bit 9: set PI mask */
#define MI_INTR_MASK_CLR_DP 0x0400 /* Bit 10: clear DP mask */
#define MI_INTR_MASK_SET_DP 0x0800 /* Bit 11: set DP mask */
/*
* The following are values to check for interrupt mask setting
* (MI_INTR_MASK_REG - read)
*/
#define MI_INTR_MASK_SP 0x01 /* Bit 0: SP intr mask */
#define MI_INTR_MASK_SI 0x02 /* Bit 1: SI intr mask */
#define MI_INTR_MASK_AI 0x04 /* Bit 2: AI intr mask */
#define MI_INTR_MASK_VI 0x08 /* Bit 3: VI intr mask */
#define MI_INTR_MASK_PI 0x10 /* Bit 4: PI intr mask */
#define MI_INTR_MASK_DP 0x20 /* Bit 5: DP intr mask */
/*************************************************************************
* Video Interface (VI) Registers
*/
#define VI_BASE_REG 0x04400000
/* VI status/control (R/W): [15-0] valid bits:
* [1:0] = type[1:0] (pixel size)
* 0: blank (no data, no sync)
* 1: reserved
* 2: 5/5/5/3 ("16" bit)
* 3: 8/8/8/8 (32 bit)
* [2] = gamma_dither_enable (normally on, unless "special effect")
* [3] = gamma_enable (normally on, unless MPEG/JPEG)
* [4] = divot_enable (normally on if antialiased, unless decal lines)
* [5] = reserved - always off
* [6] = serrate (always on if interlaced, off if not)
* [7] = reserved - diagnostics only
* [9:8] = anti-alias (aa) mode[1:0]
* 0: aa & resamp (always fetch extra lines)
* 1: aa & resamp (fetch extra lines if needed)
* 2: resamp only (treat as all fully covered)
* 3: neither (replicate pixels, no interpolate)
* [11] = reserved - diagnostics only
* [15:12] = reserved
*
*/
#define VI_STATUS_REG (VI_BASE_REG+0x00)
#define VI_CONTROL_REG VI_STATUS_REG
/* VI origin (R/W): [23:0] frame buffer origin in bytes */
#define VI_ORIGIN_REG (VI_BASE_REG+0x04)
#define VI_DRAM_ADDR_REG VI_ORIGIN_REG
/* VI width (R/W): [11:0] frame buffer line width in pixels */
#define VI_WIDTH_REG (VI_BASE_REG+0x08)
#define VI_H_WIDTH_REG VI_WIDTH_REG
/* VI vertical intr (R/W): [9:0] interrupt when current half-line = V_INTR */
#define VI_INTR_REG (VI_BASE_REG+0x0C)
#define VI_V_INTR_REG VI_INTR_REG
/*
* VI current vertical line (R/W): [9:0] current half line, sampled once per
* line (the lsb of V_CURRENT is constant within a field, and in
* interlaced modes gives the field number - which is constant for non-
* interlaced modes)
* - Any write to this register will clear interrupt line
*/
#define VI_CURRENT_REG (VI_BASE_REG+0x10)
#define VI_V_CURRENT_LINE_REG VI_CURRENT_REG
/*
* VI video timing (R/W): [ 7: 0] horizontal sync width in pixels,
* [15: 8] color burst width in pixels,
* [19:16] vertical sync width in half lines,
* [29:20] start of color burst in pixels from h-sync
*/
#define VI_BURST_REG (VI_BASE_REG+0x14)
#define VI_TIMING_REG VI_BURST_REG
/* VI vertical sync (R/W): [9:0] number of half-lines per field */
#define VI_V_SYNC_REG (VI_BASE_REG+0x18)
/* VI horizontal sync (R/W): [11: 0] total duration of a line in 1/4 pixel
* [20:16] a 5-bit leap pattern used for PAL only
* (h_sync_period)
*/
#define VI_H_SYNC_REG (VI_BASE_REG+0x1C)
/*
* VI horizontal sync leap (R/W): [11: 0] identical to h_sync_period
* [27:16] identical to h_sync_period
*/
#define VI_LEAP_REG (VI_BASE_REG+0x20)
#define VI_H_SYNC_LEAP_REG VI_LEAP_REG
/*
* VI horizontal video (R/W): [ 9: 0] end of active video in screen pixels
* : [25:16] start of active video in screen pixels
*/
#define VI_H_START_REG (VI_BASE_REG+0x24)
#define VI_H_VIDEO_REG VI_H_START_REG
/*
* VI vertical video (R/W): [ 9: 0] end of active video in screen half-lines
* : [25:16] start of active video in screen half-lines
*/
#define VI_V_START_REG (VI_BASE_REG+0x28)
#define VI_V_VIDEO_REG VI_V_START_REG
/*
* VI vertical burst (R/W): [ 9: 0] end of color burst enable in half-lines
* : [25:16] start of color burst enable in half-lines
*/
#define VI_V_BURST_REG (VI_BASE_REG+0x2C)
/* VI x-scale (R/W): [11: 0] 1/horizontal scale up factor (2.10 format)
* [27:16] horizontal subpixel offset (2.10 format)
*/
#define VI_X_SCALE_REG (VI_BASE_REG+0x30)
/* VI y-scale (R/W): [11: 0] 1/vertical scale up factor (2.10 format)
* [27:16] vertical subpixel offset (2.10 format)
*/
#define VI_Y_SCALE_REG (VI_BASE_REG+0x34)
/*
* Patterns to interpret VI_CONTROL_REG
*/
#define VI_CTRL_TYPE_16 0x00002 /* Bit [1:0] pixel size: 16 bit */
#define VI_CTRL_TYPE_32 0x00003 /* Bit [1:0] pixel size: 32 bit */
#define VI_CTRL_GAMMA_DITHER_ON 0x00004 /* Bit 2: default = on */
#define VI_CTRL_GAMMA_ON 0x00008 /* Bit 3: default = on */
#define VI_CTRL_DIVOT_ON 0x00010 /* Bit 4: default = on */
#define VI_CTRL_SERRATE_ON 0x00040 /* Bit 6: on if interlaced */
#define VI_CTRL_ANTIALIAS_MASK 0x00300 /* Bit [9:8] anti-alias mode */
#define VI_CTRL_DITHER_FILTER_ON 0x10000 /* Bit 16: dither-filter mode */
/*
* Possible video clocks (NTSC or PAL)
*/
#define VI_NTSC_CLOCK 48681812 /* Hz = 48.681812 MHz */
#define VI_PAL_CLOCK 49656530 /* Hz = 49.656530 MHz */
#define VI_MPAL_CLOCK 48628316 /* Hz = 48.628316 MHz */
/*************************************************************************
* Audio Interface (AI) Registers
*
* The address and length registers are double buffered; that is, they
* can be written twice before becoming full.
* The address must be written before the length.
*/
#define AI_BASE_REG 0x04500000
/* AI DRAM address (W): [23:0] starting RDRAM address (8B-aligned) */
#define AI_DRAM_ADDR_REG (AI_BASE_REG+0x00) /* R0: DRAM address */
/* AI length (R/W): [14:0] transfer length (v1.0) - Bottom 3 bits are ignored */
/* [17:0] transfer length (v2.0) - Bottom 3 bits are ignored */
#define AI_LEN_REG (AI_BASE_REG+0x04) /* R1: Length */
/* AI control (W): [0] DMA enable - if LSB == 1, DMA is enabled */
#define AI_CONTROL_REG (AI_BASE_REG+0x08) /* R2: DMA Control */
/*
* AI status (R): [31]/[0] ai_full (addr & len buffer full), [30] ai_busy
* Note that a 1->0 transition in ai_full will set interrupt
* (W): clear audio interrupt
*/
#define AI_STATUS_REG (AI_BASE_REG+0x0C) /* R3: Status */
/*
* AI DAC sample period register (W): [13:0] dac rate
* - vid_clock/(dperiod + 1) is the DAC sample rate
* - (dperiod + 1) >= 66 * (aclockhp + 1) must be true
*/
#define AI_DACRATE_REG (AI_BASE_REG+0x10) /* R4: DAC rate 14-lsb*/
/*
* AI bit rate (W): [3:0] bit rate (abus clock half period register - aclockhp)
* - vid_clock/(2 * (aclockhp + 1)) is the DAC clock rate
* - The abus clock stops if aclockhp is zero
*/
#define AI_BITRATE_REG (AI_BASE_REG+0x14) /* R5: Bit rate 4-lsb */
/* Value for control register */
#define AI_CONTROL_DMA_ON 0x01 /* LSB = 1: DMA enable*/
#define AI_CONTROL_DMA_OFF 0x00 /* LSB = 1: DMA enable*/
/* Value for status register */
#define AI_STATUS_FIFO_FULL 0x80000000 /* Bit 31: full */
#define AI_STATUS_DMA_BUSY 0x40000000 /* Bit 30: busy */
/* DAC rate = video clock / audio frequency
* - DAC rate >= (66 * Bit rate) must be true
*/
#define AI_MAX_DAC_RATE 16384 /* 14-bit+1 */
#define AI_MIN_DAC_RATE 132
/* Bit rate <= (DAC rate / 66) */
#define AI_MAX_BIT_RATE 16 /* 4-bit+1 */
#define AI_MIN_BIT_RATE 2
/*
* Maximum and minimum values for audio frequency based on video clocks
* max frequency = (video clock / min dac rate)
* min frequency = (video clock / max dac rate)
*/
#define AI_NTSC_MAX_FREQ 368000 /* 368 KHz */
#define AI_NTSC_MIN_FREQ 3000 /* 3 KHz ~ 2971 Hz */
#define AI_PAL_MAX_FREQ 376000 /* 376 KHz */
#define AI_PAL_MIN_FREQ 3050 /* 3 KHz ~ 3031 Hz */
#define AI_MPAL_MAX_FREQ 368000 /* 368 KHz */
#define AI_MPAL_MIN_FREQ 3000 /* 3 KHz ~ 2968 Hz */
/*************************************************************************
* Peripheral Interface (PI) Registers
*/
#define PI_BASE_REG 0x04600000
/* PI DRAM address (R/W): [23:0] starting RDRAM address */
#define PI_DRAM_ADDR_REG (PI_BASE_REG+0x00) /* DRAM address */
/* PI pbus (cartridge) address (R/W): [31:0] starting AD16 address */
#define PI_CART_ADDR_REG (PI_BASE_REG+0x04)
/* PI read length (R/W): [23:0] read data length */
#define PI_RD_LEN_REG (PI_BASE_REG+0x08)
/* PI write length (R/W): [23:0] write data length */
#define PI_WR_LEN_REG (PI_BASE_REG+0x0C)
/*
* PI status (R): [0] DMA busy, [1] IO busy, [2], error
* (W): [0] reset controller (and abort current op), [1] clear intr
*/
#define PI_STATUS_REG (PI_BASE_REG+0x10)
/* PI dom1 latency (R/W): [7:0] domain 1 device latency */
#define PI_BSD_DOM1_LAT_REG (PI_BASE_REG+0x14)
/* PI dom1 pulse width (R/W): [7:0] domain 1 device R/W strobe pulse width */
#define PI_BSD_DOM1_PWD_REG (PI_BASE_REG+0x18)
/* PI dom1 page size (R/W): [3:0] domain 1 device page size */
#define PI_BSD_DOM1_PGS_REG (PI_BASE_REG+0x1C) /* page size */
/* PI dom1 release (R/W): [1:0] domain 1 device R/W release duration */
#define PI_BSD_DOM1_RLS_REG (PI_BASE_REG+0x20)
/* PI dom2 latency (R/W): [7:0] domain 2 device latency */
#define PI_BSD_DOM2_LAT_REG (PI_BASE_REG+0x24) /* Domain 2 latency */
/* PI dom2 pulse width (R/W): [7:0] domain 2 device R/W strobe pulse width */
#define PI_BSD_DOM2_PWD_REG (PI_BASE_REG+0x28) /* pulse width */
/* PI dom2 page size (R/W): [3:0] domain 2 device page size */
#define PI_BSD_DOM2_PGS_REG (PI_BASE_REG+0x2C) /* page size */
/* PI dom2 release (R/W): [1:0] domain 2 device R/W release duration */
#define PI_BSD_DOM2_RLS_REG (PI_BASE_REG+0x30) /* release duration */
#define PI_DOMAIN1_REG PI_BSD_DOM1_LAT_REG
#define PI_DOMAIN2_REG PI_BSD_DOM2_LAT_REG
#define PI_DOM_LAT_OFS 0x00
#define PI_DOM_PWD_OFS 0x04
#define PI_DOM_PGS_OFS 0x08
#define PI_DOM_RLS_OFS 0x0C
/*
* PI status register has 3 bits active when read from (PI_STATUS_REG - read)
* Bit 0: DMA busy - set when DMA is in progress
* Bit 1: IO busy - set when IO is in progress
* Bit 2: Error - set when CPU issues IO request while DMA is busy
*/
#define PI_STATUS_ERROR 0x04
#define PI_STATUS_IO_BUSY 0x02
#define PI_STATUS_DMA_BUSY 0x01
/* PI status register has 2 bits active when written to:
* Bit 0: When set, reset PIC
* Bit 1: When set, clear interrupt flag
* The values of the two bits can be ORed together to both reset PIC and
* clear interrupt at the same time.
*
* Note:
* - The PIC does generate an interrupt at the end of each DMA. CPU
* needs to clear the interrupt flag explicitly (from an interrupt
* handler) by writing into the STATUS register with bit 1 set.
*
* - When a DMA completes, the interrupt flag is set. CPU can issue
* another request even while the interrupt flag is set (as long as
* PIC is idle). However, it is the CPU's responsibility for
* maintaining accurate correspondence between DMA completions and
* interrupts.
*
* - When PIC is reset, if PIC happens to be busy, an interrupt will
* be generated as PIC returns to idle. Otherwise, no interrupt will
* be generated and PIC remains idle.
*/
/*
* Values to clear interrupt/reset PIC (PI_STATUS_REG - write)
*/
#define PI_STATUS_RESET 0x01
#define PI_SET_RESET PI_STATUS_RESET
#define PI_STATUS_CLR_INTR 0x02
#define PI_CLR_INTR PI_STATUS_CLR_INTR
#define PI_DMA_BUFFER_SIZE 128
#define PI_DOM1_ADDR1 0x06000000 /* to 0x07FFFFFF */
#define PI_DOM1_ADDR2 0x10000000 /* to 0x1FBFFFFF */
#define PI_DOM1_ADDR3 0x1FD00000 /* to 0x7FFFFFFF */
#define PI_DOM2_ADDR1 0x05000000 /* to 0x05FFFFFF */
#define PI_DOM2_ADDR2 0x08000000 /* to 0x0FFFFFFF */
/*************************************************************************
* RDRAM Interface (RI) Registers
*/
#define RI_BASE_REG 0x04700000
/* RI mode (R/W): [1:0] operating mode, [2] stop T active, [3] stop R active */
#define RI_MODE_REG (RI_BASE_REG+0x00)
/* RI config (R/W): [5:0] current control input, [6] current control enable */
#define RI_CONFIG_REG (RI_BASE_REG+0x04)
/* RI current load (W): [] any write updates current control register */
#define RI_CURRENT_LOAD_REG (RI_BASE_REG+0x08)
/* RI select (R/W): [2:0] receive select, [2:0] transmit select */
#define RI_SELECT_REG (RI_BASE_REG+0x0C)
/* RI refresh (R/W): [7:0] clean refresh delay, [15:8] dirty refresh delay,
* [16] refresh bank, [17] refresh enable
* [18] refresh optimize
*/
#define RI_REFRESH_REG (RI_BASE_REG+0x10)
#define RI_COUNT_REG RI_REFRESH_REG
/* RI latency (R/W): [3:0] DMA latency/overlap */
#define RI_LATENCY_REG (RI_BASE_REG+0x14)
/* RI error (R): [0] nack error, [1] ack error */
#define RI_RERROR_REG (RI_BASE_REG+0x18)
/* RI error (W): [] any write clears all error bits */
#define RI_WERROR_REG (RI_BASE_REG+0x1C)
/*************************************************************************
* Serial Interface (SI) Registers
*/
#define SI_BASE_REG 0x04800000
/* SI DRAM address (R/W): [23:0] starting RDRAM address */
#define SI_DRAM_ADDR_REG (SI_BASE_REG+0x00) /* R0: DRAM address */
/* SI address read 64B (W): [] any write causes a 64B DMA write */
#define SI_PIF_ADDR_RD64B_REG (SI_BASE_REG+0x04) /* R1: 64B PIF->DRAM */
/* Address SI_BASE_REG + (0x08, 0x0c, 0x14) are reserved */
/* SI address write 64B (W): [] any write causes a 64B DMA read */
#define SI_PIF_ADDR_WR64B_REG (SI_BASE_REG+0x10) /* R4: 64B DRAM->PIF */
/*
* SI status (W): [] any write clears interrupt
* (R): [0] DMA busy, [1] IO read busy, [2] reserved
* [3] DMA error, [12] interrupt
*/
#define SI_STATUS_REG (SI_BASE_REG+0x18) /* R6: Status */
/* SI status register has the following bits active:
* 0: DMA busy - set when DMA is in progress
* 1: IO busy - set when IO access is in progress
* 3: DMA error - set when there are overlapping DMA requests
* 12: Interrupt - Interrupt set
*/
#define SI_STATUS_DMA_BUSY 0x0001
#define SI_STATUS_RD_BUSY 0x0002
#define SI_STATUS_DMA_ERROR 0x0008
#define SI_STATUS_INTERRUPT 0x1000
/*************************************************************************
* Development Board GIO Control Registers
*/
#define GIO_BASE_REG 0x18000000
/* Game to Host Interrupt */
#define GIO_GIO_INTR_REG (GIO_BASE_REG+0x000)
/* Game to Host SYNC */
#define GIO_GIO_SYNC_REG (GIO_BASE_REG+0x400)
/* Host to Game Interrupt */
#define GIO_CART_INTR_REG (GIO_BASE_REG+0x800)
/*************************************************************************
* Common macros
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
#define IO_READ(addr) (*(vu32 *)PHYS_TO_K1(addr))
#define IO_WRITE(addr,data) (*(vu32 *)PHYS_TO_K1(addr)=(u32)(data))
#define RCP_STAT_PRINT \
rmonPrintf("current=%x start=%x end=%x dpstat=%x spstat=%x\n", \
IO_READ(DPC_CURRENT_REG), \
IO_READ(DPC_START_REG), \
IO_READ(DPC_END_REG), \
IO_READ(DPC_STATUS_REG), \
IO_READ(SP_STATUS_REG))
#endif
#endif /* _RCP_H_ */

93
include/2.0L/PR/rdb.h Normal file
View File

@@ -0,0 +1,93 @@
/**************************************************************************
*
* $Revision: 1.6 $
* $Date: 1997/02/11 08:29:31 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rdb.h,v $
*
**************************************************************************/
#ifndef _RDB_H
#define _RDB_H
/* U64 side address */
#define RDB_BASE_REG 0xc0000000
#define RDB_WRITE_INTR_REG (RDB_BASE_REG + 0x8)
#define RDB_READ_INTR_REG (RDB_BASE_REG + 0xc)
#define RDB_BASE_VIRTUAL_ADDR 0x80000000
/* packet type Have six bits, so can have up to 63 types */
#define RDB_TYPE_INVALID 0
#define RDB_TYPE_GtoH_PRINT 1
#define RDB_TYPE_GtoH_FAULT 2
#define RDB_TYPE_GtoH_LOG_CT 3
#define RDB_TYPE_GtoH_LOG 4
#define RDB_TYPE_GtoH_READY_FOR_DATA 5
#define RDB_TYPE_GtoH_DATA_CT 6
#define RDB_TYPE_GtoH_DATA 7
#define RDB_TYPE_GtoH_DEBUG 8
#define RDB_TYPE_GtoH_RAMROM 9
#define RDB_TYPE_GtoH_DEBUG_DONE 10
#define RDB_TYPE_GtoH_DEBUG_READY 11
#define RDB_TYPE_GtoH_KDEBUG 12
#define RDB_TYPE_GtoH_PROF_DATA 22
#define RDB_TYPE_HtoG_LOG_DONE 13
#define RDB_TYPE_HtoG_DEBUG 14
#define RDB_TYPE_HtoG_DEBUG_CT 15
#define RDB_TYPE_HtoG_DATA 16
#define RDB_TYPE_HtoG_DATA_DONE 17
#define RDB_TYPE_HtoG_REQ_RAMROM 18
#define RDB_TYPE_HtoG_FREE_RAMROM 19
#define RDB_TYPE_HtoG_KDEBUG 20
#define RDB_TYPE_HtoG_PROF_SIGNAL 21
#define RDB_PROF_ACK_SIG 1
#define RDB_PROF_FLUSH_SIG 2
#define PROF_BLOCK_SIZE 2048
#define RDB_LOG_MAX_BLOCK_SIZE 0x8000
#define RDB_DATA_MAX_BLOCK_SIZE 0x8000
/* GIO side address */
#define GIO_RDB_BASE_REG 0xbf480000
#define GIO_RDB_WRITE_INTR_REG (GIO_RDB_BASE_REG + 0x8)
#define GIO_RDB_READ_INTR_REG (GIO_RDB_BASE_REG + 0xc)
/* minor device number */
#define GIO_RDB_PRINT_MINOR 1
#define GIO_RDB_DEBUG_MINOR 2
/* interrupt bit */
#define GIO_RDB_WRITE_INTR_BIT 0x80000000
#define GIO_RDB_READ_INTR_BIT 0x40000000
/* debug command */
#define DEBUG_COMMAND_NULL 0
#define DEBUG_COMMAND_MEMORY 1
#define DEBUG_COMMAND_REGISTER 2
#define DEBUG_COMMAND_INVALID 255
/* debug state */
#define DEBUG_STATE_NULL 0
#define DEBUG_STATE_RECEIVE 1
#define DEBUG_STATE_INVALID 255
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Structure for debug port */
typedef struct {
unsigned type : 6; /* 0: invalid, 1: print, 2: debug */
unsigned length : 2; /* 1, 2, or 3 */
char buf[3]; /* character buffer */
} rdbPacket;
extern unsigned int __osRdbWriteOK;
extern unsigned int __osRdbSendMessage;
#endif /* _LANGUAGE_C */
#endif /* !_RDB_H */

123
include/2.0L/PR/region.h Normal file
View File

@@ -0,0 +1,123 @@
/**************************************************************************
* *
* 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. *
* *
**************************************************************************/
/**************************************************************************
*
* Module: region.h
*
* $Revision: 1.8 $
* $Date: 1997/11/26 00:30:56 $
* $Author: mitu $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/region.h,v $
*
* Description:
* This file contains macros and structure definitions for the region
* library.
*
**************************************************************************/
#ifndef _REGION_H_
#define _REGION_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
/***************************************
*
* Global defines
*
*/
/* Alignment sizes */
#define ALIGNSZ (sizeof(long long)) /* 8 bytes */
#define ALIGNOFFST (ALIGNSZ-1)
/* size for storing index to free buffer */
#define BUF_CTRL_SIZE ALIGNSZ
/* Max bufcount = 32K */
#define MAX_BUFCOUNT 0x8000
/* code for last free buffer */
#define BUF_FREE_WO_NEXT 0x8000
/*
* Global defines for alignment size (default is 8-byte alignment)
*/
#define OS_RG_ALIGN_2B 2 /* 2 bytes = 16-bit alignment */
#define OS_RG_ALIGN_4B 4 /* 4 bytes = 32-bit alignment */
#define OS_RG_ALIGN_8B 8 /* 8 bytes = 64-bit alignment */
#define OS_RG_ALIGN_16B 16 /* 16 bytes = 128-bit alignment */
#define OS_RG_ALIGN_DEFAULT OS_RG_ALIGN_8B
/***************************************
*
* Macro definitions
*
*/
/* Perform alignment on input 's' */
#define ALIGN(s, align) (((u32)(s) + ((align)-1)) & ~((align)-1))
/***************************************
*
* Typedefs & structure definitions
*
*/
/*
* Structure for region header/control area
*/
typedef struct _Region_s {
u8 *r_startBufferAddress; /* start address to data buffer */
u8 *r_endAddress; /* end address of region */
s32 r_bufferSize; /* size of buffers for this region */
s32 r_bufferCount; /* up to 32K entries; MSB is used for
setting end-of-list/used */
u16 r_freeList; /* point to array index of first
available memory buffer */
u16 r_alignSize; /* alignment size (# of bytes) */
} OSRegion;
/*
* Macro to simplify accessing region header structure
*/
#define RP(x) rp->r_##x
/***************************************
*
* Function prototypes
*
*/
extern void *osCreateRegion(void *, u32, u32, u32);
extern void *osMalloc(void *);
extern void osFree(void *, void *);
extern s32 osGetRegionBufCount(void *);
extern s32 osGetRegionBufSize(void *);
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* _REGION_H_ */

39
include/2.0L/PR/rmon.h Normal file
View File

@@ -0,0 +1,39 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.6 $
* $Date: 1997/02/11 08:30:08 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rmon.h,v $
*
**************************************************************************/
#ifndef _RMON_H_
#define _RMON_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#define RMON_DBG_BUF_SIZE 2048
#define RMON_STACKSIZE 0x1000
extern void rmonMain( void * );
extern void rmonPrintf( const char *, ... );
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_H */

115
include/2.0L/PR/sched.h Normal file
View File

@@ -0,0 +1,115 @@
/*====================================================================
* sched.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.
*====================================================================*/
/**************************************************************************
*
* $Revision: 1.7 $
* $Date: 1997/02/11 08:32:02 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sched.h,v $
*
**************************************************************************/
#ifndef __sched__
#define __sched__
#include <ultra64.h>
#define OS_SC_STACKSIZE 0x2000
#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_MAX_MESGS 8
typedef struct {
short type;
char misc[30];
} OSScMsg;
typedef struct OSScTask_s {
struct OSScTask_s *next; /* note: this must be first */
u32 state;
u32 flags;
void *framebuffer; /* used by graphics tasks */
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 flags:
*/
#define OS_SC_NEEDS_RDP 0x0001 /* uses the RDP */
#define OS_SC_NEEDS_RSP 0x0002 /* uses the RSP */
#define OS_SC_DRAM_DLIST 0x0004 /* SP & DP communicate through DRAM */
#define OS_SC_PARALLEL_TASK 0x0010 /* must be first gfx task on list */
#define OS_SC_LAST_TASK 0x0020 /* last task in queue for frame */
#define OS_SC_SWAPBUFFER 0x0040 /* swapbuffers when gfx task done */
#define OS_SC_RCP_MASK 0x0003 /* mask for needs bits */
#define OS_SC_TYPE_MASK 0x0007 /* complete type mask */
/*
* OSScClient:
*
* Data structure used by threads that wish to communicate to the
* scheduling thread
*
*/
typedef struct SCClient_s {
struct SCClient_s *next; /* next client in the list */
OSMesgQueue *msgQ; /* where to send the frame msg */
} OSScClient;
typedef struct {
OSScMsg retraceMsg;
OSScMsg prenmiMsg;
OSMesgQueue interruptQ;
OSMesg intBuf[OS_SC_MAX_MESGS];
OSMesgQueue cmdQ;
OSMesg cmdMsgBuf[OS_SC_MAX_MESGS];
OSThread thread;
OSScClient *clientList;
OSScTask *audioListHead;
OSScTask *gfxListHead;
OSScTask *audioListTail;
OSScTask *gfxListTail;
OSScTask *curRSPTask;
OSScTask *curRDPTask;
u32 frameCount;
s32 doAudio;
} OSSched;
void osCreateScheduler(OSSched *s, void *stack, OSPri priority,
u8 mode, u8 numFields);
void osScAddClient(OSSched *s, OSScClient *c, OSMesgQueue *msgQ);
void osScRemoveClient(OSSched *s, OSScClient *c);
OSMesgQueue *osScGetCmdQ(OSSched *s);
#endif

196
include/2.0L/PR/sp.h Normal file
View File

@@ -0,0 +1,196 @@
/**************************************************************************
* *
* 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. *
* *
**************************************************************************/
/**************************************************************************
*
* Sprite library include file
*
* $Revision: 1.16 $
* $Date: 1998/04/17 05:03:46 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sp.h,v $
*
**************************************************************************/
#ifndef _SP_H_
#define _SP_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/mbi.h>
#include <PR/ultratypes.h>
struct bitmap {
s16 width; /* Size across to draw in texels */
/* Done if width = 0 */
s16 width_img; /* Size across of bitmap in texels */
/* Done if width = 0 */
s16 s; /* Horizontal offset into bitmap */
/* if (s > width), then load only! */
s16 t; /* Vertical offset into base */
void *buf; /* Pointer to bitmap data */
/* Don't re-load if new buf */
/* is the same as the old one */
/* Skip if NULL */
s16 actualHeight; /* True Height of this bitmap piece */
s16 LUToffset; /* LUT base index */
};
typedef struct bitmap Bitmap;
struct sprite {
s16 x,y; /* Target position */
s16 width, height; /* Target size */
f32 scalex, scaley; /* Texel to Pixel scale factor */
s16 expx, expy; /* Explosion spacing */
u16 attr; /* Attribute Flags */
s16 zdepth; /* Z Depth */
u8 red; /* Red component */
u8 green; /* Green component */
u8 blue; /* Blue component */
u8 alpha; /* Alpha component */
s16 startTLUT; /* Lookup Table Entry Starting index */
s16 nTLUT; /* Total number of Lookup Table Entries */
int *LUT; /* Pointer to Lookup Table */
s16 istart; /* Starting bitmap index */
s16 istep; /* Bitmaps index step (see SP_INCY) */
/* if 0, then variable width bitmaps */
s16 nbitmaps; /* Total number of bitmaps */
s16 ndisplist; /* Total number of display-list words */
s16 bmheight; /* Bitmap Texel height (Used) */
s16 bmHreal; /* Bitmap Texel height (Real) */
u8 bmfmt; /* Bitmap Format */
u8 bmsiz; /* Bitmap Texel Size */
Bitmap *bitmap; /* Pointer to first bitmap */
Gfx *rsp_dl; /* Pointer to RSP display list */
Gfx *rsp_dl_next; /* Pointer to next RSP display entry */
s16 frac_s, /* Fractional Texture offsets */
frac_t; /* These have 5 fraction bits */
};
typedef struct sprite Sprite;
/*
* DANGER!
* This is bad programming. Where the *heck* do these numbers come
* from?
*
* They are obviously 'maximums' from the sprite library, but since
* the sprite library is built on top of gbi.h, which includes macros
* that decode into multiple macros, etc., it is nearly impossible to
* know what these maximums should be.
*
* Worse, there are some gbi macros (texture alignment mostly) that
* decode into *many* macros, so if we choose that as a maximum, we
* are wasting TONS of space...
*
* These numbers work for "reasonable" sprite library usage, and
* there is an assert() in the library to detect when they aren't
* enough. (use the debug version)
*/
#define DL_BM_OVERHEAD (12)
#define DL_SPRITE_OVERHEAD (24)
#define NUM_DL(nb) ((nb)*DL_BM_OVERHEAD +DL_SPRITE_OVERHEAD)
/*
* Misc constants
*/
#ifndef NULL
#define NULL 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/*
* For sprite->attr
*/
#define SP_TRANSPARENT 0x00000001
#define SP_CUTOUT 0x00000002
#define SP_HIDDEN 0x00000004
#define SP_Z 0x00000008
#define SP_SCALE 0x00000010
#define SP_FASTCOPY 0x00000020
#define SP_OVERLAP 0x00000040
#define SP_TEXSHIFT 0x00000080
#define SP_FRACPOS 0x00000100
#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
*/
void spSetAttribute (Sprite *sp, s32 attr);
void spClearAttribute (Sprite *sp, s32 attr);
void spMove (Sprite *sp, s32 x, s32 y);
void spScale (Sprite *sp, f32 sx, f32 sy);
void spSetZ (Sprite *sp, s32 z );
void spColor (Sprite *sp, u8 red, u8 green, u8 blue, u8 alpha);
Gfx *spDraw (Sprite *sp);
void spInit( Gfx **glistp );
void spScissor( s32 xmin, s32 xmax, s32 ymin, s32 ymax );
void spFinish( Gfx **glistp );
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* _SP_H_ */

201
include/2.0L/PR/sptask.h Normal file
View File

@@ -0,0 +1,201 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.9 $
* $Date: 1998/03/05 06:40:29 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sptask.h,v $
*
**************************************************************************/
#ifndef _SPTASK_H_
#define _SPTASK_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
/*
* Task List Structure.
*
* Things an app might pass to the SP via the task list.
* Not every task ucode would need/use every field, but
*
* - type (audio, gfx, video, ...)
* - flags
* - wait for DP to drain before running new task
* - SEE BIT DEFINITIONS UNDER "Task Flags field"
* - pointer to boot ucode
* - size of boot ucode
* - pointer to ucode
* - size of ucode
* - pointer to initial DMEM data
* - size of initial DMEM data
* - pointer to DRAM stack
* - size of DRAM stack (max)
* - pointer to output buffer
* - pointer to store output buffer length
* - generic data pointer (for display list, etc.)
* - generic data length (for display list, etc.)
* - pointer to buffer where to store saved DMEM (in yield case)
* - size of buffer to store saved DMEM.
*
* IMPORTANT!!! Watch alignment issues.
*
* IMPORTANT!!! Watch data cache issues. The RCP may write data into the
* dram_stack, output_buff, output_buff_size, and the yield_data_ptr areas.
* These buffers should be cache aligned and use the entire line (16 bytes) to
* avoid corruption by writebacks by the CPU (cache tearing).
*
* IMPORTANT!!! all addresses are virtual addresses. Library does
* any necessary translation.
*
*/
typedef struct {
u32 type;
u32 flags;
u64 *ucode_boot;
u32 ucode_boot_size;
u64 *ucode;
u32 ucode_size;
u64 *ucode_data;
u32 ucode_data_size;
u64 *dram_stack;
u32 dram_stack_size;
u64 *output_buff;
u64 *output_buff_size;
u64 *data_ptr;
u32 data_size;
u64 *yield_data_ptr;
u32 yield_data_size;
} OSTask_t;
typedef union {
OSTask_t t;
long long int force_structure_alignment;
} OSTask;
typedef u32 OSYieldResult;
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_ASSEMBLY
/*
* For the RSP ucode:
* offsets into the task structure
*/
#include <PR/sptaskoff.h>
#endif
/*
* Task Flags field
*/
#define OS_TASK_YIELDED 0x0001
#define OS_TASK_DP_WAIT 0x0002
#define OS_TASK_LOADABLE 0x0004
#define OS_TASK_SP_ONLY 0x0008
#define OS_TASK_USR0 0x0010
#define OS_TASK_USR1 0x0020
#define OS_TASK_USR2 0x0040
#define OS_TASK_USR3 0x0080
/*
* 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)||defined(F3DEX_GBI_2))
#define OS_YIELD_DATA_SIZE 0xc00
#else
#define OS_YIELD_DATA_SIZE 0x900
#endif
#define OS_YIELD_AUDIO_SIZE 0x400
/**************************************************************************
*
* Global definitions
*
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/*
* this macro simulates atomic action.
*/
#define osSpTaskStart(tp) \
{ \
osSpTaskLoad((tp)); \
osSpTaskStartGo((tp)); \
}
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/*
* break this up into two steps for debugging.
*/
extern void osSpTaskLoad(OSTask *tp);
extern void osSpTaskStartGo(OSTask *tp);
extern void osSpTaskYield(void);
extern OSYieldResult osSpTaskYielded(OSTask *tp);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_SPTASK_H */

192
include/2.0L/PR/ucode.h Normal file
View File

@@ -0,0 +1,192 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.15 $
* $Date: 1998/03/31 07:58:57 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ucode.h,v $
*
**************************************************************************/
#ifndef _UCODE_H_
#define _UCODE_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/*
* This is the recommended size of the SP DRAM stack area, used
* by the graphics ucode. This stack is used primarily for the
* matrix stack, so it needs to be AT LEAST (10 * 64bytes) in size.
*/
#define SP_DRAM_STACK_SIZE8 (1024)
#define SP_DRAM_STACK_SIZE64 (SP_DRAM_STACK_SIZE8 >> 3)
/*
* This is the size of the IMEM, which is also the size of the
* graphics microcode. (other ucode might be less)
* This value is used in apps to tell the OS how much ucode to
* load.
*/
#define SP_UCODE_SIZE 4096
/*
* This is 1/2 the size of DMEM, which is the maximum amount of
* initialized DMEM data any of the ucode tasks need to start up.
* This value is dependent on all of the task ucodes, and is therefore
* fixed per release.
*/
#define SP_UCODE_DATA_SIZE 2048
/**************************************************************************
*
* Extern variables
*
*/
/*
* Symbols generated by "rsp2elf", included by "makerom" that indicate
* the location and size of the SP microcode objects. The ucode objects
* are loaded as part of the codesegment (arbitrary, could do other
* ways)
*
*/
/* standard boot ucode: */
extern long long int rspbootTextStart[], rspbootTextEnd[];
/* standard 3D ucode: */
extern long long int gspFast3DTextStart[], gspFast3DTextEnd[];
extern long long int gspFast3DDataStart[], gspFast3DDataEnd[];
/* 3D ucode with output to DRAM: */
extern long long int gspFast3D_dramTextStart[], gspFast3D_dramTextEnd[];
extern long long int gspFast3D_dramDataStart[], gspFast3D_dramDataEnd[];
/* 3D ucode with output through DRAM FIFO to RDP: */
extern long long int gspFast3D_fifoTextStart[], gspFast3D_fifoTextEnd[];
extern long long int gspFast3D_fifoDataStart[], gspFast3D_fifoDataEnd[];
/* 3D ucode without nearclip: */
extern long long int gspF3DNoNTextStart[], gspF3DNoNTextEnd[];
extern long long int gspF3DNoNDataStart[], gspF3DNoNDataEnd[];
/* 3D ucode without nearclip with output to DRAM: */
extern long long int gspF3DNoN_dramTextStart[];
extern long long int gspF3DNoN_dramTextEnd[];
extern long long int gspF3DNoN_dramDataStart[];
extern long long int gspF3DNoN_dramDataEnd[];
/* 3D ucode without nearclip with output through DRAM FIFO to RDP: */
extern long long int gspF3DNoN_fifoTextStart[];
extern long long int gspF3DNoN_fifoTextEnd[];
extern long long int gspF3DNoN_fifoDataStart[];
extern long long int gspF3DNoN_fifoDataEnd[];
/* 3D line ucode: */
extern long long int gspLine3DTextStart[], gspLine3DTextEnd[];
extern long long int gspLine3DDataStart[], gspLine3DDataEnd[];
/* 3D line ucode with output to DRAM: */
extern long long int gspLine3D_dramTextStart[], gspLine3D_dramTextEnd[];
extern long long int gspLine3D_dramDataStart[], gspLine3D_dramDataEnd[];
/* 3D line ucode with output through DRAM FIFO to RDP: */
extern long long int gspLine3D_fifoTextStart[], gspLine3D_fifoTextEnd[];
extern long long int gspLine3D_fifoDataStart[], gspLine3D_fifoDataEnd[];
/* 2D sprite ucode: */
extern long long int gspSprite2DTextStart[], gspSprite2DTextEnd[];
extern long long int gspSprite2DDataStart[], gspSprite2DDataEnd[];
/* 2D sprite ucode with output to DRAM: */
extern long long int gspSprite2D_dramTextStart[], gspSprite2D_dramTextEnd[];
extern long long int gspSprite2D_dramDataStart[], gspSprite2D_dramDataEnd[];
/* 2D sprite ucode with output through DRAM FIFO to RDP: */
extern long long int gspSprite2D_fifoTextStart[], gspSprite2D_fifoTextEnd[];
extern long long int gspSprite2D_fifoDataStart[], gspSprite2D_fifoDataEnd[];
/* basic audio ucode: */
extern long long int aspMainTextStart[], aspMainTextEnd[];
extern long long int aspMainDataStart[], aspMainDataEnd[];
/*========== F3DEX/F3DLX/F3DLP/L3DEX ==========*/
/* FIFO version only */
extern long long int gspF3DEX_fifoTextStart[], gspF3DEX_fifoTextEnd[];
extern long long int gspF3DEX_fifoDataStart[], gspF3DEX_fifoDataEnd[];
extern long long int gspF3DEX_NoN_fifoTextStart[], gspF3DEX_NoN_fifoTextEnd[];
extern long long int gspF3DEX_NoN_fifoDataStart[], gspF3DEX_NoN_fifoDataEnd[];
extern long long int gspF3DLX_fifoTextStart[], gspF3DLX_fifoTextEnd[];
extern long long int gspF3DLX_fifoDataStart[], gspF3DLX_fifoDataEnd[];
extern long long int gspF3DLX_NoN_fifoTextStart[], gspF3DLX_NoN_fifoTextEnd[];
extern long long int gspF3DLX_NoN_fifoDataStart[], gspF3DLX_NoN_fifoDataEnd[];
extern long long int gspF3DLX_Rej_fifoTextStart[], gspF3DLX_Rej_fifoTextEnd[];
extern long long int gspF3DLX_Rej_fifoDataStart[], gspF3DLX_Rej_fifoDataEnd[];
extern long long int gspF3DLP_Rej_fifoTextStart[], gspF3DLP_Rej_fifoTextEnd[];
extern long long int gspF3DLP_Rej_fifoDataStart[], gspF3DLP_Rej_fifoDataEnd[];
extern long long int gspL3DEX_fifoTextStart[], gspL3DEX_fifoTextEnd[];
extern long long int gspL3DEX_fifoDataStart[], gspL3DEX_fifoDataEnd[];
/*========== F3DEX2/F3DLX2/F3DLP2/L3DEX2 ==========*/
/* 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 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 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
*
*/
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_UCODE_H */

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