diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp index ac4a460bdc..6a30c8b719 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp @@ -191,6 +191,9 @@ void CEXIMic::TransferByte(u8 &byte) break; case cmdGetBuffer: printf("POS %d\n", m_uPosition); + // Are we not able to return all the data then? + // I think if we set the Interrupt to false, it reads another 64 + // Will Look in to it. if(m_uPosition == SNum / 2) // It's 16bit Audio, so we divide by two ;//m_bInterruptSet = false; byte = rand() % 0xFF; diff --git a/Source/TestSuite/Devices/Makefile b/Source/TestSuite/Devices/Makefile new file mode 100644 index 0000000000..cddbbb1275 --- /dev/null +++ b/Source/TestSuite/Devices/Makefile @@ -0,0 +1,131 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -logc + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES := $(addsuffix .o,$(BINFILES)) \ + $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ + $(sFILES:.s=.o) $(SFILES:.S=.o) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + -L$(LIBOGC_LIB) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/Source/TestSuite/Devices/source/First.cpp b/Source/TestSuite/Devices/source/First.cpp new file mode 100644 index 0000000000..a55aafbca4 --- /dev/null +++ b/Source/TestSuite/Devices/source/First.cpp @@ -0,0 +1,79 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +static void *xfb = NULL; +u32 first_frame = 1; +GXRModeObj *rmode; + +int main() +{ + VIDEO_Init(); + + rmode = VIDEO_GetPreferredMode(NULL); + + PAD_Init(); + + + xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); + + VIDEO_Configure(rmode); + + VIDEO_SetNextFramebuffer(xfb); + + VIDEO_SetBlack(FALSE); + VIDEO_Flush(); + VIDEO_WaitVSync(); + if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); + + + console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*2); + + + time_t gc_time; + gc_time = time(NULL); + + srand(gc_time); + while(1) + { + s32 Size; + s32 SSize; + u32 ID; + s32 error; + VIDEO_ClearFrameBuffer(rmode, xfb, 0); + + EXI_GetID(0, 0, &ID); + error = CARD_ProbeEx(0, &Size, &SSize); + // Can't use printf since Dolphin overrides it + if(error >= 0) // All is good + std::cout << "Card A has a size of " << Size << " and a Sector Size of " << SSize; + else if( error == -2) // Device isn't Memory card + std::cout << "Device isn't Mem card in Slot A"; + else + std::cout << "Got an error of " << error << " with slot A"; + std::cout << " ID of " << std::setbase(16) << ID << std::endl; + + std::cout << std::setbase(10); + EXI_GetID(1, 0, &ID); + error = CARD_ProbeEx(1, &Size, &SSize); + if(error >= 0) // All is good + std::cout << "Card B has a size of " << Size << " and a Sector Size of " << SSize; + else if( error == -2) // Device isn't Memory card + std::cout << "Device isn't Mem card in Slot B"; + else + std::cout << "Got an error of " << error << " with slot B"; + std::cout << " ID of " << std::setbase(16) << ID << std::endl; + VIDEO_WaitVSync(); + } + return 0; +} diff --git a/Source/TestSuite/Makefile b/Source/TestSuite/Makefile new file mode 100644 index 0000000000..3a6fe744eb --- /dev/null +++ b/Source/TestSuite/Makefile @@ -0,0 +1,8 @@ +SUBDIRS:= `ls | egrep -v '^(CVS)$$'` + +all: + @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done; + +clean: + @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done; +