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 

Kernel mode vs. user mode

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



Joined: 17 Jul 2007
Posts: 34
Location: California, USA

PostPosted: Tue Jun 24, 2008 6:14 pm    Post subject: Kernel mode vs. user mode Reply with quote

Hello everyone,

I've recently tried to add wifi support to one of my apps, which (in case of fw 1.50) involves starting up my app in kernel mode (the application was originally a user-mode application), then spawning off a user-mode thread to do the usual stuff (setting up callbacks, initting sound, etc...).
It seems like everything works fine, except my sound thread no longer works as usual. Sound is distorted and seems to skip, which I cannot explain.

The main user-mode thread is started as follows:

sceKernelCreateThread("User Mode Thread", user_main,
0x11, // default priority
256 * 1024, // stack size (256KB is regular default)
PSP_THREAD_ATTR_USER, NULL);

Here's how my app starts the sound thread:

sceKernelCreateThread(label, (void*)&AudioChannelThread, 0x12, 0x10000,
0, NULL);

My (older) user-mode init:
/* User mode */
PSP_MODULE_INFO(PSP_APP_NAME, 0, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);

New kernel-mode init:
/* Kernel mode */
PSP_MODULE_INFO(PSP_APP_NAME, 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);

Am I doing something wrong? My understanding is that the sound thread should still run exactly as before, seeing as how the stack size, priority and attributes are still the same.

Appreciate any help
Back to top
View user's profile Send private message Visit poster's website
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Tue Jun 24, 2008 10:11 pm    Post subject: Reply with quote

Create your audio thread in user mode using PSP_THREAD_ATTR_USER.

Also, change the priority of your main user thread so it is lower than the sound thread (ie. higher value).
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 -> PSP 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