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 

SIO in vsh? TyRaNiD or Deniska can you help?

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



Joined: 04 Apr 2007
Posts: 30

PostPosted: Sun Aug 05, 2007 4:32 pm    Post subject: SIO in vsh? TyRaNiD or Deniska can you help? Reply with quote

I've been pouring through the sio.c and sio.h source in psplink and also been trying to get pspDebugSio calls to work.. in the vsh... with no luck...

I have a prx that loads up fine right now..
It refuses to load when I define it as kernel (0x1000)

I am launching it from the location free player slot on the xmb.
It won't load up as an seplugin but that's ok anyways it doesn't need to.
It gets input fine (I still need to get button hooking done) and does everything I want.

I need to get data through the serial port (from a GPS device).

Nothing I try is working... when I try pspDebugSio(Init/SetBaud) calls the prx doesn't even load. I get no errors when I compile and my makefile is linking -lpspdebug, -lpsphprm and -lpsphprm_driver

When I try _sioInit from sio.c it fails (doesn't load) for any of the three functions (sceHprmEnd, sceSysregUartIoEnable and sceSysconCtrlHRPower)


the jist of my code is:

Code:

PSP_MODULE_INFO("PROJECTNAME", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
PSP_MAIN_THREAD_STACK_SIZE_KB(32);
PSP_HEAP_SIZE_KB(1024);

int main_thread() {
   pspDebugSioInit(); (or sioInit();)
   pspDebugSioSetBaud(38400); (or sioSetBaud(38400);)

   // Do Stuff ....

}

int module_start (SceSize args, void *argp) {
   main_thid = sceKernelCreateThread("main_thread", (SceKernelThreadEntry)main_thread, 0x10, 0x10000, 0, NULL);
   if (main_thid >= 0) { sceKernelStartThread(main_thid, args, argp); }
   return 0;
}




my makefile is the standard PRX makefile with a few other includes

Please any help you can provide to get me going in the right direction. I don't need to put any data to the serial, I just need to read it.

Thanks again for any assistance![/code]
Back to top
View user's profile Send private message
califrag



Joined: 04 Apr 2007
Posts: 30

PostPosted: Fri Aug 10, 2007 5:54 am    Post subject: Reply with quote

bump! anybody? do you need more info from me? please help !:O ty lol
Back to top
View user's profile Send private message
Fanjita



Joined: 28 Sep 2005
Posts: 217

PostPosted: Sat Aug 11, 2007 6:09 am    Post subject: Reply with quote

The piKey source may help you, the SIO plugin happily does SIO in VSH.
_________________
Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you!
Back to top
View user's profile Send private message
califrag



Joined: 04 Apr 2007
Posts: 30

PostPosted: Sat Aug 11, 2007 11:25 am    Post subject: Reply with quote

edit-

Okay I looked into the piKey source code and it looked like it starts the sio in it's own thread, and doesn't initialize when in vsh mode - it looks like it goes right into reading from the sio... please tell me if I've got this wrong... any pointers you can give to help me understand some of this source? from what i can tell the sio is only used for debugging purposes and only for putting characters, not for reading. i've tried to strip out as much that does not specifically do with the sio and that is all I could tell. When I tried initializing my SIO in it's own thread with the same parameters as piKey I still had no luck getting the prx to load.
Back to top
View user's profile Send private message
Fanjita



Joined: 28 Sep 2005
Posts: 217

PostPosted: Wed Aug 15, 2007 5:49 am    Post subject: Reply with quote

Take a look at framework/pikey.c, around line 830 or so.

Basically I think you need to look at what how that thread there is initialised.
_________________
Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you!
Back to top
View user's profile Send private message
califrag



Joined: 04 Apr 2007
Posts: 30

PostPosted: Wed Aug 15, 2007 3:36 pm    Post subject: Reply with quote

Thanks again Fanjita

I've tried the pspDebugSioInit calls but unfortunately those lock up the PRX and it won't launch.

I think my problem is getting into kernel mode.

Right now the PRX will compile as 0x0800 (VSH mode) or 0 (user mode) but if I try to make it kernel it just does nothing.

I've tried adding the USE_KERNEL_... to my makefile which gives me a bunch of errors. After I link in all the libraries I need until the errors go away if I try to launch the prx nothing happens.

So right now I've got it back in user mode. I will keep trying things.

I think I can't get into kernel mode because I am using the net modules which are user mode.
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Thu Aug 16, 2007 4:00 am    Post subject: Reply with quote

Kernel mode cannot call any user mode functions
your best bet is creating a usermode thread from this kernel
mode binary and then calling the user stuf from that user thread
you can also use flag 0x3007 for kernel mode and ill let you figure out
what its benefits are :)
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
califrag



Joined: 04 Apr 2007
Posts: 30

PostPosted: Thu Aug 16, 2007 4:11 am    Post subject: Reply with quote

Thanks dot_blank for that info I will test it out.

Basically my PRX is set up this way:

includes
defines
headers
display_thread (to display everything)
input_thread (to handle input conditions)
exit_thread (to handle exit conditions)
user_thread (to do all the work)
main_thread (to start all the other threads)

hopefully should be easy for me to convert it to kernel mode then change the threads to be user mode where needed.

edit:
well my main thread had a couple calls to the net modules so I moved those into a different (user) thread.

I also had some sceRtc calls in there which are user thread as well and were moved to a different (user) thread.

so now my main() does not have any user-mode calls.

I tried the 0x3007 and got the same results as with 0x1000.

still will keep messing with it. Thanks!
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