 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
dridri
Joined: 31 Jul 2009 Posts: 35
|
Posted: Fri Jul 31, 2009 1:57 am Post subject: Freeze caused by call to sceKernelDelayThread ? |
|
|
First, im french and 15 years old, im not a good english speaker ^^.
I have got a matter with a simple code in a thread, in this code the call to sceKernelDelayThread freeze the PSP :
| Code: | // This code works perfectly
while(1){
if(!mp3->playing){
pspDebugScreenPrintf("Not playing 00...\n");
sceKernelDelayThread(10000);
pspDebugScreenPrintf("Not playing 01...\n");
continue;
}
}
// This code freeze at sceKernelDelayThread
while(1){
if(!mp3->playing){
pspDebugScreenPrintf("Not playing...\n");
sceKernelDelayThread(10000);
pspDebugScreenPrintf("Not playing 2...\n");
continue;
}
/some other code ....
........
......
.......
.. */
} |
That is the same program, but there is some code following in the loop.
To be sure of this bug, i tried to launch a exception handler, the result is a BreakPoint, the adress means to be in a kernel PRX (adress cant be in my program cause its to big: 0x07.......).
My program is a simple EBOOT, compiled in PRX Mode (for 1.50+ compatibility).
Thanks ! |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Fri Jul 31, 2009 3:01 am Post subject: |
|
|
| It's almost certainly not the delay, but some other code doing something like overflowing a string buffer or the stack. |
|
| Back to top |
|
 |
iceman755
Joined: 21 Jul 2008 Posts: 34
|
Posted: Fri Jul 31, 2009 3:12 am Post subject: |
|
|
I think more code will help to solve your problem, cause you are showing the same code (just diferent outputs in pspDebugScreenPrintf) and just saying this works and this doesn't.
And how do you know that is in sceKernelDelayThread where the psp freeze??? try using psplink, it will help you with errors and finding the exact line where the code crashes. _________________ "Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum" |
|
| Back to top |
|
 |
dridri
Joined: 31 Jul 2009 Posts: 35
|
Posted: Fri Jul 31, 2009 7:52 am Post subject: |
|
|
| iceman755 wrote: | | And how do you know that is in sceKernelDelayThread where the psp freeze??? try using psplink, it will help you with errors and finding the exact line where the code crashes. |
There's the output on screen :
That's all, so the problem is caused on this function.
The entire code :
| Code: | static int MP3_Decode_Thread(int args, void *argp){
ge_Music* mp3 = (ge_Music*)((u32*)argp)[0];
pspDebugScreenPrintf("MP3_Decode_Thread called !\n");
short mp3_mix_buffer[2][1152*2] __attribute__((aligned(64)));
short mp3_output_buffer[4][1152 * 2] __attribute__((aligned(64)));
int mp3_output_index = 0;
int working_buf = 0;
int ret = 0;
int audio_channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, 1152, PSP_AUDIO_FORMAT_STEREO);
int frame_size = read_next_frame(mp3, working_buf);
/**********
while(1){
if(!mp3->playing){
pspDebugScreenPrintf("Not playing 00...\n");
sceKernelDelayThread(10000);
pspDebugScreenPrintf("Not playing 01...\n");
continue;
}
}
**********/
pspDebugScreenPrintf("mp3->playing: %d\n", mp3->playing);
while(1){
if(!mp3->playing){
pspDebugScreenPrintf("Not playing...\n");
sceKernelDelayThread(10000);
pspDebugScreenPrintf("Not playing 2...\n");
continue;
}
mp3->codec_struct[6] = (unsigned long)mp3->src_buffer[working_buf];
mp3->codec_struct[8] = (unsigned long)mp3_mix_buffer[working_buf];
mp3->codec_struct[7] = mp3->codec_struct[10] = frame_size;
mp3->codec_struct[9] = 1152 * 4;
ret = sceAudiocodecDecode(mp3->codec_struct, 0x1002);
memcpy(mp3_output_buffer[mp3_output_index], mp3_mix_buffer[working_buf], 1152*4);
sceAudioOutputBlocking(audio_channel, mp3->hard_volume, mp3_output_buffer[mp3_output_index]);
mp3_output_index = (mp3_output_index+1)%4;
memset(mp3_mix_buffer, 0, 1152*2*2);
frame_size = read_next_frame(mp3, working_buf);
}
return 0;
} |
It's very strange....
Else, if I cant resolve the proble, I think to do this code part in ASM... |
|
| Back to top |
|
 |
|
|
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
|