[PATCH v2 1/2] debug_ll.h: add PUTS_LL() function

Franck JULLIEN franck.jullien at gmail.com
Wed Jul 20 03:14:20 EDT 2011


2011/7/20 Sascha Hauer <s.hauer at pengutronix.de>:
> On Tue, Jul 19, 2011 at 03:14:03PM +0200, Franck JULLIEN wrote:
>> 2011/7/18 Sascha Hauer <s.hauer at pengutronix.de>:
>> > On Mon, Jul 18, 2011 at 05:06:09PM +0400, Antony Pavlov wrote:
>> >> Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
>> >
>> > Applied both to next.
>> >
>> > Thanks
>> >  Sascha
>> >
>> >> ---
>> >>  include/debug_ll.h |   13 +++++++++++++
>> >>  1 files changed, 13 insertions(+), 0 deletions(-)
>> >>
>> >> diff --git a/include/debug_ll.h b/include/debug_ll.h
>> >> index e99ae7d..6b1b174 100644
>> >> --- a/include/debug_ll.h
>> >> +++ b/include/debug_ll.h
>> >> @@ -35,9 +35,22 @@
>> >>                            ch = ((v >> (i*4)) & 0xf);\
>> >>                            ch += (ch >= 10) ? 'a' - 10 : '0';\
>> >>                            PUTC_LL (ch); }})
>> >> +
>> >> +static __inline__ void PUTS_LL(char * str)
>> >> +{
>> >> +     while (*str) {
>> >> +             if (*str == '\n') {
>> >> +                     PUTC_LL('\r');
>> >> +             }
>> >> +             PUTC_LL(*str);
>> >> +             str++;
>> >> +     }
>> >> +}
>> >> +
>> >>  #else
>> >>  # define PUTC_LL(c) do {} while (0)
>> >>  # define PUTHEX_LL(v) do {} while (0)
>> >> +# define PUTS_LL(c) do {} while (0)
>> >>
>> >>  #endif
>> >>
>>
>> Is there any reason for not using vsprintf in a printf_ll function
>> which would use puts_ll / putc_ll ??
>
> You would at least need a writable string buffer. I'd rather like to
> keep the ll functions as simple as possible. Otherwise you end up
> debugging the debug functions while hunting some lowlevel problem.
>

Ok I see, let's keep it like this. However, that's what I did in
nios2/lib/early_printf.c and I never
had any problem using a static 50 bytes buffer.

> Sascha
>
>
> --
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>



More information about the barebox mailing list