diff --git a/arch/cpu/arm/common/dbg-io/dbg-printf.c b/arch/cpu/arm/common/dbg-io/dbg-printf.c index 9bd09c1ac..01a02aef2 100644 --- a/arch/cpu/arm/common/dbg-io/dbg-printf.c +++ b/arch/cpu/arm/common/dbg-io/dbg-printf.c @@ -1,21 +1,22 @@ +/*---------------------------------------------------------------------------*/ #include #include #include #include - +/*---------------------------------------------------------------------------*/ static StrFormatResult write_str(void *user_data, const char *data, unsigned int len) { if (len > 0) dbg_send_bytes((unsigned char*)data, len); return STRFORMAT_OK; } - - +/*---------------------------------------------------------------------------*/ static StrFormatContext ctxt = { write_str, NULL }; +/*---------------------------------------------------------------------------*/ int printf(const char *fmt, ...) { @@ -26,5 +27,4 @@ printf(const char *fmt, ...) va_end(ap); return res; } - - +/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/arm/common/dbg-io/dbg-putchar.c b/arch/cpu/arm/common/dbg-io/dbg-putchar.c index 54f3db53f..159b54a6e 100644 --- a/arch/cpu/arm/common/dbg-io/dbg-putchar.c +++ b/arch/cpu/arm/common/dbg-io/dbg-putchar.c @@ -1,26 +1,28 @@ +/*---------------------------------------------------------------------------*/ #include #include #include - +/*---------------------------------------------------------------------------*/ #undef putchar #undef putc - +/*---------------------------------------------------------------------------*/ int putchar(int c) { dbg_putchar(c); return c; } - +/*---------------------------------------------------------------------------*/ int putc(int c, FILE *f) { dbg_putchar(c); return c; } - +/*---------------------------------------------------------------------------*/ int __sp(struct _reent *_ptr, int c, FILE *_p) { dbg_putchar(c); return c; } +/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/arm/common/dbg-io/dbg-puts.c b/arch/cpu/arm/common/dbg-io/dbg-puts.c index fa90d1022..5ad494ae3 100644 --- a/arch/cpu/arm/common/dbg-io/dbg-puts.c +++ b/arch/cpu/arm/common/dbg-io/dbg-puts.c @@ -1,7 +1,8 @@ +/*---------------------------------------------------------------------------*/ #include #include #include - +/*---------------------------------------------------------------------------*/ int puts(const char *str) { @@ -9,3 +10,4 @@ puts(const char *str) dbg_putchar('\n'); return 0; } +/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/arm/common/dbg-io/dbg-snprintf.c b/arch/cpu/arm/common/dbg-io/dbg-snprintf.c index 230d6891a..10a1631ef 100644 --- a/arch/cpu/arm/common/dbg-io/dbg-snprintf.c +++ b/arch/cpu/arm/common/dbg-io/dbg-snprintf.c @@ -1,13 +1,14 @@ +/*---------------------------------------------------------------------------*/ #include #include #include - +/*---------------------------------------------------------------------------*/ struct FmtBuffer { char *pos; size_t left; }; - +/*---------------------------------------------------------------------------*/ static StrFormatResult buffer_str(void *user_data, const char *data, unsigned int len) { @@ -22,7 +23,7 @@ buffer_str(void *user_data, const char *data, unsigned int len) buffer->left -= len; return STRFORMAT_OK; } - +/*---------------------------------------------------------------------------*/ int snprintf(char *str, size_t size, const char *format, ...) { int res; @@ -32,7 +33,7 @@ int snprintf(char *str, size_t size, const char *format, ...) va_end(ap); return res; } - +/*---------------------------------------------------------------------------*/ int vsnprintf(char *str, size_t size, const char *format, va_list ap) { struct FmtBuffer buffer; @@ -46,3 +47,4 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap) *buffer.pos = '\0'; return res; } +/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/arm/common/dbg-io/dbg-sprintf.c b/arch/cpu/arm/common/dbg-io/dbg-sprintf.c index 8124fc363..e5abd4dc5 100644 --- a/arch/cpu/arm/common/dbg-io/dbg-sprintf.c +++ b/arch/cpu/arm/common/dbg-io/dbg-sprintf.c @@ -1,7 +1,8 @@ +/*---------------------------------------------------------------------------*/ #include #include #include - +/*---------------------------------------------------------------------------*/ static StrFormatResult buffer_str(void *user_data, const char *data, unsigned int len) { @@ -9,7 +10,7 @@ buffer_str(void *user_data, const char *data, unsigned int len) (*(char**)user_data) += len; return STRFORMAT_OK; } - +/*---------------------------------------------------------------------------*/ int sprintf(char *str, const char *format, ...) { @@ -24,3 +25,4 @@ sprintf(char *str, const char *format, ...) va_end(ap); return res; } +/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/arm/common/dbg-io/strformat.c b/arch/cpu/arm/common/dbg-io/strformat.c index 13b91a563..6106a75f9 100644 --- a/arch/cpu/arm/common/dbg-io/strformat.c +++ b/arch/cpu/arm/common/dbg-io/strformat.c @@ -1,5 +1,6 @@ +/*---------------------------------------------------------------------------*/ #include - +/*---------------------------------------------------------------------------*/ #define HAVE_DOUBLE #define HAVE_LONGLONG @@ -22,9 +23,9 @@ #ifndef POINTER_INT #define POINTER_INT unsigned long #endif - +/*---------------------------------------------------------------------------*/ typedef unsigned int FormatFlags; - +/*---------------------------------------------------------------------------*/ #define MAKE_MASK(shift,size) (((1 << size) - 1) << (shift)) #define JUSTIFY_SHIFT 0 @@ -33,7 +34,6 @@ typedef unsigned int FormatFlags; #define JUSTIFY_LEFT 0x0001 #define JUSTIFY_MASK MAKE_MASK(JUSTIFY_SHIFT,JUSTIFY_SIZE) - /* How a positive number is prefixed */ #define POSITIVE_SHIFT (JUSTIFY_SHIFT + JUSTIFY_SIZE) #define POSITIVE_NONE (0x0000 << POSITIVE_SHIFT) @@ -99,6 +99,7 @@ typedef unsigned int FormatFlags; #define FLOAT_DEPENDANT (0x0002 << FLOAT_SHIFT) #define FLOAT_HEX (0x0003 << FLOAT_SHIFT) #define FLOAT_MASK MAKE_MASK(FLOAT_SHIFT, FLOAT_SIZE) +/*---------------------------------------------------------------------------*/ static FormatFlags parse_flags(const char **posp) @@ -130,7 +131,7 @@ parse_flags(const char **posp) } } - +/*---------------------------------------------------------------------------*/ static unsigned int parse_uint(const char **posp) { @@ -151,6 +152,7 @@ parse_uint(const char **posp) */ #define MAXCHARS ((sizeof(LARGEST_UNSIGNED) * 8 + 2) / 3 ) +/*---------------------------------------------------------------------------*/ static unsigned int output_uint_decimal(char **posp, LARGEST_UNSIGNED v) { @@ -164,7 +166,7 @@ output_uint_decimal(char **posp, LARGEST_UNSIGNED v) *posp = pos; return len; } - +/*---------------------------------------------------------------------------*/ static unsigned int output_uint_hex(char **posp, LARGEST_UNSIGNED v, unsigned int flags) { @@ -179,7 +181,7 @@ output_uint_hex(char **posp, LARGEST_UNSIGNED v, unsigned int flags) *posp = pos; return len; } - +/*---------------------------------------------------------------------------*/ static unsigned int output_uint_octal(char **posp, LARGEST_UNSIGNED v) { @@ -193,7 +195,7 @@ output_uint_octal(char **posp, LARGEST_UNSIGNED v) *posp = pos; return len; } - +/*---------------------------------------------------------------------------*/ static StrFormatResult fill_space(const StrFormatContext *ctxt, unsigned int len) { @@ -207,7 +209,7 @@ fill_space(const StrFormatContext *ctxt, unsigned int len) if (len == 0) return STRFORMAT_OK; return ctxt->write_str(ctxt->user_data, buffer, len); } - +/*---------------------------------------------------------------------------*/ static StrFormatResult fill_zero(const StrFormatContext *ctxt, unsigned int len) { @@ -221,9 +223,9 @@ fill_zero(const StrFormatContext *ctxt, unsigned int len) if (len == 0) return STRFORMAT_OK; return ctxt->write_str(ctxt->user_data, buffer, len); } - +/*---------------------------------------------------------------------------*/ #define CHECKCB(res) {if ((res) != STRFORMAT_OK) {va_end(ap); return -1;}} - +/*---------------------------------------------------------------------------*/ int format_str(const StrFormatContext *ctxt, const char *format, ...) { @@ -234,7 +236,7 @@ format_str(const StrFormatContext *ctxt, const char *format, ...) va_end(ap); return ret; } - +/*---------------------------------------------------------------------------*/ int format_str_v(const StrFormatContext *ctxt, const char *format, va_list ap) { @@ -615,3 +617,4 @@ format_str_v(const StrFormatContext *ctxt, const char *format, va_list ap) return written; } +/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/arm/common/dbg-io/strformat.h b/arch/cpu/arm/common/dbg-io/strformat.h index c32eed670..df6a56f39 100644 --- a/arch/cpu/arm/common/dbg-io/strformat.h +++ b/arch/cpu/arm/common/dbg-io/strformat.h @@ -1,12 +1,14 @@ +/*---------------------------------------------------------------------------*/ #ifndef STRFORMAT_H_ #define STRFORMAT_H_ - +/*---------------------------------------------------------------------------*/ #include - +/*---------------------------------------------------------------------------*/ #define STRFORMAT_OK 0 #define STRFORMAT_FAILED 1 +/*---------------------------------------------------------------------------*/ typedef unsigned int StrFormatResult; - +/*---------------------------------------------------------------------------*/ /* The data argument may only be considered valid during the function call */ typedef StrFormatResult (*StrFormatWrite)(void *user_data, const char *data, unsigned int len); @@ -15,11 +17,12 @@ typedef struct _StrFormatContext StrFormatWrite write_str; void *user_data; } StrFormatContext; - +/*---------------------------------------------------------------------------*/ int format_str(const StrFormatContext *ctxt, const char *format, ...) __attribute__ ((__format__ (__printf__, 2,3))); int format_str_v(const StrFormatContext *ctxt, const char *format, va_list ap); - +/*---------------------------------------------------------------------------*/ #endif /* STRFORMAT_H_ */ +/*---------------------------------------------------------------------------*/