Random issues preventing KIRK/SPOCK version from being read?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
jas0nuk
Posts: 137
Joined: Thu Apr 27, 2006 8:00 am

Random issues preventing KIRK/SPOCK version from being read?

Post by jas0nuk »

This is a problem and a curiosity I've been meaning to post about for a while.
In my application, PSPident, which determines the motherboard version by reading the tachyon & baryon number, I also have functions to read the KIRK and SPOCK versions from their respective registers. However, on some PSPs, one or both of them randomly returns no data, or just corrupt data (appears as a smiley face)
This does not seem to be affected by the environment in which the app is running; Pandora, 1.50 kernel and 3.XX/4.XX kernel seems to be the same, and Slim/Fat doesn't make any difference. It looks more like it's specific to certain units, but I'm not sure why. Is it a timing issue?

Some examples - some of them are posts, since the images are now down. Should've posted about this ages ago...

http://forums.maxconsole.net/showpost.p ... stcount=92
No spock version

http://forums.maxconsole.net/showpost.p ... stcount=65
No kirk version (smiley face)

http://forums.maxconsole.net/showpost.p ... stcount=73
No kirk version (smiley face)

http://www.isarapix.org/pix51/1215532728.jpg
No kirk version (smiley face)

http://www.isarapix.org/pix80/1215532795.jpg
No spock version

Here are the functions used:

Code: Select all

u32 pspGetKirkVersion(void) {
	int k1 = pspSdkSetK1(0);
	sceSysregKirkBusClockEnable();
	sceKernelDelayThread(1000);
	int err = *(u32 *)0xBDE00004;
	pspSdkSetK1(k1);
	return err;
}

u32 pspGetSpockVersion(void) {
	int k1 = pspSdkSetK1(0);
	sceSysregAtaBusClockEnable();
	sceKernelDelayThread(1000);
	int err = *(u32 *)0xBDF00004;
	pspSdkSetK1(k1);
	return err;
}
In the main app they are being printed like:

Code: Select all

	printf("Kirk:    %c%c%c%c\n", kirk[3], kirk[2], kirk[1], kirk[0]);
	printf("Spock:   %c%c%c%c\n\n", spock[3], spock[2], spock[1], spock[0]);
If anyone wants to run PSPident to see what happens on their PSP, it's here xD
http://www.sendspace.com/file/qbru1x
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

4.0.1 M33-2 PSP FAT
Tachyon: 0x00300000
Baryon: 0x00040600
Pommel: 0x00000104

Kirk: 0010
Spock: 0050

TA-081 v2.0 (01g)

3.90 m33-3 PSP FAT - 1.50 kernel enabled
Tachyon: 0x00300000
Baryon: 0x00040600
Pommel: 0x00000103

Kirk: 0010
Spock: 0050

TA-081 v2.0 (01g)

Both seem fine then :)

In those pics, it must return a value O.o, the smile must be a value which means a "smile".
Right?

Try using %d instead of %c to know the integer value ?
Image
Upgrade your PSP
adrahil
Posts: 274
Joined: Thu Mar 16, 2006 1:55 am

Post by adrahil »

%08X would be better :) Don't expect sony to keep nice versions in ASCII format...
jas0nuk
Posts: 137
Joined: Thu Apr 27, 2006 8:00 am

Post by jas0nuk »

But the version is actually stored as ASCII, even in the latest versions of Slim hardware. :p
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

I thought of writing %08X but as I don't know how the values work with the kirk and spock I wrote %d :P
@jas0nuk but by getting the %08X(:P) value you can know the ascii right? and it can be a problem with somethign but not the kirk or spock
Image
Upgrade your PSP
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

Post by crazyc »

No kirk version (smiley face)
The smiley face is 0x01 as ascii, which is what I get if I read 0xBDE00004 while kirk is disabled.
jas0nuk
Posts: 137
Joined: Thu Apr 27, 2006 8:00 am

Post by jas0nuk »

Ah.. so if kirk is disabled its 0x0 0x0 0x0 0x1, and if spock is disabled it's 0x0 0x0 0x0 0x0
I wonder why spock/kirk are sometimes disabled in these PSPs?
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

how can I know if it is disabled or not?
Image
Upgrade your PSP
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

jas0nuk wrote:Ah.. so if kirk is disabled its 0x0 0x0 0x0 0x1, and if spock is disabled it's 0x0 0x0 0x0 0x0
I wonder why spock/kirk are sometimes disabled in these PSPs?
do you protect this reading against interrupts or things like that ?
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

Post by crazyc »

Some psps may just need a longer timeout. Try this.

Code: Select all

u32 pspGetKirkVersion(void) {
   int k1 = pspSdkSetK1(0);
   int ver, i = 0, val = *(u32 *)0xBDE00004;
   sceSysregKirkBusClockEnable();
   do {
       i++;
       sceKernelDelayThread(1000);
       ver = *(u32 *)0xBDE00004;
   &#125; while &#40;&#40;ver == val&#41; && &#40;i < 10&#41;&#41;;
   pspSdkSetK1&#40;k1&#41;;
   return ver;
&#125; 
jas0nuk
Posts: 137
Joined: Thu Apr 27, 2006 8:00 am

Post by jas0nuk »

Thanks, I'll put it in the next update.
Post Reply