eprintf mit irq

Committer:
est2fe
Date:
Thu Jun 23 13:58:03 2011 +0000
Revision:
1:50fdadc001ef
Parent:
0:4843fcdba3cc
Child:
2:f63032cc0c0a
V 0.2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
est2fe 0:4843fcdba3cc 1 #ifndef __os_printf_c__
est2fe 0:4843fcdba3cc 2 #define __os_printf_c__
est2fe 0:4843fcdba3cc 3
est2fe 1:50fdadc001ef 4 #include "mbed.h"
est2fe 0:4843fcdba3cc 5 #include "eprintf.h"
est2fe 1:50fdadc001ef 6 #include "stdarg.h"
est2fe 0:4843fcdba3cc 7
est2fe 0:4843fcdba3cc 8 void printf_verarbeitung (void)
est2fe 0:4843fcdba3cc 9 {
est2fe 0:4843fcdba3cc 10 //char c;
est2fe 0:4843fcdba3cc 11 // Den printf-Buffer leeren (ausgeben)
est2fe 0:4843fcdba3cc 12 // Das wird nur hier einzig und allein gemacht!
est2fe 0:4843fcdba3cc 13 /* while (printbuffer->anzahl)
est2fe 0:4843fcdba3cc 14 {
est2fe 0:4843fcdba3cc 15 c = getchar_from_ringbuffer (printbuffer);
est2fe 0:4843fcdba3cc 16 putchar (stderror, c);
est2fe 0:4843fcdba3cc 17 }
est2fe 0:4843fcdba3cc 18 */
est2fe 0:4843fcdba3cc 19
est2fe 0:4843fcdba3cc 20 }
est2fe 0:4843fcdba3cc 21
est2fe 0:4843fcdba3cc 22 // Definition wie printf selber
est2fe 0:4843fcdba3cc 23
est2fe 1:50fdadc001ef 24 int eprintf (char *fmt, ...)
est2fe 1:50fdadc001ef 25 {
est2fe 1:50fdadc001ef 26 /*
est2fe 1:50fdadc001ef 27 int printf(const char *fmt, ...)
est2fe 1:50fdadc001ef 28 {
est2fe 1:50fdadc001ef 29 va_list ap;
est2fe 1:50fdadc001ef 30 int i;
est2fe 1:50fdadc001ef 31
est2fe 1:50fdadc001ef 32 va_start(ap, fmt);
est2fe 1:50fdadc001ef 33 i = vfprintf(stdout, fmt, ap);
est2fe 1:50fdadc001ef 34 va_end(ap);
est2fe 1:50fdadc001ef 35
est2fe 1:50fdadc001ef 36 return i;
est2fe 1:50fdadc001ef 37 }
est2fe 1:50fdadc001ef 38
est2fe 1:50fdadc001ef 39 va_list args;
est2fe 1:50fdadc001ef 40 va_start(args, fmt); // Zeiger auf die "..."
est2fe 1:50fdadc001ef 41
est2fe 1:50fdadc001ef 42 vfprintf (stdout, fmt, args); // alles andere geht zur Zeit nicht, warum auch immer!
est2fe 1:50fdadc001ef 43
est2fe 1:50fdadc001ef 44
est2fe 1:50fdadc001ef 45 */
est2fe 1:50fdadc001ef 46
est2fe 1:50fdadc001ef 47 /*
est2fe 0:4843fcdba3cc 48 os.GetResource (RES_PRINTF);
est2fe 0:4843fcdba3cc 49 // "fast voll" muss um _"Warning: Printbuffer voll!\n\r"_ = 32 Zeichen groesser sein!
est2fe 0:4843fcdba3cc 50 if (!printfbuffer_fast_voll())
est2fe 0:4843fcdba3cc 51 {
est2fe 0:4843fcdba3cc 52 printf_in_buffer (format);
est2fe 0:4843fcdba3cc 53 }
est2fe 0:4843fcdba3cc 54 else
est2fe 0:4843fcdba3cc 55 {
est2fe 0:4843fcdba3cc 56 printf_in_buffer ("Warning: Printbuffer voll!\n\r");
est2fe 0:4843fcdba3cc 57 }
est2fe 0:4843fcdba3cc 58 os_ReleaseResource 8RES_PRINTF);
est2fe 0:4843fcdba3cc 59 */
est2fe 1:50fdadc001ef 60 va_list args;
est2fe 1:50fdadc001ef 61 va_start(args, fmt); // Zeiger auf die "..."
est2fe 1:50fdadc001ef 62
est2fe 1:50fdadc001ef 63 vfprintf (stdout, fmt, args); // alles andere geht zur Zeit nicht, warum auch immer!
est2fe 0:4843fcdba3cc 64 return 0;
est2fe 0:4843fcdba3cc 65 }
est2fe 0:4843fcdba3cc 66
est2fe 0:4843fcdba3cc 67
est2fe 0:4843fcdba3cc 68 #endif // von ifndef __os_printf_c__