Commits

Michael Jimenez committed 0296449

removed hdpro_checker IOP module (HD Pro is now detected directly from EE)

Comments (0)

Files changed (7)

 		obj/hdd_cdvdman.o obj/hdd_pcmcia_cdvdman.o obj/hdd_hdpro_cdvdman.o \
 		obj/cdvdfsv.o obj/usbd_ps2.o obj/usbd_ps3.o obj/usbhdfsd.o obj/cddev.o \
 		obj/ps2dev9.o obj/smsutils.o obj/smstcpip.o obj/ingame_smstcpip.o obj/smsmap.o obj/smbman.o obj/discid.o \
-		obj/ps2atad.o obj/hdpro_atad.o obj/poweroff.o obj/ps2hdd.o obj/hdpro_checker.o obj/genvmc.o obj/hdldsvr.o \
+		obj/ps2atad.o obj/hdpro_atad.o obj/poweroff.o obj/ps2hdd.o obj/genvmc.o obj/hdldsvr.o \
 		obj/udptty.o obj/iomanx.o obj/filexio.o obj/ps2fs.o obj/util.o obj/ioptrap.o obj/ps2link.o 
 
 ifeq ($(VMC),1)
 	$(MAKE) -C modules/hdd/hdpro_atad clean
 	echo "    * ps2hdd.irx"
 	$(MAKE) -C modules/hdd/ps2hdd clean
-	echo "    * hdpro_checker.irx"
-	$(MAKE) -C modules/hdd/hdpro_checker clean
 ifeq ($(VMC),1)
 	echo "    * ps2fs.irx"
 	$(MAKE) -C modules/ps2fs clean
 	$(MAKE) -C modules/hdd/ps2hdd
 	bin2s modules/hdd/ps2hdd/ps2hdd.irx asm/ps2hdd.s ps2hdd_irx
 
-hdpro_checker.s:
-	echo "    * hdpro_checker.irx"
-	$(MAKE) -C modules/hdd/hdpro_checker
-	bin2s modules/hdd/hdpro_checker/hdpro_checker.irx asm/hdpro_checker.s hdpro_checker_irx
-
 genvmc.s:
 	echo "    * genvmc.irx"
 ifeq ($(DEBUG),1)

modules/hdd/hdpro_checker/Makefile

-IOP_BIN  = hdpro_checker.irx
-
-IOP_INCS +=
-IOP_CFLAGS  += -Wall -fno-builtin-printf
-IOP_LDFLAGS += -s
-
-IOP_OBJS = hdpro_checker.o imports.o
-IOP_LIBS =
-
-all: $(IOP_BIN)
-
-clean:
-	rm -f $(IOP_BIN) $(IOP_OBJS)
-
-rebuild: clean all
-
-run:
-	ps2client -t 1 execiop host:$(IOP_BIN)
-
-
-include $(PS2SDK)/Defs.make
-include Rules.make

modules/hdd/hdpro_checker/Rules.make

-# _____     ___ ____     ___ ____
-#  ____|   |    ____|   |        | |____|
-# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
-#-----------------------------------------------------------------------
-# Copyright 2001-2004.
-# Licenced under Academic Free License version 2.0
-# Review ps2sdk README & LICENSE files for further details.
-
-
-IOP_CC_VERSION := $(shell $(IOP_CC) -v 2>&1 | sed -n 's/^.*versi[^ ]*n.* //p')
-
-ASFLAGS_TARGET = -mcpu=r3000
-
-ifeq ($(IOP_CC_VERSION),3.2.2)
-CFLAGS_TARGET  = -miop
-ASFLAGS_TARGET = -march=r3000
-LDFLAGS_TARGET = -miop
-endif
-
-IOP_INCS := $(IOP_INCS) -I$(PS2SDK)/iop/include -I$(PS2SDK)/common/include -Iinclude
-
-IOP_CFLAGS  := $(CFLAGS_TARGET) -O2 -G0 -c $(IOP_INCS) $(IOP_CFLAGS)
-IOP_ASFLAGS := $(ASFLAGS_TARGET) -EL -G0 $(IOP_ASFLAGS)
-IOP_LDFLAGS := $(LDFLAGS_TARGET) -nostdlib $(IOP_LDFLAGS)
-
-# Externally defined variables: IOP_BIN, IOP_OBJS, IOP_LIB
-
-%.o : %.c
-	$(IOP_CC) $(IOP_CFLAGS) $< -o $@
-
-%.o : %.s
-	$(IOP_AS) $(IOP_ASFLAGS) $< -o $@
-
-# A rule to build imports.lst.
-%.o : %.lst
-	echo "#include \"irx_imports.h\"" > build-imports.c
-	cat $< >> build-imports.c
-	$(IOP_CC) $(IOP_CFLAGS) build-imports.c -o $@
-	-rm -f build-imports.c
-
-# A rule to build exports.tab.
-%.o : %.tab
-	echo "#include \"irx.h\"" > build-exports.c
-	cat $< >> build-exports.c
-	$(IOP_CC) $(IOP_CFLAGS) build-exports.c -o $@
-	-rm -f build-exports.c
-
-
-$(IOP_BIN) : $(IOP_OBJS)
-	$(IOP_CC) $(IOP_LDFLAGS) -o $(IOP_BIN) $(IOP_OBJS) $(IOP_LIBS)
-
-$(IOP_LIB) : $(IOP_OBJS)
-	$(IOP_AR) cru $(IOP_LIB) $(IOP_OBJS)
-

