Page 1 of 1

Interleaving methods for debug port output

Posted: Fri Sep 12, 2008 5:32 pm
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?

Re: Interleaving methods for debug port output

Posted: Fri Sep 12, 2008 6:36 pm
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.