forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

program hangs at hddCheckPresent

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
606u



Joined: 29 Jun 2004
Posts: 33

PostPosted: Wed Jun 30, 2004 8:33 am    Post subject: program hangs at hddCheckPresent Reply with quote

Hi,

I'm just trying to feel comfortable with PS2 SDK and I'm trying to run the following simple code:

Code:
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
Back to top
View user's profile Send private message Visit poster's website
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Sat Jul 03, 2004 9:42 pm    Post subject: Reply with quote

Erm yah you haven't loaded any hdd irx modules up :) Look at the libhdd example for how you do this and what you need to load.
Back to top
View user's profile Send private message
606u



Joined: 29 Jun 2004
Posts: 33

PostPosted: Sat Jul 10, 2004 9:35 am    Post subject: Reply with quote

I beat it :) thanks.

I took ps2menu source code and use the same method to load the modules.
Back to top
View user's profile Send private message Visit poster's website
ginkei



Joined: 12 Jul 2004
Posts: 7
Location: Annandale, VA, USA

PostPosted: Mon Jul 12, 2004 10:38 am    Post subject: Reply with quote

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 for your help!
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Mon Jul 12, 2004 11:58 am    Post subject: Reply with quote

it is for some reason in libpoweroff and in that archive only poweroff.o is, I think its like that by a freak accident since the move.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
ginkei



Joined: 12 Jul 2004
Posts: 7
Location: Annandale, VA, USA

PostPosted: Mon Jul 12, 2004 12:27 pm    Post subject: Reply with quote

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?

Thanks again!
Back to top
View user's profile Send private message
606u



Joined: 29 Jun 2004
Posts: 33

PostPosted: Mon Jul 12, 2004 7:13 pm    Post subject: Reply with quote

Look at the code I've linked in this thread.
Back to top
View user's profile Send private message Visit poster's website
clement



Joined: 13 Jul 2004
Posts: 9

PostPosted: Tue Jul 13, 2004 1:55 am    Post subject: Reply with quote

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.

Code:
void loadModules()
{
   static char hddarg[] = "-o" "\0" "4" "\0" "-n" "\0" "20";
   static char pfsarg[] = "-m" "\0" "4" "\0" "-o" "\0" "10" "\0" "-n" "\0" "40" /*"\0" "-debug"*/;

   scr_printf("cdrom0:\\POWEROFF.IRX;1\n");
   SifLoadModule("cdrom0:\\POWEROFF.IRX;1", 0, NULL);
   scr_printf("cdrom0:\\IOMANX.IRX;1\n");
   SifLoadModule("cdrom0:\\IOMANX.IRX;1", 0, NULL);
   scr_printf("cdrom0:\\FILEXIO.IRX;1\n");
   SifLoadModule("cdrom0:\\FILEXIO.IRX;1", 0, NULL);

   scr_printf("cdrom0:\\PS2DEV9.IRX;1\n");
   SifLoadModule("cdrom0:\\PS2DEV9.IRX;1", 0, NULL);
   scr_printf("cdrom0:\\PS2ATAD.IRX;1\n");
   SifLoadModule("cdrom0:\\PS2ATAD.IRX;1", 0, NULL);
   scr_printf("cdrom0:\\PS2HDD.IRX;1\n");
   SifLoadModule("cdrom0:\\PS2HDD.IRX;1", sizeof(hddarg), hddarg);
   scr_printf("cdrom0:\\PS2FS.IRX;1\n");
   SifLoadModule("cdrom0:\\PS2FS.IRX;1", sizeof(pfsarg), pfsarg);
}


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
Back to top
View user's profile Send private message
606u



Joined: 29 Jun 2004
Posts: 33

PostPosted: Tue Jul 13, 2004 2:51 am    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message Visit poster's website
clement



Joined: 13 Jul 2004
Posts: 9

PostPosted: Tue Jul 13, 2004 12:38 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
ginkei



Joined: 12 Jul 2004
Posts: 7
Location: Annandale, VA, USA

PostPosted: Tue Jul 13, 2004 1:41 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Tue Jul 13, 2004 6:54 pm    Post subject: Reply with quote

yeah #if 0 is false, so if its still in the code fileio, ps2atad, ps2hdd irx's wont be loaded.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
ginkei



Joined: 12 Jul 2004
Posts: 7
Location: Annandale, VA, USA

PostPosted: Mon Jul 19, 2004 8:00 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
clement



Joined: 13 Jul 2004
Posts: 9

PostPosted: Mon Jul 19, 2004 10:09 am    Post subject: Reply with quote

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);
Back to top
View user's profile Send private message
ginkei



Joined: 12 Jul 2004
Posts: 7
Location: Annandale, VA, USA

PostPosted: Mon Jul 19, 2004 10:32 am    Post subject: Reply with quote

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.)
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Jul 19, 2004 11:11 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
ginkei



Joined: 12 Jul 2004
Posts: 7
Location: Annandale, VA, USA

PostPosted: Mon Jul 19, 2004 11:57 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
ginkei



Joined: 12 Jul 2004
Posts: 7
Location: Annandale, VA, USA

PostPosted: Mon Jul 19, 2004 12:19 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group