modules/hdd/hdpro_checker/hdpro_checker.c

-/*
-  Copyright 2011, jimmikaelkael
-  Licenced under Academic Free License version 3.0
-  Review Open PS2 Loader README & LICENSE files for further details.
-
-  HD Pro Kit Checker module
-*/
-
-#include <loadcore.h>
-#include <intrman.h>
-#include <thbase.h>
-#include <stdio.h>
-#include <sifman.h>
-
-// HD Pro Kit is mapping the 1st word in ROM0 seg as a main ATA controller,
-// The pseudo ATA controller registers are accessed (input/ouput) by writing
-// an id to the main ATA controller
-#define HDPROreg_IO8	      (*(volatile unsigned char *)0xBFC00000) 
-#define HDPROreg_IO32	      (*(volatile unsigned int  *)0xBFC00000)
-
-#define CDVDreg_STATUS        (*(volatile unsigned char *)0xBF40200A) 
-
-static int hdpro_io_active = 0;
-static int intr_suspended = 0;
-static int intr_state;
-
-static void suspend_intr(void)
-{
-	if (!intr_suspended) {
-		CpuSuspendIntr(&intr_state);
-
-		intr_suspended = 1;
-	}
-}
-
-static void resume_intr(void)
-{
-	if (intr_suspended) {
-		CpuResumeIntr(intr_state);
-
-		intr_suspended = 0;
-	}
-}
-
-static int hdpro_io_start(void)
-{
-	if (hdpro_io_active)
-		return 0;
-
-	hdpro_io_active = 0;
-
-	suspend_intr();
-
-	// HD Pro IO start commands sequence
-	HDPROreg_IO8 = 0x72;
-	CDVDreg_STATUS = 0;
-	HDPROreg_IO8 = 0x34;
-	CDVDreg_STATUS = 0;
-	HDPROreg_IO8 = 0x61;
-	CDVDreg_STATUS = 0;
-	u32 res = HDPROreg_IO8;
-	CDVDreg_STATUS = 0;
-
-	resume_intr();
-
-	// check result
-	if ((res & 0xff) == 0xe7)
-		hdpro_io_active = 1;
-
-	return hdpro_io_active;
-}
-
-static int hdpro_io_finish(void)
-{
-	if (!hdpro_io_active)
-		return 0;
-
-	suspend_intr();
-
-	// HD Pro IO finish commands sequence
-	HDPROreg_IO8 = 0xf3;
-	CDVDreg_STATUS = 0;
-
-	resume_intr();
-
-	DelayThread(200);
-
-	if (HDPROreg_IO32 == 0x401a7800) // check the 1st in ROM0 seg get
-		hdpro_io_active = 0;	 // back to it's original state
-
-	return hdpro_io_active ^ 1;
-}
-
-int _start(int argc, char *argv[])
-{
-	int res = hdpro_io_start();
-
-	HDPROreg_IO8 = 0xe3;
-	CDVDreg_STATUS = 0;
-
-	hdpro_io_finish();
-
-	if (res) {
-		SifDmaTransfer_t dmat;
-		int oldstate, id;
-		u32 val = 0xdeadfeed;
-
-		dmat.dest = (void *)0x200c0000;
-		dmat.size = sizeof(u32);
-		dmat.src = (void *)&val;
-		dmat.attr = 0;
-
-		id = 0;
-		while (!id) {
-			CpuSuspendIntr(&oldstate);
-			id = sceSifSetDma(&dmat, 1);
-			CpuResumeIntr(oldstate);
-		}
-		while (sceSifDmaStat(id) >= 0);
-	}
-
-	return MODULE_NO_RESIDENT_END;
-}
-

