Interleaving methods for debug port output

Discussion to talk about software related topics only.
Post Reply
craiglindley
Posts: 19
Joined: Sat Apr 26, 2008 6:19 am

Interleaving methods for debug port output

Post by craiglindley »

On the mod5270, standard out and standard error are redirected to serial port 0, the debug port. As a result iprintf sends its output to the debug port which is very convenient.

My question is: is there a problem with interleaving calls to iprintf with calls like

write(fddebug, (char *) PTR(a), u);

where fddebug is the handle of debug port?

Does this mess anything up?
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: Interleaving methods for debug port output

Post by lgitlitz »

This should not be a problem but make sure you replace the stdio fd once you open the debug serial port:
int fd0=SimpleOpenSerial(0,115200 );
ReplaceStdio( 0, fd0 );
ReplaceStdio( 1, fd0 );
ReplaceStdio( 2, fd0 );

If you forget to do this then the stdio calls will talk with a polling serial driver while the write calls talk to the interrupt serial driver and things will go bad fast.
Post Reply