Changeset 5b303ba in mainline
- Timestamp:
- 2007-04-07T17:57:07Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3dbe2d1f
- Parents:
- be66dee
- Location:
- kernel/generic
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/print.h
rbe66dee r5b303ba 41 41 42 42 /* We need this address in spinlock to avoid deadlock in deadlock detection */ 43 SPINLOCK_EXTERN(printf lock);43 SPINLOCK_EXTERN(printf_lock); 44 44 45 45 #define EOF (-1) -
kernel/generic/include/printf/printf_core.h
rbe66dee r5b303ba 48 48 }; 49 49 50 int printf_core(const char *fmt, struct printf_spec *ps ,va_list ap);50 int printf_core(const char *fmt, struct printf_spec *ps, va_list ap); 51 51 52 52 #endif -
kernel/generic/src/printf/printf_core.c
rbe66dee r5b303ba 39 39 #include <putchar.h> 40 40 #include <print.h> 41 #include <synch/spinlock.h>42 41 #include <arch/arg.h> 43 #include <arch/asm.h>44 45 42 #include <arch.h> 46 47 SPINLOCK_INITIALIZE(printflock); /**< printf spinlock */48 43 49 44 #define __PRINTF_FLAG_PREFIX 0x00000001 /**< show prefixes 0x or 0*/ … … 459 454 int printf_core(const char *fmt, struct printf_spec *ps, va_list ap) 460 455 { 461 int irqpri;462 456 int i = 0, j = 0; /**< i is index of currently processed char from fmt, j is index to the first not printed nonformating character */ 463 457 int end; … … 473 467 474 468 counter = 0; 475 476 irqpri = interrupts_disable(); 477 spinlock_lock(&printflock); 478 469 479 470 while ((c = fmt[i])) { 480 471 /* control character */ … … 713 704 714 705 out: 715 spinlock_unlock(&printflock);716 interrupts_restore(irqpri);717 706 718 707 return counter; -
kernel/generic/src/printf/snprintf.c
rbe66dee r5b303ba 51 51 /** @} 52 52 */ 53 -
kernel/generic/src/printf/vprintf.c
rbe66dee r5b303ba 36 36 #include <printf/printf_core.h> 37 37 #include <putchar.h> 38 #include <synch/spinlock.h> 39 #include <arch/asm.h> 40 41 SPINLOCK_INITIALIZE(printf_lock); /**< vprintf spinlock */ 38 42 39 43 static int vprintf_write(const char *str, size_t count, void *unused) … … 56 60 { 57 61 struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL}; 58 return printf_core(fmt, &ps, ap); 59 62 63 int irqpri = interrupts_disable(); 64 spinlock_lock(&printf_lock); 65 66 int ret = printf_core(fmt, &ps, ap); 67 68 spinlock_unlock(&printf_lock); 69 interrupts_restore(irqpri); 70 71 return ret; 60 72 } 61 73 -
kernel/generic/src/printf/vsnprintf.c
rbe66dee r5b303ba 43 43 }; 44 44 45 int vsnprintf_write(const char *str, size_t count, struct vsnprintf_data *data);46 47 45 /** Write string to given buffer. 48 46 * Write at most data->size characters including trailing zero. According to C99, snprintf() has to return number … … 55 53 * @return number of characters to print (not characters really printed!) 56 54 */ 57 int vsnprintf_write(const char *str, size_t count, struct vsnprintf_data *data)55 static int vsnprintf_write(const char *str, size_t count, struct vsnprintf_data *data) 58 56 { 59 57 size_t i; -
kernel/generic/src/printf/vsprintf.c
rbe66dee r5b303ba 37 37 int vsprintf(char *str, const char *fmt, va_list ap) 38 38 { 39 return vsnprintf(str, (size_t) -1, fmt, ap);39 return vsnprintf(str, (size_t) - 1, fmt, ap); 40 40 } 41 41
Note:
See TracChangeset
for help on using the changeset viewer.