modules/hdd/hdpro_checker/imports.lst

-
-thbase_IMPORTS_start
-I_DelayThread
-thbase_IMPORTS_end
-
-stdio_IMPORTS_start
-I_printf
-stdio_IMPORTS_end
-
-intrman_IMPORTS_start
-I_CpuSuspendIntr
-I_CpuResumeIntr
-intrman_IMPORTS_end
-
-sifman_IMPORTS_start
-I_sceSifSetDma
-I_sceSifDmaStat
-sifman_IMPORTS_end
-

modules/hdd/hdpro_checker/irx_imports.h

-/*
-# _____     ___ ____     ___ ____
-#  ____|   |    ____|   |        | |____|
-# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
-#-----------------------------------------------------------------------
-# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
-# Licenced under Academic Free License version 2.0
-# Review ps2sdk README & LICENSE files for further details.
-#
-# $Id: irx_imports.h 629 2004-10-11 00:45:00Z mrbrown $
-# Defines all IRX imports.
-*/
-
-#ifndef IOP_IRX_IMPORTS_H
-#define IOP_IRX_IMPORTS_H
-
-#include "irx.h"
-
-/* Please keep these in alphabetical order!  */
-#include "intrman.h"
-#include "sifman.h"
-#include "stdio.h"
-#include "thbase.h"
-
-#endif /* IOP_IRX_IMPORTS_H */
 extern void *ps2hdd_irx;
 extern int size_ps2hdd_irx;
 
-extern void *hdpro_checker_irx;
-extern int size_hdpro_checker_irx;
-
 extern void *ps2fs_irx;
 extern int size_ps2fs_irx;
 
 #endif
 }
 
+// HD Pro Kit is mapping the 1st word in ROM0 seg as a main ATA controller,
+// The pseudo ATA controller registers are accessed (input/ouput) by writing
+// an id to the main ATA controller
+#define HDPROreg_IO8	      (*(volatile unsigned char *)0xBFC00000) 
+#define CDVDreg_STATUS        (*(volatile unsigned char *)0xBF40200A) 
+
 static int hddCheckHDProKit(void)
 {
-	int ret; 
+	int ret = 0;
 
-	vu32 *pRes = (vu32 *)0x200c0000;
 	DIntr();
-	u32 val = *pRes;
+	ee_kmode_enter();
+	// HD Pro IO start commands sequence
+	HDPROreg_IO8 = 0x72;
+	CDVDreg_STATUS = 0;
+	HDPROreg_IO8 = 0x34;
+	CDVDreg_STATUS = 0;
+	HDPROreg_IO8 = 0x61;
+	CDVDreg_STATUS = 0;
+	u32 res = HDPROreg_IO8;
+	CDVDreg_STATUS = 0;
+	ee_kmode_exit();
 	EIntr();
 
-	SifExecModuleBuffer(&hdpro_checker_irx, size_hdpro_checker_irx, 0, NULL, &ret);
-
 	FlushCache(0);
 	FlushCache(2);
 
 	DIntr();
-	if (*pRes == 0xdeadfeed) {		
-		*pRes = val;
-		EIntr();
+	ee_kmode_enter();
 
-		LOG("hddCheckHDPro() HD Pro Kit connected!\n");
-		return 1;
+	// check result
+	if ((res & 0xff) == 0xe7) {
+		HDPROreg_IO8 = 0xe3;
+		CDVDreg_STATUS = 0;
+		// HD Pro IO finish commands sequence
+		HDPROreg_IO8 = 0xf3;
+		CDVDreg_STATUS = 0;
+		ret = 1;
 	}
+	ee_kmode_exit();
 	EIntr();
 
-	return 0;
+	FlushCache(0);
+	FlushCache(2);
+
+	if (ret)
+		LOG("hddCheckHDPro() HD Pro Kit detected!\n");
+
+	return ret;
 }
 
 void hddLoadModules(void) {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.