From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Edwards To: Jonathan Larmour Cc: Fabrice Gautier , "Ecos-List (E-mail)" Subject: Re: [ECOS] A safe way to print debug output in DSRs ? Date: Tue, 29 Aug 2000 12:17:00 -0000 Message-id: <20000829141707.A4253@visi.com> References: <8AE4B526B977D411841F00A0CC334020052C30@cuz-exchange.sdesigns.net> <39AC07EC.EEFFC77C@redhat.co.uk> X-SW-Source: 2000-08/msg00321.html On Tue, Aug 29, 2000 at 07:58:52PM +0100, Jonathan Larmour wrote: > > I'm looking for a safeway to print debug ouput while in a DSR. > > > > Printf is not safe for it locks a mutex. > > > > The weird thing is that AFAICS it uses this mutex only when using the > > thread-safe printf option. Could this mean that the not thread safe printf > > call is more safe for DSRs? > > Yes, but any threads that used printf wouldn't be using it in a thread-safe > way. If this isn't going to happen, then go ahead and disable the option. > > > Or is there another call that is safe? What about diag_printf? > > diag_printf is probably a better option since it's only simple debug output > you want. Just include and go from there. If diag_printf does a busy-wait on a UART (as it does on my system in hal_diag_write_char()), it can have a pretty big timing impact on the DSR. If it doesn't get called too often and the messages fit into the UART FIFO, then this isn't too much of a problem -- but it's important to keep in mind as you sprinkle diag_printf() around in the code. -- Grant Edwards grante@visi.com