SIO in vsh? TyRaNiD or Deniska can you help?

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

Moderators: cheriff, TyRaNiD

Post Reply
califrag
Posts: 30
Joined: Wed Apr 04, 2007 4:43 pm

SIO in vsh? TyRaNiD or Deniska can you help?

Post by califrag »

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: Select all

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]
califrag
Posts: 30
Joined: Wed Apr 04, 2007 4:43 pm

Post by califrag »

bump! anybody? do you need more info from me? please help !:O ty lol
Fanjita
Posts: 217
Joined: Wed Sep 28, 2005 9:31 am

Post by Fanjita »

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!
califrag
Posts: 30
Joined: Wed Apr 04, 2007 4:43 pm

Post by califrag »

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.
Fanjita
Posts: 217
Joined: Wed Sep 28, 2005 9:31 am

Post by Fanjita »

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!
califrag
Posts: 30
Joined: Wed Apr 04, 2007 4:43 pm

Post by califrag »

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.
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

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
califrag
Posts: 30
Joined: Wed Apr 04, 2007 4:43 pm

Post by califrag »

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!
Post Reply