int
main (void)
{
t_hddInfo hdd_info;
SifInitRpc (0);
printf ("Checking for supported HDD...");
if (hddCheckPresent () == -1)
{
printf (" no supported HDD found.\n");
return (0);
}
else
printf (" found.\n");
printf ("Checking whether HDD is formatted...");
if (hddCheckFormatted () == -1)
{
printf (" HDD is not formatted.\n");
return (0);
}
else
printf (" found.\n");
printf ("Getting HDD information...");
hddGetInfo (&hdd_info);
printf (" ok.\n"
"Total size: %d MB, free space: %d MB, max partition size: %d MB\n",
hdd_info.hddSize, hdd_info.hddFree, hdd_info.hddMaxPartitionSize);
return (0);
}
Code compiles, but when executed hangs on hddCheckPresent () line. I'm guessing that, because "Checking for supported HDD..." message is printed, but nothing else. I suppose I'm missing some really important part here (like resource/library initialization or something). Can you guide me where to read?
Thanks in advance.
My setup: WinXP + CYGWIN, ee-gcc 3.2.2, PS2SDK 1.0a binary
That's odd... I'm having the same problem.. I also used the ps2menu method of loading the irx's, but my project still hangs at hddCheckPresent().
These are the IRX's I load, and the order in which I load them:
poweroff.irx
iomanX.irx
fileXio.irx
ps2dev9.irx
ps2atad.irx
ps2hdd.irx
ps2fs.irx
Did I leave out anything important?
I'm using the PS2SDK version of libhdd.
On a related note, hddPreparePoweroff() seems to be missing from PS2SDK's libhdd... has it been moved to a different lib?
Thanks, that helps a lot.
But now I have a new problem :)
I am loading irx's from ee memory, so I had to use the sbv_patches.
Now, my program freezes immediately after loading ps2hdd.irx.
The hard drive spins up, and the hard drive light comes on and stays on, but my program does not proceed to load ps2fs.irx or anything else.
Any ideas?
I have tried running the libhdd example from CD-R (I have modified the irx paths) but I am also having the same problem as ginkei: The hard drive spins up, and the hard drive light comes on and stays on, but the program does not proceed to load ps2fs.irx or anything else.
When I boot from the CD, it displays only the following lines:
cdrom0:\POWEROFF.IRX;1
cdrom0:\IOMANX.IRX;1
cdrom0:\FILEXIO.IRX;1
cdrom0:\PS2DEV9.IRX;1
cdrom0:\PS2ATAD.IRX;1
cdrom0:\PS2HDD.IRX;1
Try to embed IRX files in the ELF (as does ps2menu). Check the link above - HDD does work with that code (via NapLink or via PS2Link; TCP/IP doesn't work).
606u wrote:Try to embed IRX files in the ELF (as does ps2menu). Check the link above - HDD does work with that code (via NapLink or via PS2Link; TCP/IP doesn't work).
You mean it doesn't work when everything is on a CD-R?
I am not using any form of network transfer to run this, the elf and irx is on the CD-R itself.
Actually, I've already got the irx's embedded in my elf. I haven't seen anything in the posted code that is remarkably different from what I'm doing either... I wonder if this could be compiler related? Unless there's something I just keep missing that's supposed to be done before loading ps2hdd.irx.
Any more ideas? If not, I guess I'll just keep playing around until I get it.
Also - in that posted code, it looks like the blocks that actually load ps2hdd.irx are enclosed in an "#ifdef 0/#endif" block. Unless I've got my true/false values backwards, doesn't that mean your code is not loading ps2hdd.irx?
Ok.. I've been trying to debug a little bit. It seems the ps2 freezes up in the initialization of ps2hdd, specifically when ps2hdd.irx calles atadInit(). Is this a bios call? I couldn't find it in the sdk source via grep...
UPDATE: I realized atadInit is just another name for an export from ps2atad.irx. I've been tracing execution (via printfs... :) ) and the culprit seems to be the call to ata_device_set_transfer_mode(i,0x40,4); in ps2atad. I'm gonna keep playing around and see what I find out. The hdd I am using is not very old, so I cant imagine it wouldn't support udma4. Moreover, other hdd apps work with it! Just not ones I compile myself.
Hmmm.... testing continues...
UPDATE AGAIN: this is very strange. the line "ata_hwport->r_command=command" inside ata_io_start is where execution halts. Is this some kind of memory mapped io port that's mapped to a static struct or something? I cant think of any other reason for this assignment to lock up the system.
ginkei wrote:Ok.. I've been trying to debug a little bit. It seems the ps2 freezes up in the initialization of ps2hdd, specifically when ps2hdd.irx calles atadInit(). Is this a bios call? I couldn't find it in the sdk source via grep...
UPDATE: I realized atadInit is just another name for an export from ps2atad.irx. I've been tracing execution (via printfs... :) ) and the culprit seems to be the call to ata_device_set_transfer_mode(i,0x40,4); in ps2atad. I'm gonna keep playing around and see what I find out. The hdd I am using is not very old, so I cant imagine it wouldn't support udma4. Moreover, other hdd apps work with it! Just not ones I compile myself.
Hmmm.... testing continues...
Maybe you should changing the last parameter to some lower speed (like UDMA 2) and see if it works:
ata_device_set_transfer_mode(i, 0x40, 2);
Tried that - no such luck, even setting UDMA2 locks up the ps2 at the "ata_hwport->r_command=command" line. I even tried skiping the mode setting altogether, but then the system locks up in the ata_io_finish() call from ata_device_smart_enable().
The drive is an IBM Deskstar 120GXP, so it definitely supports both UDMA4 and SMART. (Even checked the spec sheet.)
You say that other programs for the HDD work - have you tried the IRX you use with them with your program? Maybe you're having trouble making the IRX. You want to narrow down if the problem is the IRX or how you use the IRX.
Well, the apps I've tried that worked all seem to have the irx's linked into the elf. For example, pgen. Interestingly enough, the pre-built irx's and the example that comes with libhdd all fail to work in exactly the same way...
Just for the heck of it, I'm going to try a different host on the ps2.
OK! Now I feel stupid :)
The problem was pukklink all along.
I just tried ps2link, and my problems have vanished.
Billions of printfs in hdd.c and atad.c, and for what? :)
Oh well, maybe now I can actually do something useful. I was thinking of doing some kind of mem card<->HDD<->usb drive savegame copier.